feat: add SPEED mode with gated homography (PR 3)#61
Draft
AlexBodner wants to merge 6 commits into
Draft
Conversation
Introduce pitch detection cache, speed badges, plain minimap, and Mode.SPEED. Sequence gating lives on fit_pitch_homography via HomographyGateState instead of a separate tracker class. Co-authored-by: Cursor <cursoragent@cursor.com>
Pitch detector options belong in PR3 where keypoint cache and homography-backed speed are wired. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep m/s computation in speed.py, dedupe model and min-speed constants, reuse minimap transforms for gap-fill, drop unused homography helper, and document SPEED in the soccer README. Co-authored-by: Cursor <cursoragent@cursor.com>
fit_pitch_homography is ungated per-frame fit only. Temporal reproj and jump gating uses local locked/last_was_accept vars in the replay loop. Co-authored-by: Cursor <cursoragent@cursor.com>
Reuse DEFAULT_*_MODEL_ID in main.py, align pitch detector threshold API with player detector, document gate/sprint constants, and type _speed_by_tid transformer. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore local PITCH_DETECTION_MODEL_PATH for legacy modes and use inline analytics model-id defaults instead of library constants. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
SPEEDanalytics mode: per-player ground-speed badges (m/s), direction dots, and a translucent radar minimap.detection.py), keypoint cache, and homography replay gating for stable m/s metrics.examples/soccer/speed.py; shared motion primitives stay inkinematics.py.Stack: PR 1 → PR 2 (base) → this PR
Demo
SPEEDmode — m/s badges + radar minimap (08fd33_0.mp4, truncated preview).Download full demo clip
Homography design
fit_pitch_homography— ungated per-frame fit (minimap).replay_gated_transforms— temporal reproj + jump gating for speed badges (loop-local state, no gate class).gap_fill_speed_transforms— gated H where accepted, else ungated minimap H for badge display.Scope
--pitch-detector,--pitch-model-path,--pitch-model-id)VideoTrackingSession(gap_filled_transforms_by_frame,minimap_transforms_by_frame)motion.py(shared with PR4 distance labels)Not included: distance traces, goal shading, defender locks, ball/possession/pass analytics.
Test plan
python main.py --source_video_path data/2e57b9_0.mp4 --target_video_path data/renders/speed-test.mp4 --mode SPEED --max-frames 90 --tracker bytetrack--cache)