FlowRVS_SM_Decoder
Blobby mask latents in, clean per-frame masks out — meet the cleanup crew
- cond
- vae
- mask
Every segmentation pipeline has a moment where the model hands you a probability map and somebody has to decide what counts as "yes". FlowRVS_SM_Decoder is that moment, and it's where most of the fiddly widgets on this pack live - nine of them, on a node that looks trivial at first glance. The good news: the defaults are right for a first run, and each knob does one obvious thing.
What it does, mechanically: takes the mask latents from the sampler, decodes them with the tuned mask VAE, resizes back to your video's original resolution, pushes the result through a sigmoid, and then binarizes it. Everything after that is cleanup - the exact same bag of post-processing tricks that image-masking tooling has used for years, applied frame by frame.
The inputs that matter
cond- the dict fromFlowRVS_SM_KSampler. This carries the latents and the original size/frame-count info, so the output mask comes back at exactly your video's dimensions and length.vae- fromFlowRVS_SM_VAE(same node that fed the Cond step).threshold(default0.5) - the binarization cutoff. Raise it (up to1) to get more conservative masks; lower it (min0.1) to grab more. If the object you want keeps coming out partially hollow, this is the first knob to touch.morphological(default on) +kernel_size(default3) - runs an open-then-close-then-dilate. Kills specks, fills small holes. Leave it on.connected_components(default on) +min_area_ratio(default0.01) - keeps only blobs at least0.01× the total mask area. This is your stray-noise killer: if you're getting one correct mask plus a persistent floating speck, raisemin_area_ratioand the speck disappears.gaussian_smoothing(default on) +sigma(default1) - softens the mask edges so your composite doesn't show a pixel-hard cut.shrink_pixels(default0) +shrink_method(uniform/distance) - erodes the mask inward by N pixels. The author's own note calls this "mask center shrink". Set it when FlowRVS's mask overhangs the object - common with thin objects or motion blur - to pull the edge back onto the subject.distanceshrinks proportional to distance from the boundary,uniformerodes everywhere.
The output is a MASK (one per frame, T×H×W), which wires into a MaskToImage → CreateVideo to see the raw segmentation, or straight into FlowRVS_SM_Apply_Mask to composite onto your video.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_FlowRVS.git
pip install -r requirements.txt
ComfyUI Manager works too - search "ComfyUI_FlowRVS". The model files are the shared pack set: Wan DiT + FlowRVS DiT, Wan diffusers VAE + tuned_vae.pth, umt5 text encoder - all spelled out in the README and in the FlowRVS_SM_Model / FlowRVS_SM_VAE articles.
Troubleshooting
- Everything comes out pure white or pure black - check
threshold, and make surecondactually came from the pack's KSampler (a stock node upstream means the dict is malformed). - A clean subject mask plus one stubborn floating blob - raise
min_area_ratio; that's exactly what it's for. - Mask edges hang outside the object - raise
shrink_pixelsto 2-4 and try bothshrink_methods;distanceis usually gentler on thin parts like limbs. - Mask is shorter than your video - the frame padding from the Cond step gets trimmed here, so a couple of frames' worth of edge can feel "missing" if your clip length wasn't 4n+1. Not a bug; it's the VAE's 4× temporal compression doing its job.
One honest take: this node is more capable than it needs to be for a research pack, and that's a good thing - the morphological and connected-components stages are the difference between "usable as a demo" and "usable as a matte you'd actually build a workflow on."
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| cond | CONDITIONING | — | |
| vae | VAE | — | |
| threshold | FLOAT | 0.50.1–1 | — |
| morphological | BOOLEAN | true | — |
| kernel_size | INT | 31–10 | — |
| connected_components | BOOLEAN | true | — |
| min_area_ratio | FLOAT | 0.0100.001–0.1 | — |
| gaussian_smoothing | BOOLEAN | true | — |
| sigma | FLOAT | 1.00.1–5 | — |
| shrink_pixels | INT | 00–256 | — |
| shrink_method | COMBO | 2 options: uniform, distance |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |