caffe图片批量测试时,其中一个图片无法读图,报错如下:
Traceback (most recent call last):
File “text.py”, line 44, in
im = caffe.io.load_image(’/home/wxp/cdli/1/吉利/吉利-帝豪-20142015(三厢)/001543286342692.jpg’)
File “/home/wxp/caffe-ssd/python/caffe/io.py”, line 296, in load_image
img = skimage.img_as_float(skimage.io.imread(filename, as_grey=not color)).astype(np.float32)
File “/usr/lib/python2.7/dist-packages/skimage/util/dtype.py”, line 287, in img_as_float
return convert(image, np.float64, force_copy)
File “/usr/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.
原因:未知
解决方法:在文件开头加
from PIL import ImageFile,Image
ImageFile.LOAD_TRUNCATED_IMAGES = True