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)

相关推荐
Thanks_ks7 小时前
提示词工程实战:用结构化提示词让大模型输出稳定可控
python·大模型·json·openai·提示词工程·deepseek·系统提示词
SEO_juper15 小时前
HTTPS 混合内容检查工具:页面全站 https 了,但还有 http 资源在拖后腿
开发语言·网络协议·http·https·node.js·json·bash
SeanQhl18 小时前
行号会漂,指纹不会:一份可并发编辑的 JSON 清单怎么写
json
维爱智VR认知学能20 小时前
VR课程软件版本迭代清单比对:资源哈希与依赖变更提取
json·哈希算法·vr
loopfde成序3 天前
Web-RAG 检索可见度评估体系与站点 JSON-LD 及 llms.txt 自动化核验实践
前端·自动化·json
麻瓜code8 天前
流式返回的工具参数是一段一段来的,怎么拼成一个 JSON
json
鲸渔10 天前
【AI Agent系列课程13-Python 基础13】JSON 读写:结构化数据交换基础
开发语言·python·json·ai编程
aiotto资源分享13 天前
Python 写 JSON 文件,程序中途退出会留下什么?
java·python·json·jsondecodeerror
一起学安全技术13 天前
拆大模型 10|结构化输出:让模型返回数据,而不是一段话
人工智能·语言模型·json
用户2986985301414 天前
在 Python 中把 Word 文档转换为 JSON 的三种实现方式
python·json·api