NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
EfficientNet V2 For Tensorflow2
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
EfficientNet V2 For Tensorflow2

EfficientNets are a family of image classification models, which achieve state-of-the-art accuracy, being an order-of-magnitude smaller and faster.

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

Training benchmark for EfficientNet v2-S was run on NVIDIA DGX A100 80GB and NVIDIA DGX-1 V100 32GB.

bash ./scripts/S/training/{AMP, FP32, TF32}/train_benchmark_8x{A100-80G, V100-32G}.sh

Inference performance benchmark

Inference benchmark for EfficientNet v2-S was run on NVIDIA DGX A100 80GB and NVIDIA DGX-1 V100 32GB.

Results

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

Training results for EfficientNet v2-S

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

Our results were obtained by running the training scripts in the tensorflow:21.09-tf2-py3 NGC container on multi-node NVIDIA DGX A100 (8x A100 80GB) GPUs. We evaluated the models using both the original and EMA weights and selected the higher accuracy to report.

GPUsAccuracy - TF32Accuracy - mixed precisionTime to train - TF32Time to train - mixed precisionTime to train speedup (TF32 to mixed precision)
883.87%83.93%32hrs14hrs2.28
1683.89%83.83%16hrs7hrs2.28
Training accuracy: NVIDIA DGX-1 (8x V100 32GB)

Our results were obtained by running the training scripts in the tensorflow:21.09-tf2-py3 NGC container on multi-node NVIDIA DGX V100 (8x V100 32GB) GPUs. We evaluated the models using both the original and EMA weights and selected the higher accuracy to report.

GPUsAccuracy - FP32Accuracy - mixed precisionTime to train - FP32Time to train - mixed precisionTime to train speedup (FP32 to mixed precision)
883.86%84.0%90.3hrs55hrs1.64
1683.75%83.87%60.5hrs28.5hrs2.12
3283.81%83.82%30.2hrs15.5hrs1.95

Training performance results for EfficientNet v2-S

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

EfficientNet v2-S uses images of increasing resolution during training. Since throughput changes depending on the image size, we have measured throughput based on the image size used in the last stage of training (300x300).

GPUsThroughput - TF32Throughput - mixed precisionThroughput speedup (TF32 - mixed precision)Weak scaling - TF32Weak scaling - mixed precision
13909502.4311
8280066002.357.176.94
165950145172.4315.2515.28
Training performance: NVIDIA DGX-1 (8x V100 32GB)

EfficientNet v2-S uses images of increasing resolution during training. Since throughput changes depending on the image size, we have measured throughput based on the image size used in the last stage of training (300x300).

GPUsThroughput - FP32Throughput - mixed precisionThroughput speedup (FP32 - mixed precision)Weak scaling - FP32Weak scaling - mixed precision
11563802.4311
895217741.866.104.66
16166837502.2510.699.86
32327072502.220.9619.07

Training EfficientNet v2-S at scale

10x NVIDIA DGX-1 V100 (8x V100 32GB)

We trained EfficientNet v2-S at scale using 10 DGX-1 machines each having 8x V100 32GB GPUs. We used the same set of hyperparameters and NGC container as before. Also, throughput numbers were measured in the last stage of training. The accuracy was selected as the better between that of the original weights and EMA weights.

# NodesGPUsOptimizerAccuracy - mixed precisionTime to train - mixed precisionTime to train speedupThroughput - mixed precisionThroughput scaling
18RMSPROP84.0%55hrs117741
1080RMSPROP83.76%6.5hrs8.46160399.04
10x NVIDIA DGX A100 (8x A100 80GB)

We trained EfficientNet v2-S at scale using 10 DGX A100 machines each having 8x A100 80GB GPUs. This training setting has an effective batch size of 36800 (460x8x10), which requires advanced optimizers particularly designed for large-batch training. For this purpose, we used the nvLAMB optimizer with the following hyper parameters: lr_warmup_epochs=10, beta_1=0.9, beta_2=0.999, epsilon=0.000001, grad_global_clip_norm=1, lr_init=0.00005, weight_decay=0.00001. As before, we used tensorflow:21.09-tf2-py3 NGC container and measured throughput numbers in the last stage of training. The accuracy was selected as the better between that of the original weights and EMA weights.

# NodesGPUsOptimizerAccuracy - mixed precisionTime to train - mixed precisionTime to train speedupThroughput - mixed precisionThroughput scaling
18RMSPROP83.93%14hrs166001
1080nvLAMB82.84%1.84hrs7.60621309.41

Inference performance results for EfficientNet v2-S

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

Our results were obtained by running the inferencing benchmarking script in the tensorflow:21.09-tf2-py3 NGC container on the NVIDIA DGX A100 (1x A100 80GB) GPU.

FP16 Inference Latency

Batch sizeResolutionThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1384x3842933.9933.4933.6933.89
8384x38420439.1438.6138.8239.03
32384x38477241.3540.6440.9041.15
128384x384167476.4574.2074.7075.80
256384x3841960130.57127.34128.74130.27
512384x3842062248.18226.80232.86248.18
1024384x3842032503.73461.78481.50503.73

TF32 Inference Latency

Batch sizeResolutionThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1384x3843925.5525.0525.2625.47
8384x38424432.7532.1632.4032.64
32384x38477741.1340.6940.8441.00
128384x3841000127.94126.71127.12127.64
256384x3841070239.08235.45236.79238.39
512384x3841130452.71444.64448.18452.71

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

Our results were obtained by running the inferencing benchmarking script in the tensorflow:21.09-tf2-py3 NGC container on the NVIDIA DGX V100 (1x V100 32GB) GPU.

FP16 Inference Latency

Batch sizeResolutionThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1384x3842933.9933.4933.6933.89
8384x38418443.3742.8043.0143.26
32384x38459252.9653.2053.4553.72
128384x384933136.98134.44134.79136.05
256384x384988258.94251.56252.86257.92

FP32 Inference Latency

Batch sizeResolutionThroughput AvgLatency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1384x3844522.0221.8721.9321.99
8384x38426030.7330.3330.5130.67
32384x38441676.8976.5776.6576.74
128384x384460278.24276.56276.93277.74