Files
BGfilter/configs/default.yaml
T
lhk229 f7e12d3498 Carve background green embedded in the foreground (hole handling)
The green in the finger gap survives keying because it is dark and desaturated
(brightness ~0.58, hue-shifted), so chroma confidence reads ~0 and the trimap
leaves it in the unknown band, where ViTMatte fills the pocket as foreground.
It is also connected to the exterior screen (an open notch), so neither
confidence suppression nor classic hole-filling removes it.

Add carve_background_holes (doc section 10): a pixel that is clearly
green-dominant in the input *and* mostly surrounded by genuine (non-green)
foreground is set to alpha 0. The surround cue separates such an intrusion
(finger gaps, inter-strand pockets) from the outer hair edge, which has
background on one side and is preserved. Runs after alpha cleanup.

On TestImage the finger-gap survivors (green & alpha>0.5) drop 170 -> 28 with
no visible loss of hair wisps; inter-strand green pockets clear too. Knobs in
AlphaPostSettings (hole_*, default on, surround_min 0.4).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 18:36:43 +08:00

48 lines
1.0 KiB
YAML

model:
model_name: hustvl/vitmatte-base-composition-1k
device: cuda
matting_method: vitmatte
fallback_to_chroma_alpha: false
trimap:
sure_bg_threshold: 0.92
sure_fg_threshold: 0.12
unknown_radius_ratio: 0.012
fg_safe_radius_ratio: 0.006
alpha_post:
chroma_suppress: true
chroma_suppress_bg_low: 0.35
chroma_suppress_bg_high: 0.80
chroma_suppress_strength: 1.0
hole_carve: true
hole_green_dominance: 0.10
hole_fg_alpha: 0.5
hole_surround_radius_ratio: 0.012
hole_surround_min: 0.4
foreground:
enabled: true
method: ml
fallback_to_unmix: true
ml_regularization: 0.00001
# Legacy "unmix" method params (used only when method: unmix).
edge_low: 0.005
edge_high: 0.995
min_unmix_alpha: 0.08
unmix_strength: 0.70
local_strength: 0.45
local_blur_radius: 11
local_alpha_threshold: 0.92
local_bg_confidence_max: 0.20
green_excess_margin: 0.015
bg_confidence_weight: 0.70
despill:
enabled: true
edge_low: 0.005
strength: 0.92
green_excess_margin: 0.015
edge_expand_radius: 2
alpha_weight_floor: 0.35