After attending the video “Fixing through cropping”, I am a little bit confused about the size of the image when I am training the model and when the model is in “production”.
The model “guesses right” after cropping the picture of the cat but…I am wondering isn’t the cropping changing the size of the image I used during training?
Is it correct to suppose that once the model is trained I don’t need to worry about the size of the images I’m going to use in the future?
If the size of the image can be different in “production”, why cannot I do the same in training? Why is the input_shape
argument so important on the first conv layer?
Hello @Gloria
Welcome to our Community! Thanks for reaching out.
It’s an excellent question, and there are two main issues to discuss.
-
In the “Fixing through cropping” class, the main idea is to understand that the entire environment around the image affects the classification; that is why we must seek to cut the image in such a way so that we can have only the object that we want to classify. The challenge of the class is cutouts the image and see that the green background can affect the dog vs. cat classification.
-
The input of the neural network “input_shape” is essential for both training and inference (the model in production) because mathematically, an image is a multidimensional matrix (tensor). If we analyze the image as a matrix, the image’s dimensions in pixels will affect the input. The neural network will only receive a matrix of a specific size.
An excellent way to solve this in production is to add a preprocessing step that consists of a resize the input frame to fit the input size that you defined in training.
I hope I can solve your doubts.
Greetings