当前位置:网站首页>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
边栏推荐
猜你喜欢
爱可可AI前沿推介(8.9)
x86 Exception Handling and Interrupt Mechanism (1) Overview of the source and handling of interrupts
C# async 和 await 理解
二重指针-char **、int **的作用
【Data augmentation in NLP】——1
mysql + redis + flask + flask-sqlalchemy + flask-session 配置及项目打包移植部署
win10 outlook邮件设置
结构体知识点整合(前篇)
bat文件(批处理文件)运行时一闪而过解决方法
wpf实现简易画板功能(带截取画板,签名截图等等)
随机推荐
百钱买鸡(一)
proto3-2语法
PAT1009
【DB运营管理/开发解决方案】上海道宁为您提供提高工作便利性的集成开发工具——Orange
ThreadLocal类
Oracle数据库体系结构
buck型三相PFC
x86 Exception Handling and Interrupt Mechanism (3) Interrupt Handling Process
redis主从复制
预置第三方apk到MTK项目相关问题总结
ICML 2022 | Out-of-Distribution检测与深最近的邻居
MySQL执行sql语句的机制
fork创建多个子进程
【Robustness of VQA-1】——2019-EMNLP-Don’t Take the Easy Way Out
PAT1005
ClickHouse之MaterializeMySQL引擎(十)
Qt 国际化翻译
IDEA 关闭/开启引用提示Usages
Chinese valentine's day?Programmers don't exist
PAT1006