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)

相关推荐
PixelBai1 天前
JSON压缩使用教程:从入门到精通
json
nexustech1 天前
simplejson:Python JSON 处理的备用引擎
开发语言·python·其他·json
m0_497048932 天前
Prompt工程:从自然语言到代码化思维
json
ID_180079054732 天前
淘宝商品评论 API(taobao.item.reviews.get)业务场景与 JSON 返回实战
json
PixelBai2 天前
JSON差异比较高级用法技巧
java·服务器·json
hhzz2 天前
Uniapp项目中解决一个比较典型的图标渲染问题:原生 tabBar(pages.json 里配置的那种)
uni-app·json
Ajie'Blog2 天前
2026年AI安全与治理:从幻觉到系统性欺骗的攻防之战
javascript·人工智能·安全·rpc·json·rag
PixelBai3 天前
JSON差异比较对比指南
json
珺毅同学3 天前
YOLO生成预测json标签迁移问题
python·yolo·json
PixelBai3 天前
JSON差异比较集成指南与工作流自动化
运维·自动化·json