Skip to main content

Image Classifier optimised for ecology use-cases

Project description

Lit Ecology Classifier

Documentation: https://lit-ecology-classifier.readthedocs.io/en/latest/ Lit Ecology Classifier is a machine learning project designed for image classification tasks. It leverages PyTorch Lightning for streamlined training and evaluation processes.

Features

  • Easy configuration and setup
  • Utilizes PyTorch Lightning for robust training and evaluation
  • Supports training on multiple GPUs
  • Test Time Augmentation (TTA) for enhanced evaluation
  • Integration with Weights and Biases for experiment tracking

Installation

To install Lit Ecology Classifier, use pip:

pip install lit-ecology-classifier

Usage

Training

To train the model, use the following command:

python -m lit_ecology_classifier.main --max_epochs 20 --dataset phyto --priority config/priority.json

Inference

To run inference on unlabelled data, use the following command:

python -m lit_ecology_classifier.predict --datapath /path/to/data.tar --model_path /path/to/model.ckpt --outpath ./predictions/

Configuration

The project uses an argument parser for configuration. Here are some of the key arguments:

Training Arguments

  • --datapath: Path to the tar file containing the training data.
  • --train_outpath: Output path for training artifacts.
  • --main_param_path: Main directory where the training parameters are saved.
  • --dataset: Name of the dataset.
  • --use_wandb: Use Weights and Biases for logging.
  • --priority_classes: Path to the JSON file with priority classes.
  • --balance_classes: Balance the classes for training.
  • --batch_size: Batch size for training.
  • --max_epochs: Number of epochs to train.
  • --lr: Learning rate for training.
  • --lr_factor: Learning rate factor for training of full body.
  • --no_gpu: Use no GPU for training.

Inference Arguments

  • --outpath: Directory where predictions are saved.
  • --model_path: Path to the model file.
  • --datapath: Path to the tar file containing the data to classify.
  • --no_gpu: Use no GPU for inference.
  • --no_TTA: Disable test-time augmentation.

Documentation

Detailed documentation for this project is available at Read the Docs.

Example SLURM Job Submission Script

Here is an example SLURM job submission script for training on multiple GPUs:

#!/bin/bash
#SBATCH --account="em09"
#SBATCH --constraint='gpu'
#SBATCH --nodes=2
#SBATCH --ntasks-per-core=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=12
#SBATCH --partition=normal
#SBATCH --constraint=gpu
#SBATCH --hint=nomultithread
#SBATCH --output=slurm/slurm_%j.out
#SBATCH --error=slurm/slurm_%j.err
export OMP_NUM_THREADS=12 #$SLURM_CPUS_PER_TASK
cd ${SCRATCH}/lit_ecology_classifier
module purge
module load daint-gpu cray-python
source lit_ecology/bin/activate
python -m lit_ecology_classifier.main --max_epochs 2 --dataset phyto --priority config/priority.json

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lit_ecology_classifier-0.2.3.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

lit_ecology_classifier-0.2.3-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file lit_ecology_classifier-0.2.3.tar.gz.

File metadata

File hashes

Hashes for lit_ecology_classifier-0.2.3.tar.gz
Algorithm Hash digest
SHA256 a4e4e5ac6b95314d771ffa87f448f3a7630fae1c77ac01b09cc28fece749071e
MD5 99540e48f67b839564f5bda72fa77751
BLAKE2b-256 783fa56e6677542726fc9f76d37e62ebdc9a8ccfb1130ffc6b2d71b369e05dd5

See more details on using hashes here.

File details

Details for the file lit_ecology_classifier-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lit_ecology_classifier-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c1560fa87586fb08e79b81ef176e5c613a4f26f988f64644dd8cfa405be4eae4
MD5 ab0a03e7264f171d6328fbdf9264ab4f
BLAKE2b-256 50201f40ae2d26d85773dd6d7f55399cc701e341d4464f25bfaf3a4418b49d35

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page