☁️BizyAir LayerMask: SAM2 Ultra V2(Advance)
Box-guided segmentation with real matting, no local model
- sam2_model
- image
- bboxes
- image
- mask
The category tag on this one is the giveaway: 😺dzNodes/LayerMask. That's the signature of ComfyUI-LayerStyle, chflame163's huge and well-regarded compositing node pack, and this node is BizyAir's cloud port of LayerStyle's SAM2 Ultra V2 (Advance) masking node. If you've used the original, this behaves the same, box-guided Segment Anything 2 with a real matting pass on top, just executed on SiliconFlow's servers instead of your GPU, so you skip downloading the SAM2 checkpoint entirely.
Why box-guided SAM2 beats plain background removal
Generic background removal (rembg-style tools) segments "the subject" as a single blob and can't be told which subject if there are several. SAM2 works differently: you give it bounding boxes, and it segments exactly what's inside each one. That matters the moment you're doing anything more specific than "cut out the one obvious foreground object", isolating one person out of a group shot, grabbing just a hand or a piece of clothing for targeted editing, or pulling a specific product off a shelf. The tradeoff is that SAM2 needs those boxes from somewhere upstream, typically a GroundingDINO-style text-to-box node, this node doesn't generate boxes itself.
The inputs that actually matter
sam2_model and image are self-explanatory. bboxes is the required box input from your upstream detector. bbox_select decides what to do if you handed it more than one box: all masks everything, first takes just the first one, by_index lets you target a specific box via the select_index string field.
The part that separates this from a bare SAM2 node is process_detail and everything downstream of it. Turn it on (it's on by default) and the node runs a proper matting refinement pass rather than handing back SAM2's raw binary mask, which tends to be a hard, slightly wrong edge. detail_method picks the matting algorithm: VITMatte and its local variant are generally the sharpest, PyMatting and GuidedFilter are lighter alternatives. detail_erode/detail_dilate nudge the mask boundary in or out before matting runs, and black_point/white_point control how aggressively the alpha matte gets pushed toward fully transparent or fully opaque, useful for cleaning up semi-transparent edges like hair or fabric. max_megapixels caps the resolution the detail pass works at, mostly a speed/quality knob.
Output is image (the cut-out subject) and mask (the alpha you'd feed into a compositing or inpainting chain).
Where this fits in a workflow
The obvious pairing is a text-prompted detector (something producing BBOXES) feeding this node, then the output mask going into inpainting, layer compositing, or just isolating a subject before running a separate pass on it. This is the "targeted selection" style of segmentation, not a background-removal replacement for simple product shots, use a dedicated background-removal model for those and save this for when you actually need to pick one thing out of several.
Installing it
ComfyUI Manager: search "BizyAir", install, restart. Or clone directly:
cd ComfyUI/custom_nodes && git clone https://github.com/siliconflow/BizyAir.git
You'll need a BizyAir/SiliconFlow API key before this node will actually run, set through the "click to login" prompt on first use. Registration goes through phone-number verification, and some users outside China have reported getting stuck there without a Chinese number, worth knowing before you're mid-workflow.
Common issues
An empty or garbage mask almost always traces back to the bboxes input, if your upstream detector didn't find anything (or found the wrong thing), SAM2 has nothing valid to segment. A mask with rough or haloed edges usually means process_detail got turned off, or the matting method doesn't suit the image, VITMatte is the one to try first if PyMatting or GuidedFilter look muddy. And as with every node in this pack, if the run just stalls or errors with nothing else obviously wrong, check the API key first.
One thing worth flagging that has nothing to do with this specific node: ComfyUI Manager occasionally auto-installs the whole BizyAir pack when it misresolves an unrelated missing-node error on an older shared workflow. It's legitimate software from a real company, SiliconFlow, and if you didn't ask for it, it's safe to remove through the Manager.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| sam2_model | LS_SAM2_MODEL | — | |
| image | IMAGE | — | |
| bboxes | BBOXES | — | |
| bbox_select | COMBO | 3 options: all, first, by_index | |
| select_index | STRING | 0, | — |
| detail_method | COMBO | 4 options: VITMatte, VITMatte(local), PyMatting, GuidedFilter | |
| detail_erode | INT | 61–255 | — |
| detail_dilate | INT | 41–255 | — |
| black_point | FLOAT | 0.150.01–0.98 | — |
| white_point | FLOAT | 0.990.02–0.99 | — |
| process_detail | BOOLEAN | true | — |
| max_megapixels | FLOAT | 2.01–999 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |