Created
August 12, 2021 17:04
-
-
Save Rodio346/405411270252f2505292164ec2540e24 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 CNNbuild(height, width, classes, channels): | |
model = Sequential() | |
inputShape = (height, width, channels) | |
chanDim = -1 | |
if K.image_data_format() == 'channels_first': | |
inputShape = (channels, height, width) | |
model.add(Conv2D(32, (3,3), activation = 'relu', input_shape = inputShape)) | |
model.add(MaxPooling2D(2,2)) | |
model.add(BatchNormalization(axis = chanDim)) | |
model.add(Conv2D(32, (3,3), activation = 'relu')) | |
model.add(MaxPooling2D(2,2)) | |
model.add(BatchNormalization(axis = chanDim)) | |
model.add(Conv2D(32, (3,3), activation = 'relu')) | |
model.add(MaxPooling2D(2,2)) | |
model.add(BatchNormalization(axis = chanDim)) | |
model.add(Flatten()) | |
model.add(Dense(8, activation = 'relu')) | |
model.add(Dense(8, activation = 'relu')) | |
model.add(Dense(8, activation = 'relu')) | |
model.add(BatchNormalization(axis = chanDim)) | |
model.add(Dropout(0.5)) | |
model.add(Dense(classes, activation = 'softmax')) | |
return model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment