Caltech Birds Versions Save

A set of notebooks as a guide to the process of fine-grained image classification of birds species, using PyTorch based deep neural networks.

v2.2.1a

2 years ago

Various fixes for easier use. Renaming of package directory from cub_tools to pkg. Package can now be installed from with the pkg/ directory. Setup.py has been modified to be more reliable in installing package subdirs.

v2.2.1

2 years ago

Fixed issue with trainer.py not being removed after the refactoring into separate subdir with separate files for each Trainer class. Minor release bump. Changes to Trainer class structures, allowing for different classes to be called from separate files, but from a single module. This avoids any issues with clearml not being installed when loading the training class. Code warns that clearml is not present, as init.py in the trainer sub-dir was setup to test for the installation of the clearml python sdk package.

v2.1.0

2 years ago

Updates:

Included all PyTorch step length rate schedulers for use with default optimizers.

Configuration file changed so that rate scheduler parameters are specified as a key value parameter pair list. For example, specifying the ReduceLROnPlateau scheduler with its parameters.

TRAIN:
    SCHEDULER:
        TYPE: 'ReduceLROnPlateau'
        PARAMS: ['mode', 'min', 'factor', 0.1, 'patience', 10, 'threshold', 0.0001, 'threshold_mode', 'rel', 'cooldown', 0, 'min_lr', 0.00001, 'eps', 1e-08]

v2.0.0

2 years ago

Final release of all the new features with clearml integration.

Refactoring of training scripts to use YACS YAML configuration files

Training scripts have been completely refactored to use a new Trainer class implementation.

YACS YAML config files

All configuration and parameters for the model training is now done through YAML configuration files to specify the model configuration.

Examples can be found scripts/configs for the 3 model libraries that are supported by the cub_tools package.

For a complete list of configuration fields, see cub_tools/cub_tools/config.py.

# my_project/config.py

MODEL:
    MODEL_LIBRARY: 'timm'
    MODEL_NAME: 'resnext101_32x8d'
DIRS:
    ROOT_DIR: '/home/edmorris/projects/image_classification/caltech_birds'
TRAIN:
    NUM_EPOCHS: 40

New training scripts

Models are trainined by calling the training script and specifying the configuration script.

To train a ResNeXt101_32x8d from the TIMM library, the command run from the scripts directory would be as follows:

python train_pytorch_caltech_birds.py --config configs/timm/resnext101_32x8d_config.yaml

An addition to this release is the integration of PyTorch Ignite training framework to give additional training information. The following features have been implemented.

  1. Tensorboard logging. To monitor, simply start Tensorboard with the logging directory watching the models/ directory.
  2. Model checkpointing. Saves out the best model after each iteration.
  3. Early Stopping. Terminates training if the loss does not improve after a specified number of iterations.

To use these extra features enabled by the PyTorch Ignite framework, run the following:

python train_pytorch_ignite_caltech_birds.py --config configs/timm/resnext101_32x8d_config.yaml

The open-source MLOps system ClearML enables the logging and remote execution of machine learning experiments. It logs everything about a model training, including code status (from the repository), environment dependencies, data and model versions and also training metrics and outputs in an easy to use web based GUI. A version of the training script has been developed to be able to deploy model training via the ClearML system. Note, this version uses Ignite as the framework integrates with ClearML to log training metrics out of the box.

python train_clearml_pytorch_ignite_caltech_birds.py --config configs/timm/resnext101_32x8d_config.yaml

V2.0.0-beta-rc1

2 years ago

More model configs added. Complete deployment system for ClearML integrated into the code. Inference now possible from model weights file.

v2.0.0-alpha

3 years ago

Refactoring of training scripts to use YACS YAML configuration files

Training scripts have been completely refactored to use a new Trainer class implementation.

YACS YAML config files

All configuration and parameters for the model training is now done through YAML configuration files to specify the model configuration.

Examples can be found scripts/configs for the 3 model libraries that are supported by the cub_tools package.

For a complete list of configuration fields, see cub_tools/cub_tools/config.py.

# my_project/config.py

MODEL:
    MODEL_LIBRARY: 'timm'
    MODEL_NAME: 'resnext101_32x8d'
DIRS:
    ROOT_DIR: '/home/edmorris/projects/image_classification/caltech_birds'
TRAIN:
    NUM_EPOCHS: 40

New training scripts

Models are trainined by calling the training script and specifying the configuration script.

To train a ResNeXt101_32x8d from the TIMM library, the command run from the scripts directory would be as follows:

python train_pytorch_caltech_birds.py --config configs/timm/resnext101_32x8d_config.yaml

An addition to this release is the integration of PyTorch Ignite training framework to give additional training information. The following features have been implemented.

  1. Tensorboard logging. To monitor, simply start Tensorboard with the logging directory watching the models/ directory.
  2. Model checkpointing. Saves out the best model after each iteration.
  3. Early Stopping. Terminates training if the loss does not improve after a specified number of iterations.

To use these extra features enabled by the PyTorch Ignite framework, run the following:

python train_pytorch_ignite_caltech_birds.py --config configs/timm/resnext101_32x8d_config.yaml

The open-source MLOps system ClearML enables the logging and remote execution of machine learning experiments. It logs everything about a model training, including code status (from the repository), environment dependencies, data and model versions and also training metrics and outputs in an easy to use web based GUI. A version of the training script has been developed to be able to deploy model training via the ClearML system. Note, this version uses Ignite as the framework integrates with ClearML to log training metrics out of the box.

python train_clearml_pytorch_ignite_caltech_birds.py --config configs/timm/resnext101_32x8d_config.yaml

v1.0.0

3 years ago

This is the very first release of this collection of notebooks. Included in this release are all the files associated with the ResNet152 model, including model weights, intermediate activations and all other evaluation files created from the associated notebooks.

Additional files description:

NOTE ON USAGE:

All binaries and archives below should be downloaded to the base directory of the cloned repository on your local system. Extract them from this location root location to create the expected directory structure.

resnet152_model.tar.gz

Archive containing the PTH files for the trained Torchvision ResNet152 model on the CUB-200-2011 dataset. This model was pre-trained with ImageNet weights. Adds directory structure models/classification/resnet152/

resnet152_model_onnx.tar.gz

Archive containing the exported ONNX model file for the trained Torchvision ResNet152 model on the CUB-200-2011 dataset. This model was pre-trained with ImageNet weights. Adds directory structure models/classification/resnet152/ This file can be used to run model inference using the ONNX runtime environment for deployment.

resnet152_model_pkls.tar.gz

All other binary results files from the training and evaluation of the Torchvision ResNet152 model trained on the CUB-200-2011. Adds files to directory structure models/classification/resnet152/

v1.0.0-alpha

3 years ago

This is the very first release of this collection of notebooks. Included in this release are all the files associated with the ResNet152 model, including model weights, intermediate activations and all other evaluation files created from the associated notebooks.

Additional files description:

NOTE ON USAGE:

All binaries and archives below should be downloaded to the base directory of the cloned repository on your local system. Extract them from this location root location to create the expected directory structure.

CUB_200_2011_data_original.zip

Original data from CalTech UCSD with images (unsorted), hand-crafted features data, training and test split designations and more. Will create data/ directory structure.

CUB_200_2011_data_sorted.zip

Sorted images folder, with images split into train and test folders ready to be used with PyTorch Torchvision ImageFolder module. Adds directory data/images/

resnet152_model.tar.gz

Archive containing the PTH files for the trained Torchvision ResNet152 model on the CUB-200-2011 dataset. This model was pre-trained with ImageNet weights. Adds directory structure models/classification/resnet152/

resnet152_model_pkls.tar.gz

All other binary results files from the training and evaluation of the Torchvision ResNet152 model trained on the CUB-200-2011. Adds files to directory structure models/classification/resnet152/