Skip to content

Instantly share code, notes, and snippets.

@jsalbert
Last active April 6, 2021 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsalbert/2eddb89ab13d28d18f6a5b2779c29bd3 to your computer and use it in GitHub Desktop.
Save jsalbert/2eddb89ab13d28d18f6a5b2779c29bd3 to your computer and use it in GitHub Desktop.
fcn_audio
# 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