I am using ResNet-50 model in tensorflow-slim to extract features. My question is do I need to centre the images according to some standard ResNets-50 mean values before feeding in the images? I know that for vgg-19 tf-slim provides options for centering using
_mean_image_subtraction(image, means)
defined in vgg_preprocessing.py
. But I couldn't find any such files or functions for ResNets.
I believe you should use vgg_preprocessing
as well. In get_preprocessing()
from preprocessing_factory.py:
preprocessing_fn_map = {
'cifarnet': cifarnet_preprocessing,
'inception': inception_preprocessing,
'inception_v1': inception_preprocessing,
'inception_v2': inception_preprocessing,
'inception_v3': inception_preprocessing,
'inception_v4': inception_preprocessing,
'inception_resnet_v2': inception_preprocessing,
'lenet': lenet_preprocessing,
'mobilenet_v1': inception_preprocessing,
'resnet_v1_50': vgg_preprocessing,
'resnet_v1_101': vgg_preprocessing,
'resnet_v1_152': vgg_preprocessing,
'resnet_v1_200': vgg_preprocessing,
'resnet_v2_50': vgg_preprocessing,
'resnet_v2_101': vgg_preprocessing,
'resnet_v2_152': vgg_preprocessing,
'resnet_v2_200': vgg_preprocessing,
'vgg': vgg_preprocessing,
'vgg_a': vgg_preprocessing,
'vgg_16': vgg_preprocessing,
'vgg_19': vgg_preprocessing,
}
You can also verify the use of preprocessing_factory.get_preprocessing()
from train_image_classifier.py:
preprocessing_name = FLAGS.preprocessing_name or FLAGS.model_name
image_preprocessing_fn = preprocessing_factory.get_preprocessing(
preprocessing_name,
is_training=True)
...
image = image_preprocessing_fn(image, train_image_size, train_image_size)