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)

相关推荐
Magic-ZYJ8 小时前
HarmonyOS 调用系统文件保存器导出 JSON 与 CSV
华为·json·harmonyos·鸿蒙·独立开发者
SeaTunnel11 小时前
从 JSON 到 JSONL,Apache SeaTunnel 如何解决HTTP 大数据传输的内存难题?
http·开源·json·apache·数据集成·seatunnel
++==1 天前
JSON和Python的 四种核心容器
python·json
lf13210272 天前
用 JSON Schema 管装修节点记录:从照片台账到可校验工程数据
网络·数据库·人工智能·经验分享·物联网·json·智能家居
丰锋ff2 天前
7.2Qt中Json的操作
开发语言·qt·json
bugcome_com3 天前
JWT 知识小课堂:从入门到精通,一文吃透 JSON Web Token
前端·json
ccino .3 天前
awvs_json_word.py 使用说明手册
json·word
richard_yuu3 天前
JSON vs XML vs 二进制:3种序列化终极选型
xml·c++·qt·学习·json
用户7783366132114 天前
SERP 返回 JSON 用 Pydantic 强校验:类型安全解析
json
灵析表格4 天前
灵析表格财务函数深度实用性分析与实操教程
开发语言·ai·json·excel·wps