Punisher
Punisher

Reputation: 684

Why not pad instead of warping an image for a CNN

If our CNN takes in images with size 512x512, and our test image with size 256x128, why do we choose to resize the image instead of padding the test image with 0s to match the CNN input size (in the case the test size < CNN input size)?

Will warping the test image affect how the CNN recognizes the image? Will padding work better than resizing?

Upvotes: 1

Views: 315

Answers (1)

Kadir Korkmaz
Kadir Korkmaz

Reputation: 85

If you trained your network with this kind of images ( 256x128 padded with 0's ) it could work.

Otherwise, it won't work because your network not trained to recognize this kind of images (images with 0 padding).

Maybe you can try to train custom CNN which is compatible with your test and training data. Otherwise, you need to resize your image to get consistent results.

Upvotes: 1

Related Questions