当前位置:   article > 正文

pysot 测试问题

pysot

AssertionError: D:\siamese\pysot\tools\../testing_dataset/VOT2018\ants1/color/00000001.jpg 

解决方法:去掉VOT2018.json中的color

  1. import json
  2. import os, sys
  3. json_path = 'VOT2018.json'
  4. new_json_path = 'VOT2018_new.json'
  5. txt_path = 'list.txt'
  6. dict = {}
  7. def get_json_data(path): # 修改 删除原json文件中的color
  8. with open(path) as f:
  9. params = json.load(f)
  10. file = open('list.txt')
  11. while 1 :
  12. lines = file.readline(1000)
  13. if not lines:
  14. break
  15. lines = lines[:-1] # 拿出每个视频文件夹的名字
  16. root = (params[lines]['img_names'])
  17. for i in range(len(root)):
  18. kind, color, jpg = root[i].split('/') # 举例 kind :'ants1', color: 'color' , jpg :'00000001.jpg'
  19. root[i] = kind + '/' + jpg # 重写该路径,去掉 color
  20. file.close()
  21. dict = params
  22. # print(dict)
  23. f.close()
  24. return dict
  25. def write_json_data(path, dictionary): # 保存
  26. with open(path, 'w') as r:
  27. json.dump(dictionary, r)
  28. r.close()
  29. if __name__ =='__main__':
  30. dictionary = get_json_data(json_path)
  31. write_json_data(new_json_path, dictionary)
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/695554
推荐阅读
相关标签
  

闽ICP备14008679号