NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Mask R-CNN for PyTorch
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Mask R-CNN for PyTorch

Mask R-CNN is a convolution based network for object instance segmentation. This implementation provides 1.3x faster training while maintaining target accuracy.

Benchmarking

Benchmarking can be performed for both training and inference. Both scripts run the Mask R-CNN model using the parameters defined in configs/e2e_mask_rcnn_R_50_FPN_1x.yaml. You can specify whether benchmarking is performed in FP16, TF32 or FP32 by specifying it as an argument to the benchmarking scripts.

Training performance benchmark

Training benchmarking can performed by running the script:

scripts/train_benchmark.sh <float16/tf32/float32> <number of gpus> <NHWC True/False> <Hybrid dataloader True/False>

Inference performance benchmark

Inference benchmarking can be performed by running the script:

scripts/inference_benchmark.sh <float16/tf32/float32> <batch_size>

Results

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

Training Accuracy Results

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

Our results were obtained by running the scripts/train.sh training script in the 21.12-py3 NGC container on NVIDIA DGX A100 (8x A100 80GB) GPUs.

GPUsBatch size / GPUBBOX mAP - TF32MASK mAP - TF32BBOX mAP - FP16MASK mAP - FP16Time to train - TF32Time to train - mixed precisionTime to train speedup (TF32 to mixed precision)
8120.37650.34080.37630.34172.151.851.16x
Training accuracy: NVIDIA DGX-1 (8x V100 32GB)

Our results were obtained by running the scripts/train.sh training script in the PyTorch 21.12-py3 NGC container on NVIDIA DGX-1 with 8x V100 32GB GPUs.

GPUsBatch size / GPUBBOX mAP - FP32MASK mAP - FP32BBOX mAP - FP16MASK mAP - FP16Time to train - FP32Time to train - mixed precisionTime to train speedup (FP32 to mixed precision)
8120.37680.34150.37550.34035.583.371.65x

Note: Currently V100 32GB + FP32 + NHWC + Hybrid dataloader causes a slowdown. So for all V100 32GB FP32 runs hybrid dataloader and NHWC are disabled NHWC=False HYBRID=False DTYPE=float32 bash scripts/train.sh

Training loss curves

Loss Curve

Here, multihead loss is simply the summation of losses on the mask head and the bounding box head.

Training Stability Test

The following tables compare mAP scores across 5 different training runs with different seeds. The runs showcase consistent convergence on all 5 seeds with very little deviation.

ConfigSeed 1Seed 2Seed 3Seed 4Seed 5MeanStandard Deviation
8 GPUs, final AP BBox0.37640.37660.37670.37520.37680.37630.0006
8 GPUs, final AP Segm0.34140.34110.3410.34070.34150.34110.0003

Training Performance Results

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

Our results were obtained by running the scripts/train_benchmark.sh training script in the 21.12-py3 NGC container on NVIDIA DGX A100 (8x A100 80GB) GPUs. Performance numbers in images per second were averaged over 500 iterations.

GPUsBatch size / GPUThroughput - TF32Throughput - mixed precisionThroughput speedup (TF32 - mixed precision)Weak scaling - TF32Weak scaling - mixed precision

| 1 | 12 | 23 | 24 | 1.04 | 1 | 1 | | 4 | 12 | 104 | 106 | 1.02 | 4.52 | 4.42 | | 8 | 12 | 193 | 209 | 1.08 | 8.39 | 8.71 |

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

Our results were obtained by running the scripts/train_benchmark.sh training script in the 21.12-py3 NGC container on NVIDIA DGX-1 with (8x V100 32GB) GPUs. Performance numbers in images per second were averaged over 500 iterations.

GPUsBatch size / GPUThroughput - FP32Throughput - mixed precisionThroughput speedup (FP32 - mixed precision)Weak scaling - FP32Weak scaling - mixed precision
11212161.3311
41244711.613.674.44
812851351.597.088.44

Note: Currently V100 32GB + FP32 + NHWC + Hybrid dataloader causes a slowdown. So for all V100 32GB FP32 runs hybrid dataloader and NHWC are disabled bash scripts/train_benchmark.sh fp32 <number of gpus> False False To achieve these same results, follow the steps in the Quick Start Guide.

Inference performance results

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

Our results were obtained by running the scripts/inference_benchmark.sh training script in the PyTorch 21.12-py3 NGC container on NVIDIA DGX A100 (1x A100 80GB) GPU.

FP16 Inference Latency

Batch sizeThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
12334.9133.8733.9534.15
22659.3157.8057.9958.27
431101.4699.2499.5199.86
831197.57193.82194.28194.77

TF32 Inference Latency

Batch sizeThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
12531.6631.0331.1331.26
22856.9155.8856.0556.02
429104.11102.29102.53102.74
830201.13197.43197.84198.19
Inference performance: NVIDIA DGX-1 (1x V100 32GB)

Our results were obtained by running the scripts/inference_benchmark.sh training script in the PyTorch 21.12-py3 NGC container on NVIDIA DGX-1 with 1x V100 32GB GPUs.

FP16 Inference Latency

Batch sizeThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11944.7243.6243.7744.03
22182.8081.3781.6782.06
422155.25153.15153.63154.10
822307.60304.08304.82305.48

FP32 Inference Latency

Batch sizeThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11652.7851.8752.1652.43
217100.8199.1999.67100.15
417202.05198.84199.98200.92
818389.99384.29385.77387.66

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