Introduction

In this post, I will show how I detect and track players using Yolov3, Opencv and SORT from video clip, and turn the detections to the bird’s-eye view as shown above.

  1. Object Detection (Yolo and Opencv)
  2. Object Tracking (SORT)
  3. Perspective Transform (Opencv)

Football video dataset

In order to have a stable tracking and perspective transform, I need a video clip without camera moving around. I downloaded the video from IPL Ball Detection Datasets. Please be noted that the ball is not tracked in this project, it was already tracked (green bounding box) from the source.

Image for post

Video input for this project (downloaded from here)

Object Detection

The first step is to load the video and detect the players.

I used the pre-trained Yolov3 weight and used Opencv’s dnn module and only selected detections classified as ‘person’.

I drew bounding boxes for detected players and their tails for previous ten frames.

Image for post

Player tracking using Yolov3 and Opencv

Looks like the pre-trained model is doing quite okay.

Object Tracking

Next I want to track the player and assign unique IDs to them. I used Alex Bewley’s SORT algorithm(simple online and realtime tracking), which I applied to my previous work.

#machine-learning #deep-learning #sports #soccer #artificial-intelligence #deep learning

How to track football players using Yolo, SORT and Opencv.
38.10 GEEK