Skip to content

This repository contains a computer vision/machine learning football project that uses YOLO for object detection, Kmeans for pixel segmentation, and perspective transformation to analyze player movements in football videos

Notifications You must be signed in to change notification settings

zakroum-hicham/football-analysis-CV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

--> Football Analysis Project

Project Overview

The goal of this project is to detect and track players, referees, and footballs in a video using YOLO, a leading AI object detection model. I also trained the model to improve its performance. Additionally, we assigned players to teams based on the colors of their t-shirts using Kmeans for pixel segmentation and clustering. We also assigned the ball to a player during gameplay. With this information, we measured a team's ball acquisition percentage throughout the match. Furthermore, we implemented perspective transformation to convert the scene into a 2D graphic,, allowing us to measure a player's movement in meters rather than pixels.

Features

  • Object Detection: Detect and track players, referees, and footballs using YOLO.
  • Player-Team Assignment: Assign players to teams based on t-shirt colors using KMeans clustering.
  • Ball Assignment: Assign the ball to a player during gameplay.
  • Ball Possession Analysis: Measure team ball possession throughout the match.
  • Movement Analysis: Track player movements and measure distances in meters using perspective transformation.

Tech Stack

  • Programming Language: Python
  • Framework: TensorFlow/PyTorch (for YOLO)
  • Libraries: OpenCV, NumPy, scikit-learn, matplotlib, supervision, ultralytics
  • Object Detection Model: YOLO (You Only Look Once)
  • Clustering Algorithm: KMeans (for team assignment)
  • Transformation: Perspective transformation (for real-world measurement)

Trained YOLO Model Results

Model Summary (Training)

training_res

Model Summary (Validation)

validation_res

Result

results

Final Result (Demo)

output3.1.mp4

Challenges and Improvements

  • Challenges:

    • Distinguishing players with similar t-shirt colors.
    • Tracking Players in complex game scenarios.
  • Potential Improvements:

    • Training the YOLO with more Data (I only use a small DataSet)
    • Improve goalkepper team asigner
    • Use more advanced clustering techniques for better player-team assignment.

About

This repository contains a computer vision/machine learning football project that uses YOLO for object detection, Kmeans for pixel segmentation, and perspective transformation to analyze player movements in football videos

Topics

Resources

Stars

Watchers

Forks