当前位置:网站首页>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
边栏推荐
猜你喜欢

Win10调整磁盘存储空间详解
[工程数学]1_特征值与特征向量

抗积分饱和 PID代码实现,matlab仿真实现

信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束

x86 exception handling and interrupt mechanism (2) interrupt vector table

mysql + redis + flask + flask-sqlalchemy + flask-session 配置及项目打包移植部署

BISS绝对值编码器_TI方案_线路延迟补偿

结构体知识点整合(前篇)
![[现代控制理论]5_系统的可控性_controllability](/img/a6/29c89163290eb03b4ce28274d036ca.png)
[现代控制理论]5_系统的可控性_controllability

Chinese valentine's day?Programmers don't exist
随机推荐
湖南进芯电子替代TIC2000的可能性
获取url地址中问号后参数(即使是iframe也可以)
wpf实现简易画板功能(带截取画板,签名截图等等)
x86异常处理与中断机制(3)中断处理过程
PTA习题 分类统计字符个数(C)
【Robustness of VQA-1】——2019-EMNLP-Don’t Take the Easy Way Out
fork creates multiple child processes
win10 outlook邮件设置
信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束
学习阶段总结(背包问题)
2022 全球 AI 模型周报
gdb 10.2的安装
【C language】动态数组的创建和使用
bat文件(批处理文件)运行时一闪而过解决方法
通关SQLilab靶场——Less-1思路步骤
ACM01背包问题
C语言中信号函数(signal)的使用
数论知识点
ZOJ 1729 & ZOJ 2006(最小表示法模板题)
PAT1003