Nodes/comfyui-fashn-human-parser/FASHN Human Parser (Mask)
ComfyUI Node

FASHN Human Parser (Mask)

Get a Clean Garment Mask in One Click

By dsrunpod·Created 5 months ago·Updated 5 months ago· 0
FASHN Human Parser (Mask)
  • image
  • mask
labeltop
device
dtype
model_idfashn-ai/fashn-human-parser
extra_labels
blur_radius0
invertfalse

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 to top, 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,skirt gives 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. auto for device, float16 for dtype, leave model_id alone.

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=4 gives 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 - torso and arms will 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.

CategoryFASHN/Human Parser

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
labelCOMBOtop18 options: background, face, hair, top, dress, skirt, +12
deviceCOMBO4 options: auto, cuda, cpu, mps
dtypeCOMBO3 options: float32, float16, bfloat16
model_idSTRINGfashn-ai/fashn-human-parser
extra_labelsoptSTRING
blur_radiusoptINT00–64
invertoptBOOLEANfalse

Outputs (1)

NameTypeDescription
maskMASK