3

我正在努力理解 MDLSTM 的手写识别。我已经阅读了“Offline Handwriting Recognition with Multidimensional Recurrent Neural Networks”,该论文将图像传递到 4 个LSTM 层。每个 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'))
4

0 回答 0