Giter Site home page Giter Site logo

spiideo / soccersegcal Goto Github PK

View Code? Open in Web Editor NEW
17.0 6.0 3.0 17.21 MB

Soccer pitch segmentation and camera calibration in two steps. Step 1, pixelwise segmentation of an broacast image of a soccer game into six different clases defined by the line markings. Step 2, a differential-rendering optimizer that tries to estimate camera parameters from such segementations.Trained on SoccerNet.

License: MIT License

Python 100.00%
machine-learning 3d deep-learning soccer differentiable-rendering segmentation soccer-analytics soccernet camera-calibration pytorch

soccersegcal's Introduction

Soccer Pitch Segmentation and Camera Calibration

Official implementation of Spiideo's contribution to the 2023 SoccerNet Camera Calibration challange.

Example segmentatoions Example optimization

It includes a modified version of the SoccerNet Camera Calibration Development Kit in sncalib.

Install

Install pytorch3d following it's installation instaructions, for example

python -mpip install --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1120/download.html

Install remaining requirements and setup python to run the modules from the checked out source

python -mpip install -r requirements.txt
python setup.py develop --user

Data

Download the SoccerNet into data/SoccerNet/calibration-2023

from SoccerNet.Downloader import SoccerNetDownloader as SNdl
soccerNetDownloader = SNdl(LocalDirectory="data/SoccerNet/calibration-2023")
soccerNetDownloader.downloadDataTask(task="calibration-2023", split=["train", "valid", "test", "challenge"])

Run the dataloader to display the images and generated segmentations:

python soccersegcal/dataloader.py

Train Segmentation

Train the segmentation model (add --help to se availible options):

python soccersegcal/train.py

To monitor training progress, compare different runs and get hold of the resulting checkpoint.ckpt:

mlflow ui

The checkpoint can also be found by digging through the mlruns dir.

Estimate Cameras

To use the trained segmentation model to estimate camera parameters for the first two samples (index 0 and 1) in the validation set while visualizing the optimization:

python soccersegcal/estimate_cameras.py -c path/to/segmentation/checkpoint.ckpt -i [0,1] -s

To estimate all the cameras in the test set without visualisation (faster):

python soccersegcal/estimate_cameras.py -c path/to/segmentation/checkpoint.ckpt -p test

To se other options:

python soccersegcal/estimate_cameras.py --help

The estimated cameras will be saved in the cams_out directory. To run the SoccerNet evaluation on them:

python sncalib/evaluate_camera.py -s data/SoccerNet/calibration-2023/ --split test -p cams_out/

Pretrained weights

Pretrained weights can be downloaded from the table below. It also lists hyperparameters with non-default values.

Hyperparameters Combined Metric Accuracy@5 Completeness
epochs=27 0.53 52.95 99.96 snapshot.ckpt

soccersegcal's People

Contributors

hakanardo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

soccersegcal's Issues

Model weights and hyperparameters

Hello,
I'm asking if you are planning to upload final weights of the learned model. It would be very helpful to me and definitely to other people trying out this model later on.
Also, could you please elaborate on hyperparameters of your best model? Which learning rate did you choose, how many epochs did the model require to reach the final result or what batch size was optimal for you.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.