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)

相关推荐
小黑要努力1 小时前
json-c安装以及amixer使用
linux·运维·json
听风者一号7 小时前
cssMoudle生成器
前端·javascript·json
ID_180079054731 天前
小红书笔记详情 API 接口系列 + 标准 JSON 返回参考(完整版)
数据库·笔记·json
小狗丹尼4001 天前
JSON 基础认知、数据转换与 Flask 前后端交互全解
python·flask·json
奔跑的呱呱牛2 天前
arcgis-to-geojson双向转换工具库
arcgis·json
武超杰2 天前
SpringMVC核心功能详解:从RESTful到JSON数据处理
后端·json·restful
还是大剑师兰特3 天前
Vue3 前端专属配置(VSCode settings.json + .prettierrc)
前端·vscode·json
qq_283720053 天前
Cesium实战(三):加载天地图(影像图,注记图)避坑指南
json·gis·cesium
雷帝木木3 天前
Flutter for OpenHarmony:Flutter 三方库 cbor 构建 IoT 设备的极致压缩防窃协议(基于标准二进制 JSON 表达格式)
网络·物联网·flutter·http·json·harmonyos·鸿蒙
长安11083 天前
JsonCpp的编译与使用
json