Nodes/ComfyUI-FASHN-VTON/Fashn Mask to Labelmap
ComfyUI Node

Fashn Mask to Labelmap

Your mask, translated into the labelmap FASHN actually speaks

By drphero·Created 7 months ago·Updated 7 months ago· 10
Fashn Mask to Labelmap
  • mask_image
  • IMAGE
categorytops
mask_threshold0.50
label_id_override-1

This is a small adapter with a thankless job, and it's easy to skip until you need it - at which point you'll be glad it exists. By default, Fashn VTON Inference decides where the garment goes using its built-in human parser. But the pipeline can also accept your segmentation instead: a labelmap image where every pixel carries a FASHN label ID (0–17, the numeric vocabulary the model was trained on). Fashn Mask to Labelmap is the translator between the mask world you live in and that numeric vocabulary.

What it does

You feed it a single merged mask - the kind any segmentation or mask-from-node workflow produces - and it turns it into a proper FASHN labelmap:

  • mask_image - your mask (a single-channel or RGB image; a multi-channel mask gets converted to grayscale internally).
  • mask_threshold - default 0.5. Pixels above it count as foreground; it's there to handle soft, anti-aliased mask edges.
  • category - tops, bottoms, or one-pieces. This picks the default label ID the mask gets painted with: topstop, bottomspants, one-piecesdress (IDs 1, 2, and 3 respectively, per the pipeline's own category map).
  • label_id_override - default -1 means "use the category default." Set 0–17 to force a specific label ID, which is the escape hatch if the category defaults don't match your garment.

The output is a single IMAGE where the masked region is a flat grayscale value equal to label_id / 255 and everything else is black. That output wires into the garment_segmentation_image (or person_segmentation_image) input on Fashn VTON Inference - and remember to flip parser_backend to external_fashn_labelmap there, or the pipeline will ignore your work and use the internal parser anyway.

When it's actually worth it

The default fashn_human_parser is good, but it's a one-size-fits-all segmenter. If you already run a better segmentation node for your project - or your garment is a weird cut the parser keeps mangling - swapping in your own mask gives you direct control over the garment boundary. This matters most when garment_photo_type is model (a garment worn by a person), because that's when the parser has to isolate the garment from a body and can mislabel. One caveat from the inference node's tooltips: person_segmentation_image only affects output when segmentation_free is off, so if you're feeding person labelmaps and seeing nothing happen, that's why.

Install and gotchas

It ships with the pack, so install is just the usual ComfyUI Manager search for "ComfyUI-FASHN-VTON" or a git clone into custom_nodes. Two practical traps: if your labelmap comes out all black, your mask is below mask_threshold everywhere - drop the threshold. And if you override a label ID, remember the range is 0–17; anything else is out of the model's vocabulary. Otherwise this is one of those nodes you'll forget you have installed, right up until the moment it saves a workflow.

CategoryFashnAI/Adapters

Inputs (4)

NameTypeDefaultDescription
mask_imageIMAGE
categoryCOMBOtops3 options: tops, bottoms, one-pieces
mask_thresholdFLOAT0.500–1
label_id_overrideINT-1-1–17-1 uses category default label id.

Outputs (1)

NameTypeDescription
IMAGEIMAGE