pycaffe caffe.io.resize_image does not respect aspect ratio
Is this deliberate? I was under the assumption that the aspect ratio should be maintained and the image center cropped.
This is impacting classifier.Classifier.predict() and classifier.Classifier.preprocess(), as both of these call caffe.io.resize_image
as a result, the center crop block in net.predict(oversample=False) does nothing because the image has been resized to a square.
Can you confirm if this is the intended behaviour?
Opinions differ on resizing and cropping for image classification -- caffe.Classifier just implements the common choice of resizing inputs to a canonical size then cropping. It is working as designed.
caffe.io.resize_image is agnostic about aspect ratio, and just resizes to the given dimensions. Cropping and oversampling can still make a difference because the image_dims for resizing are not necessarily the input dimensions for the network that determine the crops. For instance, CaffeNet takes 227 x 227 but in the example the input is resized to 256 x 256.
The Classifier and Detector are examples, and not the law, so please tailor them to your needs.