Skip to content

nnU-Net

nnU-Net is a semantic segmentation method that automatically adapts to a given dataset. Two module variants are available: one with CUDA 12.4, and one for CPU only. The bundle packages version 2.6.0.

Usage example

If the CUDA_VISIBLE_DEVICES environment variable is set, the CUDA 12.4 variant is the default otherwise the default is the CPU variant. The following command can be executed in the terminal to load the bundle:

module load nnunet

To explicitly load the CPU variant run:

module load nnunet cuda=none

To explicitly load the CUDA 12.4 variant run:

module load nnunet cuda=12.4

The following nnU-Net commands can be run directly:

nnUNetv2_determine_postprocessing
nnUNetv2_export_model_to_zip
nnUNetv2_plan_and_preprocess
nnUNetv2_preprocess
nnUNetv2_accumulate_crossval_results
nnUNetv2_download_pretrained_model_by_url
nnUNetv2_extract_fingerprint
nnUNetv2_plan_experiment
nnUNetv2_train
nnUNetv2_apply_postprocessing
nnUNetv2_ensemble
nnUNetv2_find_best_configuration
nnUNetv2_plot_overlay_pngs
nnUNetv2_convert_MSD_dataset
nnUNetv2_evaluate_folder
nnUNetv2_install_pretrained_model_from_zip
nnUNetv2_predict
nnUNetv2_convert_old_nnUNet_dataset
nnUNetv2_evaluate_simple
nnUNetv2_move_plans_between_datasets
nnUNetv2_predict_from_modelfolder

The nnunet_shell command can be used to access a shell in the bundle.

Setup a project

nnU-Net requires several environment variables to be set, before any of the previous commands can be run. The easiest is to setup a project:

  • Run ern project modules
  • The micro editor should open, unless configured otherwise
  • Type nnunet and save with Ctrl+S and exit with Ctrl+Q
  • Run ern project script.
  • Change the paths and nnUNet_n_proc_DA, according to your needs, in the text below.
  • Save the file.
  • Run ern project on
1
2
3
4
5
nnUNet_raw="$(pwd)/dataset/nnUNet_raw_data/"
nnUNet_preprocessed="$(pwd)/dataset/nnUNet_preprocessed/"
nnUNet_results="$(pwd)/dataset/nnUNet_trained_models/"
nnUNet_n_proc_DA=16
export nnUNet_raw nnUNet_preprocessed nnUNet_results nnUNet_n_proc_DA

The module should be loaded, and the environment variables set whenever the user changes to the directory.

Submitting a GPU job

1
2
3
ern jobs submit --inplace --hours=100 --threads=32 --gpu=2 \
    --command=nnUNetv2_train -- \
    1 3d_fullres 0 -device cuda -num_gpus 2

Performance notes

No performance notes available

No recommended resources available

Benchmarks

No benchmarks available.

Community guides and tutorials

  • No community guides available.

Official site and documentation

Licensing information

nnU-Net is licensed under the Apache v2.0.

Primary citation

External guides and resources

  • If you know of a guide/tutorial that you have found useful, please help us share it by contacting the HPC staff at hpc@ufs.ac.za