Inferensys

Glossary

Instance Segmentation

A computer vision task that detects and delineates each distinct object instance in an image, providing both a class label and a pixel-wise mask for every individual defect.
Product manager reviewing autonomous task execution dashboard on laptop, completed tasks visible, casual work session.
COMPUTER VISION

What is Instance Segmentation?

Instance segmentation is a computer vision task that detects and delineates each distinct object instance in an image, providing both a class label and a pixel-wise mask for every individual defect, part, or entity.

Instance segmentation combines object detection and semantic segmentation to identify individual objects and their exact boundaries at the pixel level. Unlike semantic segmentation, which labels all pixels of the same class uniformly, instance segmentation distinguishes between separate instances—labeling two adjacent scratches as distinct scratch_1 and scratch_2 with unique masks. This granularity is critical for quality inspection where counting, measuring, and isolating each defect independently drives scrap decisions.

Modern architectures like Mask R-CNN extend Faster R-CNN by adding a parallel branch that predicts a binary segmentation mask for each Region of Interest (RoI). The model simultaneously outputs a bounding box, class label, and pixel-wise mask per instance. Training relies on multi-task loss functions combining classification, bounding-box regression, and mask prediction errors. In manufacturing, instance segmentation enables precise defect quantification—measuring the area, perimeter, and centroid of each anomaly—while maintaining instance-level traceability for root cause analysis.

PIXEL-LEVEL DISCRIMINATION

Key Characteristics of Instance Segmentation

Instance segmentation combines the localization power of object detection with the granular precision of semantic segmentation, uniquely identifying and masking every individual object instance in an image.

01

Instance-Level Differentiation

Unlike semantic segmentation, which labels all pixels of the same class identically, instance segmentation assigns a unique identity to each distinct object. Two overlapping or adjacent defects of the same class—such as scratches—receive separate masks with distinct instance IDs. This is critical for counting individual defects, measuring per-defect morphology, and triggering precise robotic rejection of single faulty units without discarding conforming products in the same field of view.

02

Pixel-Wise Mask Prediction

The core output is a binary mask for each detected instance, classifying every pixel as belonging to the object or the background at the original image resolution. Architectures like Mask R-CNN add a parallel segmentation head to a Faster R-CNN detector, generating masks via a Fully Convolutional Network. This enables precise area, perimeter, and circularity measurements for metrology applications, quantifying defect severity beyond simple bounding box dimensions.

03

Two-Stage Detection and Segmentation Pipeline

Dominant architectures operate in two sequential stages:

  • Stage 1: Region Proposal — A Region Proposal Network scans the image and proposes candidate bounding boxes likely to contain objects.
  • Stage 2: Classification and Mask Generation — Each proposal is classified, its bounding box refined, and a pixel-level mask predicted in parallel. This decoupled approach achieves high accuracy but introduces latency, making it suitable for offline or near-real-time quality inspection rather than ultra-high-speed lines.
04

Single-Stage Alternatives for Speed

For real-time production line deployment, architectures like YOLACT and SOLOv2 perform instance segmentation in a single forward pass. YOLACT generates prototype masks and predicts per-instance linear combination coefficients, assembling final masks without a dedicated repooling step. These models trade marginal mask precision for inference speeds exceeding 30 frames per second, enabling inline defect segmentation on fast-moving conveyors.

05

Mask Quality Metrics

Segmentation accuracy is evaluated using Intersection over Union computed directly on masks, often termed mask IoU. The standard COCO evaluation protocol measures Average Precision at multiple mask IoU thresholds from 0.50 to 0.95, providing a comprehensive view of segmentation fidelity. For manufacturing, a high IoU threshold ensures that defect boundaries are precisely delineated, preventing false scrap of borderline conforming material.

06

Occlusion and Overlap Handling

Instance segmentation inherently resolves partial occlusion by predicting separate masks for overlapping objects. The model learns to infer the full extent of a partially hidden defect based on visible contours and contextual cues. This capability is essential for inspecting densely packed components—such as semiconductor wafers or assembled circuit boards—where defects frequently overlap or touch, confounding simple bounding box detectors.

COMPUTER VISION TASK COMPARISON

Instance Segmentation vs. Related Tasks

A comparison of instance segmentation against semantic segmentation, object detection, and panoptic segmentation across key capabilities relevant to manufacturing quality inspection.

CapabilityInstance SegmentationSemantic SegmentationObject DetectionPanoptic Segmentation

Distinguishes individual objects of the same class

Provides pixel-level mask for each object

Outputs class label per object

Handles overlapping objects of the same class

Segments background/stuff regions

Typical output granularity

Per-instance mask + class

Per-pixel class

Bounding box + class

Per-instance mask + per-pixel class for stuff

Common architecture

Mask R-CNN, YOLACT

U-Net, DeepLab

YOLO, Faster R-CNN

Panoptic FPN, MaskFormer

Manufacturing use case

Counting and measuring individual scratches on a surface

Segmenting all rust regions as one area

Locating screws for presence verification

Full scene understanding of a PCB with components and board area

INSTANCE SEGMENTATION

Frequently Asked Questions

Clear, technically precise answers to the most common questions about instance segmentation for manufacturing quality inspection, from foundational concepts to deployment considerations.

Instance segmentation is a computer vision task that detects and delineates each distinct object instance in an image, providing both a class label and a pixel-wise mask for every individual entity. Unlike semantic segmentation, which assigns a class label to every pixel but merges all objects of the same class into a single undifferentiated region, instance segmentation distinguishes between separate occurrences. For example, in a manufacturing context, semantic segmentation would label all pixels belonging to 'scratches' as one region, while instance segmentation would identify and mask each scratch individually—enabling precise counting, measurement, and localization of every discrete defect. Architectures like Mask R-CNN achieve this by adding a mask prediction branch parallel to the existing bounding box head in Faster R-CNN, generating a binary mask for each region of interest. This pixel-level separation is critical for quality assurance workflows that require per-defect statistics, root cause analysis, and automated pass/fail decisions based on individual defect severity rather than aggregate presence.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.