Last active
August 18, 2019 07:40
-
-
Save pranav6670/de1f3524f87ad5622b14cb2a60c9c282 to your computer and use it in GitHub Desktop.
Audio Classification Model
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 conv_model(): | |
model = Sequential() | |
model.add(Conv2D(16, (3, 3), activation='relu', strides=(1, 1), | |
padding='same', input_shape=input_shape)) | |
model.add(Conv2D(32, (3, 3), activation='relu', strides=(1,1), | |
padding='same')) | |
model.add(Conv2D(64, (3, 3), activation='relu', strides=(1,1), | |
padding='same')) | |
model.add(Conv2D(128, (3, 3), activation='relu', strides=(1,1), | |
padding='same')) | |
model.add(MaxPool2D(2, 2)) | |
model.add(Dropout(0.5)) | |
model.add(Flatten()) | |
model.add(Dense(128, activation='relu')) | |
model.add(Dense(64, activation='relu')) | |
model.add(Dense(8, activation='softmax')) # Change | |
model.summary() | |
model.compile(loss='categorical_crossentropy', | |
optimizer='adam', | |
metrics=['acc']) | |
return model | |
def recurrent_model(): | |
model = Sequential() | |
model.add(LSTM(128, return_sequences=True, input_shape=input_shape)) | |
model.add(LSTM(128, return_sequences=True)) | |
model.add(Dropout(0.5)) | |
model.add(TimeDistributed(Dense(64, activation='relu'))) | |
model.add(TimeDistributed(Dense(32, activation='relu'))) | |
model.add(TimeDistributed(Dense(16, activation='relu'))) | |
model.add(TimeDistributed(Dense(8, activation='relu'))) | |
model.add(Flatten()) | |
model.add(Dense(8, activation='softmax')) # Change | |
model.summary() | |
model.compile(loss='categorical_crossentropy', | |
optimizer='adam', | |
metrics=['acc']) | |
return model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment