NVIDIA
NVIDIA
nnU-Net for PyTorch
Resource
NVIDIA
NVIDIA
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 scripts/benchmark.py script with --mode train:

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

For example, to benchmark 3D U-Net training using mixed-precision on 8 GPUs with 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 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 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 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.

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] training scripts and averaging results in the PyTorch 21.11 NGC container on NVIDIA DGX with (8x A100 80G) GPUs.

DimensionGPUsBatch size / GPUAccuracy - mixed precisionAccuracy - 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
Training accuracy: NVIDIA DGX-1 (8x V100 16G)

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

DimensionGPUsBatch size / GPUAccuracy - mixed precisionAccuracy - 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

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.

DimensionGPUsBatch size / GPUThroughput - mixed precision [img/s]Throughput - TF32 [img/s]Throughput speedup (TF32 - mixed precision)Weak scaling - mixed precisionWeak scaling - TF32
21641129.48702.821.607N/AN/A
211281234.69741.011.666N/AN/A
28647015.454613.271.5216.2116.564
281288293.615498.781.5086.7177.421
31113.929.221.509N/AN/A
31217.6810.721.649N/AN/A
31420.5611.51.787N/AN/A
38192.9761.681.4166.6797.119
382114.4772.231.4756.4757.242
384140.5585.531.6436.8367.437

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

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

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 PyTorch 21.11 NGC container on NVIDIA DGX-1 with (8x V100 16G) GPUs. Performance numbers (in volumes per second) were averaged over an entire training epoch.

DimensionGPUsBatch size / GPUThroughput - mixed precision [img/s]Throughput - FP32 [img/s]Throughput speedup (FP32 - mixed precision)Weak scaling - mixed precisionWeak scaling - FP32
2164607.16298.842.032N/AN/A
21128653.44307.012.128N/AN/A
28644058.792196.051.8486.6857.349
281284649.372388.461.8487.1157.779
3118.661.994.352N/AN/A
3129.652.074.662N/AN/A
3149.99OOMN/AN/AN/A
38158.4515.553.7566.7497.819
38266.0316.224.0716.8427.835
38467.37OOMN/A6.743N/A

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 21.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]
2644x192x1603211.2319.9320.2420.3820.84
21284x192x1603465.4536.9438.3538.7238.95
314x128x128x12841.9323.8524.4024.6124.99
324x128x128x12844.2445.2147.0847.3848.24
344x128x128x12845.8187.3188.1388.5689.69

TF32

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
2644x192x1602172.3829.4629.9430.0330.19
21284x192x1601769.5672.3472.8473.0474.79
314x128x128x12823.8341.9742.7142.7642.87
324x128x128x12826.7574.7775.7976.0677.04
344x128x128x12827.10147.62147.81149.14190.08

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 16G)

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 21.11 NGC container on NVIDIA DGX-1 with (1x V100 16G) GPU.

FP16

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
2644x192x1601809.7935.3635.7535.8436.21
21284x192x1601987.9164.3964.7964.8765.01
314x128x128x12826.7537.3837.6637.7438.17
324x128x128x12823.2885.9186.7787.3989.54
344x128x128x12823.83167.83169.41170.30173.47

FP32

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
2644x192x1601007.9163.5063.9364.0364.19
21284x192x160812.08157.62159.02159.72161.24
314x128x128x1288.23121.45122.84123.93124.69
324x128x128x1288.42237.65239.90240.60242.85
344x128x128x1288.37478.01482.70483.43484.84

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.