py-faster-rcnn icon indicating copy to clipboard operation
py-faster-rcnn copied to clipboard

AssertionError: assert len(top) == len(self._name_to_top_map)

Open lixiang-ucas opened this issue 8 years ago • 7 comments

i have successfully trained the net my own data using end2end training. However, when training using alternative training, i meet the same error "assert len(top) == len(self._name_to_top_map) AssertionError". I have checked that len(top) = 6, but len(self._name_to_top_map) =3.

Traceback (most recent call last): File "C:\Anaconda\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\Anaconda\lib\multiprocessing\process.py", line 114, in run self._target(*self._args, **self._kwargs) File "E:\py-faster-rcnn\train_faster_rcnn_alt_opt-lx.py", line 205, in train_fast_rcnn max_iters=max_iters) File "lib\fast_rcnn\train.py", line 157, in train_net pretrained_model=pretrained_model) File "lib\fast_rcnn\train.py", line 43, in init self.solver = caffe.SGDSolver(solver_prototxt) File "lib\roi_data_layer\layer.py", line 140, in setup assert len(top) == len(self._name_to_top_map) AssertionError

I tried manually commented this line and got a new error: F0315 15:44:53.266901 23744 softmax_loss_layer.cpp:47] Check failed: outer_num_ * inner_num_ == bottom[1]->count() (1 vs. 4) Number of labels must match number of predict*** Check failure stack trace: ***

lixiang-ucas avatar Mar 15 '17 08:03 lixiang-ucas

Set cfg.TRAIN.HAS_RPN=False and try again!!!

fighting-liu avatar Mar 24 '17 10:03 fighting-liu

@fighting-liu In train_faster_rcnn_alt_opt.py/train_fast_rcnn, there already exist this configuration: cfg.TRAIN.HAS_RPN = False. But i don't know why it doesn't work. It seems that the cfg reloaded in layer.py and neglects the configuration in train_faster_rcnn_alt_opt.py/train_fast_rcnn.

lixiang-ucas avatar Mar 24 '17 10:03 lixiang-ucas

@lixiang-ucas Have you settled it yet? I had the same problem as you did

zhwis avatar May 25 '17 14:05 zhwis

sorry,I find out that my problems were due to set __C.TRAIN.BBOX_REG = False, Now it can be trained well

zhwis avatar May 26 '17 13:05 zhwis

@lixiang-ucas i encountered the same problem, it seems that cfg assignments in function train_rpn() and train_fast_rcnn() don't work. how did you solve it?

YanShuang17 avatar Dec 25 '17 13:12 YanShuang17

@fighting-liu In train_faster_rcnn_alt_opt.py/train_fast_rcnn, there already exist this configuration: cfg.TRAIN.HAS_RPN = False. But i don't know why it doesn't work. It seems that the cfg reloaded in layer.py and neglects the configuration in train_faster_rcnn_alt_opt.py/train_fast_rcnn.

change this in lib/config.py

liceHuang avatar Apr 22 '19 04:04 liceHuang

the config in train_faster_rcnn_alt_opt,py does not work we should change config in lib/config.py when train rpn,config as: __C..TRAIN.HAS_RPN = True __C..TRAIN.IMS_PER_BATCH = 1 __C..TRAIN.PROPOSAL_METHOD = 'gt' when train fast rcnn,config as: __C..TRAIN.HAS_RPN = False __C..TRAIN.IMS_PER_BATCH = 2 __C..TRAIN.PROPOSAL_METHOD = 'rpn' __C.TRAIN.BBOX_REG = True then it works.

liceHuang avatar Apr 22 '19 04:04 liceHuang