xuanjihe / speech-emotion-recognition

speech emotion recognition using a convolutional recurrent networks based on IEMOCAP
389 stars 142 forks source link

Incompatible shapes: [654] vs. [436] #25

Closed ramesh720 closed 5 years ago

ramesh720 commented 5 years ago

i am running model.py at this step loss, train_acc = sess.run([cost,accuracy],feed_dict = {X:valid_data, Y:valid_label,is_training:False, keep_prob:1}) i am getting error my valid _label shape is (436,4) my valid _data shape is (436,4)

to calculate loss we need Ylogits . but logits shape is (654,4) logits and labels must be same size: logits_size=[654,4] labels_size=[436,4]

can any one solve this problem.... Thanking you

image

xuanjihe commented 5 years ago

print the shape of every tensorflow and you will find the issue!

ramesh720 commented 5 years ago

('valid_label==', (436, 4)) ('valid_data==', (436, 300, 40, 3)) ('layer1 shape', TensorShape([Dimension(None), Dimension(300), Dimension(40), Dimension(256)])) ('layer 2 shape', TensorShape([Dimension(None), Dimension(300), Dimension(10), Dimension(512)])) (?, 300, 5, 512) ('layer2 shape', TensorShape([Dimension(None), Dimension(300), Dimension(5), Dimension(512)])) ('layer2 shape', TensorShape([Dimension(None), Dimension(200), Dimension(2560)])) ('layer2 shape', TensorShape([Dimension(None), Dimension(2560)])) ('linear1 shape', TensorShape([Dimension(None), Dimension(768)])) ('linear1 shape', TensorShape([Dimension(None), Dimension(768)])) ('linear1 shape', TensorShape([Dimension(None), Dimension(200), Dimension(768)])) ('outputs1 shape', (<tf.Tensor 'LSTM1/fw/fw/transpose:0' shape=(?, 200, 128) dtype=float32>, <tf.Tensor 'ReverseV2:0' shape=(?, 200, 128) dtype=float32>)) ('outputs shape', TensorShape([Dimension(None), Dimension(200), Dimension(256)])) ('outputs shape', TensorShape([Dimension(None), Dimension(200), Dimension(256), Dimension(1)])) ('gru shape', TensorShape([Dimension(None), Dimension(256)])) ('fully1 shape', TensorShape([Dimension(None), Dimension(64)])) ('Ylogits shape', TensorShape([Dimension(None), Dimension(4)]))

i checked and i printed all shapes looking like shapes are good . but getting same error. why i am getting more loggits. many of them getting the same error as i get. can you please check sir. Thanking you sir

xuanjihe commented 5 years ago

now i have updated the code, you can try again!

ramesh720 commented 5 years ago

thanking you sir for quick reply. sir you need to change 2 things load_validdata(FLAGS.traindata_path) from load_traindata(FLAGS.traindata_path) in model,py line 61 and gru, alphas = attention(outputs1,1, return_alphas=True) from gru, alphas = attention(outputs1, return_alphas=True) in arcnn1.py line 150