Sub topic 3
Things versus stuff
This chapter assumes you know what a segmentation label map is (an integer class per pixel) and can run Python with NumPy and SciPy. The previous chapter showed how masks are stored. Here you learn the distinction that decides which kind of segmentation a class can take part in. Every later chapter on instance and panoptic segmentation builds on it.
The core distinction
Segmentation datasets divide their classes into two groups.
- Things are countable objects with a clear shape and extent. Examples are person, car, dog, and traffic sign. You can say "three cars" and point to each one.
- Stuff is amorphous regions that you describe by material or texture, not by count. Examples are sky, road, grass, water, and wall. Saying "three skies" is meaningless.
The split is a property of the class, not of the pixel. The dataset designers fix it in advance, and it does not depend on what appears in any particular image. A picture with only one car still labels car as a thing.
| Property | Things | Stuff |
|---|---|---|
| Countable | Yes | No |
| Typical shape | Compact, with a boundary | Large, irregular, often fills the background |
| Needs separate instances | Yes, one ID per object | No, one segment per class is enough |
| Examples | person, car, bicycle | sky, road, vegetation |
| Predicted by Mask R-CNN | Yes | No |
| Predicted by plain semantic models | Yes, as a class | Yes, as a class |
Why the split matters
A semantic segmentation model ignores the distinction. It gives every pixel one class, so all pixels of "person" share a label, and two people who touch merge into one blob. That is fine for stuff, because one region per class is the right answer.
For things, you often need more. You want to count the people, track each car, or crop one dog. This is the job of instance segmentation, which gives each object its own mask and ID. But instance models such as Mask R-CNN start from a detector, and detectors need countable objects with boxes. A box around "sky" or "road" is not useful, and the box would overlap with almost everything. So instance segmentation covers only things.
The two tasks therefore cover different parts of the image.
- Semantic segmentation covers things and stuff, but cannot separate instances.
- Instance segmentation separates instances, but covers only things.
- Panoptic segmentation, covered in a later chapter, uses both. Things get an instance ID, and stuff gets one segment per class.
The following diagram shows how a class is routed.
Real class splits
Datasets publish the split as part of their label definition. The counts below are from the standard panoptic versions of these datasets.
- COCO panoptic has 133 classes: 80 things and 53 stuff.
- Cityscapes has 19 evaluated classes: 8 things (such as person, rider, car, bus) and 11 stuff (such as road, sidewalk, building, vegetation, sky).
- ADE20K has 150 classes: 100 things and 50 stuff.
The assignment is a design decision, and some classes sit on the border. In Cityscapes, a building is stuff, even though you could count buildings. In COCO, the original object categories became things and the added background categories became stuff. Always read the dataset's class list instead of guessing from the name.
Seeing the difference in a label map
A semantic label map contains no information about the split. You supply it as a set of thing class IDs. The code below builds a small map and counts connected regions per class.
import numpy as np
from scipy import ndimage
CLASS_NAMES = {0: "road", 1: "pole", 2: "car", 3: "sky"}
THING_IDS = {1, 2} # pole and car are things; road and sky are stuff
semantic = np.array([
[3, 3, 3, 1, 3, 3, 3],
[3, 3, 3, 1, 3, 3, 3],
[0, 2, 0, 1, 0, 2, 0],
[0, 0, 0, 1, 0, 0, 0],
])
for class_id, name in CLASS_NAMES.items():
mask = semantic == class_id
_, n_regions = ndimage.label(mask) # 4-connected regions
kind = "thing" if class_id in THING_IDS else "stuff"
print(f"{name:5s} ({kind}): {int(mask.sum()):2d} pixels, {n_regions} connected region(s)")The output is:
road (stuff): 10 pixels, 2 connected region(s)
pole (thing): 4 pixels, 1 connected region(s)
car (thing): 2 pixels, 2 connected region(s)
sky (stuff): 6 pixels, 2 connected region(s)The two cars are separate regions, so connected components recover two instances here. The pole splits the sky and the road into two regions each, but each should remain one stuff segment in a panoptic result. Treating each connected region as a separate instance would be wrong for stuff.
Consequences for training and evaluation
The split changes how you build and score a system.
- Model choice. A semantic model alone cannot give you counts. To get instance IDs for things, add an instance branch or use a unified model such as Mask2Former.
- Labels. In instance and panoptic annotations, thing segments carry an object ID, and stuff segments carry only a class. The annotation format must store both.
- Crowds. Dense groups, such as a crowd of people, are hard to separate. COCO marks them as a single region with an
iscrowdflag. The class is still a thing, but the region is not split into instances, and evaluators treat it specially. - Metrics. Instance metrics such as mask AP are computed over things only. Panoptic quality, covered later, scores things and stuff together, and it can also be reported separately as PQ for things and PQ for stuff. Reporting them separately often shows that a model is strong on one group and weak on the other.
- Void pixels. Pixels that annotators could not label are marked void and are excluded from scoring. Void is neither a thing nor stuff.
Common mistakes
- Deciding from the class name. Using intuition about what is "countable" instead of the dataset's list gives wrong assignments.
- Passing the wrong thing set. If you give a merging or evaluation routine the wrong thing IDs, stuff classes receive instance IDs or things lose them. Results degrade quietly instead of failing.
- Expecting instances from semantic output. A semantic mask for "person" is one class region, not a list of people.
- Comparing numbers across datasets. A class that is stuff in one dataset can be a thing in another, so scores for the same name may measure different tasks.
Exercise
A semantic model labels every pixel of a street scene. In the output, two parked cars touch, and a long wall runs behind them. Which of these classes (car, wall) can be split into separate instances, and why does the semantic map fail to do it?
Show answer
Car is a thing, so each parked car should be a separate instance. Wall is stuff, so it stays one segment per class. The semantic map gives all car pixels the same class label, so the two touching cars form one merged region. To separate them you need an instance model or a panoptic model that predicts one mask per object.
Exercise
In the code above, you add a class 4 named "tree" and decide it is stuff. A colleague says tree is countable and should be a thing. What should you check first, and what changes in the code if you follow the colleague?
Show answer
Check the dataset's published class list, because the split is fixed by the dataset and the metric definitions depend on it. If tree is a thing in that dataset, add 4 to THINGIDS, so tree regions receive instance IDs and count toward instance metrics. If the dataset lists it as stuff, leave THINGIDS unchanged, even though the objects are countable in everyday speech.