Lesson 3 - Multi-Label Image Classification

Hello,

I have attempted to implement a multi-label image classifier from a bunch of folders but it didn’t work out. The model couldn’t understand that certain images belong to multiple classes. That’s what I did:

  1. I created 8 classes of different images and placed them in 8 different folders
  2. Some images were placed in two or more folders as they belonged to a variety of classes
  3. I trained the model but…it didn’t work. When for instance I display batches it doesn’t show me the different classes of certain images.

My question is: how does the model know that an image can belong to lots of classes? More generally, how does multi label classification from folder work?

Thanks

Hi,
You may want to refer to the the look at data tutorial for how to multilabel classifcation.
Creating a csv/DataFrame with multiple columns as the labels and parsing the labels using label_from_df would be easier, I think.The label.csv of the planet data looks like:

Capture

You can look at the label_from_label source code. The docstring says:

Give a label to each filename depending on its folder.

which may mean it currently only supports the single label setting.

What about for data without any labels mentioned ?? How can we label them ?

Try label_from_func and write a function that is applied to every element of the item list and returns the desired label