FASHN Human Parser (Mask)
Get a Clean Garment Mask in One Click
- image
- mask
This is the node you actually want. Pick a body part - top, say - and it returns a clean binary mask of just that garment, ready to feed into an inpaint pass or an IP-Adapter. No hand-painting, no threshold fiddling, no background-remover that guesses "person" when you asked for "the shirt."
The name "human parser" sounds academic, but the workflow is dead simple: mask the garment you want to change, regenerate only that region, keep everything else byte-identical. That's the classic masked-inpainting move, and it's still the reliable way to do virtual try-on - instruction-edit models like Qwen/Kontext will happily "swap the shirt" but they also drift the rest of the image while they're at it. A mask keeps the unmasked pixels untouched. That's exactly the case the KB's inpainting essay makes, and this node is the cleanest way to get the mask half of it.
How it works
Same engine as the other two nodes in the pack: the FASHN SegFormer-B4 human parser runs once on your image, every pixel gets labeled one of 18 fashion classes, and this node then collects every pixel matching your chosen label(s) and turns them into a 1/0 mask. There's a single model load and a single inference pass, so the extraction itself is instant - the model is doing the work, not a pixel-chaser.
The inputs that matter
Only the first few matter for most people:
label- the primary class to extract, from 18 options:background,face,hair,top,dress,skirt,pants,belt,bag,hat,scarf,glasses,arms,hands,legs,feet,torso,jewelry. Defaults totop, which is the right default for most garment-swap work.extra_labels- comma-separated additional classes that get OR-merged into the same mask.dress,skirtgives you both in one mask. This is how you build a "everything from the waist up" mask without running the model twice.blur_radius- Gaussian blur radius for the mask edges, 0–64, default 0 (off). Set it to something like 4–8 for inpainting; the KB's inpainting essay calls out 4–12 px as the typical feathering range, and a hard-edged mask is exactly what causes those visible seams. For IP-Adapter it barely matters.invert- flips the mask. Handy when you want to protect a region instead of replace it.device,dtype,model_id- same as the parent node.autofor device,float16for dtype, leavemodel_idalone.
The single output is mask (MASK) - binary, ready to wire into InpaintModelConditioning or the SetLatentNoiseMask path. That's the whole point: no intermediate threshold node, no color decoding.
Install
ComfyUI Manager: search FASHN Human Parser. Or manual:
cd ComfyUI/custom_nodes
git clone https://github.com/dsrunpod/comfyui-fashn-human-parser
cd comfyui-fashn-human-parser
pip install -r requirements.txt
Restart ComfyUI. The ~244 MB model downloads from HuggingFace on first run, so expect a pause the first time and smooth sailing after. The heavy dependencies are transformers, opencv-python (genuinely required - the code uses cv2.GaussianBlur for the blur), and fashn-human-parser; if you get No module named 'cv2', that's the one to install.
Gotchas
- The blur radius is a full Gaussian, not a feathered edge.
blur_radius=4gives a smooth falloff, but the mask then covers a bit less than the true garment. For tight clothing that's fine; for a loose jacket you'll want a small radius or the default 0 with your own feather later. - Swimsuits and bare chests. If the person isn't wearing that garment class, you get an empty black mask. The model labels what's physically there -
torsoandarmswill cover skin, and that's the honest answer. - First frame only. A batched IMAGE input only processes frame 0. Feed single images unless you loop the node yourself.
The classic hookup is LoadImage → FASHN Human Parser (Mask) [label=top, blur_radius=4] → InpaintModelConditioning → KSampler, with an IP-Adapter off to the side feeding the new garment's reference image. That's the entire virtual-try-on recipe, and this node is the piece that makes it not-suck.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| label | COMBO | top | 18 options: background, face, hair, top, dress, skirt, +12 |
| device | COMBO | 4 options: auto, cuda, cpu, mps | |
| dtype | COMBO | 3 options: float32, float16, bfloat16 | |
| model_id | STRING | fashn-ai/fashn-human-parser | — |
| extra_labelsopt | STRING | — | |
| blur_radiusopt | INT | 00–64 | — |
| invertopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |