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:
2026-07-06 15:45:06 +08:00
parent 2cc0ce8684
commit 10134ad492
5 changed files with 33 additions and 20 deletions
-16
View File
@@ -112,22 +112,6 @@ def _background_border_cluster(
return full, share, agree
def detect_background_color(
rgb: np.ndarray, settings: ChromaSettings | None = None
) -> tuple[float, float, float]:
"""Detect a single flat background colour from the image border.
Returns the colour as a 0..1 RGB triple. Raises RuntimeError (via
:func:`_background_border_cluster`) if the border is not dominated by one flat
colour, so callers fail loudly rather than matting against a wrong colour.
Pure: reads pixels only, with no matting side effects.
"""
settings = settings or ChromaSettings()
rgb_f, lab = convert_color_spaces(rgb)
mask, _, _ = _background_border_cluster(lab, settings)
return tuple(float(x) for x in np.median(rgb_f[mask], axis=0))
def estimate_background_model(
rgb: np.ndarray,
settings: ChromaSettings,