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 天前
前后端算的 MD5、SHA-256 对不上?编码、换行、BOM、HMAC、JSON 顺序,八个原因逐个实测
前端·javascript·node.js·json·哈希算法
网络毒刘2 天前
MCP 从 0 接入 Cursor:mcp.json 安装配置到最小调用与常见报错
json
小小龙学IT2 天前
Go 语言 encoding/json 标准库深度解析:从 Tag 反射到流式处理
golang·json
李游Leo2 天前
HarmonyOS 7 + Node.js-JSON Schema:审核测试路径与版本事实的一致性门禁【鸿蒙心迹】
node.js·json·harmonyos
ha_lydms3 天前
MaxCompute中JSON函数
大数据·数据库·阿里云·json·dataworks·maxcompute·odps
LeoCrawls4 天前
Python 读取 JSON 常见报错排查,附完整处理函数
python·json·php
星河耀银海4 天前
数据解析:AI返回JSON数据在HTML5中的渲染方法
人工智能·json·html5
三8445 天前
Fastjson 漏洞 · 01 · 认识 Fastjson 与序列化基础
json·fastjson·反序列化
一直在努力的小宁5 天前
【阅读笔记】具身操作的数采方案概览
后端·json·restful·具身智能·vla·vlm
wuyk5555 天前
Python实战项目05:JSON数据解析与数据可视化小案例|全套实战闭环
python·信息可视化·json