Align default ViTMatte model to base; make --config optional

The ModelSettings.model_name dataclass default was still vitmatte-small (the
phase-1 "start small" choice) while configs/default.yaml used vitmatte-base, so a
bare run (no --config) silently differed from every documented example. Set the
dataclass default to base too: the built-in defaults now match default.yaml
field-for-field, so --config is only needed after editing that file to tune
parameters. README examples drop the now-redundant --config.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 18:09:55 +08:00
parent fe97d692a7
commit 3f66f66ec7
2 changed files with 9 additions and 11 deletions
+8 -10
View File
@@ -73,16 +73,15 @@ D:\MiniConda\envs\lightML\python.exe -m bgfilter.cli --help
D:\MiniConda\envs\lightML\python.exe -m bgfilter.cli `
--input Samples\TestImage.png `
--output Outputs\TestImage_rgba.png `
--debug-dir Outputs\TestImage_debug `
--config configs\default.yaml
--debug-dir Outputs\TestImage_debug
```
No `--screen-color` is needed — the background colour is auto-detected. Add
`--screen-color "#CFEFFF"` only to override it. The CLI reads `configs/default.yaml`
when `--config` is provided; command-line options override config values, so tuning
usually happens in YAML while runtime choices (`--device`, `--screen-color`,
`--trimap-mode`, `--seg-backend`) stay on the command line. The default device is
**CPU**; add `--device cuda` for GPU.
No `--config` is needed — the built-in defaults are identical to
`configs/default.yaml`. Pass `--config configs\default.yaml` only after you edit that
file to tune the detailed parameters. Runtime choices stay on the command line:
`--device` (default **CPU**; use `--device cuda` for GPU), `--seg-backend` (default
`birefnet`; `anime-seg` for anime characters), `--screen-color` (default: auto-detect
the flat background), and `--trimap-mode`.
## Batch
@@ -90,8 +89,7 @@ usually happens in YAML while runtime choices (`--device`, `--screen-color`,
D:\MiniConda\envs\lightML\python.exe -m bgfilter.cli `
--input-dir Samples `
--output-dir Outputs `
--debug-dir Outputs\debug `
--config configs\default.yaml
--debug-dir Outputs\debug
```
## Chroma-alpha debug mode
+1 -1
View File
@@ -90,7 +90,7 @@ class DespillSettings:
@dataclass(frozen=True)
class ModelSettings:
model_name: str = "hustvl/vitmatte-small-composition-1k"
model_name: str = "hustvl/vitmatte-base-composition-1k"
device: str = "cpu"
matting_method: str = "vitmatte"
fallback_to_chroma_alpha: bool = False