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)

相关推荐
voipmaker1 小时前
选煤厂智能化:UWB 人员定位系统 WebAPI 对接融合通信平台实战
物联网·实时互动·json·音视频·实时音视频·web·视频
IT_Octopus4 小时前
【零基础入门 LLM 开发 · Day 15】:LangChain 注册工具——告别手写 JSON Schema
java·langchain·json
星 海5 小时前
【json】cJSON库解析文件
c语言·json·cjson
工具派1 天前
JSON转Excel后18位订单号不对了?数字精度与类型边界实测
json·excel
阿皮 API1 天前
Shopee虾皮商品详情API接口调用实战:Python获取东南亚商品数据与JSON解析
开发语言·python·json
死磕音视频1 天前
让大模型稳定输出 JSON:结构化输出的三种方法与 Python 校验实践
json·大模型api·pydantic·结构化输出
今天的砖头有点烫手啊1 天前
Java 序列化到底怎么选?从 Serializable 到 Protobuf 的演进与选型
java·json
小白学鸿蒙1 天前
OpenHarmony 预置应用配置详解:/system/etc/app/ 下的 5 个 JSON
json·openharmony·预置应用
for_ever_love__1 天前
LangChain 结构化输出:让模型稳定吐出符合 schema 的 JSON
langchain·json
健康活着就好1 天前
# 手写Promise.all和Promise.race,面试再也不怕了
面试·json