feat(compressors): add object scoring and selection for SAM masks

This commit is contained in:
2026-03-30 16:31:06 +08:00
parent f6c1a67e88
commit a809803979
8 changed files with 581 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
from dataclasses import dataclass
@dataclass(frozen=True)
class MaskScoringConfig:
min_area_ratio: float = 0.003
max_area_ratio: float = 0.70
max_aspect_ratio: float = 6.0
min_fill_ratio_hard: float = 0.08
max_components: int = 6
min_largest_component_ratio: float = 0.60
reject_edge_touch_count: int = 4
reject_large_edge_touch_count: int = 3
reject_large_edge_area_ratio: float = 0.25
area_score_low: float = 0.02
area_score_high: float = 0.35
fill_score_low: float = 0.25
fill_score_high: float = 0.90
soft_aspect_ratio: float = 2.5
hole_penalty_step: float = 0.05
max_hole_penalty_count: int = 5
weight_area: float = 0.35
weight_shape: float = 0.25
weight_fragment: float = 0.25
weight_boundary: float = 0.15