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

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 --xla --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 --xla --mode train --gpus 8 --dim 3 --batch-size 2 --amp

Each of these scripts will by default run a warm-up for 100 iterations and then start benchmarking for another 100 steps. You can adjust these settings with --warmup-steps and --bench-steps parameters.

At the end of the script, a line reporting the training 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 --xla --mode predict --gpus <ngpus> --dim {2,3} --batch-size <bsize> [--amp]

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

python scripts/benchmark.py --xla --mode predict --gpus 1 --dim 3 --batch-size 4 --amp 

Each of these scripts will by default run a warm-up for 100 iterations and then start benchmarking for another 100 steps. You can adjust these settings with --warmup-steps and --bench-steps parameters.

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 (8xA100 80G)

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

DimensionGPUsBatch size / GPUDice - mixed precisionAccuracy - FP32Time to train - mixed precisionTime to train - TF32Time to train speedup (TF32 to mixed precision)
21640.73120.730229 min40 min1.38
28640.73220.73108 min10 min1.22
3120.74350.744185 min153 min1.79
3820.74400.743819 min33 min1.69

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 (8xV100 32G)

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

DimensionGPUsBatch size / GPUDice - mixed precisionAccuracy - FP32Time to train - mixed precisionTime to train - FP32Time to train speedup (FP32 to mixed precision)
21640.73150.731152 min102 min1.96
28640.73120.731612 min17 min1.41
3120.74350.7441181 min580 min3.20
3820.74340.744035 min131 min3.74

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 (8xA100 80G)

Our results were obtained by running the python scripts/benchmark.py --xla --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 throughput. To launch multi-GPU with --bind you will have to add --horovod e.g., python scripts/benchmark.py --xla --mode train --gpus 8 --dim 3 --amp --batch-size 2 --bind --horovod 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
21321347.19748.561.80--
21641662.8804.232.07--
211281844.7881.872.09--
28329056.455420.511.676.726.91
286411687.116250.521.877.037.49
2812813679.766841.782.007.427.66
31127.0211.632.32--
31229.311.812.48--
31431.8712.172.62--
381186.8491.112.057.247.83
382219.3492.912.367.777.87
384244.0196.522.537.767.93

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

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

Our results were obtained by running the python scripts/benchmark.py --xla --mode train --gpus {1,8} --dim {2,3} --batch-size <bsize> [--amp] training script in the TensorFlow 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 throughput. To launch multi-GPU with --bind you will have to add --horovod e.g., python scripts/benchmark.py --xla --mode train --gpus 8 --dim 3 --amp --batch-size 2 --bind --horovod 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
2132697.36312.512.23--
2164819.15337.422.43--
21128894.94352.322.54--
28324355.652260.371.936.257.23
28645696.412585.652.206.957.66
281286714.962779.252.427.507.89
31112.152.085.84--
31213.132.55.25--
38182.6216.594.986.807.98
38297.6819.914.917.447.96

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

Inference performance results

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

Our results were obtained by running the python scripts/benchmark.py --xla --mode predict --dim {2,3} --batch-size <bsize> [--amp] inferencing benchmarking script in the TensorFlow 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]
232192x1601728.0318.5222.5523.1824.82
264192x1604160.9115.3817.4918.5319.88
2128192x1604672.5227.3927.6827.7927.87
31128x128x12878.212.7914.2914.8715.25
32128x128x12863.7631.3736.0740.0242.44
34128x128x12883.1748.150.9652.0852.56

TF32

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
232192x1602067.6315.4817.9719.1219.77
264192x160244726.1526.4326.4826.62
2128192x1602514.7550.951.1551.2351.28
31128x128x12838.8525.7426.0426.1927.41
32128x128x12840.149.8750.3150.4450.57
34128x128x12841.6995.9597.0997.4198.03

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 (1xV100 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 TensorFlow 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]
232192x1601166.8327.4228.7628.9129.16
264192x1602263.2128.2830.6331.8332.5
2128192x1602387.0653.6253.9754.0754.3
31128x128x12836.8727.1227.3227.3727.42
32128x128x12837.6553.1253.4953.5953.71
34128x128x12838.8103.11104.16104.3104.75

FP32

DimensionBatch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
232192x160990.6132.332.4632.5132.78
264192x1601034.2261.8862.1962.3262.56
2128192x1601084.21118.06118.45118.6118.95
31128x128x1289.65103.62104.46104.52104.63
32128x128x1289.96200.75202.51202.74202.86
34128x128x12810.13394.74396.74397.0397.82

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.

Known issues

There are no known issues in this release.