Skip to content

Instantly share code, notes, and snippets.

@Akash-Rawat
Created Jul 28, 2021
Embed
What would you like to do?
def cnn(image_size, num_classes):
classifier = Sequential()
classifier.add(Conv2D(4, (3, 3), input_shape=image_size, activation='relu', padding='same'))
classifier.add(MaxPooling2D(pool_size = (2, 2)))
classifier.add(Conv2D(8, (2, 2), activation='relu', padding='same'))
classifier.add(MaxPooling2D(pool_size = (2, 2)))
classifier.add(Flatten())
classifier.add(Dense(num_classes, activation = 'softmax'))
classifier.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['acc'])
return classifier
neuralnetwork_cnn = cnn(image_size, num_classes)
neuralnetwork_cnn.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment