Skip to content

An extremely user-friendly Chest X-Ray image classifier using PyTorch Lightning, Hydra and a custom logger with ML best practices.

Notifications You must be signed in to change notification settings

fpozoc/cxr-img-classifier

Repository files navigation

CXR Image Classifier

PyTorch Lightning Config: Hydra Template

Description

This repository contains an extremely user-friendly image classification model that uses PyTorch Lightning and Hydra. It uses Chest X-Ray images but theoretically it can be implemented for any image dataset.

How to run

Install dependencies

# clone project
git clone https://github.com/fpozoc/cxr-img-classifier.git
cd cxr-img-classifier

# [OPTIONAL] create conda environment
conda create -n cxr-img-classifier python=3.8
conda activate cxr-img-classifier

# install pytorch according to instructions
# https://pytorch.org/get-started/

# install requirements
pip install -r requirements.txt

Train model with default configuration

# train on CPU
python train.py trainer.gpus=0

# train on GPU
python train.py trainer.gpus=1

Train model with chosen experiment configuration from configs/experiment/

python train.py experiment=experiment_name.yaml

You can override any parameter from command line like this

python train.py trainer.max_epochs=20 datamodule.batch_size=64

About

An extremely user-friendly Chest X-Ray image classifier using PyTorch Lightning, Hydra and a custom logger with ML best practices.

Topics

Resources

Stars

Watchers

Forks