NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
3D-UNet Medical Image Segmentation for TensorFlow1
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
3D-UNet Medical Image Segmentation for TensorFlow1

A convolutional neural network for 3D image segmentation.

The performance measurements in this document were conducted at the time of publication and may not reflect the performance achieved from NVIDIA's latest software release. For the most up-to-date performance measurements, go to NVIDIA Data Center Deep Learning Product Performance.

Benchmarking

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

Training performance benchmark

To benchmark training, run one of the train_benchmark scripts in ./scripts/:

bash scripts/unet3d_train_benchmark{_TF-AMP}.sh <num/of/gpus> <path/to/dataset> <path/to/checkpoints> <batch/size>

For example, to benchmark training using mixed-precision on 4 GPUs with batch size of 2 use:

bash scripts/unet3d_train_benchmark_TF-AMP.sh 4 <path/to/dataset> <path/to/checkpoints> 2

Each of these scripts will by default run 40 warm-up iterations and benchmark the performance during training in the next 40 iterations.

To have more control, you can run the script by directly providing all relevant run parameters. For example:

horovodrun -np <num/of/gpus> python main.py --exec_mode train --benchmark --augment --data_dir <path/to/dataset> --model_dir <path/to/checkpoints> --batch_size <batch/size> --warmup_steps <warm-up/steps> --max_steps <max/steps>

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

Inference performance benchmark

To benchmark inference, run one of the scripts in ./scripts/:

bash scripts/unet3d_infer_benchmark{_TF-AMP}.sh <path/to/dataset> <path/to/checkpoints> <batch/size>

For example, to benchmark inference using mixed-precision with batch size 4:

bash scripts/unet3d_infer_benchmark_TF-AMP.sh <path/to/dataset> <path/to/checkpoints> 4

Each of these scripts will by default run 20 warm-up iterations and benchmark the performance during inference in the next 20 iterations.

To have more control, you can run the script by directly providing all relevant run parameters. For example:

python main.py --exec_mode predict --benchmark --data_dir <path/to/dataset> --model_dir <optional, path/to/checkpoint> --batch_size <batch/size> --warmup_steps <warm-up/steps> --max_steps <max/steps>

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

Results

The following sections provide details on how we achieved our performance and accuracy of training and inference.

Training accuracy results

To reproduce this result, start the Docker container interactively and run one of the train scripts:

bash scripts/unet3d_train_full{_TF-AMP}.sh <num/of/gpus> <path/to/dataset> <path/to/checkpoint> <batch/size>

for example to train using 8 GPUs and batch size of 2:

bash scripts/unet3d_train_full_TF-AMP.sh 8 /data/preprocessed /results 2

This command will launch a script which will run 5-fold cross-validation training for 16,000 iterations on each fold and print:

  • the validation DICE scores for each class: Tumor Core (TC), Peritumoral Edema (ED), Enhancing Tumor (ET),
  • the mean DICE score,
  • the whole tumor (WT) which represents a binary classification case (tumor vs background).

The time reported is for one fold, which means that the training of 5 folds will take 5 times longer. The default batch size is 2, however if you have less than 16 GB memory card and you encounter GPU memory issues you should decrease the batch size. The logs of the runs can be found in the /results directory once the script is finished.

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

The following table lists the average DICE score across 5-fold cross-validation. Our results were obtained by running the scripts/unet3d_train_full{_TF-AMP}.sh training script in the tensorflow:21.10-tf1-py3 NGC container on NVIDIA DGX A100 (8x A100 80G) GPUs.

GPUsBatch size / GPUDICE - TF32DICE - mixed precisionTime to train - FP32Time to train - mixed precisionTime to train speedup (FP32 to mixed precision)
820.88180.88198 min7 min1.14
Training accuracy: NVIDIA DGX-1 (8x V100 16G)

The following table lists the average DICE score across 5-fold cross-validation. Our results were obtained by running the scripts/unet3d_train_full{_TF-AMP}.sh training script in the tensorflow:21.10-tf1-py3 NGC container on NVIDIA DGX-1 (8x V100 16G) GPUs.

GPUsBatch size / GPUDICE - FP32DICE - mixed precisionTime to train - FP32Time to train - mixed precisionTime to train speedup (FP32 to mixed precision)
820.88180.881933 min13 min2.54

Training performance results

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

Our results were obtained by running the scripts/unet3d_train_benchmark{_TF-AMP}.sh training script in the tensorflow:21.10-tf1-py3 NGC container on NVIDIA DGX A100 with (8x A100 80G) GPUs. Performance numbers (in volumes per second) were averaged over 80 iterations, excluding the first 40 warm-up steps.

GPUsBatch size / GPUThroughput - TF32 [img/s]Throughput - mixed precision [img/s]Throughput speedup (FP32 - mixed precision)Weak scaling - FP32Weak scaling - mixed precision
1210.4017.911.72N/AN/A
1410.6619.881.86N/AN/A
183.9920.895.23N/AN/A
8281.71100.241.237.855.60
8480.65140.441.747.567.06
8829.79137.614.627.476.59
Training performance: NVIDIA DGX-1 (8x V100 16G)

Our results were obtained by running the scripts/unet3d_train_benchmark{_TF-AMP}.sh training script in the tensorflow:21.10-tf1-py3 NGC container on NVIDIA DGX-1 with (8x V100 16G) GPUs. Performance numbers (in volumes per second) were averaged over 80 iterations, excluding the first 40 warm-up steps.

GPUsBatch size / GPUThroughput - FP32 [img/s]Throughput - mixed precision [img/s]Throughput speedup (FP32 - mixed precision)Weak scaling - FP32Weak scaling - mixed precision
111.877.453.98N/AN/A
122.328.793.79N/AN/A
8114.4946.883.237.756.29
8218.0658.303.237.786.63

To achieve these same results, follow the steps in the Training performance benchmark section.

Inference performance results

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

Our results were obtained by running the scripts/unet3d_infer_benchmark{_TF-AMP}.sh inference benchmarking script in the tensorflow:21.10-tf1-py3 NGC container on NVIDIA DGX A100 with (1x A100 80G) GPU. Performance numbers (in volumes per second) were averaged over 40 iterations, excluding the first 20 warm-up steps.

FP16

Batch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
1224x224x160x415.5867.3268.6378.00109.42
2224x224x160x415.81129.06129.93135.31166.62
4224x224x160x48.34479.47482.55487.68494.80

TF32

Batch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
1224x224x160x49.42106.22106.68107.67122.73
2224x224x160x44.69427.13428.33428.76429.19
4224x224x160x42.321723.791725.771726.301728.23

To achieve these same results, follow the steps in the Inference performance benchmark section.

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

Our results were obtained by running the scripts/unet3d_infer_benchmark{_TF-AMP}.sh inference benchmarking script in the tensorflow:21.10-tf1-py3 NGC container on NVIDIA DGX-1 with (1x V100 16G) GPU. Performance numbers (in volumes per second) were averaged over 40 iterations, excluding the first 20 warm-up steps.

FP16

Batch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
1224x224x160x47.64136.81138.94143.59152.74
2224x224x160x47.75260.66267.07270.88274.44
4224x224x160x44.78838.52842.88843.30844.62

FP32

Batch sizeResolutionThroughput Avg [img/s]Latency Avg [ms]Latency 90% [ms]Latency 95% [ms]Latency 99% [ms]
1224x224x160x42.30434.95436.82437.40438.48
2224x224x160x42.40834.99837.22837.51838.18
4224x224x160x4OOM

To achieve these same results, follow the steps in the Inference performance benchmark section.

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.