Image data cannot be converted to float

Trying to do Lesson 8, Part 2 (pascal.ipynb notebook) and am unable to display an image. Receive the error:
Image data cannot be converted to float

Occurs specifically on the “ax = show_img(im)” section.

I am able to open the image via the following:
im = open_image(IMG_PATH/im0_d[FILE_NAME]);im

but not with:

Something that matplotlib doesn’t like. Any thoughts?

After more troubleshooting (although no solution), the issue seems to be related to the data types.

the open_image() function returns a object, but the plt.imgshow() needs an array or nparray.
I tried to simply take the Image object and use np.asarray(Image_object) and then call plt.imgsho(), but same error.

Can anyone run the pascal.ipynb notebook and get the images to display?

That was a teaser and certainly compelled us to look more into the code.

You can use below code to plot the image





Thanks so much! That worked! I was stuck for a week, so thank you for helping me move forward. Have a great weekend.