问题
def preprocess_input(x):
x /= 255.
x -= 0.5
x *= 2.
return x
I am using keras inception_v3 imagenet pretrained model(inception_v3.py) to finetune on my own dataset.
When I want to subtract the imagenet mean value [123.68, 116.779, 103.939] and reverse axis RGB to BGR as we often do, I find that the author provided a _preprocess_input()_ function at the end.I am confused about this.
Should I use the provided function preprocess_input() or subtract mean value and reverse axis as usual?
Thanks lot.
回答1:
Actually in a original Inception paper the autors mention as a data preprocessor the function you provided (one which is zero-centering all channels and resizes it to [-1, 1]
interval). As in InceptionV3 paper no new data transformation is provided I think that you may assume that you should use the following function:
def preprocess_input(x):
x /= 255.
x -= 0.5
x *= 2.
return x
来源:https://stackoverflow.com/questions/42275815/should-i-substract-imagenet-pretrained-inception-v3-model-mean-value-at-inceptio