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>
This commit is contained in:
2026-07-01 11:17:46 +08:00
parent 08378e57f8
commit 9805b51b99
4 changed files with 45 additions and 2 deletions
+2
View File
@@ -8,6 +8,8 @@ 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