Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

Metadata

Release files for tfcaidm 0.0.0a4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tfcaidm 0.0.0a4
File Size Uploaded
tfcaidm-0.0.0a4.tar.gz 52.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tfcaidm 0.0.0a4
File Interpreter ABI Platform
tfcaidm-0.0.0a4-py3-none-any.whl Python 3 none any Details

Total release size: 130.9 kB

Release files / tfcaidm-0.0.0a4.tar.gz

Download URL tfcaidm-0.0.0a4.tar.gz
Size 52.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9c9289e4cdc3fa5729e5c05f7be3839058ea72b679902a61823af599c4a843f7
BLAKE2b-256 checksum
How to use checksums
5262b433a9e20537fa58b51c2f26275d23ab6970cad66aca2043ca2f58122648
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / tfcaidm-0.0.0a4-py3-none-any.whl

Download URL tfcaidm-0.0.0a4-py3-none-any.whl
Size 78.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
425ecaa0b6f50474405bf0ab2cb43ebf2a3afeb8f55752246eacc331289c226a
BLAKE2b-256 checksum
How to use checksums
8608dcca9c0c5bbdb82dbd2458187b6e108db1505b07f83ac48cb0a7ad24826a
Upload date
Uploaded using Trusted Publishing?
What is 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
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page