From b8d82bdef56b67217d814739d2f42d0b7892553d Mon Sep 17 00:00:00 2001 From: JianMiau Date: Wed, 3 Jun 2026 21:33:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E4=BD=8D=E6=95=B8=E6=BF=BE=E6=B3=A2?= =?UTF-8?q?=E8=A6=96=E7=AA=97=205=20->=207:=20=E4=BF=AE=E6=AD=A3=E8=A1=8C?= =?UTF-8?q?=E9=A7=9B=E4=B8=AD=E9=80=A3=E7=BA=8C=E8=AE=80=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E8=A2=AB=E8=AA=A4=E5=88=A4=E6=88=90=E5=81=9C=E8=BB=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit '讀不到當0' 遇到行駛中連續 3 格空白時,5 格視窗會被 3 個 0 佔多數而誤判停車, 再被起步門檻串到後面真停車一起誤刪(實例: 02 的 02:50~03:11 時速29~88行駛被剪)。 視窗放大到 7 可容忍最多 3 連續空白,行駛不再誤判;同時仍能蓋掉停車時的孤立誤讀。 實測 02: #3 由 02:50~03:32(42s)縮為 03:11~03:32(21s),只剪真停車; 05:18~07:45 仍正確合為一段。 本次修正由 Claude Opus 4.8 (1M context) 協助處理。 Co-Authored-By: Claude Opus 4.8 (1M context) --- auto_remove_redlight.py | 4 +++- config.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/auto_remove_redlight.py b/auto_remove_redlight.py index 34e6dda..914ed11 100644 --- a/auto_remove_redlight.py +++ b/auto_remove_redlight.py @@ -100,7 +100,9 @@ MAX_SPEED = 300 # 合理時速上限,超過視為誤判(雜 # 打斷,導致紅燈段沒被完整移除。對每秒速度做「補空值 + 中位數濾波」後再判定: # - 孤立的雜訊讀數會被周圍的 0 吃掉(中位數) # - 辨識失敗的空值會用前後最近的有效讀數補上 -SMOOTH_WINDOW = 5 # 中位數濾波視窗(取樣點數,奇數)。5 = 看前後各 2 秒 +SMOOTH_WINDOW = 7 # 中位數濾波視窗(取樣點數,奇數)。7 = 看前後各 3 秒。 + # 要夠大才能蓋過「行駛中連續讀不到」的空白(被當0), + # 避免把高速行駛誤判成停車(視窗 7 可容忍最多 3 連續空白)。 DEPART_SECONDS = 8.0 # 起步門檻(秒): 兩段停車中間「持續行駛」需超過此秒數, # 才算真正起步而保留;否則(起步 N 秒內又停)視為仍在等待, # 連同那段短暫蠕動一起剪掉(處理車陣走走停停)。 diff --git a/config.json b/config.json index ebd76fc..b1a55ae 100644 --- a/config.json +++ b/config.json @@ -10,7 +10,7 @@ "stop_seconds": 4.0, "speed_threshold": 0, "min_confidence": 0.5, - "smooth_window": 5, + "smooth_window": 7, "depart_seconds": 8.0, "cut_before_stop": 2.0, "keep_after_stop": 2.0,