faster-rcnn测试模型时出现FileNotFoundError: [Errno 2] No such file or directory:

操作系统:ubuntu16.04
Python3.7.6
tensorflow-1.13.1 -gpu

问题预览

FileNotFoundError: [Errno 2] No such file or directory: ‘/home/heisenberg/tf-faster-rcnn/data/VOCdevkit2007/results/VOC2007/Main/※※※.txt’

问题描述

跟着阿尔卑斯糖和北冥有杨其名为超运行faster-rcnn。

在https://github.com/endernewton/tf-faster-rcnn的Demo and Test with pre-trained models这一阶段,测试预处理resnet101模型时,运行:

GPU_ID=0
./experiments/scripts/test_faster_rcnn.sh $GPU_ID pascal_voc_0712 res101

我的电脑出现如下结果:

...
...
...
im_detect: 4950/4952 0.949s 0.012s
im_detect: 4951/4952 0.949s 0.012s
im_detect: 4952/4952 0.949s 0.012s
Evaluating detections
Writing aeroplane VOC results file
Traceback (most recent call last):
  File "./tools/test_net.py", line 120, in <module>
    test_net(sess, net, imdb, filename, max_per_image=args.max_per_image)
  File "/home/heisenberg/tf-faster-rcnn/tools/../lib/model/test.py", line 192, in test_net
    imdb.evaluate_detections(all_boxes, output_dir)
  File "/home/heisenberg/tf-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 282, in evaluate_detections
    self._write_voc_results_file(all_boxes)
  File "/home/heisenberg/tf-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 209, in _write_voc_results_file
    with open(filename, 'wt') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/heisenberg/tf-faster-rcnn/data/VOCdevkit2007/results/VOC2007/Main/comp4_0a66c815-766d-42a9-be32-d6c36dff6678_det_test_aeroplane.txt'
Command exited with non-zero status 1
2927.98user 821.72system 1:19:52elapsed 78%CPU (0avgtext+0avgdata 2285112maxresident)k
861248inputs+28160outputs (6major+513405minor)pagefaults 0swaps

原因

缺少目录 ,只需新建目录/home/heisenberg(我的用户名)/tf-faster-rcnn/data/VOCdevkit2007/results/VOC2007/Main即可。

解决方法

cd /home/heisenberg/tf-faster-rcnn/data/VOCdevkit2007  #进入现有的目录
mkdir -p results/VOC2007/Main                          #递归创建目录

结果如下:

Saving cached annotations to /home/heisenberg/tf-faster-rcnn/data/VOCdevkit2007/annotations_cache/test_annots.pkl
AP for aeroplane = 0.8305
AP for bicycle = 0.8701
AP for bird = 0.8139
AP for boat = 0.7415
AP for bottle = 0.6851
AP for bus = 0.8764
AP for car = 0.8810
AP for cat = 0.8832
AP for chair = 0.6235
AP for cow = 0.8679
AP for diningtable = 0.7061
AP for dog = 0.8855
AP for horse = 0.8731
AP for motorbike = 0.8299
AP for person = 0.8270
AP for pottedplant = 0.5310
AP for sheep = 0.8114
AP for sofa = 0.7752
AP for train = 0.8466
AP for tvmonitor = 0.7936
Mean AP = 0.7976
~~~~~~~~
Results:
0.830
0.870
0.814
0.742
0.685
0.876
0.881
0.883
0.623
0.868
0.706
0.886
0.873
0.830
0.827
0.531
0.811
0.775
0.847
0.794
0.798
~~~~~~~~

--------------------------------------------------------------
Results computed with the **unofficial** Python eval code.
Results should be very close to the official MATLAB eval code.
Recompute with `./tools/reval.py --matlab ...` for your paper.
-- Thanks, The Management
--------------------------------------------------------------
2915.43user 774.14system 1:19:42elapsed 77%CPU (0avgtext+0avgdata 2297296maxresident)k
710128inputs+80728outputs (5major+625915minor)pagefaults 0swaps

你可能感兴趣的:(faster-rcnn)