Image classification

Image classification is the task of assigning a whole image one label from a fixed set of classes (multi-class) or any number of them (multi-label), without saying where in the image the object is. In Supervisely, image labels are tags, and MMPretrain trains classifiers on them.

Tasks and training

Two setups

  • Multi-class: exactly one answer per image, such as "ok" or "defect". The scores of the classes sum to one.
  • Multi-label: each class is a separate yes or no, such as "rain", "night" and "pedestrian present" at once.

Treating a multi-label problem as multi-class forces the model to pick one tag when several are true, and its scores stop meaning anything per class.

When classification is the right task

Labeling is fast: one decision per image instead of a shape per object. That makes classification a good fit for sorting, filtering and quality gates. It struggles when the evidence is a small part of a large image, or when you need to know how many objects there are or where; object detection answers those questions at a higher labeling cost.

Measuring a classifier

Accuracy is the share of images labeled correctly; top-k accuracy accepts the true class among the k highest scores. With uneven classes, per-class precision and recall and a confusion matrix say far more than accuracy does.

Failure modes

  • Shortcut learning: the model keys on the background, a watermark or the camera rather than on the object.
  • Images that honestly fit two classes, labeled one way by one person and the other way by another.
  • Test images from the same session as the training images, which hides how badly the model transfers.

Classification labels in Supervisely

An image-level label is a tag on the image, which also lets a project mark scenes, conditions or splits; mastering image tagging covers the tag types. MMPretrain trains classifiers on those tags, with splits by tag or dataset and ImageNet-pretrained backbones, and Apply Classifier to Images Project tags a whole project, or only chosen objects, with the result.

Frequently asked questions.

What is an image classifier?

A model that assigns one or more labels to a whole image, such as cat or defective, without saying where the object is. Convolutional networks and vision transformers are the usual architectures.

What is the difference between image classification and object detection?

Classification gives a label for the whole image; object detection finds each object and gives it a class and a bounding box.