SHARE
TWEET

Custom CNN

a guest Mar 19th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def HappyModel(input_shape):
  2.   # Define the input placeholder as a tensor with shape input_shape.
  3.   X_input = Input(input_shape, name='input')
  4.  
  5.   # Zero-Padding: pads the border of X_input with zeroes
  6.   X = ZeroPadding2D((3, 3), name='padding')(X_input)
  7.  
  8.   # CONV -> BN -> RELU Block applied to X
  9.   X = Conv2D(32, (7, 7), strides=(1, 1), name='conv1')(X)
  10.   X = BatchNormalization(axis=3, name='bn1')(X)
  11.   X = Activation('relu', name='relu1')(X)
  12.  
  13.   # MAXPOOL
  14.   X = MaxPooling2D((2, 2), name='max_pool1')(X)
  15.  
  16.   # FLATTEN X (means convert it to a vector) + FULLYCONNECTED
  17.   X = Flatten(name='flatten1')(X)
  18.   X = Dense(1, activation='sigmoid', name='fc1-output')(X)
  19.  
  20.   # Create model. This creates our Keras model instance, you’ll use this instance
  21.   # to train/test the model.
  22.   model = Model(inputs=X_input, outputs=X, name='HappyModel')
  23.   return model
  24.  
  25. happyModel = HappyModel(X_train.shape[1:])
  26. happyModel.summary()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top