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)

相关推荐
terry6005 小时前
5G视频短信服务商选型全攻略:通道资源、架构能力与成本评估2026最新标准
大数据·人工智能·5g·json·asp.net·信息与通信·数据库架构
前网易架构师-高司机6 小时前
带标注的辣椒病叶数据集,识别率95.9%,可识别三种病害和健康叶子,9916张图,支持yolo,coco json,voc xml,文末有模型训练代码
yolo·json·数据集·病害·叶病·病叶·辣椒
PixelBai9 小时前
JSON扁平化使用教程:从入门到精通
json
渔舟唱晚,雁阵惊寒1 天前
CSDN博客内容丢失如何恢复?
json
衣乌安、1 天前
JSON-RPC协议
网络协议·rpc·json
PixelBai1 天前
JSON过滤使用教程:从入门到精通
javascript·chrome·json
PixelBai1 天前
JSON过滤实际应用场景案例
json
一生了无挂2 天前
Java处理JSON技巧教学(从基础到高阶实战全覆盖)
java·开发语言·json
PixelBai2 天前
JSON差异比较实际应用场景案例
json