What a segmentation mask actually is
The output is an image the same size as your input, where the value at each pixel says which region that pixel belongs to. Three flavors show up in practice:
- Binary mask. One region versus everything else. This is what background removal and masked editing consume.
- Alpha matte. Fractional values between 0 and 1, so a strand of hair can be 40 percent subject. Anything with soft or translucent edges needs this.
- Class or instance map. Every pixel tagged with a label, so you can address the sky, the road, or the second person separately.
The difference between a binary mask and an alpha matte is the single biggest quality factor in a cutout, and it is why hair, fur, smoke, glass, and motion blur are the standard hard cases.
Where segmentation sits in a generation pipeline
Most editing features that look like one operation are two: segment, then generate.
- Background removal is segmentation plus a transparency channel. Nothing is generated at all.
- Object removal is segmentation to find the object, mask dilation to give the model room, then inpainting to rebuild what was behind it.
- Targeted edits (recolor a jacket, relight a face, replace a sky) use the mask to protect everything else from the model.
- Compositing and depth-ordered insertion need region identity before anything can be layered.
Because the generate step is only as good as the mask it receives, most bad edits are actually bad masks. Check the mask at full resolution before you blame the model.
Mask handling that changes the result
Two adjustments matter more than the segmentation model you pick.
Dilate before inpainting. A mask that stops exactly at the object boundary leaves a rim of the object's own color and shadow inside the protected area, and the model paints around it, so you get a ghost outline. Grow the mask by a handful of pixels first so the boundary gets rebuilt too.
Feather for compositing, not for filling. Soft edges help when you are layering a cutout onto a new background. When you are handing the mask to an inpainting model, a soft edge just means partially-conditioned pixels and mushy transitions.
Prompt-driven segmentation, and its limits
Current models let you point at a region with a click or a phrase instead of a brush, which is fast and works well on isolated, clearly-named objects. It degrades in predictable places: overlapping instances of the same class, reflections and shadows (is the reflection part of the car?), transparent objects, thin structures like wires and railings, and anything where your phrase is ambiguous about scope. When a text prompt keeps grabbing the wrong extent, a click or box hint is usually faster than rewording.