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)

相关推荐
会篮球的程序猿10 小时前
html+canvas+thikphp 可视化工具拖拽、编辑生成JSON,渲染成海报图片 完全自定义,支持选择,文字背景色
前端·html·json
倚肆11 小时前
Hutool-json 库完整指南
java·json
q***23921 天前
MySQL JSON数据类型全解析(JSON datatype and functions)
android·mysql·json
i_am_a_div_日积月累_2 天前
JSON数据转Excel
json·excel·css3
www_stdio3 天前
用 localStorage 打造本地待办清单:一个轻量级的前端实践
javascript·css·json
Jonathan Star4 天前
JSON-RPC 2.0 详解
qt·rpc·json
还算善良_4 天前
【XML生成】根据JSON格式化的报文,动态生成XML
xml·json
涛涛讲AI5 天前
被 JSON 格式折磨?1 个快捷键让 JSON-handle 秒启动,开发者必看!
json
韩仔搭建5 天前
Cocos Creator 项目配置 JSON 最佳实践
json
曼巴UE55 天前
JSON Reader
java·服务器·json