Skip to main content

A 2D and 3D PyTorch implementation of the Tiramisu CNN

Project description

tiramisù-brûlée

https://img.shields.io/pypi/v/tiramisu_brulee.svg Documentation Status https://img.shields.io/badge/code%20style-black-000000.svg

A 2D and 3D PyTorch implementation of the Tiramisu CNN

This package is primarily used for multiple sclerosis (MS) lesion segmentation; specifically, T2 lesions in the brain.

Install

The easiest way to install the package is with:

pip install tiramisu-brulee

Alternatively, you can download the source and run:

python setup.py install

If you want a CLI to train a lesion segmentation model (or work with anything in the experiment subpackage), install with:

pip install "tiramisu-brulee[lesionseg]"

Basic Usage

Import the 2D or 3D Tiramisu version with:

from tiramisu_brulee.model import Tiramisu2d, Tiramisu3d

If you install tiramisu-brulee with [lesionseg] extras, then you can train a lesion segmentation Tiramisu CNN and predict with:

lesion-train ...
lesion-predict ...
lesion-predict-image ...

Use the --help option to see the arguments. See the documentation for a tutorial on how to use the CLIs.

References

[1] Jégou, Simon, et al. “The one hundred layers tiramisu: Fully convolutional densenets for semantic segmentation.” CVPR. 2017.

[2] Zhang, Huahong, et al. “Multiple sclerosis lesion segmentation with Tiramisu and 2.5D stacked slices.” International Conference on Medical Image Computing and Computer-Assisted Intervention. Springer, Cham, 2019.

Why the name?

Why is the name tiramisù-brûlée? Well, tiramisù is named after the neural network [1] whose name is inspired by the dessert; however, tiramisu—by itself—was already taken as a package on PyPI. I added brûlée to get around the existence of that package and because this package is written in PyTorch (torch -> burnt). Plus brûlée in English is often associated with the dessert crème brûlée. Why combine an Italian word (tiramisù) with a French word (brûlée)? Because I didn’t think about it until after I already deployed the package to PyPI.

History

0.2.2 (2022-01-19)

  • Remove transpose convolution option in when using interpolate upsampling

0.2.1 (2022-01-19)

  • Cleanup Makefile

  • Add interpolation resize test

0.2.0 (2022-01-11)

  • Add option to upsample with interpolation instead of transpose conv.

  • Remove separate padding layer and use conv. built-in padding

  • Improvements to ONNX converter

0.1.37 (2021-12-16)

  • Improve type annotations

0.1.36 (2021-12-01)

  • Fix validation logging in MLFlow

0.1.35 (2021-11-30)

  • Add support for deterministic validation patches

0.1.34 (2021-11-19)

  • Add support for bandit

  • Fix warning filter for dataloader

0.1.33 (2021-11-18)

  • Add support for a dataset that can prevent a known PyTorch/Python memory leak issue

0.1.32 (2021-11-16)

  • Fix bug in prediction where data not transferred to GPU

0.1.31 (2021-11-16)

  • Updates to support pytorch-lightning~=1.5.1

0.1.30 (2021-11-15)

  • Add option to change label sampling probabilities

  • Bump pip version in requirements_dev.txt for security

0.1.29 (2021-11-02)

  • Support dicom images in lesion-predict

  • Change logger.warnings to warnings.warn

  • Remove deprecation warning for floor divide in torch in patch-based prediction

0.1.28 (2021-11-01)

  • Add commit hash logger function to tag MLFlow runs

  • Save configuration files to MLFlow

  • Add option to save top K checkpoints

0.1.27 (2021-10-12)

  • Add union and voting aggregation to prediction and other minor bug fixes

0.1.26 (2021-08-09)

  • Reformat with newer version of black (v21.7b0)

  • Change to every_n_epochs in ModelCheckpoint since every_n_val_epochs will be deprecated

0.1.25 (2021-08-06)

  • Detect and use tensorboard directory (/opt/ml/output/tensorboard) for logging on SageMaker

0.1.24 (2021-08-06)

  • Add experiment and trial name as options to explicitly specify artifact locations

0.1.23 (2021-08-04)

  • Change AWS option to just MLFlow

  • Compliant with mypy

  • Other minor bug fixes and fix docs

0.1.22 (2021-07-30)

  • Add AWS extras (MLFlow and train and serve console scripts)

  • Add option to resample images within a subject for consistent orientation

  • Add optional check of DICOM images to determine if they are uniformly sampled

  • Make package compatible with Python 3.6 and 3.9

  • Split CLI functions into a subpackage for better organization

0.1.21 (2021-07-27)

  • Add MLFlow logging option

  • Add support for reading DICOM images and writing DICOM (Segmentation Objects)

  • Fix some type hints and make pos_weight a vector of length 1

0.1.20 (2021-07-25)

  • Make reorientation to canonical optional

  • Add option to track best network on validation Dice, PPV, loss, or ISBI15 score

  • Unify and simplify the positive weight in focal/bce component of combo loss

  • Change flip in spatial augmentation to only do lateral flips

  • Fix predict_probability flag in CLI

0.1.19 (2021-07-22)

  • Fix Dice score component of almost_isbi15_score metric

0.1.18 (2021-06-30)

  • Fix reorientation to original orientation from canonical in prediction.

0.1.17 (2021-06-11)

  • Migrate to Github actions for testing and deployment.

0.1.16 (2021-06-11)

  • Add support for training with all orientations. Convert all inputs to canonical orientation before input to network in training and prediction (and convert back to original orientation in prediction before saving).

0.1.15 (2021-06-05)

  • Add multi-class segmentation support, headers to predictions, and other bug fixes.

0.1.14 (2021-06-03)

  • Bug fixes for training multiple models, remove unintended restriction on column names

0.1.13 (2021-05-31)

  • Fix a bug when using pseudo3d_dim == 0.

0.1.12 (2021-05-31)

  • Fix bug with patch-based prediction and add support for training/predicting with networks with differing pseudo3d dimensions.

0.1.11 (2021-05-30)

  • Add better prediction support for pseudo3d networks.

0.1.10 (2021-05-29)

  • Add CLI usage documentation and fix some minor bugs/typos.

0.1.9 (2021-05-28)

  • Add pseudo3d (2.5D) support and patch-based prediction

0.1.8 (2021-05-27)

  • Fix ISBI 15 score metric

0.1.7 (2021-05-25)

  • Add precision to arguments for prediction

0.1.6 (2021-05-25)

  • Improve documentation

0.1.5 (2021-05-25)

  • Add docs and split out CLIs from seg module

0.1.4 (2021-05-13)

  • Add lesion segmentation CLI.

0.1.3 (2021-05-13)

  • Fix deployment by fixing repo name in travis.

0.1.2 (2021-05-13)

  • Fix supported versions and docs.

0.1.1 (2021-05-13)

  • Fix tests and deployment.

0.1.0 (2021-05-13)

  • First release on PyPI.

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

tiramisu-brulee-0.2.2.tar.gz (849.8 kB view hashes)

Uploaded Source

Built Distribution

tiramisu_brulee-0.2.2-py3-none-any.whl (55.7 kB view hashes)

Uploaded Python 3

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