iamaaditya / VQA_Keras

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

value error during training #4

Closed iqbal-chowdhury closed 7 years ago

iqbal-chowdhury commented 7 years ago

Hi,

I am getting this error while running: python train.py -model DeeperLSTM or python train -model simple_mlp

img_feature = np.divide(img_feature, np.tile(tem,(1,args.img_vec_dim))) ValueError: operands could not be broadcast together with shapes (82459,4096) (1,2048)

ValueError: operands could not be broadcast together with shapes (82459,4096) (1,2048)

iamaaditya commented 7 years ago

It looks like you might be using ResNet or GoogleNet for features (size 2048), and code is expecting VGGNet - 4096. Just change the code to reflect the sizes of image features.

iqbal-chowdhury commented 7 years ago

arguments.py file under the utils folder has configuration like this:

parser.add_argument('-img_vec_dim' , type=int , default=2048) parser.add_argument('-img_features' , type=str , default='resnet') parser.add_argument('-img_normalize' , type=int , default=0) When the img_vec_dim is changed to 4096 it shows that

File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-4rPeHA-build/h5py/_objects.c:2684) File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-4rPeHA-build/h5py/_objects.c:2642) File "/home/iqbal/.local/lib/python2.7/site-packages/h5py/_hl/group.py", line 166, in getitem oid = h5o.open(self.id, self._e(name), lapl=self._lapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-4rPeHA-build/h5py/_objects.c:2684) File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-4rPeHA-build/h5py/_objects.c:2642) File "h5py/h5o.pyx", line 190, in h5py.h5o.open (/tmp/pip-4rPeHA-build/h5py/h5o.c:3570) ValueError: Not a location (Invalid object id)

ValueError: Not a location (Invalid object id)

iamaaditya commented 7 years ago

Hmm.. Looking at the error it looks like incompatibility with the input file. What are your hdf5 data files ? It is possible that VQA_LSTM_CNN repo has changed the format of the data, on which this code depends.

If you are looking for VQA starter code (without too much dependency like mine) in Python, following are good too ---

  1. https://github.com/anantzoid/VQA-Keras-Visual-Question-Answering
  2. https://github.com/mateuszmalinowski/visual_turing_test-tutorial
  3. https://github.com/avisingh599/visual-qa

If you want State of the art models, then most of them are in lua (torch). Let me know, I can share.

iqbal-chowdhury commented 7 years ago

Hi,

I am going to create the h5 file from VQA_LSTM_CNN properly. Also please share state of the art models implemented in lua (torch). Thanks for the links.

iamaaditya commented 7 years ago

VQA - [SOTAs]

  1. https://github.com/jiasenlu/HieCoAttenVQA
  2. https://github.com/jnhwkim/cbp

More details here https://github.com/jnhwkim/awesome-vqa