Fast.ai show_image() working?

I’m getting a different result than the expected one when I run show_image().

My result:
image

Expected result:
image

Why are these 2 images different and how does this function actually work?

This forum post provides a solution to this. In short, you want to run this line at the top of the notebook which should change the colormap to gray:

matplotlib.rc('image', cmap='Greys')

In terms of how show_image actually works, here is the source code. From my understanding, after some pre-processing of the image data, the main line which plots the image is ax.imshow(im, **kwargs) which comes from matplotlib.

Ah, now it works. Thanks!

1 Like