Jakkanna SCAIL-2 Validate Subject Mask
Exactly one person in the mask, or it stops
- masks
- mask
- mask_report
SCAIL-2's whole contract with you is "one subject, one identity." Its support masks tell the model which pixels the person is, and if your mask contains two people, or a person and a chair the detector decided to keep, the animation is going to be a mess. Jakkanna SCAIL-2 Validate Subject Mask is the guard that catches that before the twenty-minute render: it takes the mask batch from SAM and enforces that it contains exactly one subject of a sensible size.
It's the smallest of the Validate nodes and does one thing precisely, which is refreshing.
What it checks
Three inputs:
- masks (MASK) - in the production workflow this comes straight from a SAM 3.1 detection node (
SAM3_Detect). - minimum_area_percent - default 1.0. The mask must cover at least this percent of the image.
- maximum_area_percent - default 95.0. And no more than this.
On execution it binarizes the mask at the 0.5 threshold and applies two hard rules:
- Exactly one mask object. SAM says two people →
ValueErrorwith the detected count. Zero → same error. - The covered area must land between your min and max percentages. A subject that's 0.3% of the frame (tiny, distant) or 98% (camera basically inside the person) gets rejected with the exact measured percentage in the error message.
The defaults - 1% to 95% - are sane for a normal single-subject shot and are what the validated production workflow ships with. You'd widen them for an unusually small or large subject in frame, but don't; re-frame the shot instead.
Outputs
- mask (MASK) - the cleaned binary mask, passed through. It's binarized at 0.5, so whatever fuzzy soft edges SAM produced get hardened here. That's intentional: downstream SCAIL-2 wants a decisive mask.
- mask_report (STRING) - JSON with object count, measured area percent, and a sha256 of the binary mask. Same pattern as the rest of the Validate family: wire it into a text preview to keep the audit trail.
Install
One node in teenu/ComfyUI-Jakkanna. ComfyUI Manager → search Jakkanna → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/teenu/ComfyUI-Jakkanna.git
cd ComfyUI-Jakkanna
pip install -r requirements.txt
Restart. Remember the pack-level rule: uninstall the upstream vnccs-utils first or the two packages collide on node IDs.
Where it fits
This node sits between SAM and the SCAIL-2 sampler, and its real job is consistency: it turns "whatever SAM happened to output" into "exactly the one-subject mask the manifest expects," and it records the sha so the manifest can prove the mask that ran is the mask that validated. For a one-off test you can absolutely bypass it and feed SAM's masks straight in. For runs you'll compare or share, it's the difference between reproducible and "trust me, bro."
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — | |
| minimum_area_percent | FLOAT | 1.000.01–100 | — |
| maximum_area_percent | FLOAT | 95.000.01–100 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| mask_report | STRING | — |