An open API service indexing awesome lists of open source software.

https://github.com/itsluketwist/sports-image-prediction

Predicting a sport from an image using PyTorch and CNNs!
https://github.com/itsluketwist/sports-image-prediction

cnn cnn-pytorch pytorch sports

Last synced: 3 months ago
JSON representation

Predicting a sport from an image using PyTorch and CNNs!

Awesome Lists containing this project

README

        

# **sports-image-prediction**

A simple python project that takes an image of a sport, and uses a CNN to make a prediction about
which sport it is!

![check code workflow](https://github.com/itsluketwist/sports-image-prediction/actions/workflows/check.yaml/badge.svg)





MIT License


Python 3


PyTorch

## *usage*

Follow `predict_sport.ipynb` for easy access to the prediction code.

Otherwise install with:

```shell
pip install -e .
```

And run predictions (or re-train / re-evaluate the model) via the command line using `run`.

```shell
run predict -i output/sports_mod_tuned.pth -s sample/basketball.png
```

To retrain the model, check and update the hyperparameters in `src/train.py`, then run:

```shell
run train
```

## *set-up and development*

Clone the repository code:

```shell
git clone https://github.com/itsluketwist/sports-image-prediction.git
```

Once cloned, install the requirements locally in a virtual environment:

```shell
python -m venv venv

. venv/bin/activate

pip install -e ".[dev]"
```

Install and use pre-commit to ensure code is in a good state:

```shell
pre-commit install

pre-commit autoupdate

pre-commit run --all-files
```

## *inspiration*

Wanted to learn more about neural networks, and get some experience building wqith PyTorch.