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)

相关推荐
远方16092 天前
16-Oracle 23 ai-JSON-Relational Duality-知识准备
数据库·oracle·json
sc写算法2 天前
基于nlohmann/json 实现 从C++对象转换成JSON数据格式
开发语言·c++·json
酷爱码3 天前
Spring Boot项目中JSON解析库的深度解析与应用实践
spring boot·后端·json
不惑_3 天前
用 PyQt5 打造一个可视化 JSON 数据解析工具
开发语言·qt·json
漫游者Nova3 天前
PDF转Markdown/JSON软件MinerU最新1.3.12版整合包下载
pdf·json·markdown·mineru
snow@li4 天前
vue3+ts+vite:详细、完整的 tsconfig.json 示例 / 常见配置项及其用途
json·tsconfig.json
南郁4 天前
007-nlohmann/json 项目应用-C++开源库108杰
c++·开源·json·nlohmann·现代c++·d2school·108杰
紫乾20144 天前
idea json生成实体类
java·json·intellij-idea
愿你天黑有灯下雨有伞5 天前
MyBatis-Plus LambdaQuery 高级用法:JSON 路径查询与条件拼接的全场景解析
mysql·json·mybatis
wtsolutions5 天前
JSON to Excel 3.0.0 版本发布 - 从Excel插件到Web应用的转变
json·excel·json-to-excel·wtsolutions