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)

相关推荐
墨神谕1 小时前
JSON-RPC 2.0
网络协议·rpc·json
PixelBai5 小时前
什么是 JSON 验证工具?
json
码农学院10 小时前
电商零售品牌的6个技术信号——从JSON-LD结构化数据到llms.txt,让AI搜索主动推荐你的产品
人工智能·json·零售
月走乂山10 小时前
DeepSeek 对话记录一键导出:零依赖 Tampermonkey 脚本(支持 JSON/Markdown/ZIP)
json·油猴脚本·tampermonkey·数据导出·deepseek·对话记录·用户脚本
前网易架构师-高司机12 小时前
带标注的打电话识别数据集,识别率98.9%,9723张图,支持yolo,coco json,voc xml,文末有模型训练代码
yolo·json·手机·数据集·打电话
sjg200104141 天前
JSON对象参数转URL参数
json
techdashen1 天前
Uber 如何用原生 gRPC 加速 OpenSearch:从 REST/JSON 瓶颈到搜索与写入性能优化
性能优化·json
wtsolutions1 天前
Excel-to-JSON本地化Excel插件发布 - 在Excel中安全离线转换数据
安全·json·excel
忧郁的紫菜2 天前
WCF+JSON+实体对象与WebService+DataSet效率大比拼
数据库·oracle·json
PixelBai2 天前
JSON转XML使用教程:从入门到精通
xml·json