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)

相关推荐
龙侠九重天8 小时前
大型语言模型结构化输出:用 JSON Schema 约束大模型输出
人工智能·语言模型·自然语言处理·大模型·json
原来是猿1 天前
网络计算器:理解序列化与反序列化(下)
linux·开发语言·网络·网络协议·json·php
SelectDB技术团队1 天前
强行拍平?全表扫描? AI Agent 动态 JSON 的观测分析
数据库·人工智能·json·apache doris
码农学院1 天前
JSON 里是一个空字符串 ““,Newtonsoft.Json 无法直接把字符串转成列表
json
c1s2d3n4cs2 天前
Qt模仿nlohmann::json进行序列化和反序列化
开发语言·qt·json
一只很酸de橘子2 天前
PostgreSQL 生成 JSON 字符串
postgresql·json
Kiyra2 天前
Query Rewrite 不是越智能越好:RAG 检索的精确词保护与动态召回
redis·websocket·junit·单元测试·json
Msshu1232 天前
XSP25全协议 100W PD快充诱骗芯片_串口读电压电流信息
hive·云计算·json·database·memcached
水火既济__2 天前
hive中加载json数据建表(大规模)
hive·hadoop·json
朝新_2 天前
【LangChain】输出解析器 Str/Pydantic/JSON 解析器用法详解 告别模型乱输出
microsoft·langchain·json