Segmentation Mask

A segmentation mask is an annotation that labels an object or region at the pixel level, marking exactly which pixels belong to it rather than enclosing it in a box. Masks can be semantic (a class per pixel) or instance (a separate mask per object).

What is a segmentation mask?

A segmentation mask assigns a label to individual pixels, so it captures an object's exact shape instead of just its bounding rectangle. It is usually stored as a binary or indexed raster the same size as the image, as a compact run-length encoding (RLE) like the one COCO uses, or as the polygon outline that rasterizes into it. Each mask carries a class, and depending on the task it may also carry an instance ID.

Key takeaways

  • A mask captures exact shape at the pixel level, which a bounding box cannot.
  • Masks are more expensive to label than boxes, often by roughly an order of magnitude.
  • Semantic masks label every pixel by class, instance masks separate individual objects.

Types and formats

  • Semantic, instance, and panoptic: class-per-pixel, per-object, or the two combined.
  • Storage: binary or indexed raster, RLE (compact, used by COCO), or polygon outlines that rasterize to a mask.
  • Drawn vs painted vs model-assisted: vertices, a brush, or increasingly a click-to-segment model.

How it works, and how FiftyOne fits

Annotators paint or click to produce the mask, more and more with model assistance like SAM-style click-to-segment, then review the edges. In FiftyOne, masks render as overlays on the image, and you can compare predicted masks against ground truth to see exactly where they disagree.

Mask vs box vs polygon

Comparison of segmentation masks, boxes, and polygons
Comparison of segmentation masks, boxes, and polygons
TermWhat it capturesCost
Bounding boxA rectangle around the objectLow
PolygonThe object outline as verticesMedium
Segmentation maskPer-pixel membershipHigh

Why it matters

Masks are what you need when shape matters, medical imaging, manufacturing defects, anything where a rectangle is too coarse. Mask quality lives or dies at the boundary. Most labeling error and most inter-annotator disagreement is on the edge pixels, and IoU on a thin or wispy object, hair, wires, transparent regions, punishes a few stray boundary pixels heavily. That is why boundary-aware review and model-assisted refinement matter so much for masks.

Frequently asked questions

What is the difference between a segmentation mask and a bounding box?

A box is a rectangle marking location, a mask labels the exact pixels of the object.

What is the difference between semantic and instance segmentation?

Semantic labels every pixel by class, instance gives each object its own mask.

How are masks stored?

As a raster, as run-length encoding (RLE), or as polygon outlines that rasterize to a mask.

Related terms

Semantic segmentation, Instance segmentation, Polygon annotation, Bounding box, Intersection over union (IoU), Annotation.

Try it in FiftyOne

Create masks with click-to-segment and compare them against ground truth in the FiftyOne segmentation getting-started path.
Last updated July 1, 2026

Building visual or physical AI?

Let's talk.