当前位置:网站首页>Modify the VOT2018.json file and remove the color in the image path
Modify the VOT2018.json file and remove the color in the image path
2022-08-09 11:44:00 【anonymous magician】
Upload the code directly
import jsonimport os, sysjson_path = 'VOT2018.json'new_json_path = 'VOT2018_new.json'txt_path = 'list.txt'dict = {}def get_json_data(path): # Modify and delete the color in the original json filewith open(path) as f:params = json.load(f)file = open('list.txt')while 1 :lines = file.readline(1000)if not lines:breaklines = lines[:-1] # Get the name of each video folderroot = (params[lines]['img_names'])for i in range(len(root)):kind, color, jpg = root[i].split('/') # example kind :'ants1', color: 'color' , jpg :'00000001.jpg'root[i] = kind + '/' + jpg # rewrite the path, remove colorfile.close()dict = params# print(dict)f.close()return dictdef write_json_data(path, dictionary): # savewith open(path, 'w') as r:json.dump(dictionary, r)r.close()if __name__ == '__main__':dictionary = get_json_data(json_path)write_json_data(new_json_path, dictionary)
OK
边栏推荐
猜你喜欢
wait系统调用
C# 获取系统已安装的.NET版本
人体解析(Human Parse)开源数据集整理
JS 封装节流(后期优化)
【Robustness of VQA-1】——2019-EMNLP-Don’t Take the Easy Way Out
链表基本操作(详解)
Redis的下载安装
ICML 2022 | Out-of-Distribution检测与深最近的邻居
【Adobe Premiere Pro 2020】pr2020安装和基本操作【PR安装、新建项目流程、导入及管理素材项目文件、添加标记、创建出入点剪辑视频、快速剪接及自动音乐卡点的方法
How tall is the B+ tree of the MySQL index?
随机推荐
Win10调整磁盘存储空间详解
Number theory knowledge
ACM01 Backpack problem
gdb tui的使用
学生成绩查找系统
PTA习题 阶梯电价(C)
OC-块对象
x86异常处理与中断机制(1)概述中断的来源和处理方式
TI的片上固化好的boot ROM(上电引导加载程序)退出后的去向
PAT1004
结构体变量的首地址获取注意事项
MySQL执行sql语句的机制
富媒体在客服IM消息通信中的秒发实践
Two ways to enter the Oracle database
字符串 | 反转字符串 | 双指针法 | leecode刷题笔记
[现代控制理论]2_state-space状态空间方程
[C language] creation and use of dynamic arrays
The use of gdb tui
PAT1010
学长告诉我,大厂MySQL都是通过SSH连接的