Caffe: classify.py skimage error: ValueError: can not convert object to float64

Created on 22 May 2014  路  5Comments  路  Source: BVLC/caffe

Hi, I receive this error when running the python wrapper classify.py on ubuntu 12.04 server

Traceback (most recent call last):
  File "classify.py", line 161, in <module>
    main(sys.argv)
  File "classify.py", line 113, in main
    inputs = [caffe.io.load_image(str(args.input_file))]
  File "/home/ubuntu/caffe/caffe-dev/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/dist-packages/skimage/util/dtype.py", line 287, in img_as_float
    return convert(image, np.float64, force_copy)
  File "/usr/local/lib/python2.7/dist-packages/skimage/util/dtype.py", line 99, in convert
    raise ValueError("can not convert %s to %s." % (dtypeobj_in, dtypeobj))
ValueError: can not convert object to float64.

The weird thing is when i tried running it on ubuntu 12.04 desktop using the same installation procedure, it works....

downstream problem?

Most helpful comment

importing io and using 'matplotlib' fixed the issue

from skimage import io; io.use_plugin('matplotlib')

All 5 comments

I'm getting the same error. Did you by any chance fix it?

importing io and using 'matplotlib' fixed the issue

from skimage import io; io.use_plugin('matplotlib')

For me, switching from PIL to pillow fixed a similar error.

If you use PIL package uninstall it and use pillow.

I encountered this error on images in the COCO dataset. Switching from PIL to Pillow alone wasn't enough; I also had to add

from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True

as in this StackOverflow answer.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FreakTheMighty picture FreakTheMighty  路  3Comments

shiorioxy picture shiorioxy  路  3Comments

prathmeshrmadhu picture prathmeshrmadhu  路  3Comments

weather319 picture weather319  路  3Comments

LarsHH picture LarsHH  路  3Comments