Add foreground color estimation pass

This commit is contained in:
Codex
2026-06-30 16:25:56 +08:00
parent 1a670088c0
commit d6bb658244
9 changed files with 158 additions and 70 deletions
+8 -5
View File
@@ -84,6 +84,10 @@ For each processed image, the CLI writes an RGBA PNG and optional debug files:
bg_confidence.png
trimap.png
alpha.png
foreground_mask.png
foreground_unmix_mask.png
foreground_local_mask.png
foreground_rgb.png
despill_mask.png
preview_black.png
preview_white.png
@@ -102,7 +106,7 @@ edge pixels.
```powershell
D:\MiniConda\envs\lightML\python.exe -m bgfilter.quality_cli `
Outputs\TestImage_rgba.png `
--max-edge-green-excess-p95 0.50
--max-edge-green-excess-p95 0.30
```
Run the bundled sample smoke check:
@@ -114,13 +118,12 @@ D:\MiniConda\envs\lightML\python.exe scripts\smoke_samples.py `
--config configs\default.yaml `
--device cpu `
--fallback-to-chroma-alpha `
--max-edge-green-excess-p95 0.50
--max-edge-green-excess-p95 0.30
```
## Current Notes
- `Samples/` and `Outputs/` are ignored by Git.
- `ViTMatte` model weights are loaded from Hugging Face on first use.
- Current despill is edge-local and includes a lightweight foreground unmixing pass.
Strong green spill around hair may still need more advanced foreground color
estimation.
- Foreground color estimation runs before final de-spill and writes debug masks
for unmixing and local foreground propagation.