This repository has been archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 651
The implementation of resnet may not correct. #534
Comments
After carefully comparing different implementations, I thought that The original paper summaries that However, keras-contrib/keras_contrib/applications/resnet.py Lines 181 to 215 in 3fc5ef7
This issue could be fixed by the following patch: - return _shortcut(input_features, x)
+ x = _shortcut(input_features, x)
+ return Activation("relu")(x) The second thing is I'm not sure why the condition |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The original resnet papaer summaries each layer's output size in Table 1.
The output size of last conv5_x layer (before avg_pool) is
7x7
. ButResNet
fromkeras-contrib
is4x4
.The following code can reproduce the result what I say:
I thought that the root cause is that the first cell's stride should handle carefully.
From pytorch implementation, they set frist cell's stride to 1 by default and set others cells' stride to 2 manully.
From keras-team implementation, they set frist cell's stride to 1 manully and set others cells' stride to 2 by default.
However, from
keras-contrib
implementation, they do nothing when building each cell.keras-contrib/keras_contrib/applications/resnet.py
Lines 394 to 407 in 3fc5ef7
This issue could be fixed easily. We only need an extra condition to check whether current cell is the frist cell.
The text was updated successfully, but these errors were encountered: