Skip to content

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

Notifications You must be signed in to change notification settings

afonsomartingo/football_analysis

Repository files navigation

Football Analysis System

Overview

This project focuses on the detection and tracking of players, referees, and footballs within video footage using the YOLO (You Only Look Once) object detection model. By training the model, we aim to enhance its accuracy. Additionally, players are grouped into teams based on their jersey colors through pixel segmentation and clustering using KMeans. This enables the assessment of a team's ball possession percentage during matches. We employ optical flow techniques to analyze camera movements between frames, providing precise measurements of player actions. With perspective transformation, we can better visualize the scene's depth, converting measurements from pixels to meters. Furthermore, we calculate each player's speed and total distance covered. This project integrates various concepts and addresses real-world challenges.

output_video.1.webm

Technologies Used

The following technologies and libraries are essential for this project:

  • YOLO: For object detection
  • KMeans: For color segmentation and clustering of jersey colors
  • Optical Flow: For analyzing camera motion
  • Perspective Transformation: To depict depth and spatial relations
  • Speed and Distance Metrics: To evaluate player performance

Pre-trained Models

Example Video

Installation Requirements

To execute this project, make sure to have the following libraries installed:

  • Python 3.x
  • ultralytics
  • supervision
  • OpenCV
  • NumPy
  • Matplotlib
  • Pandas

Credits

This project draws inspiration from the original Football Analysis Project, used for educational purposes only.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published