Caffe: About training data resizing

Created on 30 Jul 2016  路  5Comments  路  Source: weiliu89/caffe

As you stated in the paper and codes, the training images should be resized to a special size, typically a square, would this leads to the distortion of images if the original image is quite different between the height and the width? And would this leads to failure of the algorithm?

Most helpful comment

I won't say failure, but it would probably lead to suboptimal results. For example, if you naively warp kitti images to 300x300, it would probably 'squeeze' the objects too much. The network should still learn something, but probably cannot achieve the best results it should have. There are in generally two solutions to it:

  • Slide the 300 x 300 model over the original image.
  • Train on images with the original aspect ratio instead of warping it. All layers in SSD is convolution, so it can theoretically do that. For example, you can change the resize method from WARP to FIT_SMALL_SIZE. (Note that the code is not tested for this case. You should expect to have bugs if you want to try this.)

All 5 comments

I won't say failure, but it would probably lead to suboptimal results. For example, if you naively warp kitti images to 300x300, it would probably 'squeeze' the objects too much. The network should still learn something, but probably cannot achieve the best results it should have. There are in generally two solutions to it:

  • Slide the 300 x 300 model over the original image.
  • Train on images with the original aspect ratio instead of warping it. All layers in SSD is convolution, so it can theoretically do that. For example, you can change the resize method from WARP to FIT_SMALL_SIZE. (Note that the code is not tested for this case. You should expect to have bugs if you want to try this.)

@weiliu89 How to find about the information of 'P.Resize.WARP' ? I want to change this resize option. And are there any resize mode param of train_tranform_param?

Thanks Wei :+1:

@weiliu89 I'm getting completely degenerate bounding boxes after training with ssd_pascal_resnet.py on 480x640 KITTI images (cropped). E.g. https://imgur.com/a/YAXeh as detection output with confidence >= 0.99999 even after the loss seems to get to some pretty reasonable amounts. The bounding boxes are all very skinny -- e.g. 0.178 -0.229 0.178 1.09399998 as coordinates. Any idea?

Edit: I changed the image resize to 480x640 but left the min_dim as 300.

Was this page helpful?
0 / 5 - 0 ratings