Fuse semantic segmentation mask into the trimap
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>
This commit is contained in:
@@ -4,11 +4,19 @@ model:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user