Skip to content

KaziiBotashev/football_classifier

Repository files navigation

Football player classifier

Identification with API

Setup API

In parent directory run

sudo bash run_docker_api.sh

It will automatically download all needed files and run Docker container.

Make a query

Terminal

curl -X POST "http://127.0.0.1:5000/predict/?use_individual_models=true" -H  "accept: application/json" -H  "Content-Type: multipart/form-data" -F "file=@/path/to/your/image.png;type=image/png"

You need to specify which approach will be used for classification by setting the variable use_individual_models in your query. Set true to use a method based on three separate sequential models, or false to use one universal model.

Or open GUI in your browser with following link http://127.0.0.1:5000/docs

Reuse data preprocessing and model training

If you want to train new model follow these steps. Both steps will automatically download all needed model weights and datasets. First of all change to deep learning part's directory with

cd deep_learning_model

Using virtual environment

Setup virtual environment by running

source create_venv.sh

To launch data preprocessing pipeline

jupyter-lab data_preprocessing.ipynb

To train new model

cd training
python3 train.py

To evaluate existing model:

cd training
python3 eval.py

Using Docker

sudo bash run_docker_train.sh

All preprocessed data already downloaded during env/docker initialization and you can skip next step and start train new models.

However, you can launch data preprocessing pipeline using:

jupyter notebook --ip 0.0.0.0 --no-browser --allow-root

Navigate to deep_learning_model/training and open data_preprocessing.ipynb notebook.

To train new model

cd training
python3 train.py <model_num>

To evaluate existing model:

cd training
python3 eval.py <model_num>

Here <model_name> is variable that used to specify which model to be trained. Set 0 to train model that predicts 5 classes such as:

0 - blue team 1 - white team 2 - main referee 3 - side referee 4 - others

Set 1 to train model that predicts ID of the blue team players Set 2 to train model that predicts ID of the white team players Set 3 to train one universal model that predicts any class of 25 used

After evaluation see ROC curve plot in directory and balanced accuracy in plot's name last value.

To evaluate two-step algorithm use:

cd training
python3 evaluate_combination_models.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages