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)

相关推荐
吳所畏惧7 小时前
少走弯路:uniapp里将h5链接打包为apk,并设置顶/底部安全区域自动填充显示,阻止webview默认全屏化
android·安全·uni-app·json·html5·webview·js
CaliXz11 小时前
取出51.la统计表格内容为json数据 api
java·javascript·json
songgz12 小时前
多线程双向 JSON 解析器
java·服务器·json
xcLeigh12 小时前
超全 Kingbase KES V9R3C15 JSON 函数指南:从基础操作到高级应用
json·函数·国产数据库·kingbase·金仓数据库
差点GDP1 天前
模拟请求测试 Fake Rest API Test
前端·网络·json
ID_180079054731 天前
基于 Python 的 Cdiscount 商品详情 API 调用与 JSON 核心字段解析(含多规格 SKU 提取)
开发语言·python·json
闲人编程1 天前
OpenAPI/Swagger规范与API文档自动化
运维·自动化·json·swagger·schema·openapi·codecapsule
普通网友1 天前
SpringCloud系列教程:微服务的未来 (五)枚举处理器、JSON处理器、分页插件实现
spring cloud·微服务·json
wtsolutions1 天前
JSON导入WPS表格,JSON转wps,json2wps, WPS 插件使用指南
json·wps·wtsolutions
ewboYang1 天前
JSON.parse()大整数精度丢失的问题和解决方法
json