I'm a little bit lost about the rescale parameter in the ImageDatagenerator function. I know that the rescale argument by itself does not augment my data and that by doing rescale=1./255 it will convert the pixels in range [0,255] to range [0,1].

Currently, I'm only using random flips(vertical and horizontal) and 90º degrees rotations but I'm pondering whether or not I should add the rescale parameter.

My question is what is the advantage in doing that?


As rightly pointed out by you the rescale=1./255 will convert the pixels in range [0,255] to range [0,1].

This process is also called Normalizing the input. Scaling every images to the same range [0,1] will make images contributes more evenly to the total loss.

Without scaling, the high pixel range images will have a large say to determine how to update weights. For example, black/white cat image could be higher pixel range than pure black cat image, but it just doesn't mean black/white cat image is more important for training.

Also the neural network has a higher chance of converging as it make the coefficients in range of [0,1] as opposed to [0,255] so helps the model process input faster.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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