keras-team / keras-io

Keras documentation, hosted live at keras.io
Apache License 2.0
2.78k stars 2.04k forks source link

The Example in Object Detection is broken #1476

Closed smoshie25 closed 1 year ago

smoshie25 commented 1 year ago

The example here is broken Loading Image fails:

`filepath = tf.keras.utils.get_file(origin="https://i.imgur.com/gCNcJJI.jpg") image = keras.utils.load_img(filepath) image = np.array(image)

visualization.plot_image_gallery( [image], value_range=(0, 255), rows=1, cols=1, scale=5, )`

with error: AttributeError: 'list' object has no attribute 'shape'

Screenshot 2023-08-10 105919

or this error: plot_images_gallery() requires you to batch your np.array samples together.

Screenshot 2023-08-10 105957
rbardon commented 1 year ago

Just an easy fix:

filepath = tf.keras.utils.get_file(origin="https://i.imgur.com/gCNcJJI.jpg") image = keras.utils.load_img(filepath) image = np.array(image)

visualization.plot_image_gallery( image.reshape((1,3024, 4032, 3)), value_range=(0, 255), rows=1, cols=1, scale=5, )

sachinprasadhs commented 1 year ago

Hi,

Thanks for reporting the issue.

The issue has been fixed by the commit here https://github.com/keras-team/keras-io/pull/1478/commits/8d6039241d399db50cff7e9bdf8dff1ab91ff5a5. Could you please verify and close the issue.