Created
January 2, 2021 07:31
-
-
Save Crazz-Zaac/00882d0a6ad08f43a4d4c5665b937122 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
def HappyModel(input_shape): | |
""" | |
Implementation of the HappyModel. | |
Arguments: | |
input_shape -- shape of the images of the dataset | |
(height, width, channels) as a tuple. | |
Note that this does not include the 'batch' as a dimension. | |
If you have a batch like 'X_train', | |
then you can provide the input_shape using | |
X_train.shape[1:] | |
Returns: | |
model -- a Model() instance in Keras | |
""" | |
### START CODE HERE ### | |
# Feel free to use the suggested outline in the text above to get started, and run through the whole | |
# exercise (including the later portions of this notebook) once. The come back also try out other | |
# network architectures as well. | |
X_input = Input(input_shape) | |
# Zero-Padding: pads the border of X_input with zeroes | |
X = ZeroPadding2D((3, 3))(X_input) | |
# CONV -> BN -> RELU Block applied to X | |
X = Conv2D(32, (7, 7), strides = (1, 1), name = 'conv0')(X) | |
X = BatchNormalization(axis = 3, name = 'bn0')(X) | |
X = Activation('relu')(X) | |
# MAXPOOL | |
X = MaxPooling2D((2, 2), name='max_pool')(X) | |
# FLATTEN X (means convert it to a vector) + FULLYCONNECTED | |
X = Flatten()(X) | |
X = Dense(1, activation='sigmoid', name='fc')(X) | |
# Create model. This creates your Keras model instance, you'll use this instance to train/test the model. | |
model = Model(inputs = X_input, outputs = X, name='HappyModel') | |
### END CODE HERE ### | |
return model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment