Py-faster-rcnn: how to test my model on the datasets like Voc2007,

Created on 29 Apr 2016  路  7Comments  路  Source: rbgirshick/py-faster-rcnn

@rbgirshick hello ,thanks for your py-faster-rcnn .I met problem as followed when I used test_net.py to test my dataset ,command :./tools/test_net.py --gpu 0 --def ./models/pascal_voc/VGG_CNN_M_1024/faster_rcnn_end2end/test.prototxt --net ./output/faster_rcnn_end2end/voc_2007_train/vgg_cnn_m_1024_faster_rcnn_iter_5000.caffemodel --imdb voc_2007_test --cfg experiments/cfgs/faster_rcnn_end2end.yml

and the problem:
VOC07 metric? Yes
000001
Traceback (most recent call last):
File "./tools/test_net.py", line 90, in
test_net(net, imdb, max_per_image=args.max_per_image, vis=args.vis)
File "/home/rs/myGithub/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 295, in test_net
imdb.evaluate_detections(all_boxes, output_dir)
File "/home/rs/myGithub/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 322, in evaluate_detections
self._do_python_eval(output_dir)
File "/home/rs/myGithub/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 285, in _do_python_eval
use_07_metric=use_07_metric)
File "/home/rs/myGithub/py-faster-rcnn/tools/../lib/datasets/voc_eval.py", line 127, in voc_eval
R = [obj for obj in recs[imagename] if obj['name'] == classname]
KeyError: '000001'

anyone met the same problem ?

Most helpful comment

Hey,
had the same problem with an old annotation cache. Just delete it
rm data/VOCdevkit2007/annotations_cache/annots.pkl and run the program again.
You should also delete the roidb cache:
rm data/cache/voc_2007_trainval_gt_roidb.pkl

All 7 comments

Hey,
had the same problem with an old annotation cache. Just delete it
rm data/VOCdevkit2007/annotations_cache/annots.pkl and run the program again.
You should also delete the roidb cache:
rm data/cache/voc_2007_trainval_gt_roidb.pkl

thanks a lot @mkardel

I have the same problem. It has an extra step as mkardel, it also deletes the test.txt_annots.pkl if you are in testing phase

Hi,I delete the cache: rm data/VOCdevkit2007/annotations_cache/annots.pkl . But after the new training and testing锛宼he annots.pkl is not created锛宎nd I get this error:

Traceback (most recent call last):
File "/home/pytorch/my/my_faster_rcnn_pytorch/test.py", line 165, in
test_net(save_name, net, imdb, max_per_image, thresh=thresh, vis=vis)
File "/home/pytorch/my/my_faster_rcnn_pytorch/test.py", line 148, in test_net
imdb.evaluate_detections(all_boxes, output_dir)
File "/home/pytorch/my/my_faster_rcnn_pytorch/faster_rcnn/datasets/pascal_voc.py", line 339, in evaluate_detections
self._do_python_eval(output_dir)
File "/home/pytorch/my/my_faster_rcnn_pytorch/faster_rcnn/datasets/pascal_voc.py", line 302, in _do_python_eval
use_07_metric=use_07_metric)
File "/home/pytorch/my/my_faster_rcnn_pytorch/faster_rcnn/datasets/voc_eval.py", line 109, in voc_eval
recs[imagename] = parse_rec(annopath.format(imagename))
File "/home/pytorch/my/my_faster_rcnn_pytorch/faster_rcnn/datasets/voc_eval.py", line 23, in parse_rec
obj_struct['bbox'] = [int(bbox.find('xmin').text),
ValueError: invalid literal for int() with base 10: '464.000000'

I solved it .

Can you please tell me how you solved it?
Thank you!!

you must check whether your groundtruth is " int".
If you just like me, the groundtruth is "float":

476.000000
525.000000
615.000000
628.000000
You change the code in this path /home/.../faster_rcnn_pytorch/faster_rcnn/datasets/voc_eval.py

obj_struct['bbox'] = [int(float(bbox.find('xmin').text)),
int(float(bbox.find('ymin').text)),
int(float(bbox.find('xmax').text)),
int(float(bbox.find('ymax').text))]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

limorbagizada picture limorbagizada  路  5Comments

monajalal picture monajalal  路  4Comments

mbuckler picture mbuckler  路  3Comments

ghost picture ghost  路  3Comments

ednarb29 picture ednarb29  路  4Comments