Closed
Description
I was getting the following error running the classification.ipynb notebook on a fresh installation on OSX:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-7167c0e21af1> in <module>()
----> 1 prediction = net.predict([input_image]) # predict takes any number of images, and formats them for the Caffe net automatically
2 print 'prediction shape:', prediction[0].shape
3 plt.plot(prediction[0])
4 print 'predicted class:', prediction[0].argmax()
/Users/george/Documents/caffe/python/caffe/classifier.py in predict(self, inputs, oversample)
84 caffe_in[ix] = self.transformer.preprocess(self.inputs[0], in_)
85 out = self.forward_all(**{self.inputs[0]: caffe_in})
---> 86 predictions = out[self.outputs[0]].squeeze(axis=(2,3))
87
88 # For oversampling, average predictions across crops.
ValueError: 'axis' entry 2 is out of bounds [-2, 2)
which I was able to fix by deleting the arguments for squeeze so that 86 looks like this:
predictions = out[self.outputs[0]].squeeze()
Metadata
Metadata
Assignees
Labels
No labels