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)

相关推荐
Martin-Luo12 小时前
Vue3 通过json配置生成查询表单
javascript·vue.js·json
星尘库13 小时前
后端json数据反序列化枚举类型不匹配的错误
json
BXCQ_xuan13 小时前
软件工程实践四:MyBatis-Plus 教程(连接、分页、查询)
spring boot·mysql·json·mybatis
王维志14 小时前
LiteDB详解
数据库·后端·mongodb·sqlite·c#·json·database
ID_180079054731 天前
Python采集京东店铺所有商品数据,json数据返回
json
ljh5746491191 天前
mysql 必须在逗号分隔字符串和JSON字段之间二选一,怎么选
数据库·mysql·json
小孔龙1 天前
02.Kotlin Serialization 属性序列化控制
kotlin·json
Cachel wood2 天前
信息检索、推荐系统模型排序质量指标:AP@K和MAP@K
windows·搜索引擎·json·推荐系统·搜索
tebukaopu1482 天前
json文件转excel
json·excel
小孔龙3 天前
01.Kotlin Serialization - 基础用法
kotlin·json