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)

相关推荐
加号313 小时前
【C#】 JSON 序列化与反序列化:从入门到最佳实践
c#·json
li星野18 小时前
FastAPI 响应类型完全指南:从 JSON 到流式响应、异常处理与输出模型
前端·json·fastapi
就叫飞六吧1 天前
JSON 与 JSON Schema:从“数据快递”到“使用说明书”
json
奇树谦1 天前
YAML、XML、JSON、TOML、INI、CSV 全面对比:配置文件和数据交换到底该怎么选?
xml·json
TheRouter2 天前
LLM 流式输出工程实践:SSE、背压、断流重连与JSON 流解析的 6 个生产陷阱
人工智能·json
chushiyunen2 天前
json-rpc笔记
笔记·rpc·json
装不满的克莱因瓶2 天前
JSON 处理与内嵌 Tomcat 部署:Spring Boot 如何实现前后端数据交互与一键启动?
java·spring boot·spring·架构·tomcat·json
ID_180079054733 天前
淘宝 API 详情类 JSON 结构化解析实战(核心章节)
json
haven-8523 天前
AI Agent 生态核心概念详解:Agent、MCP、Skill 与 JSON-RPC
人工智能·rpc·json
_xaboy3 天前
开源Vue组件FormCreate通过 JSON 生成TinyVue表单
前端·vue.js·低代码·开源·json·表单设计器