NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
ResNet50 v1.5 for MXNet
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
ResNet50 v1.5 for MXNet

With modified architecture and initialization this ResNet50 version gives ~0.5% better accuracy than original.

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

To benchmark training and inference, run: python benchmark.py -n <numbers of gpus separated by comma> -b <batch sizes per GPU separated by comma> --data-root <path to imagenet> --dtype <float32 or float16> -o <path to benchmark report>

  • To control the benchmark length per epoch, use the -i flag (defaults to 100 iterations).
  • To control the number of epochs, use the -e flag.
  • To control the number of warmup epochs (epochs which are not taken into account), use the -w flag.
  • To limit the length of the dataset, use the --num-examples flag.

By default, the same parameters as in ./runner will be used. Additional flags will be passed to ./runner.

Training performance benchmark

To benchmark only training, use the --mode train flag.

Inference performance benchmark

To benchmark only inference, use the --mode val flag.

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)

90 epochs configuration

Our results were obtained by running 8 times the ./runner -n <number of gpus> -b 512 --dtype float32 script for TF32 and the ./runner -n <number of gpus> -b 512 script for mixed precision in the mxnet-22.10-py3 NGC container on NVIDIA DGX A100 with (8x A100 80GB) GPUs.

GPUsAccuracy - mixed precisionAccuracy - TF32Time to train - mixed precisionTime to train - TF32Time to train - speedup
177.18577.1848.7529.393.36
877.18577.1841.143.823.35
Training accuracy: NVIDIA DGX-1 (8x V100 16GB)

90 epochs configuration

Our results were obtained by running the ./runner -n <number of gpus> -b 96 --dtype float32 training script for FP32 and the ./runner -n <number of gpus> -b 192 training script for mixed precision in the mxnet-22.10-py3 NGC container on NVIDIA DGX-1 with (8x V100 16GB) GPUs.

GPUsAccuracy - mixed precisionAccuracy - FP32Time to train - mixed precisionTime to train - FP32Time to train - speedup
177.34277.16024.284.53.49
477.19677.2906.021.43.59
877.15077.3133.010.73.54
Training stability test

Our results were obtained by running the following commands 8 times with different seeds.

  • For 50 epochs

    • ./runner -n 8 -b 96 --dtype float32 --num-epochs 50 for FP32
    • ./runner -n 8 -b 192 --num-epochs 50 for mixed precision
  • For 90 epochs

    • ./runner -n 8 -b 96 --dtype float32 for FP32
    • ./runner -n 8 -b 192 for mixed precision
  • For 250 epochs

    • ./runner -n 8 -b 96 --dtype float32 --num-epochs 250 --mixup 0.2 for FP32
    • ./runner -n 8 -b 192 --num-epochs 250 --mixup 0.2 for mixed precision
# of epochsmixed precision avg top1FP32 avg top1mixed precision standard deviationFP32 standard deviationmixed precision minimum top1FP32 minimum top1mixed precision maximum top1FP32 maximum top1
5076.30876.3290.000730.0009476.23076.23476.44076.470
9077.15077.3130.000980.0008576.97277.22877.26677.474
25078.46078.4830.000780.0006578.28478.40478.56078.598

Plots for 250 epoch configuration Here are example graphs of FP32 and mixed precision training on 8 GPU 250 epochs configuration:

TrainingLoss

TrainingAccuracy

ValidationAccuracy

Training performance results

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

The following results were obtained by running the python benchmark.py -n 1,4,8 -b 512 --dtype float32 -o benchmark_report_tf32.json -i 500 -e 3 -w 1 --num-examples 32000 --mode train script for TF32 and the python benchmark.py -n 1,4,8 -b 512 --dtype float16 -o benchmark_report_fp16.json -i 500 -e 3 -w 1 --num-examples 32000 --mode train script for mixed precision in the mxnet-22.10-py3 NGC container on NVIDIA DGX A100 with (8x A100 80GB) GPUs.

Training performance reported as Total IPS (data + compute time taken into account). Weak scaling is calculated as a ratio of speed for given number of GPUs to speed for 1 GPU.

GPUsThroughput - mixed precisionThroughput - TF32Throughput speedup (TF32 - mixed precision)Weak scaling - mixed precisionWeak scaling - TF32
13410.521055.782.181.001.00
413442.664182.303.243.973.96
826673.728247.443.237.827.81
Training performance: NVIDIA DGX-1 (8x V100 16GB)

The following results were obtained by running the python benchmark.py -n 1,2,4,8 -b 192 --dtype float16 -o benchmark_report_fp16.json -i 500 -e 3 -w 1 --num-examples 32000 --mode train script for mixed precision and the python benchmark.py -n 1,2,4,8 -b 96 --dtype float32 -o benchmark_report_fp32.json -i 500 -e 3 -w 1 --num-examples 32000 --mode train script for FP32 in the mxnet-20.12-py3 NGC container on NVIDIA DGX-1 with (8x V100 16GB) GPUs.

Training performance reported as Total IPS (data + compute time taken into account). Weak scaling is calculated as a ratio of speed for given number of GPUs to speed for 1 GPU.

GPUsThroughput - mixed precisionThroughput - FP32Throughput speedup (FP32 - mixed precision)Weak scaling - mixed precisionWeak scaling - FP32
113763843.581.001.00
227687633.622.011.98
4535715133.543.893.94
81072330053.567.797.82
Training performance: NVIDIA DGX-2 (16x V100 32GB)

The following results were obtained by running the python benchmark.py -n 1,2,4,8,16 -b 256 --dtype float16 -o benchmark_report_fp16.json -i 500 -e 3 -w 1 --num-examples 32000 --mode train script for mixed precision and the python benchmark.py -n 1,2,4,8,16 -b 128 --dtype float32 -o benchmark_report_fp32.json -i 500 -e 3 -w 1 --num-examples 32000 --mode train script for FP32 in the mxnet-20.12-py3 NGC container on NVIDIA DGX-2 with (16x V100 32GB) GPUs.

Training performance reported as Total IPS (data + compute time taken into account). Weak scaling is calculated as a ratio of speed for given number of GPUs to speed for 1 GPU.

GPUsThroughput - mixed precisionThroughput - FP32Throughput speedup (FP32 - mixed precision)Weak scaling - mixed precisionWeak scaling - FP32
114924173.571.001.00
229358213.571.961.96
4572616233.523.833.92
81136832233.527.617.72
162148463383.3814.3915.19

Inference performance results

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

The following results were obtained by running the python benchmark.py -n 1 -b 1,2,4,8,16,32,64,128,192,256 --dtype float16 -o inferbenchmark_report_fp16.json -i 500 -e 3 -w 1 --mode val script for mixed precision and the python benchmark.py -n 1 -b 1,2,4,8,16,32,64,128,192,256 --dtype float32 -o inferbenchmark_report_tf32.json -i 500 -e 3 -w 1 --mode val script for TF32 in the mxnet-22.10-py3 NGC container on NVIDIA DGX A100 with (8x A100 80GB) GPUs.

Inference performance reported as Total IPS (data + compute time taken into account). Reported mixed precision speedups are relative to TF32 numbers for corresponding configuration.

Batch sizeThroughput (img/sec) - mixed precisionThroughput - speedupAvg latency (ms) - mixed precisionAvg latency - speedup50% latency (ms) - mixed precision50% latency - speedup90% latency (ms) - mixed precision90% latency - speedup95% latency (ms) - mixed precision95% latency - speedup99% latency (ms) - mixed precision99% latency - speedup
11431.991.90.71.90.681.950.711.90.841.650.881.7
22530.662.190.792.190.742.310.862.050.932.02.00.97
43680.742.111.092.110.922.491.211.981.641.516.030.45
82593.881.113.081.112.891.174.090.894.720.89.850.55
164340.081.523.691.523.311.684.731.246.30.9512.310.54
326808.222.14.72.14.02.466.441.589.011.1515.880.68
647659.962.218.362.217.442.4810.761.7513.911.3721.960.9
1288017.672.2315.962.2315.02.3718.951.921.651.6730.361.23
1928240.82.2623.32.2622.492.3325.652.0727.541.9437.191.5
2567909.622.1532.372.1531.662.234.272.0537.021.942.831.66
5127213.432.0770.982.0770.482.0873.212.0474.382.0379.151.99
Inference performance: NVIDIA DGX-1 (1x V100 16GB)

The following results were obtained by running the python benchmark.py -n 1 -b 1,2,4,8,16,32,64,128,192,256 --dtype float16 -o inferbenchmark_report_fp16.json -i 500 -e 3 -w 1 --mode val script for mixed precision and the python benchmark.py -n 1 -b 1,2,4,8,16,32,64,128,192,256 --dtype float32 -o inferbenchmark_report_fp32.json -i 500 -e 3 -w 1 --mode val script for FP32 in the mxnet-20.12-py3 NGC container on NVIDIA DGX-1 with (8x V100 16GB) GPUs.

Inference performance reported as Total IPS (data + compute time taken into account). Reported mixed precision speedups are relative to FP32 numbers for corresponding configuration.

Batch sizeThroughput (img/sec) - mixed precisionThroughput - speedupAvg latency (ms) - mixed precisionAvg latency - speedup50% latency (ms) - mixed precision50% latency - speedup90% latency (ms) - mixed precision90% latency - speedup95% latency (ms) - mixed precision95% latency - speedup99% latency (ms) - mixed precision99% latency - speedup
12861.273.481.273.451.273.611.263.681.263.861.24
25191.343.841.343.771.354.051.314.161.294.591.27
49101.604.391.604.351.614.591.564.661.565.191.47
816422.204.872.204.682.295.352.056.011.8411.061.04
1623592.556.782.556.492.667.072.488.332.1213.891.30
3229022.8611.022.8610.433.0212.252.6013.882.3121.411.55
6432342.7419.782.7418.892.8622.502.4425.382.1730.781.81
12833622.6938.062.6937.202.7542.322.4445.122.3050.592.07
19231782.5260.402.5259.622.5565.562.3568.162.2573.722.10
25630572.3883.732.3882.772.4092.262.2492.262.17100.842.23
Inference performance: NVIDIA T4

The following results were obtained by running the python benchmark.py -n 1 -b 1,2,4,8,16,32,64,128,192,256 --dtype float16 -o inferbenchmark_report_fp16.json -i 500 -e 3 -w 1 --mode val script for mixed precision and the python benchmark.py -n 1 -b 1,2,4,8,16,32,64,128,192,256 --dtype float32 -o inferbenchmark_report_fp32.json -i 500 -e 3 -w 1 --mode val script for FP32 in the mxnet-20.12-py3 NGC container on an NVIDIA T4 GPU.

Inference performance reported as Total IPS (data + compute time taken into account). Reported mixed precision speedups are relative to FP32 numbers for corresponding configuration.

Batch sizeThroughput (img/sec) - mixed precisionThroughput - speedupAvg latency (ms) - mixed precisionAvg latency - speedup50% latency (ms) - mixed precision50% latency - speedup90% latency (ms) - mixed precision90% latency - speedup95% latency (ms) - mixed precision95% latency - speedup99% latency (ms) - mixed precision99% latency - speedup
11311.117.611.177.100.9710.280.9211.350.9515.050.96
22771.487.201.537.301.197.741.488.821.4912.091.58
43741.4710.671.5010.201.4013.511.0914.821.0322.360.74
86722.2111.902.2311.212.2114.541.7417.241.4828.650.92
1612673.5712.623.5812.023.5914.023.1316.022.7622.282.01
3214733.8521.713.8621.673.7622.633.6422.983.6023.853.52
6415613.7040.983.7040.873.6441.983.5742.563.5343.853.46
12815553.6082.263.6081.863.5783.873.5184.633.4996.563.09
19215453.64124.263.64123.673.61125.763.58126.733.56143.273.19
25615593.71164.153.71163.973.71166.283.70167.013.70168.543.69