复现faster-rcnn.pytorch-1.0测试自己的数据集时报错——已解决,随手记录
测试参考链接:Faster-RCNN.pytorch的搭建、使用过程详解(适配PyTorch 1.0以上版本)
运行python test_net.py --dataset pascal_voc --net res101 --checksession 1 --checkepoch 20 --checkpoint 463 --cuda
时报错:
Traceback (most recent call last):
File "test_net.py", line 325, in <module>
imdb.evaluate_detections(all_boxes, output_dir)
File "F:\***\faster-rcnn.pytorch-pytorch-1.0\lib\datasets\pascal_voc.py", line 348, in evaluate_detections
self._do_python_eval(output_dir)
File "F:\***\faster-rcnn.pytorch-pytorch-1.0\lib\datasets\pascal_voc.py", line 311, in _do_python_eval
use_07_metric=use_07_metric)
File "F:\***\faster-rcnn.pytorch-pytorch-1.0\lib\datasets\voc_eval.py", line 115, in voc_eval
recs[imagename] = parse_rec(annopath.format(imagename))
File "F:\***\faster-rcnn.pytorch-pytorch-1.0\lib\datasets\voc_eval.py", line 18, in parse_rec
tree = ET.parse(filename)
File "E:\DL-environment\Anaconda3\envs\pytorchF\lib\xml\etree\ElementTree.py", line 1197, in parse
tree.parse(source, parser)
File "E:\DL-environment\Anaconda3\envs\pytorchF\lib\xml\etree\ElementTree.py", line 587, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '000001.xml'
如图:
解决方法:
修改lib\datasets\pascal_voc.py 291行左右,如图:
把{😒}.xml中的:s删掉,下同:
修改lib\datasets\voc_eval.py 120行左右,如图:
重新测试,成功
截个图意思一下
参考链接:YOLOX训练环境搭建问题总结
还好我没因为是YOLO就放弃参考哈哈哈哈哈!