#3023·nnUNet

[Feature Request] Optional Visualization / Debug Mode for Preprocessing and Training.

Author: VAIDEHI-28Created Apr 20, 2026Updated Sep 24, 2026
Labelsfeature request

Summary

I would like to propose an optional visualization (debug) mode in nnU-Net to help users better understand and debug the preprocessing and training pipeline.

Currently, nnU-Net provides a highly automated pipeline, but it can be difficult for users—especially new users—to inspect intermediate steps such as preprocessing transformations, data augmentations, and model predictions during training.


Motivation

In medical image segmentation workflows, understanding intermediate steps is often important for:

  • Verifying preprocessing (resampling, normalization, cropping)
  • Debugging data issues (incorrect labels, spacing problems, empty masks)
  • Understanding whether the model is learning meaningful representations
  • Inspecting the effect of augmentations

At the moment, this requires manual modification of the codebase, which can be error-prone and time-consuming.


Proposed Solution

Introduce an optional debug/visualization flag (e.g., --vis_debug) that, when enabled, saves a small number of representative visualizations during preprocessing and training.

1. Preprocessing Visualization

For a few selected cases:

  • Original image
  • After normalization
  • After resampling
  • After cropping

2. Training Visualization (periodic)

At configurable intervals (e.g., every N epochs):

  • Input image
  • Ground truth segmentation
  • Model prediction

3. Augmentation Visualization

For selected batches:

  • Original patch
  • Augmented patch

Design Considerations

  • Fully optional (disabled by default)
  • Minimal performance overhead (limited samples and frequency)
  • No changes to existing default workflows
  • Outputs saved as images (e.g., PNG) in a structured debug directory

Example output structure:

results/
 └── debug/
      ├── preprocessing/
      ├── augmentation/
      ├── training/

Benefits

  • Improves interpretability of nnU-Net pipeline
  • Helps users debug dataset and preprocessing issues
  • Useful for research, teaching, and experimentation
  • Reduces need for ad-hoc code modifications

I would be happy to work on implementing this feature in a way that aligns with the design philosophy of nnU-Net and keeps the default behavior unchanged.


Thank you for your time!