FASHN Human Parser
The Human Parser That Labels Every Pixel of Your Subject
- image
- segmentation_image
- label_id_mask
You hand it a photo of a person and it tells you, pixel by pixel, what every part of them is: face, hair, top, dress, pants, hat, scarf, glasses, arms, hands, legs, feet, jewelry - all 18 classes plus background. That's the whole trick of FASHN Human Parser, and it's the exact thing virtual-try-on pipelines need before they can touch a single garment.
The model behind it is FASHN AI's human parser, a SegFormer-B4 fine-tuned specifically for fashion and body-part segmentation. It's not a brand-new idea - u2net has a cloth-seg variant, BiRefNet will happily give you a person silhouette - but those give you "person / not person." This gives you the wardrobe inventory, which is a different, more useful question.
Why reach for it: any workflow where you want to replace one garment without touching the rest, or composite parts of an outfit. The full node's real job is recon - it shows you the whole segmentation in one pass so you can see exactly how the model is carving up your subject before you commit to a mask. The sibling FashnHumanParserMask node does the actual mask extraction; this one is the "show me everything" view.
How it works
Under the hood it's a standard semantic-segmentation run. The image gets resized to 384×576 (that's a fixed input, so resolution is a lot less important than you'd think - detail survives because the logits are upsampled back to your original size), normalized with ImageNet mean/std, and pushed through the SegFormer-B4 encoder + MLP decoder. The output logits get bilinearly upsampled to your input's dimensions, and argmax picks the winning class per pixel. All 18 masks derive from that single forward pass, which is why the three nodes in this pack share the same "run once, slice the result" design.
The model weights (~244 MB) are pulled from HuggingFace on first use, then cached in memory. Nothing is downloaded at install time, so your first run takes a few extra seconds and needs a working connection to HuggingFace.
The inputs and outputs that matter
Four inputs, and you'll only touch two of them:
image- any IMAGE tensor. Heads up: the node processes the first frame only if you feed a batch.device-auto/cuda/cpu/mps.autopicks CUDA if it's there, else CPU, and it does not pick MPS on a Mac - setmpsyourself if you want it.dtype-float32/float16/bfloat16. float16 is the sensible default on CUDA; the model is small enough that this barely matters, but half precision halves the memory and nobody can tell the difference on the output.model_id- the HF repo, defaulting tofashn-ai/fashn-human-parser. You can point it at another SegFormer semantic-seg checkpoint and mostly get away with it, but the class labels in the code assume FASHN's 18.
Two outputs:
segmentation_image- the color-coded visualization, one distinct color per class. This is the eyeball-the-result output; the legend maps ID→color in the source if you ever need to decode it.label_id_mask- a MASK where the pixel value encodes the class ID, normalized by dividing by 17. This is not a binary mask. If you wire it straight into inpaint conditioning you'll get garbage, because it's a 0-to-1 gradient of class labels, not white-on-black. Use it with a threshold or aMaskToImage+ compare step if you want a real mask.
Install
Easiest path is ComfyUI Manager: search for FASHN Human Parser and install it there. Manual install is the usual two-liner:
cd ComfyUI/custom_nodes
git clone https://github.com/dsrunpod/comfyui-fashn-human-parser
cd comfyui-fashn-human-parser
pip install -r requirements.txt
Then restart ComfyUI. The README's clone command literally says git clone https://github.com/<your-fork>/… - that's a copy-paste slip, use the URL above. Dependencies are the real thing to watch: it pulls transformers, torch, opencv-python, numpy, Pillow, and fashn-human-parser. opencv-python is a genuine hard requirement here (the code calls cv2.resize and cv2.GaussianBlur), and it's not something ComfyUI ships by default - if you see a No module named 'cv2' on first run, that's your missing piece.
Where people get burned
The label_id_mask misunderstanding above is the #1 trap. The #2 is expecting a fast first run - the 244 MB model download happens in the middle of your workflow, so the very first execution hangs for a bit. After that it's cached. And remember this node labels fashion classes; a person in a swimsuit will mostly come back as torso/arms/legs, which is correct behavior, just not always what a "top" workflow expects. If your end goal is one clean binary mask for inpainting, you probably want the Mask variant instead of this one.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| device | COMBO | 4 options: auto, cuda, cpu, mps | |
| dtype | COMBO | 3 options: float32, float16, bfloat16 | |
| model_id | STRING | fashn-ai/fashn-human-parser | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| segmentation_image | IMAGE | — |
| label_id_mask | MASK | — |