VQA_Keras icon indicating copy to clipboard operation
VQA_Keras copied to clipboard

Error while training

Open Dishank99 opened this issue 4 years ago • 10 comments

I tried training the model and i got the following error ValueError: All input arrays (x) should have the same number of samples. Got array shapes: [(320006L, 26L), (122805L, 4096L)]

Can someone please try to resolve this error.

Dishank99 avatar Feb 14 '21 11:02 Dishank99

From the error, it looks like that your input (x) is not of the same size. Most of the networks train a single batch at a fixed size. Check the shape of your input and if the problem is because of the last batch of the data, consider sampling with a replacement or rejecting the last batch.

iamaaditya avatar Feb 14 '21 16:02 iamaaditya

I tried to train the model and save the weights using following code. model.fit(....) model.save_weights('VQA_WEIGHTS')

And tried to use it in demo.py from VQA_Demo repository using following code.

vqa_model = get_vqa_model('VQA_WEIGHTS')

but it popped with the error 'you are trying to load weights having 10 layers into model with 7 layers'

can you please provide some solution for this

Dishank99 avatar Feb 14 '21 17:02 Dishank99

They are different networks. You can use interchangeably use the weights. Change the network structure in VQA_DEMO to match the network as you trained from this repo.

iamaaditya avatar Feb 14 '21 17:02 iamaaditya

I changed the VQA model in VQA_Demo to be same as DeeperLSTM of VQA_Keras but while predicting received this error ValueError: Error when checking : expected embedding_1_input to have 2 dimensions, but got array with shape (1L, 26L, 300L)

Dishank99 avatar Feb 14 '21 19:02 Dishank99

Squeeze your input so that this (1L, 26L, 300L) becomes (26L, 300L). See this: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html

iamaaditya avatar Feb 14 '21 20:02 iamaaditya

The VQA model that you mentioned in VQA_Demo didn't have the embedding layer but both the models in VQA_Keras had embedding layer. So should VQA model for predicting have embedding layer or not

Dishank99 avatar Feb 14 '21 20:02 Dishank99

If one of them doesn't have the embedding layer then remove it from the other one. I don't remember the specifics of the network but definitely, you want it to have a common architecture.

Thanks and Regards Adi

On Sun, Feb 14, 2021 at 3:22 PM Dishank Tak [email protected] wrote:

The VQA model that you mentioned in VQA_Demo didn't have the embedding layer but both the models in VQA_Keras had embedding layer. So should VQA model for predicting have embedding layer or not

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iamaaditya/VQA_Keras/issues/7#issuecomment-778836150, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOTJ4VJBJ2O3TV37BV7R73S7AWHDANCNFSM4XTEKEGA .

iamaaditya avatar Feb 14 '21 20:02 iamaaditya

We cannot remove Embedsing layer from the training model. We have to make some adjustments in predicting model i guess

On Mon, 15 Feb 2021, 1:58 am aaditya prakash, [email protected] wrote:

If one of them doesn't have the embedding layer then remove it from the other one. I don't remember the specifics of the network but definitely, you want it to have a common architecture.

Thanks and Regards Adi

On Sun, Feb 14, 2021 at 3:22 PM Dishank Tak [email protected] wrote:

The VQA model that you mentioned in VQA_Demo didn't have the embedding layer but both the models in VQA_Keras had embedding layer. So should VQA model for predicting have embedding layer or not

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/iamaaditya/VQA_Keras/issues/7#issuecomment-778836150 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAOTJ4VJBJ2O3TV37BV7R73S7AWHDANCNFSM4XTEKEGA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/iamaaditya/VQA_Keras/issues/7#issuecomment-778836989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKGGMGLKYNMM4R6LVG5PSDS7AXABANCNFSM4XTEKEGA .

Dishank99 avatar Feb 14 '21 20:02 Dishank99

Is it that VQA_Demo's training project is different from VQA_Keras? Because lot of things are different betwwen them, they are some how not linking together

Dishank99 avatar Feb 14 '21 22:02 Dishank99

Yes; they are totally different and meant for different purposes. There are plenty of codebases for training VQA that are more recent, maintained, and compatible with the latest libraries. I will recommend you to browse and consider them. It is difficult for me to maintain very old code bases like these.

iamaaditya avatar Feb 14 '21 22:02 iamaaditya