YuwenXiong / py-R-FCN

R-FCN with joint training and python support
MIT License
1.05k stars 471 forks source link

why does roi_data_layer forward twice in one solver step? #25

Closed litingfeng closed 8 years ago

litingfeng commented 8 years ago

I tried to train rfcn_end2end_ohem.

In /roi_data_layer/layer.py, I added print "forward RoiDataLayer" inforward() (line 146). In fast-rcnn/train.py, I added for layer_name, blob in self.solver.net.blobs.iteritems(): print layer_name+'\t'+ str(blob.data.shape) intrain_model() (line 148).

The output is forward RoiDataLayer forward RoiDataLayer I1110 11:00:53.827004 25709 solver.cpp:228] Iteration 0, loss = 3.86447 I1110 11:00:53.827035 25709 solver.cpp:244] Train net output #0: accuarcy = 0 I1110 11:00:53.827045 25709 solver.cpp:244] Train net output #1: loss_bbox = 0.0267997 (* 1 = 0.0267997 loss) I1110 11:00:53.827050 25709 solver.cpp:244] Train net output #2: loss_cls = 3.04452 (* 1 = 3.04452 loss) I1110 11:00:53.827055 25709 solver.cpp:244] Train net output #3: rpn_cls_loss = 0.693147 (* 1 = 0.693147 loss) I1110 11:00:53.827060 25709 solver.cpp:244] Train net output #4: rpn_loss_bbox = 0.111002 (* 1 = 0.111002 loss) I1110 11:00:53.827067 25709 sgd_solver.cpp:106] Iteration 0, lr = 0.001 data (1, 3, 600, 943) im_info (1, 3) gt_boxes (1, 5, 1, 1) data_input-data_0_split_0 (1, 3, 600, 943) data_input-data_0_split_1 (1, 3, 600, 943) im_info_input-data_1_split_0 (1, 3) im_info_input-data_1_split_1 (1, 3) gt_boxes_input-data_2_split_0 (1, 5, 1, 1) gt_boxes_input-data_2_split_1 (1, 5, 1, 1)

It seems that it runs forward twice in one solver step, besides I'm sure IMS_PER_BATCH: 1. why is that ?

YuwenXiong commented 8 years ago

Because I use iter_size: 2 in end2end training. Since RPN only supports IMS_PER_BATCH: 1, we usually use this way to support batch_size = 2. Please check Caffe's code for more detail.