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
How was the mean values of BGR decided?
In the mean_subtract() function, how are the values 123.68, 116.779 and 103.939 decided?
def mean_subtract(img):
img = T.set_subtensor(img[:,0,:,:],img[:,0,:,:] - 123.68)
img = T.set_subtensor(img[:,1,:,:],img[:,1,:,:] - 116.779)
img = T.set_subtensor(img[:,2,:,:],img[:,2,:,:] - 103.939)
return img / 255.0
And how do I customize it?
The text was updated successfully, but these errors were encountered:
Those are the channel-wise mean of images in the ImageNet dataset on which the model was pre-trained. This is done to keep the channel-wise mean (per batch) close to zero, which itself is known to speed up training [1].
I believe subtracting this mean, become less of a factor when the pixel intensities are scaled from [0,255] to [0,1]. So either you could compute channel-wise mean of images on your training set or otherwise not subtract any mean and divide by 255.
You could setup a simple experiment to confirm (or discard) this hypothesis. Would love to hear back on your results!
[1] Clevert, Djork-Arné, Thomas Unterthiner, and Sepp Hochreiter. "Fast and accurate deep network learning by exponential linear units (elus)." arXiv preprint arXiv:1511.07289 (2015).
@duggalrahul Thanks much for your response. I will experiment on the hypothesis you have mentioned and will update you on the results. But do you think it is still valid to use subtract channel-wise mean of images of the ImageNet dataset when I am actually not using the pretrained weights and I am training the network from scratch?
How was the mean values of BGR decided?
In the mean_subtract() function, how are the values 123.68, 116.779 and 103.939 decided?
def mean_subtract(img):
img = T.set_subtensor(img[:,0,:,:],img[:,0,:,:] - 123.68)
img = T.set_subtensor(img[:,1,:,:],img[:,1,:,:] - 116.779)
img = T.set_subtensor(img[:,2,:,:],img[:,2,:,:] - 103.939)
And how do I customize it?
The text was updated successfully, but these errors were encountered: