image_analysis.resize() gives ValueError

User 2448 | 3/3/2016, 4:25:22 PM

When I run this code copy-pasted right from the Python docs at https://dato.com/products/create/docs/generated/graphlab.image_analysis.resize.html:

url ='s3://gl-testdata/images/nested'
image_sarray = graphlab.image_analysis.load_images(url, "auto", with_path=False,
                                                   recursive=True)
resized_images = graphlab.image_analysis.resize(image_sarray, 100, 100, 1)

I get the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-37-cfb1c37775c0> in <module>()
      2 image_sarray = gl.image_analysis.load_images(url, "auto", with_path=False,
      3                                                    recursive=True)
----> 4 resized_images = gl.image_analysis.resize(image_sarray, 100, 100, 1)

/home/david/anaconda3/envs/dato-env/lib/python2.7/site-packages/graphlab/toolkits/image_analysis/image_analysis.pyc in resize(image, width, height, channels)
    146         return image.apply(lambda x: _extensions.resize_image(x, width, height, channels, encode))
    147     else:
--> 148         raise ValueError("Cannot call 'resize' on objects that are not either an Image or SArray of Images")

ValueError: Cannot call 'resize' on objects that are not either an Image or SArray of Images

Comments

User 1359 | 3/4/2016, 7:41:47 PM

Thanks for reporting this!

There does seem to be an issue. It seems to be a mismatch between the return value type of load_images and resize

Please try the following:

    url ='s3://gl-testdata/images/nested'
    image_sarray = graphlab.image_analysis.load_images(url, "auto", with_path=False,
                                                       recursive=True)
    resized_images = graphlab.image_analysis.resize(image_sarray['image'], 100, 100, 1)