You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the contribution of this work. I'm trying to use the pre-trained network as a feature extractor. To best utilize the pre-trained weights, I must figure out how input images are pre-processed during pre-training and follow it exactly. However, I find two different pre-processing approaches in this repository.
The first one is found in the Tensorflow training code. The data will firstly be rescaled to [0, 1]. Then in preprocess_input function, since the default mode is caffe, it will reorder the channels from "RGB" to "BGR", and subtract the mean value of ImageNet (doc).
The second one (in the PyTorch Demo) rescales the input to [-1, 1], which is different from the first one and will result in different input distribution and output of the pre-trained network.
I'm also confused by it. I checked ImageDataGenerator code, https://github.com/keras-team/keras/blob/601488fd4c1468ae7872e132e0f1c9843df54182/keras/preprocessing/image.py#L1849-L1852. What it did inside is to first use preprocess_input to zero-center the images, then use rescale=1./255 to rescale. So during training, the images will be normalized by img = (img-mean)/255. In the case when original img has range [0,255] with mean of 127.5, it will be normalized to [-0.5,0.5]? If so, it seems demo code needs to be changed
Dear author,
Thank you for the contribution of this work. I'm trying to use the pre-trained network as a feature extractor. To best utilize the pre-trained weights, I must figure out how input images are pre-processed during pre-training and follow it exactly. However, I find two different pre-processing approaches in this repository.
The first one is found in the Tensorflow training code. The data will firstly be rescaled to [0, 1]. Then in
preprocess_input
function, since the default mode iscaffe
, it will reorder the channels from "RGB" to "BGR", and subtract the mean value of ImageNet (doc).RadImageNet/breast/breast_train.py
Lines 144 to 153 in 0ce16f7
The second one (in the PyTorch Demo) rescales the input to [-1, 1], which is different from the first one and will result in different input distribution and output of the pre-trained network.
It will be much appreciated if there can be clarification on this issue. Thanks!
The text was updated successfully, but these errors were encountered: