Batch size of all the data must be same?


#1
data_shape = (1, 2, 7, 7)
roi_shape = (2, 5)
data = mx.sym.Variable('data')
roi = mx.sym.Variable('roi')
pool = mx.sym.ROIPooling(data=data, rois=roi, spatial_scale=1/2., pooled_size=(3,3))
mod = mx.mod.Module(pool, data_names=['data', 'roi'], label_names=None)
mod.bind(data_shape=[('data', data_shape), ('roi', roi_shape)]
mod.init_params()
mod.forward(...)

When I do as above, it throws AssertionError: all data must have the same batch size: batch_size=1, but rois has shape (2, 5). It’s my first time to try mxnet and I wonder how can I solve it. In practice, roi number varies from image. If I extend roi_shape to (1, 1, 2, 5), it’s against the input required in sym.ROIPooling.


#2

I solve it as the way fast rcnn did in exemple/rcnn. Give the roi a batch size dimension first and then reshape it.