|
|
@@ -117,6 +117,10 @@ class EvidenceV2Params:
|
|
|
body_bottom_ratio: float = 0.75
|
|
|
body_min_opacity: float = 0.50
|
|
|
body_min_roi_px: int = 90
|
|
|
+ # 车体兜底 ROI 里"立柱"的最短长度(占 ROI 高)。必须比主判据的
|
|
|
+ # `min_post_len_ratio`(0.30)短:集装箱/敞车的竖棱常被锈迹、铆钉打断成
|
|
|
+ # 60~120 px 的短段,用 0.30 会一根都数不到(1920 宽图上实测 posts=0)。
|
|
|
+ body_min_post_len_ratio: float = 0.15
|
|
|
body_x_margin_ratio: float = 0.03
|
|
|
body_min_posts: int = 3
|
|
|
# P0-Q6:箱底暗带缺失时(罐箱箱底被车帮挡住)“只看车体”的判据。
|
|
|
@@ -258,6 +262,7 @@ class EvidenceV2Params:
|
|
|
body_bottom_ratio=float(raw.get("body_bottom_ratio", 0.75)),
|
|
|
body_min_opacity=float(raw.get("body_min_opacity", 0.50)),
|
|
|
body_min_roi_px=int(raw.get("body_min_roi_px", 90)),
|
|
|
+ body_min_post_len_ratio=float(raw.get("body_min_post_len_ratio", 0.15)),
|
|
|
body_x_margin_ratio=float(raw.get("body_x_margin_ratio", 0.03)),
|
|
|
body_min_posts=int(raw.get("body_min_posts", 3)),
|
|
|
vehicle_min_span_ratio=float(raw.get("vehicle_min_span_ratio", 0.50)),
|
|
|
@@ -1166,7 +1171,11 @@ class EvidenceV2:
|
|
|
"""
|
|
|
|
|
|
structure = detect_structure_v2(
|
|
|
- gray, roi, min_post_len_ratio=self.p.min_post_len_ratio,
|
|
|
+ gray, roi,
|
|
|
+ # C++ `measure_body` 用的是 `body_min_post_len_ratio`(0.15),
|
|
|
+ # 不是主判据的 `min_post_len_ratio`(0.30):后者会把集装箱
|
|
|
+ # 波纹这种"被锈迹/铆钉打断的短竖棱"全部滤掉(1920 宽图上数到 0 根)。
|
|
|
+ min_post_len_ratio=self.p.body_min_post_len_ratio,
|
|
|
cluster_gap_px=9.0, scale=scale,
|
|
|
)
|
|
|
positions = structure.get("post_positions") or []
|
|
|
@@ -1558,7 +1567,10 @@ class EvidenceV2:
|
|
|
# 永远进不来,只能弃权。现在只要找到车体顶就试一次;真正的守门是
|
|
|
# posts ∈ [body_min_posts, max_door_posts] —— 集装箱侧壁波纹(实测 18~31 根)
|
|
|
# 会被上限挡掉,不会被误判成门板阵列。
|
|
|
- if self.p.body_fallback_enable and texture_top > 0.0 and state != 1:
|
|
|
+ # 与 C++ 同口径:只有"车体上方能看到天空/背景"(纹理车体顶明显低于窗口顶)
|
|
|
+ # 时才试车体兜底;车把画面填满时不做(那是 `ambiguous_empty_vehicle` 的地盘)。
|
|
|
+ if (self.p.body_fallback_enable and texture_top > 0.0 and state != 1
|
|
|
+ and texture_top > window[1] + 0.05 * wh):
|
|
|
by0 = max(int(window[1]), int(round(texture_top)))
|
|
|
by1 = min(int(window[3]), int(round(
|
|
|
texture_top + self.p.body_bottom_ratio * (window[3] - texture_top))))
|
|
|
@@ -1594,7 +1606,7 @@ class EvidenceV2:
|
|
|
)
|
|
|
if body is not None:
|
|
|
gap_m = 0.0
|
|
|
- if (body is None and texture_top > 0.0 and state == 2 and posts == 0
|
|
|
+ if (body is None and texture_top > 0.0 and state == 2 and posts <= 1
|
|
|
and box.y1 > texture_top + 0.02 * wh
|
|
|
and (body_stats is None
|
|
|
or body_stats["posts"] <= self.p.max_door_posts)):
|