True match is shown with blue border | True match is shown with blue border |
Sportsreid is useful for re-identifying the same player in different frames of a broadcast video of a match. This repo is built on top of SoccerNet Re-Identification and the popular Torchreid. It is currently ranked #2 on the test split leaderboard for the SoccerNet 2022 ReIdentification challenge.
A detailed discussion of our approach can be found on arXiv.
If you use this repository and/or models in your research, please cite
@misc{https://doi.org/10.48550/arxiv.2206.02373,
doi = {10.48550/ARXIV.2206.02373},
url = {https://arxiv.org/abs/2206.02373},
author = {Comandur, Bharath},
title = {Sports Re-ID: Improving Re-Identification Of Players In Broadcast Videos Of Team Sports},
We provide trained models and config files for different network architectures in the table below. These models were pretrained on ImageNet and then trained on the train split of the SoccerNet Re-Identification dataset.
name | #params | Resolution | mAP | rank-1 | chkpt | config |
---|---|---|---|---|---|---|
ResNet50-fc512 | 24.6M | 256x128 | 81.8 | 76.1 | model | config |
OSNet_x1_0 | 2.2M | 256x128 | 83.4 | 78.0 | model | config |
DeiT-Tiny/16 | 5.5M | 224x224 | 82.2 | 76.2 | model | config |
DeiT-S/16 | 21.7M | 224x224 | 84.3 | 79.4 | model | config |
ViT-B/16 | 57.7M | 224x224 | 86.0 | 81.5 | model | config |
ViT-L/16* | 303.6M | 224x224 | 89.8 | 86.7 | model | config |
The ViT-L/16* model is trained with 5 different random seeds for initialization and then the weights are averaged across these seeds to further increase mAP. This is inspired by this paper.
# cd to your preferred directory and clone this repo
git clone https://github.com/sportsreid/sportsreid.git
# create environment
cd sportsreid/
conda create --name sportsreid python=3.7
conda activate sportsreid
# install dependencies
# make sure `which python` and `which pip` point to the correct path
pip install -r requirements.txt
# install torch and torchvision (select the proper cuda version to suit your machine)
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
# install sportsreid (don't need to re-build it if you modify the source code)
python setup.py develop
python benchmarks/baseline/main.py --config-file <path to config yaml file>
This will automatically download the SoccerNet data as well. If you want to download data separately, please look at the SoccerNet github page
python benchmarks/baseline/main.py --config-file <path to config yaml file> test.evaluate True model.resume <path to model checkpoint>