Abstract
Deep learning research in medical imaging often suffers from repetitive "boilerplate" code and difficulties in handling complex 3D data across different frameworks. We present Delira (Deep Learning in Radiology), a high-level, framework-agnostic library designed to streamline the development of medical imaging models. By providing a unified interface for PyTorch and TensorFlow, Delira allows researchers to focus on model architecture and data science rather than the underlying training infrastructure.
Introduction
In the rapidly evolving field of deep learning for medical imaging, researchers frequently find themselves reinventing the wheel. While powerful, low-level frameworks like PyTorch and TensorFlow often require significant "boilerplate" code for routine tasks such as logging, model checkpointing, and training loops. This repetition is not only inefficient but also a source of potential errors.
Furthermore, medical imaging data, such as Computed Tomography (CT) and Magnetic Resonance (MR) scans, is inherently three-dimensional. Most standard computer vision libraries are optimized for 2D images, leaving medical researchers to rely on fragmented third-party solutions for essential tasks like 3D data augmentation. Delira was developed to bridge these gaps, providing a structured, modular environment specifically tailored for the radiology AI community.
Framework Architecture and Methods
Delira is built on a modular architecture that intentionally decouples the data pipeline from the specific deep learning backend. This design philosophy is realized through several core components:
- Framework Agnosticism: Delira acts as a high-level wrapper that currently supports both PyTorch and TensorFlow. This allows users to switch between backends while utilizing the same high-level API for data handling and training, facilitating easier comparison of state-of-the-art models across different frameworks.
- The NetworkTrainer and Experiment Classes: To eliminate manual training loops, Delira provides a
NetworkTrainerclass that handles the standard training routine. A level higher, theExperimentclass manages complex workflows, such as automated cross-validation schemes, ensuring consistency across experiments. - Modular Subpackages: The library is organized into distinct, reusable modules:
data_loading,io,logging,models,training, andutils. This structure encourages the reuse of data pipelines across different models and projects, improving maintainability. - Specialized Data Handling: Unlike general-purpose frameworks, Delira integrates native support for 3D medical image augmentation. This addresses a major pain point by providing specialized spatial transformations required for volumetric data.
- Reference Implementations: The
modelssubpackage includes "out-of-the-box" implementations for common medical imaging tasks, including classification, segmentation, and Generative Adversarial Networks (GANs).
Design Philosophy and Key Insights
The development of Delira is centered on three key insights:
- Standardization over Customization: By standardizing the non-core components of deep learning research—such as logging, saving, and loading—Delira reduces the surface area for bugs and significantly enhances research reproducibility.
- Decoupling for Flexibility: By separating the data loading pipeline from the specific deep learning backend, researchers can experiment with different frameworks without the need to rewrite their entire data preprocessing logic.
- Medical-First Design: The inclusion of native 3D augmentation support acknowledges that medical imaging requires specialized tools that are often overlooked in mainstream AI software.
Availability and Results
As a software-focused contribution, the primary result is the availability and feature set of the Delira framework, as presented in the Journal of Open Source Software (JOSS). It offers a unified API that successfully bridges PyTorch and TensorFlow. The project is released under the liberal BSD Clause-2 license and is publicly available on GitHub. To lower the barrier to entry, the authors provide comprehensive HTML documentation and tutorials, supporting the broader goal of making high-quality medical imaging research more accessible.
Conclusion and Future Work
While currently supporting the industry-standard PyTorch and TensorFlow backends, Delira's architecture is designed for extensibility, making the addition of new backends, such as JAX, relatively straightforward. As an open-source project, its future utility depends on community adoption and the contribution of new reference models. Additionally, while it supports 3D augmentation, future iterations may seek deeper integration or expansion of native augmentation suites to further reduce reliance on external libraries like batchgenerators.
Summary updated