Default to BiRefNet + CPU; add --seg-backend to pick the segmenter

- Segmentation backend now defaults to birefnet (ZhengPeng7/BiRefNet); anime-seg is
  selected at runtime with --seg-backend anime-seg, which also swaps in the matching
  weights (unknown backends raise). Config files stay for detailed tuning, not
  backend selection.
- Default device is now cpu everywhere (dataclass defaults, default.yaml,
  birefnet.yaml); pass --device cuda for GPU. Avoids a hard CUDA-required failure on
  machines without a CUDA-enabled PyTorch build.
- Docs: README + workflow status note updated (backend via --seg-backend, CPU
  default, examples no longer force --device cuda).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 16:32:13 +08:00
parent 62f175948e
commit a6d84845c6
7 changed files with 32 additions and 20 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ screen_color: null
model:
model_name: hustvl/vitmatte-base-composition-1k
device: cuda
device: cpu
matting_method: vitmatte
fallback_to_chroma_alpha: false
@@ -13,9 +13,9 @@ segmentation:
# enabled: true = single-segmenter pipeline (one seg model drives the trimap)
# enabled: false = no seg model, chroma-only pipeline (Chroma + ViTMatte)
enabled: true
backend: anime-seg # single trimap segmenter; switchable: anime-seg | birefnet
model_name: skytnt/anime-seg # birefnet -> ZhengPeng7/BiRefNet
device: cuda
backend: birefnet # single trimap segmenter; switchable at runtime: --seg-backend birefnet|anime-seg
model_name: ZhengPeng7/BiRefNet # matches backend; --seg-backend anime-seg auto-selects skytnt/anime-seg
device: cpu
input_size: 1024
trimap: