Open wellescastro opened 7 years ago
hi, i have tried to implement a multidimentional LSTM, here is a old version of my code http://stackoverflow.com/questions/42071074/multidimentional-lstm-tensorflow . I am not sure that it actually learns something. but we can try to make it better. also there is a branch that has a implementation with mdlstm, but i think it did not work very well!
I have used your MDLSTM code in your stackoverflow answer. But it seems not converge in my task. Have you test successfully in your task ?
i have made a test with a matrix of zeros, and i put some ones in it, and train the MDLSTM to count the ones and it converges. but with images of text i did not succeed, maybe there is an error of initialization is not correct.
@johnsmithm Is this right?
w,h = int(shape[1]/sh[0]),int(shape[2]/sh[1])
features = sh[1]*sh[0]*shape[3]
batch_size = shape[0]
x = tf.reshape(input_data, [batch_size,h,w, features])
I know MDLSTM need input to split to blocks, But I think the reshape fucntion above will damage the image distribution .
you are right, it is needed to split sh[0] times the input in the second dimension(height), then each slice split sh[1] the third dimension.
lines = tf.split(input_data,h,axis=1)#have a list of h blocks of sh[0] lines
x = []
for line in lines:#shape[0], sh[0], shape[2], shape[3] - bs, sh[0], total width, chanels
line = tf.transpose(line,[0,2,1,3])
line = tf.reshape(line,[batch_size,1,w,features])
x.append(line)
x = tf.pack(x,axis=1)
Good, have you test it in your image task? If you test it successfully, please tell me.
i have not test it yet
I haven't found a mdlstm of tensorflow version work well so far, I hope it works! And I will test it also.
it works, here is the code https://github.com/johnsmithm/mdlstm
Hi!
Is there any plan to support Multi-Directional Multi-Dimensional LSTMs? If you with, i'm available to help.
Thanks, Dayvid Castro.