Skip to content

Conversation

@balvisio
Copy link
Contributor

@balvisio balvisio commented Jan 6, 2023

The keras source code shows that keras.applications.resnet50 the input mode is caffe instead of tf. (https://github.com/keras-team/keras/blob/e6784e4302c7b8cd116b74a784f4b78d60e83c26/keras/applications/resnet.py#L606-L613). Thus, normalizing the input to [-1, 1] might no be appropriate. It is suggested to use tf.keras.applications.resnet50.preprocess_input() instead. This will actually subtract the same mean from each channel used when training the model.

@balvisio balvisio changed the title Use resnet50 'preprocess_input' function before feeding them to model Use resnet50 'preprocess_input' function before feeding it to model Jan 6, 2023
@balvisio balvisio force-pushed the ba/use-resnet50-preprocessing branch from 126c4cd to 8bb5f80 Compare January 6, 2023 17:48
Copy link
Contributor

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. This will also better generalize when people attempt to use a different backbone.

@fchollet fchollet merged commit 0dd0b78 into keras-team:master Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants