Highlights generation of Soccer Matches
Project Areas: Computer Vision, Image Processing, Audio Processing, Machine Learning, Object Detection.
Aim:
- The aim of this project is to automate the process of generating highlights of a match using machine learning.
- Highlights are at times more important than the match itself because most would not have the time to watch the whole match and would rather prefer to watch the important parts of a match.
- Shot Boundary detection is used to split the input video into its constituent shots.
- Chi-squared algorithm has been implemented for shot boundary detection in OpenCV as it is good for detecting hard cuts in videos.
- We downloaded 4 soccer match videos of varying lengths and ran the shot detector algorithm to split them into constituent shots. The number of shots amassed to 800. These shots were classified as highlights and non-highlights manually. We ended up with a 3:1 ratio of negatives to positives. Later, we extracted audio from the shots and created separate corresponding audio files using ffmpeg.
- PyAudioAnalysis is being used for extracting audio features as it gives 34 relevant features for a single audio file including MFCC features and audio amplitude.
- For visual features, the ball and goalposts were detected in frames by training different tensorflow object detection models.
- We used 3 different models - Faster-RCNN with Inception, SSD Lite with MobileNet, SSD with Inception were tried.
- Finally, SSD Lite with Mobilenet was chosen because of its speed.
- a) Average Size of a Goalpost
- b) Percentage of frames in which Goalpost was detected
- c) Position of Goalpost
- Now for each shot in training dataset a feature vector comprising of audio and visual features as well as the shot duration was generated and this was trained on scikit-learn's object detection model.
- Given an input match video it was divided into shots and then for each shot its features were extracted and its probability of being a highlight was computed using the trained SVM model.
- Finally the shots with highest probability were added into output video as long as the probability was greater than 0.5 and the maximum length of output video was not exceeded.
- Selected Shots were stitched using MoviePy to generate the highlights.
Shot Boundary Detection:
Dataset Creation:
Audio Feature Extraction:
Object Detection:
Visual Feature Computation:
The following features have been computed over certain intervals of a shot:
Prediction using Scikit-Learn’s SVM: