# How AI garment extraction and background removal work

Canonical: http://localhost:3000/guides/how-ai-garment-extraction-works
Updated: 2026-09-24

> Outfello uses AI garment extraction to turn outfit photos into separate cut-out pieces, running most single-garment cut-outs on its own hardware. AI garment extraction has three stages: detection finds and labels each garment, segmentation and matting separate it from the background, and a generation step can redraw pieces that are partly hidden.

Photograph an outfit and ask a wardrobe app to "import" it, and a few seconds later you have a set of tidy garments on plain backgrounds: a jacket, a T-shirt, jeans, trainers. AI garment extraction is the name for that process. It looks like a single trick, but it is several separate problems solved in sequence, and knowing what each stage does explains most of the odd results you will ever see.

This guide walks through the stages in general terms, then says where the hard cases come from and how to take photos that avoid them.

## The three stages of AI garment extraction

Almost every system that pulls clothes out of photos breaks the job into three stages:

1. **Detection:** find each garment in the photo, draw a rough region around it, and label what it is.
2. **Segmentation and matting:** work out exactly which pixels belong to that garment, down to the edges, and remove everything else.
3. **Clean-up or reconstruction:** tidy the result into a usable cut-out, and in harder cases, redraw the parts the camera could not see.

After that comes a lighter step of naming, categorising and colour-tagging each piece so it can be filed. The stages can be separate models or parts of one larger model, but the jobs are the same.

## Detection: finding each garment

A vision model looks at the whole image and proposes regions that contain garments. Each region comes with a label (shirt, jacket, trousers, trainers, bag) and a confidence score. Classic object detectors do this with bounding boxes; newer vision-language models can also be asked in plain terms to find "every item of clothing" and describe what they find.

Two things make clothing harder than, say, detecting cars:

- **Clothes change shape.** A shirt looks different laid flat, on a hanger, tucked in or worn open under a coat. The model has to recognise the category across all of those.
- **Clothes are next to each other.** A top ends where a skirt begins, a jacket sits over a shirt, and a scarf crosses both. Regions overlap, and the model has to decide which pixels belong to which garment.

Detection is also where the category and a first guess at the colour come from. Colour is trickier than it sounds: the same navy jumper photographed under warm indoor light and cool daylight gives different pixel values. Systems usually sample colour from the garment's own pixels after the background is gone, which is why the label can improve once segmentation is done.

## Segmentation and matting: removing the background

Once a garment's region is known, segmentation decides, pixel by pixel, whether each point belongs to the garment. The output is a mask: a black-and-white image where white means "garment". For clothing on a person, a related technique called human parsing labels each pixel of a body as skin, hair, upper clothes, lower clothes, shoes and so on, which helps separate the garment from the arm or leg inside it.

A hard-edged mask is not quite enough. Knitwear has fuzzy edges, sheer fabric lets the background show through, and hair or fringing overlaps the outline. Matting refines the mask into an alpha channel, where each edge pixel can be partly transparent. That is what stops a mohair jumper from looking as if it was cut out with scissors.

Background removal fails in predictable ways:

| Situation | What goes wrong | Why |
| --- | --- | --- |
| Garment and background are similar colours | Edges get eaten or the background leaks in | The model has little contrast to separate |
| Strong shadows | Shadow is kept as part of the garment | A dark shadow can look like dark fabric |
| Busy background, such as a patterned duvet | Patches of background survive | Pattern edges compete with garment edges |
| Very sheer or reflective fabric | Holes or odd transparency | The garment genuinely shows what is behind it |

Most of these come down to the photo rather than the model. [How to photograph clothes so background removal works](http://localhost:3000/guides/photograph-clothes-for-cutouts) covers the lighting, background and framing that avoid them.

## Why several overlapping garments are harder

A single garment on a plain surface is close to the easy case: one region, one mask, clean edges. A full outfit worn by a person is a much harder problem, for three reasons.

**Occlusion.** A jacket hides most of the shirt under it. A bag strap cuts across a top. Crossed arms hide the waist of the trousers. Segmentation can only keep pixels that are there, so a straight cut-out of the shirt comes out with a jacket-shaped hole in it.

**Shared edges.** Where a tucked top meets a waistband, or boots meet trouser hems, the model has to decide which garment owns each pixel. Small mistakes produce a sliver of one piece stuck to another.

**Pose and folds.** A worn garment is bent around a body. Even when every pixel is visible, the result looks like a person-shaped shirt, not a shirt you would recognise on a shelf.

This is why outfit photos and mirror selfies are more demanding than flat lays, even though they are far more convenient to collect.

## Why some photos get redrawn by an image model

To get around occlusion and pose, some systems do not just cut the garment out; they ask an image-generation model to redraw it. The model is given the photo and the detected region and asked to produce the garment on its own, complete and laid out cleanly, filling in the parts that were hidden.

This is the same family of models that generates images from text, conditioned here on the real garment instead of a prompt alone. The advantage is a whole, readable garment even when half of it was under a coat. The cost is that the model is inferring, not copying. The hidden parts are a plausible guess, and small details anywhere on the piece can drift: a logo can lose letters, a print can shift, stitching can change, and the shade can move slightly.

In Outfello, every garment in the frame is detected, not just one, and each is cut out on its own with the background removed, then named, categorised and colour-tagged. Most single-garment cut-outs run on Outfello's own hardware; a photo holding several pieces at once is redrawn by an AI image model. Either way, nothing goes straight into the wardrobe: each piece lands in a review tray first, where it can be renamed, moved to another part, have its colours picked off the cut-out, get detail tags, or be dropped. The [digital closet](http://localhost:3000/use-cases/digital-closet) page covers what happens after that.

## Taking photos that extract cleanly

Knowing the stages makes the advice straightforward:

- **Show the whole garment** if you want the whole garment back. Open jackets hide less than closed ones; arms at the sides hide less than crossed arms.
- **Use contrast.** A light garment on a dark background, or the other way round, makes segmentation easy.
- **Use soft, even light** to avoid hard shadows that read as fabric.
- **Photograph a detail-heavy piece on its own** if the logo or print matters, so it can be cut out rather than redrawn.
- **Check the result.** A quick look in review catches a wrong category, a stray patch of background or a drifted print while the photo is still to hand.

Related image models handle the reverse job: putting a garment onto a photo of a person. [How AI virtual try-on works](http://localhost:3000/guides/how-ai-virtual-try-on-works) explains that side.

## Frequently asked questions

### Why is my cut-out missing part of the garment?

Usually because that part was hidden in the photo, for example a top covered by a jacket or a bag strap across it, or because the garment blended into a background of a similar colour. A photo with the whole piece visible against a contrasting background gives the cleanest result.

### Why does a redrawn garment look slightly different from the original?

An image-generation model reconstructs the piece rather than copying pixels, so small details such as prints, logos, stitching or the exact shade can drift. Checking each piece before it is saved, and retaking the photo if a detail matters, is the practical fix.

### Does AI garment extraction work on screenshots and product pages?

Yes, as long as the garment is clearly visible. Product photos on a plain background are often the easiest input of all, because detection and segmentation have little to separate.

### Can I correct the category or colour the AI picked?

In Outfello, yes. Every detected piece waits in a review tray where it can be renamed, moved to another part, have its colours picked off the cut-out or be dropped, and the same fields stay editable later.
