mxnet-ssd icon indicating copy to clipboard operation
mxnet-ssd copied to clipboard

ImageDetRecordIter arbitrary image size

Open caiqi opened this issue 8 years ago • 2 comments

Hi, it seems that ImageDetRecordIter only supports fix image size now. Is there any way to support arbitrary image size for training SSD with keeping image ratios. Thanks.

caiqi avatar Oct 27 '17 12:10 caiqi

@caiqi The default code use a data_shape of 3 x 300 x 300 or 3 x 512 x 512. I've modified it to support arbitrary image size. Here are my modifications:

  1. Add multi-scale support for argparse parameters in train.py, evaluate.py, deploy.py and demo.py. Modify the "--data-shape" argument to: parser.add_argument('--data-shape', 'data_shape', type=int, nargs='+', default=[300], help='set image size')

2.Modify the data-shape processing code in train_net.py. In function train_net, line 178: if len(data_shape) ==1: data_shape = (3, data_shape[0], data_shape[0]) elif len(data_shape) == 2: data_shape = (3, data_shape[0], data_shape[1]) else: data_shape = tuple(data_shape)

  1. Assuming your input size is 3-channel image WxH, use "--data-shape 3 H W" or "--data-shape H W"; otherwise, if your input size is 1-channel grayscale WxH, use "--data-shape 1 H W".

ghost avatar Oct 31 '17 02:10 ghost

@xioryu Thank you very much. I originally thought of getting different size of images in different batches for batch size ==1 like that in Faster R-CNN to resize images with shorter size to 600.

caiqi avatar Oct 31 '17 08:10 caiqi