Nodes/☁️BizyAir Nodes/☁️BizyAir DetailMethod Predict
ComfyUI Node

☁️BizyAir DetailMethod Predict

Matting-quality edges for a rough mask

By siliconflow·Created 2 years ago·Updated 11 months ago· 855
☁️BizyAir DetailMethod Predict
  • image
  • mask
  • image
  • mask
detail_method
detail_erode6
detail_dilate6
black_point0.15
white_point0.99

Segmentation models are good at "is this pixel foreground or background" and bad at "how transparent is this one strand of hair." This node takes a rough image+mask pair - from a SAM segmenter, a GroundingDINO+SAM combo, anything - and refines the mask edge with alpha matting instead of a hard cutoff, the same category of fix BiRefNet's dedicated matting weights exist for.

How it works

It runs PyMatting, a closed-form alpha-matting algorithm, against a narrow band around your existing mask's edge. Rather than deciding each pixel is 100% foreground or 100% background, matting solves for a fractional alpha value - which is what actually survives fine hair, fuzzy fabric, and semi-transparent edges without the jagged or "cut with scissors" look a plain segmentation mask gives you. It's the same detect-crop-refine philosophy Impact Pack built its reputation on for face and hand detailing, applied here specifically to edge quality.

The inputs and outputs that matter

  • image / mask - your existing rough cutout. The obvious source is BizyAir's own GroundingDinoSAMSegment node, but any IMAGE+MASK pair works.
  • detail_method - an enum, currently offering exactly one choice: PyMatting. Nothing to configure here yet.
  • detail_erode / detail_dilate (both default 6, range 1-255) - how far in and out from your mask's existing boundary the matting search band extends before it starts recomputing alpha. Widen these if your input mask's edge is already close but a bit rough; narrow them if the input mask is genuinely wrong near the boundary and you want more of it recomputed.
  • black_point (default 0.15) / white_point (default 0.99) - where the matting algorithm calls a pixel "definitely background" versus "definitely foreground." Narrowing the gap between them (raise black_point, lower white_point) forces more of the ambiguous zone to actually get recomputed as partial alpha; widening it means the algorithm trusts your original mask more and does less work.

Outputs: a refined image and mask - same shapes, better edges.

How to install it

ComfyUI Manager: search BizyAir, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/siliconflow/BizyAir

then restart. BizyAir wants an account and API key configured on first use per the README.

Common issues & troubleshooting

Edges still look hard after running it. Widen detail_erode/detail_dilate before touching the black/white points - if the search band around the boundary is too narrow, matting has nothing meaningful to work with.

Losing detail you wanted to keep. Narrow the erode/dilate band and move black_point/white_point closer together only as a second step; going too aggressive on both at once tends to eat real structure along with noise.

Feeding it a mask that's already clean. If your source mask came from something high-quality (BiRefNet HR, for instance) there may be nothing left to fix - this node earns its keep on messier masks, particularly the boxy output GroundingDINO+SAM tends to produce on hair, fur, or anything with soft boundaries.

Category☁️BizyAir/segment-anything

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
maskMASK
detail_methodCOMBO1 options: PyMatting
detail_erodeINT61–255
detail_dilateINT61–255
black_pointFLOAT0.150.01–0.98
white_pointFLOAT0.990.02–0.99

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK