Skip to content

Latest commit

 

History

History
114 lines (77 loc) · 3.69 KB

README.md

File metadata and controls

114 lines (77 loc) · 3.69 KB

Player Classification

This repository contains the code for our two soccer player classification methods.

Player classification model

The repository includes:

  • Source code for training the models
  • Training/testing code for SoccerNet-V2

The code is documented and designed to be easy to extend. If you use it in your research, please consider citing this repository (bibtex below).

⚽ Requirements

Python 3.9, PyTorch 1.12.1, and other common packages listed in environment.yml. (A Conda environment can be created from it following the instructions below.)

SoccerNet Requirements:

To train or test on SoccerNet V2 and V3, you'll also need:

⚽ Setup

  1. Clone this repository:
git clone https://github.com/gorayni/player_classification
  1. Create and initialize a conda environment:
cd player_classification
conda env create --name player --file environment.yml
conda activate player

NOTE: Another way to create the conda environment is to run the conda_environment.sh file.

  1. Link the SoccerNet dataset inside the datasets directory:
ln -s /path/to/soccernet data/soccernet

⚽ Training/Testing

After activating the conda environment described in the setup section you can train/test the network as follows:

Backbone CNN

The backbone network is trained on patches obtained in an unsupervised way using metric learning.

python main.py -c config/transformer.json -a backbone --m data/train_v2.csv

Clustering

Labels for unseen matches are obtained by clustering their embeddings from the backbone network.

python main.py -c config/transformer.json --cluster --sequences data/snv3_matches.json -b weights/backbone.pth
python main.py -c config/transformer.json --cluster -m sandbox.csv -b weights/backbone.pth

Transformer

After obtaining the labels through clustering the embeddings of the backbone network, the transformer is trained by:

python main.py -c config/transformer.json -a transformer --sequences data/snv3_matches.json -b weights/backbone.pth

Training a single transformer:

python main.py -c config/transformer_snv2.json -a transformer -s data/splits_v2.json -b weights/backbone.pth

⚽ Testing Previous Methods

python main.py -c config/cnn.json -a cnn -m data/test_v2.csv

Citation

The paper is freely available here. If you use this code, please cite the following paper:

Alejandro Cartas, Coloma Ballester, and Gloria Haro. "Two Weakly Supervised Approaches for Role Classification of Soccer Players" ACM MMSports Workshop (2024).

@inproceedings{cartas2024PlayerClassification,
author = {Cartas, Alejandro and Ballester, Coloma and Haro, Gloria},
title = {Two Weakly Supervised Approaches for Role Classification of Soccer Players},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
booktitle = {Proceedings of the 7th International ACM Workshop on Multimedia Content Analysis in Sports},
series = {MMSports '24}
location = {Melbourne, Australia},
year = {2024},
}

Acknowledgements

This project is a collaboration effort between MOG Technologies and the Universitat Pompeu Fabra. The authors acknowledge support by MICINN/FEDER UE project, ref. PID2021-127643NB-I00, and the support of the European Commission, Horizon Europe Programme, EMERALD Project 101119800.

Ministerio   EMERALD