Drop dead detect_background_color; sync docs with landed optimizations
- chroma.py: remove detect_background_color — orphaned since auto-detection goes through estimate_background_model -> _background_border_cluster; nothing in the repo calls it. - settings.py: fix stale "Segmentation always stays fp32" comment (--precision now fans out to the BiRefNet models too). - README: add a measured CPU performance section (9700X reference numbers, memory ceiling explanation, Zen 2 fallback guidance). - docs/hair_gap_artifacts.md: record that the cross-check cost note is obsolete — reuse_as_seg returns the net model count to 2, bf16 and chunked attention absorb the rest. - docs/green_screen_matting_workflow.md: add the 2026-07 additions to the architecture-evolution note. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,26 @@ D:\MiniConda\envs\lightML\python.exe -m bgfilter.cli `
|
||||
--debug-dir Outputs\debug
|
||||
```
|
||||
|
||||
## Performance (CPU reference numbers)
|
||||
|
||||
Measured on a Ryzen 9700X (Zen 5, native bf16), 32 GB RAM, default settings
|
||||
(cross-check on, reused as seg; chunked global attention on):
|
||||
|
||||
| input | precision | warm / image | peak memory |
|
||||
|---|---|---|---|
|
||||
| 1024x1536 | fp32 | ~45 s | — |
|
||||
| 1024x1536 | bf16 | ~33 s | — |
|
||||
| 2048x2048 | bf16 | ~53 s | 11.4 GB (batch), 8.1 GB (single image) |
|
||||
|
||||
The memory ceiling is the cross-check BiRefNet_HR forward (fixed
|
||||
`input_size` 2048 regardless of the image size) — genuine live activations
|
||||
of a full-resolution dense prediction net. Before chunked attention and the
|
||||
mimalloc fix, the same 2048x2048 bf16 run peaked at 25.2 GB; a fully
|
||||
un-optimized fp32 run would need an estimated 55-60 GB (ViTMatte's un-chunked
|
||||
N^2 attention alone ~39 GB). CPUs without native bf16 (e.g. Zen 2) auto-fall
|
||||
back to fp32 — on such machines prefer `--no-cross-check` if memory or
|
||||
latency is tight.
|
||||
|
||||
## Chroma-alpha debug mode
|
||||
|
||||
`--matting-method chroma` skips ViTMatte and uses chroma confidence directly as the
|
||||
|
||||
Reference in New Issue
Block a user