Issue with pd.Dataframe MNIST


image

imcube_t = tensor(imcube_bw)
df = pd.DataFrame(imcube_t[1:32,1:32])
df.style.set_properties(**{'font-size':'6pt'}).background_gradient('Greys')

It seems the PILImageBW.create, will also revert the colors. Is that correct?
image

Placing 255-tensor(imcube_bw) is a nice workaround, but still not sure, what I was doing wrong.

 imcube_t = 255-tensor(imcube_bw)
    df = pd.DataFrame(imcube_t[1:32,1:32])
    df.style.set_properties(**{'font-size':'6pt'}).background_gradient('Greys')

Yep, that’s the default behaviour, you can do:

PILImageBW._show_args['cmap'] = 'gray'

to change that

Or you can create your custom type like described here

1 Like

Thank you so much Lucas, is there a specific computational reason why Jeremy used ImageBW and not the cmap to gray?

I have also noticed we have IntToFloatTensor in Chapt 11. Great to use with DataLoaders and pipelines