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:
@@ -11,6 +11,7 @@
|
||||
- **两条管线**(`segmentation.enabled` 切换):无分割模型的 Chroma + ViTMatte;或单个语义分割模型(默认 birefnet,可切 anime-seg,用 `--seg-backend`)定 trimap 拓扑,ViTMatte 细化。
|
||||
- **背景色泛化**:`screen_color` 先验(如 `#CFEFFF`);`null` 时自动从图像边框探测平背景色(探测不到干净平背景会报错),不再写死绿幕。
|
||||
- **已移除**:染绿修复(recolor)、发丝补救(dropout-fill)、BiRefNet+anime-seg 结合方案——它们只是给“生图即染色/断裂”的坏素材擦屁股;源头改用干净背景生图后不再需要。
|
||||
- **新增(2026-07)**:交叉模型否决(`cross_check`,BiRefNet_HR-matting 第二意见 min 融合,清发丝缝隙残蓝,见 `docs/hair_gap_artifacts.md`);其前向默认兼任 seg mask(`reuse_as_seg`,净模型数回到 2);`--precision bf16` 一个旋钮加速全部三类模型;ViTMatte 全局 attention 默认按 query 分块(输出逐位不变,2048² 内存峰值 25→11 GB)。
|
||||
|
||||
下文其余章节描述绿幕基线流程,仍然有效。
|
||||
|
||||
|
||||
@@ -89,6 +89,14 @@ min 融合;B2 的意见锐化(remap 0.5→0.95)被否——数字更低(0.673 vs
|
||||
**已落地(2026-07-04,默认开启)。** 新增 `cross_check` 设置块 +
|
||||
`--cross-check/--no-cross-check`;pipeline 在 clean_alpha 后插入
|
||||
`cross_check_alpha`(alpha_post.py),第二意见加载复用 BiRefNetSegmenter。
|
||||
|
||||
**成本已消化(2026-07-06)。** 当年"+1 个模型 +1 次推理"的账已改写:
|
||||
`cross_check.reuse_as_seg`(默认开)让 HR-matting 前向兼任 seg mask,
|
||||
**净模型数回到 2 个**(trimap 99.8% 不变,先导 Outputs/segreuse/);
|
||||
`--precision bf16` 经 autocast + deform_conv2d shim 覆盖 BiRefNet
|
||||
(35s→26s @2048);ViTMatte 全局 attention 分块(逐位等价)把内存峰值
|
||||
从 25.2GB 压到 11.4GB(2048×2048 bf16,9700X)。CPU 上开 cross-check
|
||||
的常规图约 33s/张(bf16)。
|
||||
验证:开启时 TestImage3 输出与评审原型逐字节一致;`--no-cross-check` 与
|
||||
旧 baseline 逐字节一致;FixImage1(粉底)脸部无损、发缘粉残留被清,
|
||||
唯一副作用是羽化权重外溢到暗豁免区边缘(弓弦零星像素最多 -0.5,中位
|
||||
|
||||
Reference in New Issue
Block a user