forked from BytesNBitsCL/modelo_lstm_lsch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.py
18 lines (15 loc) · 820 Bytes
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from keras.models import Sequential
from keras.layers import LSTM, Dense, Dropout
from keras.regularizers import l2
from constants import LENGTH_KEYPOINTS
def get_model(max_length_frames, output_length: int):
model = Sequential()
model.add(LSTM(64, return_sequences=True, input_shape=(max_length_frames, LENGTH_KEYPOINTS), kernel_regularizer=l2(0.01)))
model.add(Dropout(0.5))
model.add(LSTM(128, return_sequences=False, kernel_regularizer=l2(0.001)))
model.add(Dropout(0.5))
model.add(Dense(64, activation='relu', kernel_regularizer=l2(0.001)))
model.add(Dense(64, activation='relu', kernel_regularizer=l2(0.001)))
model.add(Dense(output_length, activation='softmax'))
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
return model