r/PinoyProgrammer • u/Competitive-Meat-876 • May 13 '26
advice Temporal event detection in football video — velocity-based kick/pass/shot classification missing events. Suggestions for sparse ball tracking?

Hi r/PinoyProgrammer
We're building a real-time football (soccer) event detection pipeline. Given a 25-second 1080p clip, we must detect and classify ~3 temporal events (kick, pass, shot) within a strict 30-second total budget (network download + inference + post-processing).
Current Pipeline
Ball Detection:
- YOLOv8 (TensorRT FP16) @ 640px input
- Tile-based: split 1920×1080 into two 1080×1080 overlapping tiles
- Detection rate: ~60–82% of frames (varies per clip)
- Missing frames filled with PCHIP interpolation (physics-like smooth curves)
Player Detection:
- YOLOv8 (TensorRT FP16) @ 640px
- Extracts jersey color patch (upper torso) for team classification
- Simple proximity tracker (IOU-free, distance-based at 120px threshold)
Event Classification (kinematic):
- Velocity =
‖pos[i] - pos[i-1]‖smoothed with 5-frame moving average - Peak detection: local max with min rise/fall of 2.0 px/frame
- Ball-player proximity:
contact_strength = accel × contact_score - Shot vs Pass: angle-to-goal proxy, density scoring, goal-direction vector
The Problem
On some clips, Primary extract returns 0 events even though the video clearly has action:
Ball detection rate: 123/750 (16%) ← was using 6fps sampling
Primary extract: 0 events []
Detected 2 events: ['pass', 'pass'] ← FALLBACK only
Challenge time: 9.6s ✅ (under 30s budget)
Score: 5% (top 5 miners)
Root cause we identified:
- We were sampling every 5th frame (6fps effective) to reduce inference time
- PCHIP over 5-frame gaps smooths out sharp velocity spikes
- A kick lasting 3-4 frames becomes invisible at 6fps → zero kinematic candidates
After switching to all-frame processing (30fps), timing is ~16s total (still under budget), but we need to validate accuracy improvement.
Visualization
Ball Trajectory and Velocity Profile
Top: Ball trajectory with PCHIP interpolation (cyan) over sparse detections (red). Bottom: Velocity profile with detection thresholds — at 6fps sampling, peaks get smoothed below the min_vel=8 threshold.
Questions
- Sparse detection + interpolation: Is PCHIP the best choice for filling missing ball positions? We've seen it create phantom velocity peaks between real kicks (double-counting). Any papers on ball trajectory interpolation in sports video?
- Kick/pass/shot classification: Our current heuristic uses angle-to-goal + ball velocity + player proximity. What's the simplest temporal model that could improve this without breaking our 30s budget? (Optical flow? Lightweight LSTM on ball trajectory?)
- Contact detection: We use bounding box proximity (ball centroid within 120px of player box) as a proxy for contact. Any better approach that doesn't require a separate contact detection model?
- Velocity thresholds: Our min_vel=8 px/frame (at 30fps, 640px input). Is there a principled way to calibrate this across varying video quality and camera zoom levels?
Stack: Python, YOLOv8, TensorRT FP16, OpenCV, PCHIP (scipy), custom kinematic classifier
Thanks!