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)

相关推荐
wtsolutions14 小时前
Using the JSON to Excel API - Programmatic Access for Developers
json·excel
wtsolutions17 小时前
Understanding JSON Formats - What JSON to Excel Supports
json·excel
wtsolutions18 小时前
Advanced Features - Unlocking the Power of JSON to Excel Pro
linux·json·excel
wtsolutions21 小时前
Real-World Use Cases - How Organizations Use JSON to Excel
json·excel
wtsolutions21 小时前
Introduction to JSON to Excel - The Ultimate Conversion Tool
json·excel
San30.1 天前
LangChain 第二课:拒绝“废话”,用 Zod 强制 AI 输出标准 JSON
人工智能·langchain·json
wtsolutions1 天前
JSON to Excel WPS Add-in - Perfect for WPS Office Users
json·excel·wps
wtsolutions1 天前
Flat vs Nested JSON Conversion - Deep Dive into Conversion Modes
json
weixin_462446231 天前
【实战】Java使用 Jsoup 将浏览器书签 HTML 转换为 JSON(支持多级目录)
java·html·json·书签
alonewolf_991 天前
Redis Stack全面解析:从JSON存储到布隆过滤器,打造高性能Redis扩展生态
数据库·redis·json