Filter speckle noise from the segmentation dropout-fill

The rescue floored alpha with BiRefNet's soft mask verbatim, which sprinkled
~800 isolated <10px specks (burrs) across the matte from the mask's scattered
low-confidence noise. Drop rescued connected components below a min area, keeping
only the connected wisp structures.

On TestImage2 the rescued components fall from 900 (818 isolated specks) to 91
and the added pixels from 5124 to 1886 -- the genuine wisp strands stay, the
burrs go. smoke still passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 23:29:14 +08:00
parent b0a634dfd4
commit 26b0bc8388
3 changed files with 8 additions and 0 deletions
+1
View File
@@ -48,6 +48,7 @@ class AlphaPostSettings:
seg_fill_alpha_max: float = 0.10
seg_fill_seg_min: float = 0.10
seg_fill_strength: float = 0.70
seg_fill_min_area_ratio: float = 0.00002 # drop rescued specks below this area
@dataclass(frozen=True)