https://github.com/davanstrien/flyswot-gym
🦾 training flyswot models (fairly) easily
https://github.com/davanstrien/flyswot-gym
Last synced: 11 months ago
JSON representation
🦾 training flyswot models (fairly) easily
- Host: GitHub
- URL: https://github.com/davanstrien/flyswot-gym
- Owner: davanstrien
- License: apache-2.0
- Created: 2022-01-31T09:28:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T18:01:27.000Z (almost 4 years ago)
- Last Synced: 2025-07-14T15:54:48.784Z (11 months ago)
- Language: Jupyter Notebook
- Size: 3.31 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# flyswot-gym 🦾
> “When you go through hardships and decide not to surrender, that is strength.” - Arnold Schwarzenegger
`flyswot-gym` is a set of functions for helping to train [`flyswot`](github.com/davanstrien/flyswot/) models. This is a WIP and mainly intended for our particular workflow.
## 🚀 Training/updating a new flyswot model
These steps will also work for training other image classification models thought the pipeline isn't intended to cover all possible scenarios to you may not get good results if you are doing something very different.
### Loading our data
The data loading workflow described below assumes that you are working with data structured in an image folder structure. In this structure images are sorted into subdirectories with those directories representing the label for that image. For example:
```
Images/
dogs/
dog1.jpg
dog2.jpg
cats/
cats1.jpg
cats2.jpg
```
We use the Hugging Face hub to store the data we are going to use for training. To upload our data from a local file system to the hub, we will use a command line tool `hugit`. This uploads our data to the hub and gets it into a format that can be used to train a computer vision model. For full instructions on using `hugit` please refer to the [docs](https://hugit-cli.readthedocs.io/en/latest/).
## Training/updating a model
Once you have your data uploaded to the 🤗 hub we can train our or update a new model. There is a notebok which helps us do this 🦾
## Using our model
For using a new model you can use [flyswot](https://github.com/davanstrien/flyswot/). You can pass in the model ID for your model to let `flyswot` know which model it should use for making predictions.
```
Usage: flyswot predict directory [OPTIONS] DIRECTORY CSV_SAVE_DIR
Predicts against all images stored under DIRECTORY which match PATTERN in the
filename.
By default searches for filenames containing 'fs'.
Creates a CSV report saved to `csv_save_dir`
Arguments:
DIRECTORY Directory to start searching for images from [required]
CSV_SAVE_DIR Directory used to store the csv report [required]
Options:
--model-id TEXT The model flyswot should use for making predictions
[default: flyswot/convnext-tiny-224_flyswot]
--pattern TEXT Pattern used to filter image filenames
--bs INTEGER Batch Size [default: 16]
--image-formats TEXT Image format(s) to check [default: .tif]
--help Show this message and exit.
```