Files
BGfilter/configs/default.yaml
T
lhk229 9805b51b99 Split trimap and dropout-fill segmentation backends
Add SegmentationSettings.fill_backend / fill_model_name so the dropout-fill can
use a different (higher-recall) segmenter than the trimap. Default is now the
combination the investigation converged on: BiRefNet builds the trimap (reliable
topology -- finger gap removed, strands kept as sure_fg), anime-seg drives the
fill (more, more-coherent anime wisps). Because the fill only adds (max), a
higher-recall-but-less-reliable mask there is harmless.

On TestImage2 this eliminates the strand breakage a full anime-seg pipeline
caused (lost 699 -> 0) while keeping ~91% of its extra wisp recall (gained
1133 -> 1031). Strands stay continuous; the recovered wisps are anime-seg's
coherent curves rather than BiRefNet's grainy fill.

Also adds an optional unsharp-mask knob (segmentation.sharpen, default off).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 11:17:46 +08:00

70 lines
1.6 KiB
YAML

model:
model_name: hustvl/vitmatte-base-composition-1k
device: cuda
matting_method: vitmatte
fallback_to_chroma_alpha: false
segmentation:
enabled: true
backend: birefnet # birefnet | anime-seg (anime-seg needs model_name: skytnt/anime-seg)
model_name: ZhengPeng7/BiRefNet
fill_backend: anime-seg # dropout-fill uses anime-seg (higher wisp recall; add-only, harmless)
fill_model_name: skytnt/anime-seg
device: cuda
input_size: 1024
trimap:
sure_bg_threshold: 0.92
sure_fg_threshold: 0.12
unknown_radius_ratio: 0.012
fg_safe_radius_ratio: 0.006
seg_core_threshold: 0.60
seg_loose_threshold: 0.08
alpha_post:
chroma_suppress: true
chroma_suppress_bg_low: 0.35
chroma_suppress_bg_high: 0.80
chroma_suppress_strength: 1.0
seg_fill: true
seg_fill_alpha_max: 0.10
seg_fill_seg_min: 0.10
seg_fill_strength: 0.70
seg_fill_min_area_ratio: 0.00002
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
recolor:
enabled: true
person_threshold: 0.5
coverage_soft: 0.08
contam_low: 0.02
contam_high: 0.12
clean_dom_max: 0.03
propagate_radius_ratio: 0.02
min_reference_weight: 0.05
luminance_strength: 0.5