Should I substract imagenet pretrained inception_v3 model mean value at inception_v3.py keras?

梦想的初衷 提交于 2019-12-23 17:06:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!