I would like to ask why we use different image processing at train and test for an image classification task. For example, this pytorch tutorial uses RandomResizedCrop at train time and then Resize + CenterCrop at test time. pytorch tutorial example

I just read this paper called Fixing the train-test resolution discrepancy and it says this has been the best practice. Fixing the train-test resolution discrepancy

However, I'm unable to figure out why nor find any documentation online as to why this is the case. Please help me shed some light on this. Thank you.


1 Answer 1


The key difference is that for training the preprocessing serves the purpose of data augmentation: it increases variance in the training data and thereby helps to better generalize. That is why you will find random cropping, flipping, rotating and zooming here.

But during inference that is not required and these random preprocessing steps would not be helpful. Therefore, you only do the preprocessing steps required and eliminate randomness (e.g. crop images to the correct input size with centercrop instead of randomcrop).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.