Skip to main content
COMPUTER VISION · SEGMENTATION

What Is Instance Segmentation?

Instance segmentation is a computer vision task that finds each object in an image, labels it and outlines it with its own pixel mask, so two touching parts of the same class stay separate. It combines object detection, which boxes each object, with segmentation, which assigns pixels. Common models include Mask R-CNN and the YOLO -seg models.

01

What instance segmentation is

Instance segmentation is a computer vision task that finds every object of interest in an image, gives it a class label and outlines it with its own pixel mask. Two bolts touching in a tray come back as two separate masks rather than one blob, which is what makes the task useful for counting, measuring and picking.

Each detected object normally carries four pieces of information: a class, a confidence score, a bounding box and a mask, which is a map of exactly which pixels belong to that object. The mask is what object detection lacks. A box around a curved hose or a diagonal bracket also takes in background, while a mask follows the edge of the object itself.

It is one of the standard tasks covered in our explainer on computer vision, and it earns its place where the shape or area of each object matters.

02

Instance vs semantic vs panoptic segmentation

The three segmentation tasks differ in whether they tell individual objects apart and whether they label the background. Researchers call countable objects, such as parts, people and vehicles, things, and uncountable regions, such as floor, sky or conveyor belt, stuff.

Task What it labels Separates touching objects Output Example on a line
Object detection Things only, as rectangles Yes, as boxes Class, confidence and box per object Counting cartons passing a camera
Semantic segmentation Every pixel, by class No One class map for the whole image Marking the area of a stain or a clear floor path
Instance segmentation Things only, pixel by pixel Yes Class, box and mask per object Separating overlapping parts in a bin
Panoptic segmentation Every pixel: things by instance, stuff by class Yes, for things Class map plus an ID for each thing Mapping a warehouse floor, its racking and the pallets on it

Panoptic segmentation was proposed by Kirillov and colleagues in a 2018 paper that also introduced the panoptic quality (PQ) metric to score both kinds of region together. For inspection and handling, instance segmentation is usually enough, because the background is fixed and the objects are what need measuring.

03

How instance segmentation models work

Most instance segmentation models are object detectors with a mask added. The detector finds and classifies each object, and a mask head predicts which pixels inside its region belong to it. Three families are in common use.

  • //
    Two-stage models. Mask R-CNN, published by He and colleagues in 2017, adds a mask branch to the Faster R-CNN detector. Its paper reports around 5 frames per second, and it remains a common reference model.
  • //
    Single-stage YOLO models. Ultralytics publishes -seg versions of its YOLO detectors. The current YOLO26-seg family runs from n to x sizes, predicts boxes, classes and masks in one pass, and exports to formats including ONNX and TensorRT.
  • //
    Transformer models. Detection transformers now have segmentation versions too. Roboflow’s RF-DETR, for example, covers detection and instance segmentation in one package, with its core sizes released under the Apache 2.0 license.
04

Training on your own parts

Pretrained models are usually trained on the COCO dataset, which has 80 everyday classes. Industrial parts are rarely among them, so a real project fine-tunes the model on labeled images from the site, with each object traced as a polygon. Tracing outlines takes longer than drawing boxes, and labeling is often the main cost of a segmentation project. The images should cover every part variant, orientation and lighting condition the line will see.

FAQ · 01
How is pose estimation different from instance segmentation?
Pose estimation locates keypoints, such as a person’s shoulders, elbows and knees, and joins them into a skeleton to show posture and movement. Instance segmentation outlines the whole object pixel by pixel. Some systems run both on the same camera feed.
Read the full FAQ —
05

Measuring parts with masks

A mask turns a detected object into geometry. Count its pixels and you have the area. Fit an outline and you have the perimeter, orientation and centre point. With a calibrated camera at a fixed distance, those pixel figures convert to millimeters, so one model can sort, grade and measure in the same pass.

Typical uses include checking that a seal bead is continuous, grading castings by size and giving a robot the outline and centre of a part so it can choose where to grip. Add depth from one of our stereo cameras and the same mask places the part in 3D for bin picking.

A learned mask edge is typically accurate to a few pixels, not to a fraction of one. Where a tolerance is tighter than that, a common approach is to use the mask to find and isolate the part, then run a rule-based edge measurement inside that region.

06

The extra load against detection

A mask costs compute. Ultralytics publishes figures for its YOLO26 detection and segmentation models on the same NVIDIA T4 GPU with TensorRT. YOLO26s takes about 2.5 ms per image for detection and 3.3 ms for segmentation, and YOLO26m about 4.7 ms against 6.7 ms. Across the five sizes, the segmentation models need roughly 60 to 80 percent more operations and around 25 to 45 percent more GPU time.

Mask accuracy is also lower than box accuracy, because tracing an outline is harder than placing a box: YOLO26s-seg scores 47.3 box mAP and 40.0 mask mAP on COCO. Masks then have to be scaled to the image and turned into outlines, which adds post-processing. Four things set the total load.

  • //
    Input resolution. Compute grows roughly with the number of pixels, so moving from 640 to 1,280 pixels square costs around four times as much.
  • //
    Model size. YOLO26x-seg outlines small parts better but takes several times longer per image than YOLO26n-seg.
  • //
    Objects per frame. Mask post-processing scales with the number of instances.
  • //
    Cameras and frame rate. Every camera adds load, unless frames are captured only on a trigger.
07

Running instance segmentation at the edge

Segmentation for handling and inspection usually runs beside the camera, because a robot or reject gate needs the answer within the cycle time. On NVIDIA Jetson, the usual path is to export the trained model to ONNX, build an FP16 engine with TensorRT and try INT8 only after checking mask accuracy on site images.

A small model on one or two cameras suits an Orin Nano. More cameras or larger models point to Jetson Orin NX computers or AGX Orin, and multi-camera lines with high-resolution sensors may need an x86 system with a GPU card from our edge AI computers. Our Jetson comparison and module selector compares memory, AI performance and camera inputs across the Orin and Thor modules.

08

Quick answers on instance segmentation

Instance segmentation: common questions

What is semantic segmentation?

Labeling every pixel by class. Each pixel is marked as, say, part, belt or background, but two touching objects of the same class are not separated.

Can YOLO do segmentation?

Yes. Ultralytics publishes -seg versions of its YOLO models, including YOLO26-seg, which predict a mask for each detected object alongside its box and class.

Is instance segmentation the same as object detection?

No, it goes a step further. Detection places a box around each object. Instance segmentation adds a pixel mask showing its exact shape.

What is panoptic segmentation?

Semantic and instance segmentation combined. Every pixel gets a class, and each countable object also gets its own ID.

How is an instance segmentation model trained?

On images with traced outlines. Each object is labeled with a polygon and a class, often in COCO format, and a pretrained model is fine-tuned on those images.

We integrate the Jetson or GPU computer with its frame grabbers and camera interfaces as standard, so each vision system arrives as one build rather than a set of parts.