Closed ahundt closed 6 years ago
Primarily, incorrect classification if scaling is not performed. I referred to the Keras-Densenet repo for this right ? Or did I forget that when I rewrote the call
It's approximately 1/58.8 for some reason. I never could find out why this is the case.
Maybe try with 1/255 and see if it still classifies correctly?
Actually, the reason of 0.017
is the following:
Originally, they preprocess normalized between [0.0; 1.0]
RGB images by subtracting a mean value [0.485, 0.456, 0.406]
and dividing each channel by a corresponding std value from [0.229, 0.224, 0.225]
, see here.
But as @titu1994 says that the weights are ported from here and Felix says that the weights were ported from here, where the preprocessing is
and if you compute the inverse of 255 * mean(std)
, it gives 1.0 / (255.0 * 0.227) = 0.01727563272004837
HTH
Thank you very much for the explanation @vfdev-5 !
@vfdev-5 good sleuthing, thanks!
Looking at the preprocess function I see:
I thought it might be 1/128 but that is 0.0078125. I can't find anywhere else that something similar is done either in upstream implementations or in the keras preprocessing. Do you have information or reasoning regarding this scaling factor?