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·wps·灵析表格·excel公式盒子
猿长大人19 小时前
C# | JSON 序列化中的多态接口处理:基于 Attribute 实现精准 $type 控制
c#·json
消失的旧时光-19431 天前
第六篇:Redis Hash——一个用户对象应该保存成 JSON,还是保存成 Hash?
redis·json·哈希算法
SEO_juper1 天前
2026年Schema自动注入实战:用Python批量给1000个页面加上JSON-LD,AI引用率实测提升38%
人工智能·python·json·seo·独立站
Wang's Blog1 天前
AI Agent白手起家37: LangChain 输出解析器实战:文本、JSON、XML 与 Pydantic
xml·langchain·json
灵析表格1 天前
json_ObjectToKV 函数深度研究报告
json·excel·wps·灵析表格·excel公式盒子
wtsolutions1 天前
JSON 怎么导入 WPS?怎么转换成 WPS 表格?WPS 怎么打开 JSON?完整教程
json·wps
IDIOT___IDIOT2 天前
JSON-RPC 2.0 与 MCP 协议:从消息格式到进程通信 大模型MCP
rpc·大模型·json·agent·mcp
憧憬成为原神糕手2 天前
Playwright、Selenium、DrissionPage 与 JSON 接口怎么选?
数据库·selenium·json
SelectDB技术团队2 天前
Apache Doris 4.1:面向 AI & Search 的统一数据底座怎么选?向量检索 + 全文搜索 + 100MB JSON 完整能力拆解
人工智能·json·apache doris