Multi-category classification, labels do not appear in data.show_batch()

Hi everyone,

I’ve just started with FastAI’s Deep Learning course and the fastai library.

I’m trying to create a classifier for Bengali.AI Handwritten Grapheme Classification. It’s a multi-category classification task where I have to predict exactly three labels belonging to three different categories for each of the images.

I have a pandas dataframe consisting of image file names and its three labels as follow:

I created data using this data frame(named, new) as follow:

Now when try to I see the contents of data using data.show_batch(), I see blank in most of the image labels and in some cases just one thing is being printed which is not the label but the name of the column itself, as follows:

I can not figure out what I am doing wrong. I tried looking at the documentation but still could not get it.

Could someone please help me out?


That’s because MultiCategory expects the labels to be one-hot encoded. Take a look at the Lesson 3 planet example.

In your case, if you execute x,y = data.one_batch(); y you should see a three column tensor with all of the numerical labels.

1 Like