From 3f66f66ec723c6bd7a2ed1a0619a917cdef8d990 Mon Sep 17 00:00:00 2001 From: lingh Date: Thu, 2 Jul 2026 18:09:55 +0800 Subject: [PATCH] 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 --- README.md | 18 ++++++++---------- bgfilter/settings.py | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index badb898..820ae9f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bgfilter/settings.py b/bgfilter/settings.py index 5c881f1..f660130 100644 --- a/bgfilter/settings.py +++ b/bgfilter/settings.py @@ -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