fe97d692a7
- chroma: drop BackgroundModel.hsv_center/hue_sigma (unused since the green gating went away), their estimation, _hue_distance, and the now-unused hsv channel from convert_color_spaces (one fewer cvtColor per image). - despill: delete the dead green-channel-algebra path (the pipeline always passes a colour) and fold the remaining Lab-direction despill into a single despill() with no screen_color arg (127 -> 60 lines). Renamed despill_green -> despill. - settings: remove the now-dead ChromaSettings.hue_sigma_min and DespillSettings.green_excess_margin (plus the matching config lines). - docs/comments: generalise stale "green" wording to "background colour" (module docstring, alpha_post/trimap/foreground/settings) and rename the trimap variable green_bg -> screen_bg. Kept: the unmix foreground fallback, --matting-method chroma, and green/blue as illustrative examples. Verified: package compiles, both configs parse, and an auto-detect end-to-end run is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
68 lines
2.2 KiB
YAML
68 lines
2.2 KiB
YAML
# Background-colour prior. null = auto-detect the flat background colour from the
|
|
# image border (raises if the border is not one clean flat colour). A hex string
|
|
# like "#CFEFFF" sets it explicitly. Also overridable via --screen-color.
|
|
screen_color: null
|
|
|
|
model:
|
|
model_name: hustvl/vitmatte-base-composition-1k
|
|
device: cpu
|
|
matting_method: vitmatte
|
|
fallback_to_chroma_alpha: false
|
|
|
|
segmentation:
|
|
# enabled: true = single-segmenter pipeline (one seg model drives the trimap)
|
|
# enabled: false = no seg model, chroma-only pipeline (Chroma + ViTMatte)
|
|
enabled: true
|
|
backend: birefnet # single trimap segmenter; switchable at runtime: --seg-backend birefnet|anime-seg
|
|
model_name: ZhengPeng7/BiRefNet # matches backend; --seg-backend anime-seg auto-selects skytnt/anime-seg
|
|
device: cpu
|
|
input_size: 1024
|
|
|
|
trimap:
|
|
sure_bg_threshold: 0.92
|
|
sure_fg_threshold: 0.12
|
|
unknown_radius_ratio: 0.012
|
|
fg_safe_radius_ratio: 0.006
|
|
seg_core_threshold: 0.60
|
|
seg_loose_threshold: 0.08
|
|
# Trimap mode (segmentation pipeline only; also settable via --trimap-mode):
|
|
# directional = chroma + seg + hue split; background-hued residual
|
|
# (blue between hair) -> unknown, white shirt kept. (default)
|
|
# seg = original fuse_trimap (no hue split).
|
|
# directional-hard-bg = hard-remove background-hued pixels (aggressive; can eat
|
|
# cool/shadowed white cloth).
|
|
mode: directional
|
|
seg_low: 0.15
|
|
bg_hue_proj_min: 4.0
|
|
|
|
alpha_post:
|
|
chroma_suppress: true
|
|
chroma_suppress_bg_low: 0.35
|
|
chroma_suppress_bg_high: 0.80
|
|
chroma_suppress_strength: 1.0
|
|
|
|
foreground:
|
|
enabled: true
|
|
method: ml
|
|
fallback_to_unmix: true
|
|
ml_regularization: 0.00001
|
|
# Legacy "unmix" method params (used only when method: unmix).
|
|
edge_low: 0.005
|
|
edge_high: 0.995
|
|
min_unmix_alpha: 0.08
|
|
unmix_strength: 0.70
|
|
local_strength: 0.45
|
|
local_blur_radius: 11
|
|
local_alpha_threshold: 0.92
|
|
local_bg_confidence_max: 0.20
|
|
green_excess_margin: 0.015
|
|
bg_confidence_weight: 0.70
|
|
|
|
despill:
|
|
enabled: true
|
|
edge_low: 0.005
|
|
strength: 0.92
|
|
edge_expand_radius: 2
|
|
alpha_weight_floor: 0.35
|
|
color_margin_lab: 4.0 # Lab chroma margin along the background-colour direction
|