Back to Projects

Sports Analytics Computer Vision System

Master's thesis project: real-time player tracking, body orientation estimation, and scanning behavior analysis for football matches using state-of-the-art computer vision.

May 5, 2025
Computer VisionYOLOv8PyTorchDeepSORTSports Analytics

Overview

My master's thesis at Vrije Universiteit Amsterdam, developed at the Sports Intelligence Lab. A lot of statistical analysis and annotation in football is done manually by humans — this thesis automates that process by proposing a computer vision pipeline for two specific statistics: determining the body orientation of a player receiving the ball at a pass event, and counting the number of scanning checks a player performs before receiving the ball.

Pipeline Architecture

Technical Architecture

  • Player Detection: YOLOv8 for real-time detection of players, with team assignment via HSV color analysis and K-means clustering
  • Ball Detection: Dedicated YOLOv8 model trained on custom Roboflow datasets at 2560px resolution
  • Multi-Object Tracking: Norfair tracker with Kalman filters for maintaining player identities across frames
  • Pass Event Detection: Automated detection of pass events based on ball possession changes and same-team transfers
  • Pose Estimation: GluonCV ResNet-152 for extracting 17 body keypoints per player
  • Body Orientation: Shoulder keypoint vector analysis classifying orientation into 3 categories (Open, Closed, Half-Open) with 75% accuracy
  • Scan Counting: Angular velocity calculation from yaw angles with a 45-degree/second threshold to count rapid head movements

Player Detection and Tracking Output

Body Orientation System

The body orientation system classifies a player's facing direction relative to the opponent's goal at the moment of receiving a pass. Using shoulder keypoint vectors, it determines whether a player has an "open" body (facing the goal), "closed" (facing away), or "half-open" orientation — a key tactical metric for coaching staff.

Pose Estimation and Body Orientation

Using GluonCV's keypoint detection, the system extracts shoulder coordinates to compute orientation vectors. The shoulder vector, its perpendicular (forward-facing direction), and the angular difference to the goal determine the player's body orientation category.

Keypoints detected by GluonCV (a) and orientation vectors: shoulder (red), perpendicular (blue), forward (green), angular difference (purple) (b)

Body Orientation Classification: Open, Closed, Half-Open

Key Results

  • Body orientation: 75% accuracy validated against professional analyst annotations on Women's Super League match footage (Brighton vs. Aston Villa, 2024/25 season)
  • Scan counting: Established framework for automated analysis, though video resolution proved to be the primary limitation for facial keypoint accuracy
  • Published: Semi-Automatic Estimation of Body Orientation in Football at ACM MMSports '25

Technologies

PyTorch, OpenCV, YOLOv8, GluonCV, Norfair, MXNet, Python