Py-faster-rcnn: Training with Mini-Batch size greater than 1

Created on 21 Jul 2016  路  15Comments  路  Source: rbgirshick/py-faster-rcnn

Hi,

I am trying to train py-faster-rcnn using a mini-batch size of 4.
However, when I look at all the python layers in RPN, I found that it supports a mini-batch of only 1.
For example here, there is an assert which doesn't allow a greater than 1 mini-batch.

I am currently trying to modify the python code to support a bigger mini-batch but the task seems daunting and I am not even sure if it can be done with slight modifications or do I have to make huge changes.

Would really appreciate if someone with a better insight can give some opinions/suggestions/directions.
Thanks!

Most helpful comment

@zimenglan-sysu-512 @babylonico Please find appropriate changes https://github.com/ice-pice/py-faster-rcnn . It gives me equivalent performance compared to using same iter_size. @GBJim

All 15 comments

@ice-pice
This closed issue might give you some clues:
#51

Thanks but this is a workaround.
I have modified the data layer and rpn layers to accept greater mini-batch.
Training the model currently....

@ice-pice That's great!
Would you like to share those modifications later?

@GBJim Let me validate the changes first.
I might have done a lousy job from software engineering perspective but if it works, I won't mind sharing!

@ice-pice can you share your modification? thanks a lot.

@ice-pice did you validate your work around?

@zimenglan-sysu-512 @babylonico Please find appropriate changes https://github.com/ice-pice/py-faster-rcnn . It gives me equivalent performance compared to using same iter_size. @GBJim

@ice-pice can you please make a pull request?

@ice-pice How can you get batchsize more than one? Because the input image sizes differ in aspect ratio, so they cannot be input as a batch, so the input batchsize should be one.

Can you see my repo where I make the changes.
https://github.com/ice-pice/py-faster-rcnn

Hi, I have a problem, 'Faster RCNN' says Ncls =256 , 256 is the mini-batch size , but comments say batch size is 1, so I confused, 256 is the anchors of a image?

@ujsyehao 1 is the number of image each iteration, 256 is the number of rois(pos and neg) in this image, So 256 is the true batchsize often grasped.

Thank you! @liangzimei

what's the meaning of the im_inds?

please clarify ... @ice-pice
so each image contributes 256 roi's ?
and if I have 4 images in mini-batch, after roi-align tensor shape will become 4*256 X C X H X W ?

Was this page helpful?
0 / 5 - 0 ratings