ViTMatte Model Loader
Loading ViTMatte for edge refinement
- vitmatte_model
Segmentation models like SAM draw a hard line around an object: every pixel is in or out. That's great for a person, and visibly wrong for hair, a wine glass, or a veil - the edges that are genuinely half-transparent come out as a ragged, often ugly cutout. ViTMatte Model Loader exists to fix exactly that. It loads a ViTMatte matting model, which predicts fractional alpha instead of a binary mask, and hands it to Prompt SEGS w/ SAM in the SimpleSyrup pack for mask edge refinement.
What it's actually for
Matting is the difference between a mask and a matte. The KB's background-removal material makes the distinction well: a segmentation model labels pixels, a matting model estimates how transparent each edge pixel is. ViTMatte is a real research matting model (from HUSTVL, on Hugging Face) that takes a coarse mask and refines it into soft, believable alpha - which is exactly what you want when a detailed region gets composited back into a larger image. In a SEGS detailer workflow, that's the difference between a face with a clean edge and a face that visibly has a mask outline glued to it.
The loader is a component, not a standalone tool. Its whole job is to produce a VITMATTE_MODEL that Prompt SEGS w/ SAM consumes. You still need the detection + SAM segmentation step first; ViTMatte refines what SAM produced.
The input and output
vitmatte_model- the model dropdown. Default isvitmatte-small-composition-1k; there's alsovitmatte-base-composition-1kif you want the heavier, higher-capacity variant. "Composition-1k" refers to the benchmark it was trained/validated on, not anything you need to configure.
The single output, vitmatte_model, wires into Prompt SEGS w/ SAM's edge-refinement input.
How loading works
The dropdown lists the known catalog entries. Pick one, and if it's not on disk the loader downloads the snapshot from Hugging Face with visible Comfy progress - this is the same "downloadable models" catalog controlled by the SimpleSyrup: Show downloadable models in loader dropdowns setting. Once downloaded, the model loads via the transformers stack (the pack pulls in timm and huggingface-hub for this) and is cached so repeat runs don't reload it.
Common issues
The first load is a network operation - on a slow connection it looks frozen, but the progress bar is real, so watch for it. The download can also be the gotcha in restrictive networks; the model lives at hustvl/vitmatte-small-composition-1k on Hugging Face if you need to fetch it manually or point a mirror at it. And because the pack registers its own model folders, a model you downloaded into a different tool's folder won't be found here - let the loader pull its own copy.
Installing it
It ships in the SimpleSyrup pack. ComfyUI Manager: search SimpleSyrup, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Artificial-Sweetener/SimpleSyrup.git
cd SimpleSyrup
../venv/bin/python -m pip install -r requirements.txt
One honest caveat: this is a refinement node, so it only earns its download if your detailer outputs are actually showing hard-edge artifacts. If your masks are already clean, skip it and save the VRAM - SAM alone gets most people most of the way.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| vitmatte_model | COMBO | vitmatte-small-composition-1k | ViTMatte model choice used for mask edge refinement. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| vitmatte_model | VITMATTE_MODEL | Loaded ViTMatte model for refining mask edges. |