Image Segmentation

If you subscribe to a service from a link on this page, we may earn a commission.

Quick answer: Image segmentation is a computer vision task that labels every pixel in an image according to what it belongs to, producing a precise outline of each region instead of a single tag for the whole picture or a box drawn around an object. It divides a scene into meaningful pieces, a road, a tumor, a person, an item of clothing, at the pixel level, which is a finer level of detail than either classification or detection. That precision is why it shows up in surgery planning, self-driving perception, and photo tools that need to isolate one exact object.

So what does that look like in practice? It is the layer that traces a tumor’s exact edge on an MRI scan for a surgeon, the layer that lets a phone blur everything behind a person in a portrait photo without a stray straight edge showing, and the layer a self-driving car uses to know precisely where the road surface ends and the sidewalk begins. This entry covers how image segmentation works, how it differs from object detection and image classification, where it turns up, and where it still struggles.

What Is Image Segmentation?

Segmentation partitions an image into groups of pixels, called segments, where every pixel gets assigned to a region rather than the image getting one label or a handful of boxes. There are three common flavors, and they answer slightly different questions.

Semantic segmentation labels every pixel with a class and stops there: every pixel belonging to any car gets the label “car,” with no distinction between one car and another. Instance segmentation goes further and separates individual objects of the same class, giving each car its own mask, which matters when objects overlap or sit close together. Panoptic segmentation combines both, giving every pixel a class label and, for objects that can be counted, an instance ID on top of it, which is why it is the version usually chosen when a system needs the full picture, background regions and individual objects alike.

Which flavor a team picks depends on the question they need answered. A system counting cars in a parking lot needs instance segmentation, since it has to know where one car ends and the next begins. A system just measuring how much of a scene is road, sky, or building only needs semantic segmentation, since counting individual sky patches would be meaningless.

How Does Image Segmentation Work?

The simplest segmentation methods do not involve a neural network at all. Thresholding converts a grayscale image to a binary mask using a cutoff pixel value, and clustering methods like k-means group pixels by color or intensity into a fixed number of regions. Both still work fine for simple cases, such as separating an object from a plain, even background.

Convolutional neural networks reached state-of-the-art segmentation results around 2015, and one architecture from that year still anchors much of the field. U-Net, published by Olaf Ronneberger, Philipp Fischer, and Thomas Brox for biomedical image analysis, uses an encoder that shrinks the image while extracting features, paired with a decoder that expands it back to full resolution, connected by skip links that preserve fine detail the encoder would otherwise lose. It was designed to work well with a relatively small amount of labeled training data, which mattered in medicine, where pixel-level labels are expensive to produce.

Mask R-CNN pairs the same region-proposal step used in two-stage object detection with an added branch that predicts a pixel mask for each proposed region, which is how it produces instance segmentation rather than just boxes.

Meta released the Segment Anything Model, or SAM, in April 2023. It is promptable: a person points at an object with a click, a box, or a short text description, and the model generates a mask for it even if it never saw that exact category during training. Meta trained it on the SA-1B dataset, more than 1.1 billion masks collected across about 11 million images.

SAM 2, released in July 2024, extended the same idea to video, adding a memory mechanism that tracks a segmented object across frames instead of handling one still image at a time.

Image Segmentation vs. Object Detection and Classification: What’s the Difference?

A classification label and a detection box both describe an object without describing its shape. A box drawn around a cyclist also contains road, sky, and whatever sits behind the wheels, and for counting cyclists or pointing a camera at one, that is perfectly good enough.

Segmentation is what you reach for when the extra area inside the box is the problem. Two overlapping objects share one rectangle and a box cannot say which pixels belong to which, and a downstream step that has to measure a tumor or steer along a road edge needs the real boundary rather than a rough one.

The cost is per-pixel work. A segmentation model produces a prediction for every pixel in the frame instead of one label or a short list of boxes, which is why it is the slowest of the three to run.

Where Is Image Segmentation Used?

Medical imaging leans on segmentation to outline tumors and organs on CT and MRI scans, measure tissue volume over time, and plan surgery around a structure’s real boundary rather than an approximate region. Self-driving systems segment the drivable road surface, lane markings, and sidewalks, since knowing the exact edge of the road matters more for a safety margin than a rough box around “road” would.

Photo and video tools use segmentation to remove or blur a background cleanly, power a virtual background in a video call, or let someone tap a single object in a photo and edit just that object, all of which increasingly run directly on a phone’s chip instead of a remote server, part of the broader shift toward on-device AI. Satellite imagery analysis segments land into roads, forests, and cropland to track deforestation or estimate crop yield over a season.

What Are the Limits of Image Segmentation?

The expense that bites hardest is not inference but annotation. Producing pixel-accurate masks by hand for thousands of images is slow, skilled work, which is a large part of why a general-purpose model like SAM, trained once on a huge labeled dataset and then pointed at new categories without retraining, mattered so much when it shipped.

Fine detail remains the hardest case. Hair, fur, smoke, and transparent or reflective surfaces rarely have a clean edge for a model to follow, and a mask that is off by a few pixels along a boundary looks wrong in a way a slightly loose bounding box never does.

Even the boundary itself can be a matter of opinion. Two annotators labeling the same tumor or the same shadowed curb will not trace exactly the same line, so a segmentation model’s reported accuracy is partly a measure of how consistently its training masks were drawn.