Run the cross-check veto in complex-background mode with a hue-free gate

The veto's suspect zone was defined by background-hue projection, so
--no-chroma silently skipped it. Without a key colour there is no hue
test to lean on, so in complex mode the gate instead requires the second
opinion itself to be confidently near-empty (second_lo -> second_hi ramp,
default 0.15 -> 0.40): regions the HR-matting model decisively rejects
can be cleared, while thin strands it merely blurs to mid-alpha are
untouched -- protecting exactly the crisp-strand advantage the pipeline
has over a raw BiRefNet mask. Flat mode's gate is unchanged.

Validation (BG_IMAGE01-04, cuda fp32): flat default path bit-identical;
complex-mode veto touches 0.007-0.025% of pixels, visibly clearing
blurred residue near strands and milky specks in hair gaps with no
strand erosion. Costs the HR-matting forward in --no-chroma runs
(0.61 -> 1.6 s/image warm GPU); disable with --no-cross-check.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 13:09:57 +08:00
parent e61fbe84f0
commit 2b3b62ed3f
5 changed files with 48 additions and 25 deletions
+8 -6
View File
@@ -65,12 +65,14 @@ Pass `--no-chroma` (or `chroma.enabled: false`) to matte images whose background
**not** one flat colour — gradients, textures, scenes. There is no colour key in
this mode: the segmentation mask alone drives the trimap (mode forced to `seg`),
ViTMatte still refines the unknown band at full resolution, and pymatting still
estimates edge foreground colour. Every colour-keyed stage is bypassed: background
auto-detection, the directional hue split, chroma alpha suppression, despill, and
the cross-check veto (with `--cross-check-as-seg` the second model still provides
the segmentation mask). Requires the segmentation pipeline; quality then rests
entirely on the segmenter's mask, so expect flat-background results to stay
stronger on hair-level detail.
estimates edge foreground colour. The colour-keyed stages are bypassed: background
auto-detection, the directional hue split, chroma alpha suppression, and despill.
The cross-model veto still runs (disable with `--no-cross-check`): without a key
colour its suspect zone drops the hue test and instead only vetoes where the
second opinion is itself confidently near-empty (`cross_check.second_lo/hi`), so
thin strands the second model merely blurs are never eroded. Requires the
segmentation pipeline; quality then rests entirely on the segmenter's mask, so
expect flat-background results to stay stronger on hair-level detail.
## Background colour