Skip to main content

Deep learning pipeline for medical imaging

Project description

TFCAIDM Tensor

TensorFlow CAIDM

Deep learning pipeline for medical imaging

Site | Slides | License


Introduction

TFCAIDM is a unified framework for building and training medical imaging deep learning models built on top of TensorFlow and JarvisMD. The library supports interfacing custom datasets with jarvis, model development with tensorflow, and built-in reproducibility, traceability, and performance logging for all experiments. User's can train or extend pre-existing models that have been implemented in MODEL_ZOO.md or define their own.

Available Features
  • Reusable state-of-the-art deep learning model blocks
  • Support for training multiple models in parallel
  • High-level interface for customizing datasets, models, loss functions, training routines, etc.
  • Reproducibility, performance logging, model checkpointing, and hyperparameter tracking
Upcoming Features
  • AutoML / efficient hyperparameter search
  • Distributed data and model training
  • Vision transformer models
  • Better documentation
More Information
  • YAML configuration files
  • Hyperparameter tuning
  • Supported models
  • Customizability
  • Viewing results
  • Benchmarks (coming soon)

Disclaimer: The library is primarily built for users with access to the caidm clusters, though general users are also supported.


Installation

The current library is supported on python 3.7 and tensorflow 2.5+, and the installation instructions provided below assume that your system is already equipped with cuda and nvcc.

Local Installation

Install using the conda virtual environment.

Where user is your account username.

user $ conda create --name tfcaidm python=3.7
user $ conda activate tfcaidm
user (tfcaidm) $ pip install tensorflow
user (tfcaidm) $ pip install jarvis-md
user (tfcaidm) $ pip install tfcaidm

Example

Training a set of models require two separate python scripts: a training submission script and a training routine script.

Training Submission
from jarvis.utils.general import gpus
from tfcaidm import Jobs

# --- Define paths
YML_CONFIG = "pipeline.yml"
TRAIN_ROUTINE_PATH = "main.py"

# --- Submit a training job
Jobs(path=YML_CONFIG).setup(
    producer=__file__,
    consumer=TRAIN_ROUTINE_PATH,
).train_cluster()
Automated Training Routine
from jarvis.train import params
from jarvis.utils.general import gpus
from tfcaidm import Trainer

# --- Autoselect GPU (use only on caidm cluster)
gpus.autoselect()

# --- Get hyperparameters (args passed by environment variables)
hyperparams = params.load()

# --- Train model (dataset and model created within trainer)
trainer = Trainer(hyperparams)
results = trainer.cross_validation(save=True)
trainer.save_results(results)
Custom Training Routine
from jarvis.train import params
from jarvis.utils.general import gpus, overload
from tfcaidm import JClient
from tfcaidm import Model
from tfcaidm import Trainer

# --- Autoselect GPU (use only on caidm cluster)
gpus.autoselect()

# --- Get hyperparameters (args passed by environment variables)
hyperparams = params.load()

# --- Setup custom dataset generator (more details in notebooks)
@overload(JClient)
def create_generator(self, gen_data):
    for xs, ys in gen_data:

        # --- User defined code
        xs = DataAugment(xs)

        yield xs, ys

# --- Setup custom model (more details in notebooks)
@overload(Model)
def create(self):

    # --- User defined code
    model = ViT(...)
    model.compile(...)

    return model

# --- Train model (dataset and model created within trainer)
trainer = Trainer(hyperparams)
results = trainer.cross_validation(save=True)
trainer.save_results(results)

# See notebooks for a breakdown on customizability

For an example project, see examples/projects. For a more detailed walkthrough of the library, see notebooks.


Sister Repositories

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

tfcaidm-0.0.0a4.tar.gz (52.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tfcaidm-0.0.0a4-py3-none-any.whl (78.2 kB view details)

Uploaded Python 3

File details

Details for the file tfcaidm-0.0.0a4.tar.gz.

File metadata

  • Download URL: tfcaidm-0.0.0a4.tar.gz
  • Upload date:
  • Size: 52.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for tfcaidm-0.0.0a4.tar.gz
Algorithm Hash digest
SHA256 9c9289e4cdc3fa5729e5c05f7be3839058ea72b679902a61823af599c4a843f7
MD5 4758a0ba52e388c5ca196d4ff96c8f37
BLAKE2b-256 5262b433a9e20537fa58b51c2f26275d23ab6970cad66aca2043ca2f58122648

See more details on using hashes here.

File details

Details for the file tfcaidm-0.0.0a4-py3-none-any.whl.

File metadata

  • Download URL: tfcaidm-0.0.0a4-py3-none-any.whl
  • Upload date:
  • Size: 78.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for tfcaidm-0.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 425ecaa0b6f50474405bf0ab2cb43ebf2a3afeb8f55752246eacc331289c226a
MD5 53e16453a57a1012b04953f4857be8b6
BLAKE2b-256 8608dcca9c0c5bbdb82dbd2458187b6e108db1505b07f83ac48cb0a7ad24826a

See more details on using hashes here.

Supported by

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