I trained my own model using my own annotated images by pretending it's VOC3001. Since I was interested in training for one class (e.g., car), I had files such as car_trainval.txt only (i.e., no bicycle_trainval.txt. The training completed; the command used was:
+ echo Logging output to experiments/logs/faster_rcnn_end2end_VGG_CNN_M_1024_--set_EXP_DIR_20161003b_own.txt.2016-10-03_22-30-42
Logging output to experiments/logs/faster_rcnn_end2end_VGG_CNN_M_1024_--set_EXP_DIR_20161003b_own.txt.2016-10-03_22-30-42
+ ./tools/train_net.py --gpu 0 --solver models/pascal_voc/VGG_CNN_M_1024/faster_rcnn_end2end/solver.prototxt --weights data/imagenet_models/VGG_CNN_M_1024.v2.caffemodel --imdb voc_3001_trainval --iters 70000 --cfg experiments/cfgs/faster_rcnn_end2end.yml --set EXP_DIR 20161003b_own
However, when I try to apply the model on a test image, I got the following error:
I1006 02:08:49.275831 2168 layer_factory.hpp:77] Creating layer input-data
I1006 02:08:49.297262 2168 net.cpp:106] Creating Layer input-data
I1006 02:08:49.297297 2168 net.cpp:411] input-data -> data
I1006 02:08:49.297338 2168 net.cpp:411] input-data -> im_info
I1006 02:08:49.297359 2168 net.cpp:411] input-data -> gt_boxes
Traceback (most recent call last):
File "testDetector.py", line 49, in <module>
main()
File "testDetector.py", line 45, in main
tester.go()
File "testDetector.py", line 25, in go
net = caffe.Net(prototxt, self.model, caffe.TEST)
File "/home/ubuntu/Will/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line 125, in setup
top[idx].reshape(1, self._num_classes * 4)
IndexError: Index out of range
By the way, what is the difference between the extensions .prototxt (used in the end2end algorithm) and .pt (used in the alt_opt algorithm)?
Thanks in advance.
Previously I was using train.prototxt which produced the error.
The error went away when I specified test.prototxt. However, when I load a test image and call demo() in tools/demo.py, I get
File "testDetector.py", line 31, in go
demo(net, inputFile)
File "/home/ubuntu/Will/py-faster-rcnn/tools/demo.py", line 85, in demo
scores, boxes = im_detect(net, im)
File "/home/ubuntu/Will/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 121, in im_detect
blobs, im_scales = _get_blobs(im, boxes)
File "/home/ubuntu/Will/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 105, in _get_blobs
blobs['rois'] = _get_rois_blob(rois, im_scale_factors)
File "/home/ubuntu/Will/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 68, in _get_rois_blob
rois, levels = _project_im_rois(im_rois, im_scale_factors)
File "/home/ubuntu/Will/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 83, in _project_im_rois
im_rois = im_rois.astype(np.float, copy=False)
AttributeError: 'NoneType' object has no attribute 'astype'
I fixed the problem by using cfg.TEST.HAS_RPN = True.
Thanks!! It works!!!
More details:
Change py-R-FCN/lib/faster_rcnn/config.py
__C.TEST.HAS_RPN = False to True
Most helpful comment
I fixed the problem by using
cfg.TEST.HAS_RPN = True.