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
from keras.layers import Dense, Dropout, Flatten, Conv1D, Input, MaxPooling1D | |
from keras.models import Model | |
from keras.callbacks import EarlyStopping, ModelCheckpoint | |
from keras import backend as K | |
K.clear_session() | |
inputs = Input(shape=(8000,1)) | |
#First Conv1D layer | |
conv = Conv1D(8,13, padding='valid', activation='relu', strides=1)(inputs) | |
conv = MaxPooling1D(3)(conv) | |
conv = Dropout(0.3)(conv) | |
#Second Conv1D layer | |
conv = Conv1D(16, 11, padding='valid', activation='relu', strides=1)(conv) | |
conv = MaxPooling1D(3)(conv) | |
conv = Dropout(0.3)(conv) | |
#Third Conv1D layer | |
conv = Conv1D(32, 9, padding='valid', activation='relu', strides=1)(conv) | |
conv = MaxPooling1D(3)(conv) | |
conv = Dropout(0.3)(conv) | |
#Fourth Conv1D layer | |
conv = Conv1D(64, 7, padding='valid', activation='relu', strides=1)(conv) | |
conv = MaxPooling1D(3)(conv) | |
conv = Dropout(0.3)(conv) | |
#Flatten layer | |
conv = Flatten()(conv) | |
#Dense Layer 1 | |
conv = Dense(256, activation='relu')(conv) | |
conv = Dropout(0.3)(conv) | |
#Dense Layer 2 | |
conv = Dense(128, activation='relu')(conv) | |
conv = Dropout(0.3)(conv) | |
outputs = Dense(len(labels), activation='softmax')(conv) | |
model = Model(inputs, outputs) | |
model.summary() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment