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
小程序·json·元数据·汉字·笔顺·笔画
熊猫钓鱼>_>1 天前
Kotlin Multiplatform for OpenHarmony 实战:kotlinx-serialization JSON 适配
开发语言·华为·kotlin·华为云·json·harmonyos·code
雪芽蓝域zzs2 天前
json数据转化成interface属性
前端·javascript·json
ha_lydms2 天前
Json Functions(JSON 函数)
大数据·hadoop·spark·json·数据处理·dataworks·maxcompute
BD_Marathon2 天前
JSONLoader加载JSON文件
json
积流成海2 天前
JSON 格式化:语法校验与错误定位实践
json·状态模式·盘子工具站
JavaPub-rodert3 天前
Docker 日志为什么能把磁盘写爆?讲透 json-file、local、journald、日志轮转与 docker logs
docker·eureka·json
voipmaker3 天前
选煤厂智能化:UWB 人员定位系统 WebAPI 对接融合通信平台实战
物联网·实时互动·json·音视频·实时音视频·web·视频
IT_Octopus3 天前
【零基础入门 LLM 开发 · Day 15】:LangChain 注册工具——告别手写 JSON Schema
java·langchain·json