Hi,
Thank you for this interactive demo of VQA. Anyway while running the prediction cell:
`y_output = model_vqa.predict([question_features, image_features])
labelencoder = joblib.load(label_encoder_file_name)
for label in reversed(np.argsort(y_output)[0,-5:]):
print str(round(y_output[0,label]*100,2)).zfill(5), "% ", labelencoder.inverse_transform(label)`
Then it showing some error just as below:
`ValueError Traceback (most recent call last)
in ()
----> 1 y_output = model_vqa.predict([question_features, image_features])
2
3 # This task here is represented as a classification into a 1000 top answers
4 # this means some of the answers were not part of training and thus would
5 # not show up in the result.
/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/models.pyc in predict(self, x, batch_size, verbose)
454 if self.model is None:
455 raise Exception('The model needs to be compiled before being used.')
--> 456 return self.model.predict(x, batch_size=batch_size, verbose=verbose)
457
458 def predict_on_batch(self, x):
/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/engine/training.pyc in predict(self, x, batch_size, verbose)
1117 f = self.predict_function
1118 return self._predict_loop(f, ins,
-> 1119 batch_size=batch_size, verbose=verbose)
1120
1121 def train_on_batch(self, x, y,
/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/engine/training.pyc in _predict_loop(self, f, ins, batch_size, verbose)
837 ins_batch = slice_X(ins, batch_ids)
838
--> 839 batch_outs = f(ins_batch)
840 if type(batch_outs) != list:
841 batch_outs = [batch_outs]
/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/backend/theano_backend.pyc in call(self, inputs)
505 def call(self, inputs):
506 assert type(inputs) in {list, tuple}
--> 507 return self.function(*inputs)
508
509
/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.pyc in call(self, _args, *_kwargs)
869 node=self.fn.nodes[self.fn.position_of_error],
870 thunk=thunk,
--> 871 storage_map=getattr(self.fn, 'storage_map', None))
872 else:
873 # old-style linkers raise their own exceptions
/usr/local/lib/python2.7/dist-packages/theano/gof/link.pyc in raise_with_op(node, thunk, exc_info, storage_map)
312 # extra long error message in that case.
313 pass
--> 314 reraise(exc_type, exc_value, exc_trace)
315
316
/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.pyc in call(self, _args, *_kwargs)
857 t0_fn = time.time()
858 try:
--> 859 outputs = self.fn()
860 except Exception:
861 if hasattr(self.fn, 'position_of_error'):
ValueError: total size of new array must be unchanged
Apply node that caused the error: Reshape{3}(Elemwise{Add}[(0, 0)].0, TensorConstant{[ -1 30 512]})
Toposort index: 49
Inputs types: [TensorType(float32, matrix), TensorType(int64, vector)]
Inputs shapes: [(3, 512), (3,)]
Inputs strides: [(2048, 4), (8,)]
Inputs values: ['not shown', array([ -1, 30, 512])]
Outputs clients: [[Join(TensorConstant{2}, Reshape{3}.0, Reshape{3}.0, Reshape{3}.0, Reshape{3}.0)]]
Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/engine/topology.py", line 341, in create_input_layer
self(x)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/engine/topology.py", line 485, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/engine/topology.py", line 543, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/engine/topology.py", line 148, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/layers/recurrent.py", line 219, in call
preprocessed_input = self.preprocess_input(x)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/layers/recurrent.py", line 729, in preprocess_input
input_dim, self.output_dim, timesteps)
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/layers/recurrent.py", line 38, in time_distributed_dense
x = K.reshape(x, (-1, timesteps, output_dim))
File "/usr/local/lib/python2.7/dist-packages/Keras-1.0.2-py2.7.egg/keras/backend/theano_backend.py", line 283, in reshape
return T.reshape(x, shape)
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.`