Another tf.keras model example --a simple CNN with 7 layers
model = tf.keras.Sequential()
#Layer 1
# Must define the input shape in the first layer of the neural network
#conv2D 32 filters 5x5 w/ Relu activation
model.add(tf.keras.layers.Conv2D(filters=32, kernel_size=5, padding='same', activation='relu', input_shape=(IMAGE_SIZE,IMAGE_SIZE,1)))
#followed by Max Pooling
model.add(tf.keras.layers.MaxPooling2D((5,5), padding='same'))
#Layer 2 # Must define the input shape in the first layer of the neural network #conv2D 64 filters 5x5 w/ Relu activation model.add(tf.keras.layers.Conv2D(filters=64, kernel_size=5, padding='same', activation='relu', input_shape=(IMAGE_SIZE,IMAGE_SIZE,1))) #followed by Max Pooling model.add(tf.keras.layers.MaxPooling2D((5,5), padding='same'))
#Layer 3
# Must define the input shape in the first layer of the neural network
#conv2D 128 filters 5x5 w/ Relu activation
model.add(tf.keras.layers.Conv2D(filters=128, kernel_size=5, padding='same', activation='relu', input_shape=(IMAGE_SIZE,IMAGE_SIZE,1)))
#followed by Max Pooling
model.add(tf.keras.layers.MaxPooling2D((5,5), padding='same'))
#Layer 4
# Must define the input shape in the first layer of the neural network
#conv2D 64 filters 5x5 w/ Relu activation
model.add(tf.keras.layers.Conv2D(filters=64, kernel_size=5, padding='same', activation='relu', input_shape=(IMAGE_SIZE,IMAGE_SIZE,1)))
#followed by Max Pooling
model.add(tf.keras.layers.MaxPooling2D((5,5), padding='same'))
#Layer 5
# Must define the input shape in the first layer of the neural network
#conv2D 32 filters 5x5 w/ Relu activation
model.add(tf.keras.layers.Conv2D(filters=32, kernel_size=5, padding='same', activation='relu', input_shape=(IMAGE_SIZE,IMAGE_SIZE,1)))
#followed by Max Pooling
model.add(tf.keras.layers.MaxPooling2D((5,5), padding='same'))
#model.add(tf.keras.layers.Dropout(0.3))
#Layer 6
#Flatten output from last convolutional layer to send as input to fully connected (DENSE) layer , w/ 1024 output nodes
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(1024, activation='relu'))
#model.add(tf.keras.layers.Dropout(0.5))
#Layer 7
#Final softmax deicsion layer - 2 output nodes for the vector [x y] for cat/dog 2 class decision
model.add(tf.keras.layers.Dense(2, activation='softmax'))
# Take a look at the model summary
print("created model")
model.summary()
print(model)
