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)

相关推荐
lskblog5 小时前
PHP中正确处理HTTP响应:从原始响应到JSON数组的完整指南
http·json·php·laravel
Kiyra6 小时前
阿里云 OSS + STS:安全的文件上传方案
网络·人工智能·安全·阿里云·系统架构·云计算·json
逛街的猫啊14 小时前
【AI 专栏】JSON-RPC
ai·rpc·json
期待のcode16 小时前
Jackson
java·spring boot·json
木风小助理1 天前
在 Spring Boot 中实现 JSON 字段的蛇形命
spring boot·后端·json
Hqst_xiangxuajun2 天前
万兆SFP光纤笼子交换机和PCIE网卡主板上起到什么作用
网络·fpga开发·oracle·sqlite·json·信息与通信
3824278272 天前
python:输出JSON
前端·python·json
就叫飞六吧2 天前
JSONPath“隔空取物”思想,直击JSON深处的目标字段
服务器·windows·json
卓码软件测评2 天前
第三方软件测评机构:【Gatling构建JSON请求体StringBody、ElFileBody和Pebble模板的使用】
测试工具·性能优化·json·测试用例