Semantic segmentation

Semantic segmentation is the image segmentation task that assigns a class to every pixel, producing a map of regions such as road, sky or crack without telling apart separate objects of the same class. In Supervisely, UNet and MMSegmentation train on such masks, drawn with polygons, brush and pen.

Tasks and trainingAlso called image segmentation, pixel-level classification

Compared with the other segmentation tasks

TaskOutputTwo touching cars
Semantic segmentationOne class per pixelOne "car" region
Instance segmentationA mask per objectTwo masks, two IDs
Panoptic segmentationBoth at onceTwo car instances plus road and sky regions

It fits anything measured by area rather than counted: land cover, road surface, cracks, corrosion, tissue types in medical images.

Labeling for it

Labels are pixel masks, drawn directly with a brush or as polygons that are filled in at export. Every pixel needs an answer, so the guidelines must say what happens to pixels that belong to no class (a "background" class, or pixels ignored in the loss) and where the border of a soft region such as a shadow or a blurry edge lies.

How models are scored

Pixel accuracy is easy to read but misleading when one class covers most of the image. Per-class IoU and its mean across classes are the standard; the Dice coefficient is common in medical work.

Pitfalls

  • Thin structures such as wires or cracks cover few pixels, so a model can ignore them and still post a high mean score.
  • Downscaling images for training erases those same thin structures.
  • Masks exported at a different resolution or with antialiased edges introduce class values that do not exist.

In Supervisely

Masks are drawn in the image labeling toolbox with polygons, brush, eraser and pen. UNet and MMSegmentation train on them, and the evaluation report gives pixel accuracy, IoU and boundary IoU and splits errors into boundary, extent and segment errors. Masks export as PNG masks or Cityscapes.

Frequently asked questions.

How does semantic segmentation work?

A network assigns a class to every pixel of the image, usually with an encoder that extracts features and a decoder that turns them back into a full-resolution class map. It does not separate objects of the same class.

Which model is best for semantic segmentation?

It depends on the data and the speed you need. SegFormer and other models in MMSegmentation, MaskDINO and UNet are common choices; train two on the same split and compare their IoU.