我正致力于手写识别,我正在努力了解MDLSTM。我已经通过"Offline Handwriting Recognition with Multidimensional Recurrent Neural Networks"将图像传递给4 LSTM layers的论文。每个LSTM层都在四个不同的方向上扫描图像(即左,右,上,下)。我已尝试下面的代码在keras中实现,但我不知道如何在LSTM中实现扫描部分。给我一些有助于理解整个过程的想法/参考代码。
left = Sequential()
left.add(LSTM(output_dim=hidden_units, init='uniform', inner_init='uniform',
forget_bias_init='one', return_sequences=True, activation='tanh',
inner_activation='sigmoid', input_shape=(99, 13)))
right = Sequential()
right.add(LSTM(output_dim=hidden_units, init='uniform', inner_init='uniform',
forget_bias_init='one', return_sequences=True, activation='tanh',
inner_activation='sigmoid', input_shape=(99, 13), go_backwards=True))
top = Sequential()
top.add(LSTM(output_dim=hidden_units, init='uniform', inner_init='uniform',
forget_bias_init='one', return_sequences=True, activation='tanh',
inner_activation='sigmoid', input_shape=(99, 13)))
bottom = Sequential()
bottom.add(LSTM(output_dim=hidden_units, init='uniform', inner_init='uniform',
forget_bias_init='one', return_sequences=True, activation='tanh',
inner_activation='sigmoid', input_shape=(99, 13)))
model = Sequential()
model.add(Merge([left, right,top,bottom], mode='sum'))