← All models

image-segmentation Β· vision Β· WASM Β· ~29 MB

Clothes Parsing β€” give every pixel of a person a garment name

This is human parsing: not "cut out the person" and not "find the face" β€” every pixel of a person is classified into one of 18 clothing and body classes (upper-clothes, dress, skirt, pants, hat, scarf, belt, bag, shoes, hair, face, arms, legs). Pick a photo and watch it become a colour-blocked map of garments, entirely on your device.

A different job from the segmentation demos already here: portrait matting cuts the whole person out as one silhouette, face parsing labels facial regions, and background removal is binary foreground/background. Clothes parsing labels which garment each pixel belongs to β€” the raw material for fashion tagging, virtual try-on, and per-garment edits.

At a glance

ModelXenova/segformer_b2_clothes (ONNX build of mattmdjaga/segformer_b2_clothes)
Task / pipelineimage-segmentation (semantic subtask β€” a full 18-class label map)
ArchitectureSegFormer (MiT-B2 hierarchical transformer encoder + all-MLP decode head), finetuned on human/ATR parsing
Classes18: background, hat, hair, sunglasses, upper-clothes, skirt, pants, dress, belt, left/right shoe, face, left/right leg, left/right arm, bag, scarf
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~29 MB (q8), cached after first load
LicenseOther β€” see model card (SegFormer/MiT base carries NVIDIA's research-use terms)
Web APIsWebAssembly, Web Workers, Canvas, FileReader β€” all Baseline widely available

Run it

Pick or drop a photo of a person and hit Parse. Every pixel gets a garment/body label; the map is drawn over your photo. Slide the opacity to fade between the photo and the pure colour map.

Drop a photo of a person here, or click to choose
Studio portrait of a young woman in a striped cardigan and skirt, 1940s A market crowd of people in varied clothing beside a river A narrow street scene with people walking, Γ‰vora

60%

Garment legend

Run parsing to label the clothing.

See inside

The model outputs a score for every one of the 18 classes at every pixel, then takes the argmax β€” the winning class per pixel β€” to make the label map. On the left is that map on its own (the raw model output, no photo). On the right, the class distribution: how much of the frame each garment/body part claimed. That coverage vector is a compact "what is this person wearing?" signature β€” useful for fashion tagging, retrieval, or driving per-garment edits.

Run parsing to see the label map and class distribution.

Why it matters

A per-pixel garment map is the raw material for fashion, retail, and avatar features β€” and having it run locally means you can analyse or edit what someone is wearing without uploading their photo to a server.

Use cases

Basics

Parse a person and read the colour map and legend β€” see human parsing plainly.

Practical

Fashion tagger + garment cut-out: get "what are they wearing" tags and extract one garment on a transparent background.

Wild

Outfit recolour: restyle the upper-clothes, dress, or pants to a new colour, on-device.

Multi-model

Clothes parsing β†’ CLIP: extract the outfit, then ask CLIP what style it is.

How the API works

Clothes parsing is the standard Transformers.js semantic-segmentation pipeline. It returns one entry per class present, each with a full-resolution mask:

import { pipeline } from "@huggingface/transformers";

const parse = await pipeline(
  "image-segmentation",
  "Xenova/segformer_b2_clothes",
); // downloads + caches ~29 MB once

const output = await parse(imageURL);
// β†’ [{ score: null, label: "Upper-clothes", mask: RawImage },
//    { score: null, label: "Pants", mask: RawImage },
//    { score: null, label: "Hair", mask: RawImage }, … ]
//   each mask is 0/255 for that class; together they tile the whole image

This page runs that in a Web Worker, then folds the per-class masks into a single colour-coded overlay (argmax per pixel) and a per-class pixel count β€” so the map, legend, and coverage bars are all views of the one label map the model produced. Nothing is uploaded.

References

Sample images: studio portrait β€” Jones, W. A. (Public domain); market crowd β€” Francisco Anzola (CC BY 3.0); street scene β€” Ken & Nyetta (CC BY 2.0). All via Wikimedia Commons.