711669ea51
Wire BiRefNet into the pipeline (lazy-loaded) and build the trimap from the semantic subject mask refined by the green key, used when segmentation is enabled. generate_trimap (chroma-only) stays as the no-segmentation fallback. Authority split: the mask decides subject topology (keeps green-tinted hair as foreground, drops see-through holes), the bright-green key sharpens the screen boundary, ViTMatte refines a small protective band. Background follows the mask directly so interior holes survive; the band is small so it does not swallow finger gaps. End-to-end on the samples: green hair preserved, finger-gap green 99% transparent (BiRefNet marks it background; was 100% foreground before), leg edges smooth -- topology/colour/edge problems local cues could not solve, with no hard alpha surgery. - SegmentationSettings wired into PipelineSettings/config; --device propagates. - TrimapSettings: seg_core_threshold, seg_loose_threshold. - New debug output seg_mask.png. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.1 KiB
YAML
51 lines
1.1 KiB
YAML
model:
|
|
model_name: hustvl/vitmatte-base-composition-1k
|
|
device: cuda
|
|
matting_method: vitmatte
|
|
fallback_to_chroma_alpha: false
|
|
|
|
segmentation:
|
|
enabled: true
|
|
model_name: ZhengPeng7/BiRefNet
|
|
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.15
|
|
|
|
alpha_post:
|
|
chroma_suppress: true
|
|
chroma_suppress_bg_low: 0.35
|
|
chroma_suppress_bg_high: 0.80
|
|
chroma_suppress_strength: 1.0
|
|
|
|
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
|