CRNN-Keras
CRNN-Keras copied to clipboard
Bi-LTSM's implementation
Are you want to implement a bidirectional LSTM in the Model.py file between line 62 to 64? If the answer is YES. Here are a mistake of the Bi-LTSM's implementation.Did you forget to reverse the last_1b's output before input the add operation?
Yes, I saw this mistake too.
I do not really understand your comment. Is it reverse because I used go_backwoards = True in lstm_1b?
If it is wrong, please let me know how to fix it.
'go_backwoards = True' in lstm_1b is only reverse the input of the lstm_1b, If you not reverse the output of the lstm_1b, for example, now the output is (S'_i, S'_i-1, ... S'_2, S'_1) will be added to (S_1, S_2,...S_i-1,S_i)(the output of the lstm_1). Are your sure your code between line 62 to 64 is to implement a Bi-LSTM or other. If you want to implement a Bi-LSTM it should be:
lstm_1 = LSTM(256, return_sequences=True, name='lstm_1')(inner) lstm_1b = LSTM(256, return_sequences=True, go_backwards=True, name='lstm_1b')(inner) reversed_lstm_1b= Lambda(lambda inputTensor: K.reverse(inputTensor, axes=1)) (lstm_1b) lstm1_merged = add([lstm_1, reversed_lstm_1b])
Now I understand. I've been using it wrong so far.
I modified your model.py
code with your help.
Thank you.
Why not try Bidirectional
layer = Bidirectional(LSTM(256, return_sequences=True, kernel_initializer='he_normal'), merge_mode='concat')(layer)
Why not try Bidirectional
layer = Bidirectional(LSTM(256, return_sequences=True, kernel_initializer='he_normal'), merge_mode='concat')(layer)
I also wonder why.. Is there any problem with this?