Feat/mike/89 bbox analysis within roi#91
Draft
kei-asami wants to merge 18 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
対応Issue
issue #89
なぜやったか
カメラ映像から入庫・出庫台数を自動でカウントする仕組みが必要だったため.従来の単純な座標比較では蛇行・一時停止・bboxの揺れによる誤判定が課題だった.
何をやったか
raspi/roi-counter/に,ROI内を通過する車両の進行度sを用いた入出庫カウントシステムを実装した.src/):ROI判定・進行度計算・状態機械・描画scripts/):ROI確認・単体分析・閾値スイープ・複数動画MAE算出analysis/):スイープ結果のヒートマップ可視化main.py)tests/):21件全通過どのように実装したか
ROI内に設けた3つのバンド(入口側・中央・奥側)を車両が横断したかどうかで入出庫を判定するバンドベース状態機械を採用した.
s = (y_max - y) / (y_max - y_min)(0.0=道路側,1.0=駐車場側)s < s_lowで入庫候補(IN_CANDIDATE),s > s_highに到達で入庫確定2動画(IMG_2787, IMG_2788)に対して
s_low(0.10〜0.40)×s_high(0.60〜0.90)の49パターンをスイープした結果,s_high ∈ {0.60, 0.65}の14パターンで MAE = 0.0 を達成した.検出モデルは YOLOv8s,検出クラスは car(2)と truck(7).
画面スクリーンショット等
テスト項目
uv run pytest raspi/roi-counter/tests/が全件通過することを確認scripts/01_show_roi.pyを実行してROIとバンドラインが正しく描画されることを確認scripts/02_run_analysis.pyを実行してdata/outputs/に result.json・vehicles.csv・frames.csv・annotated.mp4 が出力されることを確認scripts/03_sweep_params.pyを実行してdata/outputs/に results.csv が出力されることを確認scripts/04_multi_video_mae.pyを実行してdata/outputs/に results.csv・mae_summary.csv が出力されることを確認main.pyを実行して入庫・出庫カウントが表示されることを確認備考