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)

相关推荐
奔跑的蜗牛AZ10 天前
TiDB 字符串行转列与 JSON 数据查询优化知识笔记
笔记·json·tidb
jarctique12 天前
java 找出两个json文件的不同之处
java·json
wtsolutions12 天前
Excel to JSON online converter, flat and nested JSON converter
json·excel·excel-to-json·wtsolutions
漫谈网络13 天前
JSON 数据格式详解
网络·python·json·数据格式
lwb_011814 天前
Spring MVC参数绑定终极手册:单&多参对象集合JSON文件上传精讲
spring·json·mvc
电商数据girl15 天前
【经验分享】浅谈京东商品SKU接口的技术实现原理
java·开发语言·前端·数据库·经验分享·eclipse·json
亚林瓜子15 天前
AWS S3拒绝非https的请求访问
https·云计算·json·ssl·aws·s3
于本淡15 天前
一篇文章快速学会HTML
开发语言·前端·数据结构·qt·html·json·html5
HaiQinyanAN16 天前
【学习笔记】nlohmannjson&&cjson
c++·笔记·学习·json
Code季风16 天前
学习 Protobuf:序列化、反序列化及与 JSON 的对比
学习·rpc·golang·json