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)

相关推荐
LeoCrawls19 小时前
Python 读取 JSON 常见报错排查,附完整处理函数
python·json·php
星河耀银海1 天前
数据解析:AI返回JSON数据在HTML5中的渲染方法
人工智能·json·html5
三8442 天前
Fastjson 漏洞 · 01 · 认识 Fastjson 与序列化基础
json·fastjson·反序列化
一直在努力的小宁2 天前
【阅读笔记】具身操作的数采方案概览
后端·json·restful·具身智能·vla·vlm
wuyk5552 天前
Python实战项目05:JSON数据解析与数据可视化小案例|全套实战闭环
python·信息可视化·json
波力海苔夹心脆6752 天前
C# 序列化与反序列化详解:System.Text.Json、Newtonsoft.Json、XmlSerializer 用法、特性选项与安全实践
经验分享·后端·c#·json·.net
数据狐(Datafox)3 天前
淘宝商品详情API实战:多语言代购商城自动同步数据完整方案
开发语言·前端·数据库·爬虫·json
阿钱真强道4 天前
21 嵌入式操作系统 | JSON 与 json-c:生成与解析
c语言·开发语言·json·json-c
譕痕10 天前
JSONObject与JSONArray封装数据格式区别
java·json
A黄俊辉A10 天前
uniapp webview中实现 app和内嵌的H5双向通信
vue.js·json