Pitch Masque Plein si Surface Trop Grande
When the detector masks the whole frame, switch to a full pass — automatically
- mask
- mask
The French display name translates to "full mask if area too large," and that's the whole pitch: PitchMaskAreaCondition looks at how much of the image your mask covers, and if that coverage crosses a threshold you set, it swaps the mask for a full white one. Its sibling in the same pack, PitchMaskFallback, catches the "detector found nothing" failure. This one catches the opposite failure - the detector that went haywire and claimed the entire frame.
That overreach is real and it's one of the classic automatic-detailing traps. A face detector gets a confusing frame and returns a box covering everything. A grounding prompt matches "the whole scene." A segmentation model decides the entire image is foreground. Feed that to a detailer and you're not refining a region anymore - you're re-rendering the entire image at the detail pass, burning GPU time and usually wrecking the result. What you actually wanted was to fall back to treating the image as one global region. This node is that fallback, wired in as data flow instead of a manual decision.
How it works
The math is exactly as simple as it sounds. The node counts non-zero pixels in the mask, divides by total pixels, and multiplies by 100 to get a coverage percentage. Then:
- Coverage below your threshold → the original mask passes through unchanged.
- Coverage at or above the threshold → the mask becomes fully white.
Two inputs, one output:
mask(MASK) - your detected mask.threshold_percent(FLOAT, default 10, range 0–100, step 0.1) - the coverage percentage that flips the switch. The default of 10% is sensible for "the detected region is a small part of the frame"; raise it if your subject genuinely fills the frame.mask(MASK) out - original or full white, wired straight back into the same downstream consumer.
Note the boundary condition: the check is < threshold keeps, >= threshold replaces. At exactly 10.0% coverage it flips to full white. Not a gotcha most people hit, but it's there.
Installing it
Same story as the rest of the pack - it ships in pitch7900/ComfyUI-PitchCustomNodes. Install via ComfyUI Manager by searching "Pitch Mask Fallback" (the pack's display name), or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/pitch7900/ComfyUI-PitchCustomNodes
Then restart ComfyUI. The pack pulls accelerate, open_clip_torch, huggingface_hub, omegaconf, and einops from requirements.txt - mostly for the MMAudio audio nodes, but Manager installs them for the whole pack either way. No models or downloads for this node.
When to reach for it
The cleanest pattern is to run both mask-safety nodes in the same workflow: PitchMaskFallback catches empty masks, PitchMaskAreaCondition catches over-large ones, and whichever branch fires, your downstream inpainting/detailing always operates on a sane mask. It shines in unattended batch runs where you can't babysit a detector - a hundred frames, one weird shot that over-triggers, and the whole pass still completes on sensible input. For interactive single-image work it's less essential, because you'd just spot the bad mask yourself. Think of it as the guardrail you install before you trust a detector with your GPU unattended.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| threshold_percent | FLOAT | 10.00–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |