caffe icon indicating copy to clipboard operation
caffe copied to clipboard

"Axes do not match array" in out of the box classify.py?

Open ayashee opened this issue 11 years ago • 1 comments

Hi,

Trying to run this code out of the box, however I am getting this error:

ValueError                                Traceback (most recent call last)
<ipython-input-20-20f12d755c0b> in <module>()
      4                        channel_swap=(2,1,0),
      5                        raw_scale=255,
----> 6                        image_dims=(256, 256))

/home/local/caffe/python/caffe/classifier.pyc in __init__(self, model_file, pretrained_file, image_dims, gpu, mean, input_scale, raw_scale, channel_swap)
     33 
     34         if mean is not None:
---> 35             self.set_mean(self.inputs[0], mean)
     36         if input_scale is not None:
     37             self.set_input_scale(self.inputs[0], input_scale)

/home/local/caffe/python/caffe/pycaffe.pyc in _Net_set_mean(self, input_, mean, mode)
    221         if mean.shape[1:] != in_shape[2:]:
    222             # Resize mean (which requires H x W x K input).
--> 223             mean = caffe.io.resize_image(mean.transpose((1,2,0)),
    224                                          in_shape[2:]).transpose((2,0,1))
    225         self.mean[input_] = mean

ValueError: axes don't match array

Not really sure what the issue is... I am literally just trying to run this out of the box.

Thanks

ayashee avatar Mar 03 '15 19:03 ayashee

It seems to complain that the shape of the mean array doesn't match the shape of the input image arrays. Maybe you can debug more on that.

We welcome you to look at the extensive documentation, tutorials, and examples at http://caffe.berkeleyvision.org/ However, please ask usage questions on caffe-users -- this issues tracker is primarily for Caffe development discussion. Thanks!

n-zhang avatar Mar 16 '15 22:03 n-zhang