In Doc of tensorflow 2, it's said to use a pretrained resnet model, we should first input our image tensor into a specific preprocess_input layer. And I noticed this preprocess layer only accept tensors with value in range(0-255). Is that mean, the pre-trained weights are trained with image that have value in range(0-255)?
My another question is, when I check the source code in github, the preprocess_input layer works only in caffee mode, where the input tensors are only zero-centered with 3 values for 3 channels and aren't scaled into range of [0,1]. Should I rescale the ouput of preprocess layer before put the tensors into pretrained resnet model? And why it is in caffee mode?
Some definitions in tensorflow doc:
- preprocess layer for resnet
tf.keras.applications.resnet.preprocess_input(
x, data_format=None
)
x: A floating point numpy.array or a tf.Tensor, 3D or 4D with 3 color channels, with values in the range [0, 255].
- requirement to use preprocess layer in 1
Note: each Keras Application expects a specific kind of input preprocessing. For ResNet, call tf.keras.applications.resnet.preprocess_input on your inputs before passing them to the model.
Thanks