Training rcnn with image size of 31*512, What values of anchor box scales and ratio, min_size are required

I have got the below error when training on my own data with image size of 31*512…

INFO:root:{‘ANCHOR_RATIOS’: [0.5, 1, 2],
‘ANCHOR_SCALES’: [8, 16, 32],
‘FIXED_PARAMS’: [‘conv1’, ‘conv2’],
‘FIXED_PARAMS_SHARED’: [‘conv1’, ‘conv2’, ‘conv3’, ‘conv4’, ‘conv5’],
‘IMAGE_STRIDE’: 0,
‘NUM_ANCHORS’: 9,
‘NUM_CLASSES’: 3,
‘PIXEL_MEANS’: array([103.939, 116.779, 123.68 ]),
‘RCNN_FEAT_STRIDE’: 16,
‘RPN_FEAT_STRIDE’: 16,
‘SCALES’: [(600, 1000)],
‘TEST’: {‘BATCH_IMAGES’: 1,
‘CXX_PROPOSAL’: True,
‘HAS_RPN’: False,
‘NMS’: 0.3,
‘PROPOSAL_MIN_SIZE’: 16,
‘PROPOSAL_NMS_THRESH’: 0.7,
‘PROPOSAL_POST_NMS_TOP_N’: 2000,
‘PROPOSAL_PRE_NMS_TOP_N’: 20000,
‘RPN_MIN_SIZE’: 16,
‘RPN_NMS_THRESH’: 0.7,
‘RPN_POST_NMS_TOP_N’: 300,
‘RPN_PRE_NMS_TOP_N’: 6000},
‘TRAIN’: {‘ASPECT_GROUPING’: True,
‘BATCH_IMAGES’: 1,
‘BATCH_ROIS’: 128,
‘BBOX_MEANS’: [0.0, 0.0, 0.0, 0.0],
‘BBOX_NORMALIZATION_PRECOMPUTED’: True,
‘BBOX_REGRESSION_THRESH’: 0.5,
‘BBOX_STDS’: [0.1, 0.1, 0.2, 0.2],
‘BBOX_WEIGHTS’: array([1., 1., 1., 1.]),
‘BG_THRESH_HI’: 0.5,
‘BG_THRESH_LO’: 0.0,
‘CXX_PROPOSAL’: True,
‘END2END’: True,
‘FG_FRACTION’: 0.25,
‘FG_THRESH’: 0.5,
‘RPN_BATCH_SIZE’: 256,
‘RPN_BBOX_WEIGHTS’: [1.0, 1.0, 1.0, 1.0],
‘RPN_CLOBBER_POSITIVES’: False,
‘RPN_FG_FRACTION’: 0.5,
‘RPN_MIN_SIZE’: 16,
‘RPN_NEGATIVE_OVERLAP’: 0.3,
‘RPN_NMS_THRESH’: 0.7,
‘RPN_POSITIVE_OVERLAP’: 0.7,
‘RPN_POSITIVE_WEIGHT’: -1.0,
‘RPN_POST_NMS_TOP_N’: 2000,
‘RPN_PRE_NMS_TOP_N’: 12000}}
INFO:root:voc_2007_train num_images 1500
INFO:root:voc_2007_train wrote gt roidb to data/cache/voc_2007_train_gt_roidb.pkl
INFO:root:voc_2007_train append flipped images to roidb
INFO:root:load data: filtered 0 roidb entries: 3000 -> 3000
Traceback (most recent call last):
File “train_end2end.py”, line 195, in
main()
File “train_end2end.py”, line 192, in main
lr=args.lr, lr_step=args.lr_step)
File “train_end2end.py”, line 64, in train_net
anchor_ratios=config.ANCHOR_RATIOS, aspect_grouping=config.TRAIN.ASPECT_GROUPING)
File “/home/ubuntu/incubator-mxnet/example/rcnn/rcnn/core/loader.py”, line 291, in init
self.get_batch()
File “/home/ubuntu/incubator-mxnet/example/rcnn/rcnn/core/loader.py”, line 401, in get_batch
self.anchor_ratios, self.allowed_border)
File “/home/ubuntu/incubator-mxnet/example/rcnn/rcnn/io/rpn.py”, line 166, in assign_anchor
gt_argmax_overlaps = overlaps.argmax(axis=0)
ValueError: attempt to get argmax of an empty sequence

Is it possible to train the network with image size of 31*512??
What i understood was it is due to the anchor box scale and min_size… But what values are the best for this type of input data… I have tried with scales of (2,4,8) and min_size 2 and 16 but i got results as

AP for bicycle = 0.0000
Ap for pedestrian = 0.0000
mean AP = 0.0000.

Please someone give the solution for this error…
Any help is really appreciated.

31 is too small for this particular network, you will get feature size 0x15 for example after several downsampling layers. This is not related to rcnn.

1 Like

So, Is there any other way where we can feed 31*512 image input??
Or If i remove some layers in resnet or mobilenet will that be okay???

Yes, but you have to make sure network has decent amount of layers. Or you can consider removing some downsampling layers.