A lightweight real-time system for tracking soccer ball movement in broadcast footage using a Kalman Filter and YOLOv11. Designed for handling partial occlusions, missed detections, and camera motion using confidence-aware prediction.
⚽ Built with Football Love on highly Caffeinated Code Sessions ☕
- Detect soccer ball, players, goalkeepers, and referees in match footage.
- Predict the ball’s position even when occluded or not detected.
- Compare predicted vs. actual positions using error metrics.
YOLOv11(via Ultralytics) for detectionKalman Filter(pykalman) for trajectory trackingSupervisionfor annotated video renderingRoboflowfor model hostingONNX RuntimeGPU acceleration on Colab
-
🔍 Detection
YOLOv11 detects objects in each video frame (ball, players, etc.). -
📈 Tracking
A Kalman Filter smooths and predicts ball positions based on confidence scores. -
🎥 Visualization
Annotated video is generated with actual vs. predicted positions. -
📊 Evaluation
Errors (mean, RMSE, max) between prediction and ground truth are visualized and stored.
Tracks [x, y, vx, vy, ax, ay] using a constant acceleration model:
state = [position_x, position_y, velocity_x, velocity_y, acceleration_x, acceleration_y]
| Annotated Detection | Kalman Prediction | CSV Logging |
|---|---|---|
| ✅ Players & Ball | ✅ Predicted Trajectory | ✅ Saved as positions.csv |
Object-Tracking-EKF-YOLO/
├── track_ball.py
├── kalman_filter.py
├── yolov11_training.ipynb
├── inference.ipynb
├── vids/
│ ├── 121364_0.mp4
│ └── 121364_0_result_1.mp4
└── positions.csv
- YOLOv11 via Ultralytics
- Roboflow dataset:
football-players-detection-3zvbc Supervisionlibrary for annotations