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)

相关推荐
talle20211 天前
Hive | json数据处理
hive·hadoop·json
一起养小猫1 天前
Flutter for OpenHarmony 实战:网络请求与JSON解析完全指南
网络·jvm·spring·flutter·json·harmonyos
雪碧聊技术1 天前
JSON数据格式
json·fastjson
从此不归路1 天前
Qt5 进阶【12】JSON/XML 数据协议处理:与后端/配置文件的对接
xml·开发语言·c++·qt·json
说给风听.2 天前
零基础学 JSON:原理、语法与应用全解析
json
天若有情6732 天前
XiangJsonCraft v1.2.0重大更新解读:本地配置优先+全量容错,JSON解耦开发体验再升级
前端·javascript·npm·json·xiangjsoncraft
Sylvia33.2 天前
足球“文字直播/事件流”API详解:解码比赛的数字DNA
java·服务器·前端·json
Elieal2 天前
统一 JSON 格式,JacksonObjectMapper 定制 Spring Boot JSON 转换规则
spring boot·json·状态模式
像风一样自由20203 天前
解决百度网盘安装报错:D 盘 package.json 触发 Electron ESM/CJS 冲突
javascript·electron·json
灰太狼大王灬3 天前
OCR-RenameStudio是一个基于 PaddleOCR-json的桌面工具——Umi-OCR 智能重命名助手
json·ocr