MIC-DKFZ/batchgenerators

A framework for data augmentation for 2D and 3D image classification and segmentation

What it solves

It provides a comprehensive framework for data augmentation, specifically addressing the lack of support for 3D input data in many existing frameworks. It helps improve model robustness and performance by simulating various real-world data variations, including soft-tissue deformations and multi-modal image misalignments.

How it works

Users derive from the DataLoaderBase class and implement the generate_train_batch function to stack desired augmentations. The system uses a simple Python dictionary structure for data, where a data key is required and a seg key can be used for segmentations (ensuring spatial transforms are applied to both). To optimize performance, it includes a MultiThreadedAugmenter for parallel processing and supports converting numpy arrays to PyTorch tensors for faster inter-process communication.

Who it’s for

It is designed for researchers and developers working with 2D and 3D image data, particularly those in medical image computing and computer vision who need robust data augmentation pipelines.

Highlights

  • 3D Support: Full compatibility with both 2D and 3D input data.
  • Diverse Augmentations: Includes spatial (elastic deformations, rotations), color (brightness, contrast), and noise (Gaussian, Rician) transforms.
  • Specialized Medical AI Tools: Features anatomy-informed augmentation for soft-tissue simulation and misalignment augmentation for multi-modal images.
  • Performance Optimization: Includes a multi-threaded augmenter and support for pinned memory to accelerate GPU data transfer.

Related

  • Project
  • Project
  • Project
  • Project