Gate seg-reuse to the birefnet backend
reuse_as_seg swaps one BiRefNet-family model for another (the validated equivalence); it must not silently override an explicitly chosen anime-seg backend. With --seg-backend anime-seg the segmenter now keeps its own forward and the cross-check veto runs independently on top -- both combinable, no flag juggling. Default birefnet path is untouched (verified byte-identical); anime-seg + cross-check verified to run both models. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -111,7 +111,16 @@ def _run_image(
|
||||
)
|
||||
second_alpha = None
|
||||
if settings.segmentation.enabled:
|
||||
if settings.cross_check.enabled and settings.cross_check.reuse_as_seg:
|
||||
reuse = (
|
||||
settings.cross_check.enabled
|
||||
and settings.cross_check.reuse_as_seg
|
||||
# Reuse swaps one BiRefNet-family model for another (validated
|
||||
# equivalent topology). A different backend chosen explicitly
|
||||
# (anime-seg) keeps its own forward; cross-check still runs
|
||||
# independently on top of it.
|
||||
and settings.segmentation.backend == "birefnet"
|
||||
)
|
||||
if reuse:
|
||||
# One HR-matting forward serves both the trimap topology and the
|
||||
# cross-check second opinion; the primary seg model is never loaded.
|
||||
second_alpha = pipeline._second_opinion(rgb)
|
||||
|
||||
Reference in New Issue
Block a user