avisingh599 / visual-qa

[Reimplementation Antol et al 2015] Keras-based LSTM/CNN models for Visual Question Answering
https://avisingh599.github.io/deeplearning/visual-qa/
MIT License
480 stars 186 forks source link

evaluate.py seems to fail on the example (get_started.sh) script. #18

Open NightFury13 opened 8 years ago

NightFury13 commented 8 years ago

Running the evaluate.py script as given in get_started.sh is leading to a Key Error. Any reasons/explanations as to what might be going wrong?

`$> python evaluateMLP.py -model ../models/mlp_num_hidden_units_1024_num_hidden_layers_3.json -weights ../models/mlp_num_hidden_units_1024_num_hidden_layers_3_epoch_00_loss_5.10.hdf5 -results ../results/mlp_1024_3_ep0.txt

Using Theano backend. Couldn't import dot_parser, loading of dot files will not be possible. /usr/local/lib/python2.7/dist-packages/theano/tensor/signal/downsample.py:5: UserWarning: downsample module has been moved to the pool module. warnings.warn("downsample module has been moved to the pool module.") Traceback (most recent call last): File "evaluateMLP.py", line 102, in main() File "evaluateMLP.py", line 22, in main model.load_weights(args.weights) File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 849, in load_weights for k in range(f.attrs['nb_layers']): File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-build-fkfoP6/h5py/h5py/_objects.c:2453) File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-build-fkfoP6/h5py/h5py/_objects.c:2410) File "/usr/local/lib/python2.7/dist-packages/h5py/_hl/attrs.py", line 52, in getitem attr = h5a.open(self._id, self._e(name)) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-build-fkfoP6/h5py/h5py/_objects.c:2453) File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-build-fkfoP6/h5py/h5py/_objects.c:2410) File "h5py/h5a.pyx", line 77, in h5py.h5a.open (/tmp/pip-build-fkfoP6/h5py/h5py/h5a.c:2057) KeyError: "Can't open attribute (Can't locate attribute: 'nb_layers')"`

NightFury13 commented 8 years ago

Strangely, the script runs fine if I pass one of the training snapshots instead of the final model hdf5 (eg. mlp_num_hidden_units_1024_num_hidden_layers_3_epoch_99.hdf5). @avisingh599 : Can you throw some light on this?

BulatSuleymanoff commented 8 years ago

I have the same issue, can you help to solve it?

sidgan commented 8 years ago

Did you use spaCy to load the Stanford Glove word2vec? The pre-trained model has that and unless changed locally spaCy will NOT load the Stanford Glove.