Last active
April 6, 2021 18:21
-
-
Save jsalbert/2eddb89ab13d28d18f6a5b2779c29bd3 to your computer and use it in GitHub Desktop.
fcn_audio
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
# FCN Model | |
def create_model(num_classes=10, input_shape=None, dropout_ratio=None): | |
model = Sequential() | |
if input_shape is None: | |
model.add(Input(shape=(None, None, 1))) | |
else: | |
model.add(Input(shape=input_shape)) | |
model.add(Conv2D(filters=16, kernel_size=(2, 4), activation='relu')) | |
model.add(MaxPooling2D(pool_size=(2, 3))) | |
model.add(Conv2D(filters=32, kernel_size=(2, 4), activation='relu')) | |
model.add(MaxPooling2D(pool_size=2)) | |
model.add(Conv2D(filters=64, kernel_size=(2, 4), activation='relu')) | |
model.add(MaxPooling2D(pool_size=2)) | |
model.add(Conv2D(filters=128, kernel_size=(2, 4), activation='relu')) | |
model.add(GlobalAveragePooling2D()) | |
if dropout_ratio is not None: | |
model.add(Dropout(dropout_ratio)) | |
# Add dense linear layer | |
model.add(Dense(num_classes, activation='softmax')) | |
return model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment