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)

相关推荐
TheRouter16 小时前
LLM 流式输出工程实践:SSE、背压、断流重连与JSON 流解析的 6 个生产陷阱
人工智能·json
chushiyunen20 小时前
json-rpc笔记
笔记·rpc·json
装不满的克莱因瓶1 天前
JSON 处理与内嵌 Tomcat 部署:Spring Boot 如何实现前后端数据交互与一键启动?
java·spring boot·spring·架构·tomcat·json
ID_180079054732 天前
淘宝 API 详情类 JSON 结构化解析实战(核心章节)
json
haven-8522 天前
AI Agent 生态核心概念详解:Agent、MCP、Skill 与 JSON-RPC
人工智能·rpc·json
_xaboy2 天前
开源Vue组件FormCreate通过 JSON 生成TinyVue表单
前端·vue.js·低代码·开源·json·表单设计器
yumgpkpm2 天前
华为HUAWEI昇腾910B下千问Qwen3.6-27B在的推理加速实践
sql·华为·langchain·json·ai编程·ai写作·gpu算力
SilentSamsara2 天前
文件与数据处理:CSV/JSON/Excel/Parquet 高效操作与内存优化
开发语言·python·青少年编程·性能优化·json·excel
lzhdim2 天前
SQL 入门 17:MySQL 数据类型:从字符串到 JSON 的全面解析
数据库·sql·mysql·json
无风听海2 天前
JSON Web Token(JWT)完全指南
java·前端·json