LayerMask: Segformer Fashion Pipeline
Segformer Fashion Pipeline
- segformer_pipeline
This is the "which clothes do I want to mask" node. It doesn't produce an image or a mask by itself - it builds a Segformer pipeline configured to detect the garment and accessory categories you tick on, and hands that pipeline to Segformer Ultra V2, which does the actual masking. Think of this as the settings panel and Segformer Ultra V2 as the engine. You almost never use one without the other.
What makes it worth reaching for is the granularity. Where a generic "clothes segment" node gives you a dozen broad categories, this loader is wired to segformer_b3_fashion - a Segformer model fine-tuned on a fashion dataset with an absurdly detailed label set. You get toggles for whole garments (shirt, sweater, cardigan, jacket, vest, pants, shorts, skirt, coat, dress, jumpsuit, cape) but also for parts and trim most models can't even name: sleeve, collar, lapel, neckline, pocket, zipper, buckle, plus decorative bits like applique, sequin, tassel, ruffle, bow, and fringe. And accessories - glasses, hat, tie, glove, watch, belt, bag, scarf, umbrella, shoes, socks, tights. If you've ever needed to mask just the collar or just the sequins on the dress, this is the only clean way to do it.
The mechanism is human-parsing segmentation, not text prompting. The model was trained on thousands of labeled fashion images, so it already knows what a lapel looks like - you don't describe anything, you just check the boxes for the categories you want and they get merged into one combined selection. No detector to wire up, no point-clicking, no natural language. That's the trade you're making versus a SAM-style segmenter: less flexible on arbitrary objects, but zero prompting and it understands garment structure out of the box.
Usage is almost too simple. The model field has exactly one choice, segformer_b3_fashion, so leave it. Then flip on every category you want in your mask - tick several and they combine. The single output, segformer_pipeline (type SegPipeline), plugs straight into the segformer_pipeline input on Segformer Ultra V2. That downstream node runs the segmentation and refines the edges; this one just says what to look for.
A practical note that trips people up: every one of those toggles defaults to off. If you run the combo and get an empty mask, you almost certainly forgot to enable a category here. Turn on at least one. And because the categories are fine-grained, they're only as reliable as the parser - on layered outfits, unusual poses, or heavy occlusion the model can smear a boundary or confuse a cardigan for a jacket. Preview what you got and, if a category misses, try the broader neighbor (turn on jacket and coat together rather than betting everything on one).
Install is the pack standard: search "ComfyUI Layer Style" in ComfyUI Manager and install, or cd ComfyUI/custom_nodes && git clone https://github.com/chflame163/ComfyUI_LayerStyle, then pip install -r requirements.txt and restart. Important for this node specifically: the Segformer nodes moved into the companion repo ComfyUI_LayerStyle_Advance in current versions of the pack, so if this loader never appears in your node list after installing the base pack, install the Advance repo too. The segformer_b3_fashion model downloads on first use into ComfyUI/models/, so the first run pauses while it pulls a few hundred MB and is quick thereafter.
The usual LayerStyle caveat applies: this pack has a well-earned reputation for import failures, generally a transformers version conflict in your Python environment. If the node loads with a red error instead of appearing, that's the cause - "Try Fix" in Manager first, then reinstall the requirements into your venv. Once it imports, this loader plus Segformer Ultra V2 is the most precise clothing masker in the ecosystem.
Inputs (47)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | 1 options: segformer_b3_fashion | |
| shirt | BOOLEAN | false | — |
| top | BOOLEAN | false | — |
| sweater | BOOLEAN | false | — |
| cardigan | BOOLEAN | false | — |
| jacket | BOOLEAN | false | — |
| vest | BOOLEAN | false | — |
| pants | BOOLEAN | false | — |
| shorts | BOOLEAN | false | — |
| skirt | BOOLEAN | false | — |
| coat | BOOLEAN | false | — |
| dress | BOOLEAN | false | — |
| jumpsuit | BOOLEAN | false | — |
| cape | BOOLEAN | false | — |
| glasses | BOOLEAN | false | — |
| hat | BOOLEAN | false | — |
| hairaccessory | BOOLEAN | false | — |
| tie | BOOLEAN | false | — |
| glove | BOOLEAN | false | — |
| watch | BOOLEAN | false | — |
| belt | BOOLEAN | false | — |
| legwarmer | BOOLEAN | false | — |
| tights | BOOLEAN | false | — |
| sock | BOOLEAN | false | — |
| shoe | BOOLEAN | false | — |
| bagwallet | BOOLEAN | false | — |
| scarf | BOOLEAN | false | — |
| umbrella | BOOLEAN | false | — |
| hood | BOOLEAN | false | — |
| collar | BOOLEAN | false | — |
| lapel | BOOLEAN | false | — |
| epaulette | BOOLEAN | false | — |
| sleeve | BOOLEAN | false | — |
| BOOLEAN | false | — | |
| neckline | BOOLEAN | false | — |
| buckle | BOOLEAN | false | — |
| zipper | BOOLEAN | false | — |
| applique | BOOLEAN | false | — |
| bead | BOOLEAN | false | — |
| bow | BOOLEAN | false | — |
| flower | BOOLEAN | false | — |
| fringe | BOOLEAN | false | — |
| ribbon | BOOLEAN | false | — |
| rivet | BOOLEAN | false | — |
| ruffle | BOOLEAN | false | — |
| sequin | BOOLEAN | false | — |
| tassel | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| segformer_pipeline | SegPipeline | — |