caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Python Wrapper: AttributeError

Open dkkim930122 opened this issue 12 years ago • 2 comments

Hello. I am working on one of the examples (visualizing features and filters)on the Caffe website. As I followed the instruction, in the code (scores = net.predict([caffe.io.load_image(caffe_root + 'examples/images/cat.jpg')])), I had the problem. I think the problem is about caffe.io.load_image function.

The error shows:

Traceback (most recent call last): File "visualizingFeaturesAndFilters.py", line 24, in scores = net.predict([caffe.io.load_image('/home/dkkim930122/caffe-master/examples/images/cat.jpg')]) File "/home/dkkim930122/caffe-master/distribute/python/caffe/io.py", line 18, in load_image img = skimage.img_as_float(skimage.io.imread(filename)).astype(np.float32) File "/usr/local/lib/python2.7/site-packages/scikit_image-0.10.0-py2.7-linux-x86_64.egg/skimage/io/_io.py", line 97, in imread img = call_plugin('imread', fname, plugin=plugin, **plugin_args) File "/usr/local/lib/python2.7/site-packages/scikit_image-0.10.0-py2.7-linux-x86_64.egg/skimage/io/manage_plugins.py", line 209, in call_plugin return func(_args, *_kwargs) File "/usr/local/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 2198, in imread return _imread(_args, *_kwargs) File "/usr/local/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/image.py", line 1254, in imread 'more images' % list(six.iterkeys(handlers.keys))) File "/usr/local/lib/python2.7/site-packages/six-1.6.1-py2.7.egg/six.py", line 490, in iterkeys return iter(getattr(d, _iterkeys)(**kw)) AttributeError: 'builtin_function_or_method' object has no attribute 'iterkeys'

Could someone help me solve this issue? Thank you in advance!

dkkim930122 avatar Jun 04 '14 00:06 dkkim930122

Follow the Caffe installation instructions instead of whatever you did and either use Anaconda or be careful that you installed all the requirements. You did not include support for image formats in scikit-image.

shelhamer avatar Jul 18 '14 11:07 shelhamer

Same issue here. Install PIL solves the problem for me.

clwen avatar Jul 25 '14 01:07 clwen