rbgirshick / py-faster-rcnn

Faster R-CNN (Python implementation) -- see https://github.com/ShaoqingRen/faster_rcnn for the official MATLAB version
Other
8.07k stars 4.11k forks source link

Training Faster RCNN #199

Open slchiang opened 8 years ago

slchiang commented 8 years ago

Hi,

I would like to learn how to train this net. I download VOCdevkit2007 to the path as shown on guide. I used the original prototxt files as below in python:

caffe_model = os.path.join(FRCNN_ROOT, 'data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel')
solver_path = os.path.join(FRCNN_ROOT, 'models/pascal_voc/ZF/faster_rcnn_end2end/solver.prototxt')
solver = caffe.SGDSolver(solver_path)
solver.solve()

And I got error:

I0519 22:47:34.114130 16254 net.cpp:454] rpn_loss_cls <- rpn_labels
I0519 22:47:34.114147 16254 net.cpp:411] rpn_loss_cls -> rpn_cls_loss
I0519 22:47:34.114174 16254 layer_factory.hpp:77] Creating layer rpn_loss_cls
F0519 22:47:34.115299 16254 loss_layer.cpp:19] Check failed: bottom[0]->num() == bottom[1]->num() (2 vs. 1) The data and label should have the same number.
*** Check failure stack trace: ***

I did't change any code yet. How should I fix it? Any suggestion is appreciated

Thanks. Sony

happyharrycn commented 8 years ago

You should use the provided bash scripts (.sh) file or manually call train_net.py in tools for training VOC.

slchiang commented 8 years ago

Hi @happyharrycn ,

Thanks for your reply.

I tried both bash scripts and train_net.py, ./experiments/scripts/faster_rcnn_end2end.sh 1 ZF pascal_voc but I got the following message for both. Do you have any idea about it?

Loaded dataset `voc_2007_trainval` for training
Set proposal method: selective_search
Appending horizontally-flipped training examples...
voc_2007_trainval gt roidb loaded from /home/sony/Desktop/Sony/py-faster-rcnn/data/cache/voc_2007_trainval_gt_roidb.pkl
Traceback (most recent call last):
  File "./tools/train_net.py", line 104, in <module>
    imdb, roidb = combined_roidb(args.imdb_name)
  File "./tools/train_net.py", line 69, in combined_roidb
    roidbs = [get_roidb(s) for s in imdb_names.split('+')]
  File "./tools/train_net.py", line 66, in get_roidb
    roidb = get_training_roidb(imdv)
  File "/home/sony/Desktop/Sony/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 118, in get_training_roidb
    imdb.append_flipped_images()
  File "/home/sony/Desktop/Sony/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 106, in append_flipped_images
    boxes = self.roidb[i]['boxes'].copy()
  File "/home/sony/Desktop/Sony/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 67, in raids
    self._roidb = self.roidb_handler()
  File "/home/sony/Desktop/Sony/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 136, in selective_search_roidb
    ss_roidb = self._load_selective_search_roidb(gt_roidb)
  File "/home/sony/Desktop/Sony/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 182, in _load_selective_search_roidb
    return self.create_roidb_from_box_list(box_list, gt_roidb)
  File "/home/sony/Desktop/Sony/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 211, in create_roidb_from_box_list
    'Number of boxes must match number of ground-truth images'
AssertionError: Number of boxes must match number of ground-truth images 

Any suggestion is appreciated and thanks a lot in advance.

ricepot100 commented 8 years ago

You have double chip GPU? If not, I guess maybe: ./experiments/scripts/faster_rcnn_end2end.sh 0 ZF pascal_voc In my platform: ubuntu 14.04, NV-980TI-6GDDR, I train the ZF with following command, it could success: ./experiments/scripts/faster_rcnn_alt_opt.sh 0 ZF pascal_voc

and should delete /home/sony/Desktop/Sony/py-faster-rcnn/data/cache/ directory before training.

xupinjie commented 7 years ago

Hi!@slchiang Do you solve this problem? Can you give me some suggestion?

whmin commented 6 years ago

@slchiang How did you solve the above error:AssertionError: Number of boxes must match number of ground-truth images? Could you help me?Thank you !!!

lizitou commented 6 years ago

@whmin Hi whmin.I 've got the same assertion error :Number of boxes must match number of ground-truth images.Did you solve it?