Skip to content
tezvyn:
Menu

Semantic versus instance segmentation

Source: interviewEasyHow cards are made

Summary

distinguishing two pixel-labeling tasks.

Key points

semantic segmentation labels each pixel by class but merges objects of the same class; instance segmentation also separates individual objects.

What's really being asked

Whether you can crisply distinguish two related dense-prediction tasks, which determines which model family you would reach for.

The full answer

Semantic segmentation assigns a class label to every pixel in the image, partitioning it into regions like road, sky, person, and car. Critically, it does not distinguish between separate objects of the same class; all person pixels get the same person label regardless of how many people there are. Instance segmentation goes further: it labels pixels by class and also separates each distinct object instance, producing an individual mask for each one. So three people would be one merged region under semantic segmentation but three separate masks under instance segmentation. The fundamental difference is instance awareness, whether objects of the same category are kept distinct. Panoptic segmentation unifies both, giving stuff classes semantic labels and thing classes instance masks.

The mistakes people make

Saying semantic segmentation outputs boxes; it outputs pixel labels. Thinking semantic segmentation can count objects of a class; it cannot separate them. Confusing instance segmentation with object detection, which gives boxes not pixel-precise masks. Forgetting panoptic segmentation as the combined view.

What usually comes next

What model architectures suit each, for example FCN or U-Net versus Mask R-CNN. What is panoptic segmentation. How is instance segmentation evaluated. Why is instance segmentation harder.

A concrete example

Picture a photo of three overlapping cows in a field. Semantic segmentation colors every cow pixel with the single label cow and the rest as grass and sky, so you cannot tell there are three animals. Instance segmentation produces three distinct cow masks, cow one, cow two, cow three, each a separate region, so you can count and isolate each animal. That instance-level separation is the defining difference between the two tasks.

Interview question

What can instance segmentation do that semantic segmentation cannot?

  • a.Assign a class label to every pixel in the image
  • b.Produce bounding boxes around each detected object
  • c.Separate individual objects of the same class into distinct masksCorrect
  • d.Classify the whole image with a single label
Why?

Instance segmentation distinguishes separate objects of the same class, which semantic segmentation merges into one labeled region. Per-pixel class labeling is what both share, and boxes or whole-image labels describe detection and classification.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on computer-vision — each one lists the topics its interview covers.

See open roles