Roboflow has supported the entire process of creating object detection and single-label classification computer vision projects, from collecting and annotating images to training and deploying a model since our launch of end to end classification support last summer. Now, we're adding support for another project type: Multi-Label Classification.
What is Multi-Label Classification?
In traditional, single-label classification, each image is given a single label. It assumes each image can be categorized into a discrete non-overlapping bucket (eg "safe for work" and "not safe for work"). But the world often isn't so cut and dry. Sometimes you want the flexibility of predicting multiple labels for a single image (eg a single photo might be night
, cloudy
, and winter
) and this is what multi-label classification is all about; it lets your model learn and predict multiple classes for a given image instead of just one.
With single-label classification you can work around this problem by concatenating classes together (eg night-cloudy-winter
), but this requires much more training data, because instead of having to learn to differentiate between eight separate things (day
, night
, cloudy
, sunny
, winter
, spring
, summer
, fall
), it has to independently learn all 16 possible combinations ( day-cloudy-winter
, day-cloudy-spring
, day-cloudy-summer
, day-cloudy-fall
, day-sunny-winter
, etc). The dataset you collect will need to have enough examples of each combination for the model to learn to differentiate them, and information from cloudy days won't help the model learn anything about cloudy nights. This problem gets exponentially worse the more classes you add.
Multi-label classification lets you independently label each image as day/night
, cloudy/sunny
, and winter/spring/summer/fall
, and lets the model learn each distinction independently which greatly decreases the amount of training data you need and maximizes what the model will be able to learn from it.
Multi-Label Classification in Roboflow
To create a multi-label classification project in Roboflow, simply select Multi-Label Classification
as the Project Type
when creating a new project.
This will enable you to toggle multiple classes on or off for each image in Roboflow Annotate instead of being restricted to choosing only a single class as in Single-Label Classification projects.
Once you generate a version of your dataset, you can choose to either export it for training with your own model:
Or using Roboflow Train to automatically train and deploy a multi-label classification model for you with our autoscaling inference API.
Once your model is done training (which usually only takes a few minutes, but may take longer depending on your dataset size and Roboflow plan), you'll be able to try your model by dropping an image into your web browser, or integrate it into your application using our API.
Converting Object Detection Projects to Multi-Label Classification
Object detection is inherently multi-label; the difference is that it additionally adds and predicts localization information for each labeled box (and can can predict/count multiple instances of each class in an image).
If you'd like to discard this information to try framing your problem as a multi-label classification problem, you can export any object detection project in Roboflow as a Multi-Label Classification CSV
and then import it into a new Multi-Label Classification project.
This ability to reframe object detection projects as multi-label classifications in Roboflow means that there are already hundreds of public datasets you can use to experiment with multi-label classification on Roboflow Universe!
How to choose between Multi-Label Classification and Object Detection
A good rule of thumb for when to use object detection vs classification is whether the things you're trying to predict are "objects in an image" vs "properties of an image".
For example, a chess piece
is an "object in an image", but winter
is a "property of an image". If you were trying to draw a box around the winter
or daytime
part of an image, you'd likely end up drawing a box around the whole thing.
If you can't decide, we recommend starting out by labeling your images for object detection, because while you can convert an object detection project to a multi-label classification project easily, to convert in the other direction will require re-labeling your dataset.
What's Next
Roboflow is continually adding support for new computer vision project types. If you'd like to log your vote for segmentation, keypoint detection, or something else, we'd love to hear from you on our discussion forums!
Cite this Post
Use the following entry to cite this post in your research:
Brad Dwyer. (Apr 3, 2022). Launch: End to End Multi-Label Classification. Roboflow Blog: https://blog.roboflow.com/multi-label-classification/
Discuss this Post
If you have any questions about this blog post, start a discussion on the Roboflow Forum.