labelme 修改后的json文件 ,imageData 值改为null的脚本

import os

import json

def set_image_data_to_null(directory):

for filename in os.listdir(directory):

if filename.endswith('.json'):

file_path = os.path.join(directory, filename)

with open(file_path, 'r', encoding='utf-8') as file:

data = json.load(file)

将 imageData 设置为 None,在JSON文件中会显示为 null

if 'imageData' in data:

data['imageData'] = None

保存修改后的文件

with open(file_path, 'w', encoding='utf-8') as file:

json.dump(data, file, indent=4)

替换以下路径为你的JSON文件所在的文件夹路径

directory_path = 'path_to_your_directory'

set_image_data_to_null(directory_path)

相关推荐
www_stdio1 小时前
用 localStorage 打造本地待办清单:一个轻量级的前端实践
javascript·css·json
Jonathan Star1 天前
JSON-RPC 2.0 详解
qt·rpc·json
还算善良_1 天前
【XML生成】根据JSON格式化的报文,动态生成XML
xml·json
涛涛讲AI2 天前
被 JSON 格式折磨?1 个快捷键让 JSON-handle 秒启动,开发者必看!
json
韩仔搭建2 天前
Cocos Creator 项目配置 JSON 最佳实践
json
曼巴UE52 天前
JSON Reader
java·服务器·json
864记忆3 天前
Qt 对 JSON和XML文件的操作详解
xml·qt·json
x***01063 天前
使用 MySQL 从 JSON 字符串提取数据
mysql·oracle·json
咸甜适中4 天前
rust语言,将JSON中的所有值以字符串形式存储到sqlite数据库中(逐行注释)
数据库·rust·sqlite·json
Ustinian_3104 天前
【HTML】前端工具箱实现【文本处理/JSON工具/加解密/校验和/ASCII/时间戳转换等】【附完整源代码】
前端·html·json