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 小时前
文本序列化格式全景——JSON、XML、YAML 的适用边界与选型
后端·json
ZC跨境爬虫1 天前
模块化烹饪小程序开发日记 Day7:(菜谱详情接口开发与JSON数据读取全流程)
前端·javascript·css·ui·微信小程序·json
alwaysrun2 天前
C++之现代易用JSON库nlohmann
c++·json·序列化·nlohmann
lifejump2 天前
JSON技术解析
json
NiceCloud喜云3 天前
Claude Files API 深入:从上传、复用到配额管理的工程化指南
android·java·数据库·人工智能·python·json·飞书
徒手猫4 天前
myslq 中json 格式的数据如何获取某个属性
android·json
颂love4 天前
JWT 认证系统全流程细粒度拆解
json
m0_738120725 天前
渗透测试基础知识——从零认识JWT(JSON Web Token)身份令牌
服务器·前端·安全·web安全·网络安全·json