Keyerror: Class 'numpy.object_' While Downloading Image Dataset Using Imread
I am trying to download images from URLs using imread. After downloading about 700 images, I see KeyError: class 'numpy.object_' . I am really not familiar with numpy and Conda lib
Solution 1:
Edit
I reproduced your results with:
from skimage import io
url = "https://requestor-proxy.figure-eight.com/figure_eight_datasets/open-images/test/f54ecb040198098c.jpg"
img = io.imread(url)
print(img.shape)
Turns out, this actually returns two images or layers of the same image, where img[0]
is the actual image you want, and img[1]
is some faulty reading in Pillow (the module skimage is using to read images).
Check this issue out.
For now, some quick workaround should be fine.
if img.shape[0] == 2:
img = img[0]
Original
Could you show the URL that triggers this error? It could be your formatting on url[-20:]
that adds some funky extension. Also, I'd recommend just printing img
and img.shape
and img.dtype
to have a better idea of what's going on.
Post a Comment for "Keyerror: Class 'numpy.object_' While Downloading Image Dataset Using Imread"