Last active
April 25, 2018 09:08
-
-
Save johnolafenwa/406b08431474d200193f8d3093aea051 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A single resnet module consisting of 1 x 1 conv - 3 x 3 conv and 1 x 1 conv | |
def resnet_identity_module(x, filters, pool=False): | |
res = x | |
stride = 1 | |
if pool: | |
stride = 2 | |
res = Conv2D(filters, kernel_size=1, strides=2, padding="same")(res) | |
x = BatchNormalization()(x) | |
x = Activation("relu")(x) | |
x = Conv2D(int(filters / 4), kernel_size=1, strides=stride, padding="same")(x) | |
x = BatchNormalization()(x) | |
x = Activation("relu")(x) | |
x = Conv2D(int(filters / 4), kernel_size=3, strides=1, padding="same")(x) | |
x = BatchNormalization()(x) | |
x = Activation("relu")(x) | |
x = Conv2D(filters, kernel_size=1, strides=1, padding="same")(x) | |
x = add([x, res]) | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment