当前位置:网站首页>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
边栏推荐
猜你喜欢
[Essence] Analysis of the special case of C language structure: structure pointer / basic data type pointer, pointing to other structures
抗积分饱和 PID代码实现,matlab仿真实现
mysql8.0和navicat premium15下载安装
wait system call
爱可可AI前沿推介(8.9)
fidder为什么不会抓包的问题
[工程数学]1_特征值与特征向量
【Robustness of VQA-1】——2019-EMNLP-Don’t Take the Easy Way Out
Visual Studio 2017 ASP.NET Framework MVC 项目 MySQL 配置连接
在北京参加UI设计培训到底怎么样?
随机推荐
信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束
_main C:/ti/ccs1011/ccs/tools/compiler/ti-cgt-c2000_20.2.1.LTS/lib/rts2800_fpu32.lib<ar在线升级跳转疑问
proto3-2语法
抗积分饱和 PID代码实现,matlab仿真实现
PAT1011
redis主从复制
CANopen DS402名词
redis内存的淘汰机制
在北京参加UI设计培训到底怎么样?
es6的async函数
[工程数学]1_特征值与特征向量
[现代控制理论]4_PhasePortrait爱情故事动态系统分析
PAT1014 未解决
UNIX Philosophy
Open3D point cloud average point spacing evaluation
PAT1002
[现代控制理论]6_稳定性_李雅普诺夫_Lyapunov
PAT1001
Oracle数据库体系结构
PAT1004