iamaaditya / VQA_Keras

Modular and Simple approach to VQA in Keras
22 stars 10 forks source link

Error while training #7

Open Dishank99 opened 3 years ago

Dishank99 commented 3 years ago

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.

iamaaditya commented 3 years ago

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.

Dishank99 commented 3 years ago

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

iamaaditya commented 3 years ago

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.

Dishank99 commented 3 years ago

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)

iamaaditya commented 3 years ago

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

Dishank99 commented 3 years ago

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

iamaaditya commented 3 years ago

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 notifications@github.com 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 .

Dishank99 commented 3 years ago

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, notifications@github.com 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 notifications@github.com 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 commented 3 years ago

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

iamaaditya commented 3 years ago

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.