Skip to content

Latest commit

 

History

History
60 lines (32 loc) · 1.66 KB

README.md

File metadata and controls

60 lines (32 loc) · 1.66 KB

Fμτsτατs

logo

Football Statistics generator with Python

Introduction

This Python code provides a basic statistic/visualization generator than can be use to asses the percentage of posession for each team, the heatmap of the ball and diferent players. It expandes the roboflow player object dection. Its is not perfect and was just intended as a fun personal project.

Ball posession

08fd33_4.webm

It uses a YOLOV8 model to detect players in every frame, a tracking Bytrack model to asign a id to every player and a KNearestNeighbour algorithm to cluster the players in two teams based on the HSV of the object detection bounding box.

Ball tracking across the field

08fd33_0.webm

It uses the previous YOLOV8 model to predict the ball and a new model to predict the keypoints of the football field needed to compute the homography matrix.

Bird view

08fd33_0_warped.webm

It uses the homography matrix to compute the bird view of the football field and the ball trajectory using some open-cv modules.

Code structure

An overview of the code structure can be found here

Instalation

  • Clone ByteTrack
  • Clone Yolov5
  • Install project with :
pip install -e .

Usage

python launch.py hsv-team-posession-tracking

or

python launch.py ball-homography

logo