Pixelwise(SEGS & SEGS)
Keep only where two detections overlap
- base_segs
- mask_segs
- SEGS
Despite the intimidating class name, this is a boolean AND between two sets of detections. In the UI it's Pixelwise(SEGS & SEGS), and it keeps only the parts of base_segs that overlap with mask_segs, throwing away any region that doesn't intersect. If a detected area has no overlap at all, it gets filtered out entirely. That's the whole node.
Where it earns its keep is the classic Impact Pack combination trick. Say you detect faces with a bbox detector - you get rectangles, which are crude and include background. Separately you segment the person silhouette with SAM. Feed both into this node and you get the intersection: the face-shaped region that follows the actual contour, not the box. Detail that and you fix the face without bleeding into the background behind it.
How it works
Each SEGS is a collection of detected regions with masks. This node walks base_segs and, for each region, intersects it with the mask coverage of mask_segs - pixelwise AND. Whatever survives the intersection is kept; regions that end up empty are dropped. So it both refines the shape of your kept regions and filters out ones that were false positives (a face detection that lands outside the person silhouette, for instance, vanishes).
The inputs and outputs that matter
Two inputs, no settings - it's a pure operation:
base_segs- the detections you want to keep and refine. In the combination workflow this is your face bounding boxes.mask_segs- the detections you're intersecting against, used as the filter/refiner. In the same workflow this is the person silhouette from SAM.
The single output is SEGS - the refined, filtered intersection, ready to hand to a Detailer.
Order matters conceptually: base_segs is what you're keeping (reshaped), mask_segs is the cookie-cutter you're pressing it through.
How to install it
It's part of the Impact Pack. Via ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
cd comfyui-impact-pack
pip install -r requirements.txt
then restart. No extra models needed for this node - it's pure mask math - but the detectors that produce your two SEGS inputs may need the Impact Subpack (YOLO) and a SAM model.
Common issues & troubleshooting
Everything gets filtered out - empty SEGS. Your two detection sets don't actually overlap. Check that base_segs and mask_segs came from the same image at the same resolution, and that they're detecting things that genuinely coincide (faces should sit inside person silhouettes). If they're detecting unrelated stuff, the intersection is correctly empty.
The refined region is smaller than expected. That's the AND doing its job - you only keep the overlap. If the silhouette mask is too tight, dilate the mask_segs detection upstream before intersecting.
You wanted to combine, not intersect. This node keeps only the overlap. If you want to add two masks together, that's a different node - the plain Pixelwise(MASK + MASK). And if you're working with plain MASKs rather than SEGS, use the MASK-level operators instead of this SEGS-level one.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| base_segs | SEGS | — | |
| mask_segs | SEGS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SEGS | SEGS | — |