5f73fe0599380479a37029de1d5647f33aae18c8,main.py,ModelSpeech,CreateModel,#ModelSpeech#,23
Before Change
"""
定义LSTM/CNN模型,尚未完成
"""
_model = Sequential()
_model.add(LSTM(self.MS_EMBED_SIZE, return_sequences=True, input_shape = (200,400))) // input_shape需要修改
_model.add(Dropout(0.3))
_model.add(Conv1D(self.QA_EMBED_SIZE // 2, 5, border_mode="valid"))
_model.add(MaxPooling1D(pool_length=2, border_mode="valid"))
_model.add(Dropout(0.3))
_model.add(Flatten())
//_model = Sequential()
//_model.add(Merge([m_lstm, aenc], mode="concat", concat_axis=-1))
_model.add(Dense(1279, activation="softmax"))
_model.compile(optimizer="adam", loss="categorical_crossentropy",metrics=["accuracy"])
return _model
def TrainModel(self,datapath,epoch = 2,save_step=1000,filename="model_speech/LSTM_CNN_model"):
After Change
输出层:全连接层,神经元数量为1279,使用softmax作为激活函数,使用CTC的loss作为损失函数
"""
// 每一帧使用13维mfcc特征及其13维一阶差分和13维二阶差分表示,最大信号序列长度为1500
layer_input = Input((1500,39))
layer_h1 = Conv1D(256, 5, use_bias=True, padding="valid")(layer_input) // 卷积层
layer_h2 = MaxPooling1D(pool_size=2, strides=None, padding="valid")(layer_h1) // 池化层
layer_h3 = Dropout(0.2)(layer_h2) // 随机中断部分神经网络连接,防止过拟合
layer_h4 = LSTM(256, activation="relu", use_bias=True)(layer_h3) // LSTM层
layer_h5 = Dropout(0.2)(layer_h4) // 随机中断部分神经网络连接,防止过拟合
layer_h6 = Dense(1279, activation="softmax")(layer_h5) // 全连接层
//labels = Input(name="the_labels", shape=[60], dtype="float32")
layer_out = Lambda(ctc_lambda_func,output_shape=(1279,), name="ctc")(layer_h6) // CTC
_model = Model(inputs = layer_input, outputs = layer_out)
//_model = Sequential()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 12
Instances
Project Name: nl8590687/ASRT_SpeechRecognition
Commit Name: 5f73fe0599380479a37029de1d5647f33aae18c8
Time: 2017-09-04
Author: 3210346136@qq.com
File Name: main.py
Class Name: ModelSpeech
Method Name: CreateModel
Project Name: inspirehep/magpie
Commit Name: 28b8b9d39f53d8327dbf658048a81b7046ae398f
Time: 2017-10-08
Author: stypka@spotify.com
File Name: magpie/nn/models.py
Class Name:
Method Name: rnn
Project Name: inspirehep/magpie
Commit Name: 28b8b9d39f53d8327dbf658048a81b7046ae398f
Time: 2017-10-08
Author: stypka@spotify.com
File Name: magpie/nn/models.py
Class Name:
Method Name: cnn