Skip to content

levan92/torch_img_clf

Repository files navigation

PyTorch Image Classification

Introduction

Simple straightfoward repo for simple task of image classsification. Uses yaml config files to set hyperparameters for training. And loads data through list-style datasets. Training logs are written to console and also to tensorboard.

Dataset Format

Each dataset (train/val/test) is defined in csv files:

<path to image>,<class name>
...
...
...
<path to image>,<class name>

Accompanied by class names in classes.txt

classA
classB
...
classZ

To Train

  1. Copy configs/config-example.yaml and modify accordingly.
  2. python3 train.py --config <path to config>

To Test

  1. Copy configs/config-example.yaml and modify accordingly. Make sure pointing to the right path of the trained weights.
  2. python3 test.py --config <path to config>

For Inference

  1. Copy configs/config-infer-example.yaml and modify accordingly. Make sure pointing to the right path of the trained weights.
  2. python3 infer.py --config <path to config>
  3. Look at the example under the if __name__=='__main__' portion of infer.py and adapt to your own application accordingly. Main thing is instantiating the Classifier object with your config yaml file and running its predict method.

Special notes

  • Augmentations/preprocessing transformations are defined in their own .yaml files, supports torchvision.transforms.

About

PyTorch Image Classification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published