NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
nnU-Net for PyTorch
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
nnU-Net for PyTorch

An optimized, robust and self-adapting framework for U-Net based medical image segmentation

Benchmarking

The following section shows how to run benchmarks to measure the model performance in training and inference modes.

Training performance benchmark

To benchmark training, run the scripts/benchmark.py script with --mode train:

python scripts/benchmark.py --mode train --gpus <ngpus> --dim {2,3} --batch_size <bsize> [--amp] [--bind]

For example, to benchmark 3D U-Net training using mixed-precision on 8 GPUs with a batch size of 2, run:

python scripts/benchmark.py --mode train --gpus 8 --dim 3 --batch_size 2 --amp

Each of these scripts will by default run 1 warm-up epoch and start performance benchmarking during the second epoch.

At the end of the script, a line reporting the best train throughput and latency will be printed.

Inference performance benchmark

To benchmark inference, run the scripts/benchmark.py script with --mode predict:

python scripts/benchmark.py --mode predict --dim {2,3} --batch_size <bsize> [--amp]

For example, to benchmark inference using mixed-precision for 3D U-Net, with a batch size of 4, run:

python scripts/benchmark.py --mode predict --dim 3 --amp --batch_size 4

Each of these scripts will by default run a warm-up for 1 data pass and start inference benchmarking during the second pass.

At the end of the script, a line reporting the inference throughput and latency will be printed.

Note that this benchmark reports performance numbers for iterations over samples with fixed patch sizes. The real inference process uses sliding window for input images with arbitrary resolution and performance may vary for images with different resolutions.

Results

The following sections provide details on how to achieve the same performance and accuracy in training and inference.

Training accuracy results

Training accuracy: NVIDIA DGX A100 (8x A100 80G)

Our results were obtained by running the python scripts/train.py --gpus {1,8} --fold {0,1,2,3,4} --dim {2,3} [--amp] [--bind] --learning_rate lr --seed n training scripts and averaging results in the PyTorch 22.11 NGC container on NVIDIA DGX with (8x A100 80G) GPUs.

Note: We recommend using --bind flag for multi-GPU settings to increase the throughput. To launch multi-GPU with --bind use PyTorch distributed launcher, e.g., python -m torch.distributed.launch --use_env --nproc_per_node=8 scripts/benchmark.py --mode train --gpus 8 --dim 3 --amp --batch_size 2 --bind for the interactive session, or use regular command when launching with SLURM's sbatch.

DimensionGPUsBatch size / GPUDice - mixed precisionDice - TF32Time to train - mixed precisionTime to train - TF32Time to train speedup (TF32 to mixed precision)
21273.2173.1133 min48 min1.46
28273.1573.169 min13 min1.44
31274.3574.34104 min167 min1.61
38274.3074.3223min36 min1.57

Reported dice score is the average over 5 folds from the best run for grid search over learning rates {1e-4, 2e-4, ..., 9e-4} and seed {1, 3, 5}.

Training accuracy: NVIDIA DGX-1 (8x V100 32G)

Our results were obtained by running the python scripts/train.py --gpus {1,8} --fold {0,1,2,3,4} --dim {2,3} [--amp] [--bind] --seed n training scripts and averaging results in the PyTorch 22.11 NGC container on NVIDIA DGX-1 with (8x V100 32G) GPUs.

Note: We recommend using --bind flag for multi-GPU settings to increase the throughput. To launch multi-GPU with --bind use PyTorch distributed launcher, e.g., python -m torch.distributed.launch --use_env --nproc_per_node=8 scripts/benchmark.py --mode train --gpus 8 --dim 3 --amp --batch_size 2 --bind for the interactive session, or use regular command when launching with SLURM's sbatch.

DimensionGPUsBatch size / GPUDice - mixed precisionDice - FP32Time to train - mixed precisionTime to train - FP32Time to train speedup (FP32 to mixed precision)
21273.1873.2260 min114 min1.90
28273.1573.1813 min19 min1.46
31274.3174.33201 min680 min3.38
38274.3574.3941 min153 min3.73

Reported dice score is the average over 5 folds from the best run for grid search over learning rates {1e-4, 2e-4, ..., 9e-4} and seed {1, 3, 5}.

Training performance results

Training performance: NVIDIA DGX A100 (8x A100 80G)

Our results were obtained by running the python scripts/benchmark.py --mode train --gpus {1,8} --dim {2,3} --batch_size <bsize> [--amp] training script in the NGC container on NVIDIA DGX A100 (8x A100 80G) GPUs. Performance numbers (in volumes per second) were averaged over an entire training epoch.

Note: We recommend using --bind flag for multi-gpu settings to increase the througput. To launch multi-GPU with --bind use python -m torch.distributed.launch --use_env --nproc_per_node=<npgus> scripts/train.py --bind ... for the interactive session, or use regular command when launching with SLURM's sbatch.

DimensionGPUsBatch size / GPUThroughput - mixed precision [img/s]Throughput - TF32 [img/s]Throughput speedup (TF32 - mixed precision)Weak scaling - mixed precisionWeak scaling - TF32
21321040.58732.221.42--
21641238.68797.371.55--
211281345.29838.381.60--
28327747.275588.21.397.457.60
28649417.276246.951.517.608.04
2812810694.16631.081.617.957.83
31124.619.662.55--
31227.4811.272.44--
31429.9612.222.45--
381187.0776.442.457.637.91
382220.8388.672.497.837.87
384234.596.612.437.917.91

To achieve these same results, follow the steps in the Quick Start Guide.

Training performance: NVIDIA DGX-1 (8x V100 32G)

Our results were obtained by running the python scripts/benchmark.py --mode train --gpus {1,8} --dim {2,3} --batch_size <bsize> [--amp] [--bind] training script in the PyTorch 22.11 NGC container on NVIDIA DGX-1 with (8x V100 32G) GPUs. Performance numbers (in volumes per second) were averaged over an entire training epoch.

Note: We recommend using --bind flag for multi-gpu settings to increase the througput. To launch multi-GPU with --bind use python -m torch.distributed.launch --use_env --nproc_per_node=<npgus> scripts/train.py --bind ... for the interactive session, or use regular command when launching with SLURM's sbatch.

DimensionGPUsBatch size / GPUThroughput - mixed precision [img/s]Throughput - FP32 [img/s]Throughput speedup (FP32 - mixed precision)Weak scaling - mixed precisionWeak scaling - FP32
2132561.6310.211.81--
2164657.91326.022.02--
21128706.92332.812.12--
28323903.882396.881.636.957.73
28644922.762590.661.907.487.95
281285597.872667.562.107.928.02
31111.382.075.50--
31212.342.514.92--
38184.3816.555.107.418.00
38298.1720.154.877.968.03

To achieve these same results, follow the steps in the Quick Start Guide.

Inference performance results

Inference performance: NVIDIA DGX A100 (1x A100 80G)

Our results were obtained by running the python scripts/benchmark.py --mode predict --dim {2,3} --batch_size <bsize> [--amp] inferencing benchmarking script in the PyTorch 22.11 NGC container on NVIDIA DGX A100 (1x A100 80G) GPU.

FP16

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
232192x1601818.0517.619.8620.3820.98
264192x1603645.1617.5619.8620.8223.66
2128192x1603850.3533.2434.7261.463.58
31128x128x12868.4514.6117.0217.4119.27
32128x128x12856.935.1540.943.1557.94
34128x128x12876.3952.3657.959.5270.24

TF32

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
232192x1601868.5617.1351.7553.0754.92
264192x1602508.5725.5156.8390.0896.87
2128192x1602609.649.05191.48201.8205.29
31128x128x12835.0228.5551.7553.0754.92
32128x128x12839.8850.1556.8390.0896.87
34128x128x12841.3296.8191.48201.8205.29

Throughput is reported in images per second. Latency is reported in milliseconds per batch. To achieve these same results, follow the steps in the Quick Start Guide.

Inference performance: NVIDIA DGX-1 (1x V100 32G)

Our results were obtained by running the python scripts/benchmark.py --mode predict --dim {2,3} --batch_size <bsize> [--amp] inferencing benchmarking script in the PyTorch 22.11 NGC container on NVIDIA DGX-1 with (1x V100 32G) GPU.

FP16

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
232192x1601254.3825.5129.0730.0731.23
264192x1602024.1331.6271.5171.7872.44
2128192x1602136.9559.961.2361.63110.13
31128x128x12836.9327.0828.631.4348.3
32128x128x12838.8651.4753.354.7792.49
34128x128x12839.15102.18104.62112.17180.47

FP32

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
232192x1601019.9731.3732.9355.5869.14
264192x1601063.5960.1762.3263.11111.01
2128192x1601069.81119.65123.48123.83225.46
31128x128x1289.92100.78103.2103.62111.97
32128x128x12810.14197.33201.05201.4201.79
34128x128x12810.25390.33398.21399.34401.05

Throughput is reported in images per second. Latency is reported in milliseconds per batch. To achieve these same results, follow the steps in the Quick Start Guide.

NVIDIA uses cookies to improve your experience on our web site. We and our third-party partners also use cookies and other tools to collect and record information you provide as well as information about your interactions with our websites for performance improvement, analytics, and to assist in marketing efforts. By clicking "Accept All", you consent to our use of cookies and other tools as described in our Cookie Policy. You can manage your cookie settings by clicking on "Manage Settings." By continuing to use this site or by clicking one of the buttons below, you agree to our Terms of Service (which contains important waivers). Please see our Privacy Policy for more information on our privacy practices.