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)

相关推荐
Knight_AL5 分钟前
Spring Boot + Docker:实现可挂载可热更新的 config.json
spring boot·docker·json
树码小子1 小时前
SpringMVC(3):传递 Json
spring·json·mvc
芋头莎莎20 小时前
基于MQTT通讯UNIapp程序解析JSON数据
前端·uni-app·json
研☆香1 天前
介绍一下JSON数据
json
电商API&Tina1 天前
【电商API】淘宝/天猫拍立淘(按图搜索商品)API 全解析
大数据·开发语言·数据库·人工智能·json·图搜索算法
winfredzhang1 天前
实战复盘:如何用 HTML+JS+AI 打造一款“影迹”智能影视管理系统
javascript·html·json·加载·搜索·保存·电影接口
流沙QS2 天前
JSON序列化/反序列化工具改进版
java·json
曹牧2 天前
JSON文本格式化
json
ChindongX2 天前
garbage at the end of the document
qt·json
_xaboy2 天前
开源Vue组件-动态表单组件设计,告别重复CRUD,JSON一键生成表单
前端·vue.js·低代码·开源·json