Search

Search papers and lessons

EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks

Mingxing Tan, Quoc V. Le · 2019

EfficientNet scales a convolutional network's depth, width and input resolution together with one shared coefficient, and reaches 84.3 percent ImageNet top-1 with 66 million parameters.

On this page

  • Colour = topic mix
  • Linear algebra
  • Probability
  • Calculus
  • Architectures
  • Discrete math
  • Neural network basics
  • ReadReady to readNot yet

TL;DR

Before this paper, a convolutional network was made bigger by adding layers, widening the channels, or feeding it larger images, usually one at a time. The paper shows that these three dimensions work better when they grow together in a fixed ratio. It sets that ratio with a single coefficient ϕ\phi, and it also designs a small baseline network, EfficientNet-B0, to scale. The largest model, EfficientNet-B7, reaches 84.3 percent top-1 accuracy on ImageNet (a standard image classification benchmark) with 66 million parameters. The abstract reports this as 8.4 times smaller than the previous best, GPipe, which has 557 million parameters.

Builds on: Convolutional Neural Network, MBConv Block, Neural Architecture Search, Residual Connection · Leads to: Compound Scaling, the rule the paper introduces

Why it mattered

The paper gives a recipe any convolutional family can follow: fix a baseline, choose three factors once, then scale with one number. Its models are also evaluated as image backbones for transfer learning. Its abstract reports transfer accuracy of 91.7 percent on CIFAR-100 and 98.8 percent on Flowers, with an order of magnitude fewer parameters than the earlier models it compares against. The source code is published in the TensorFlow TPU repository.

The paper also reports efficiency beyond accuracy. Instead of only accuracy, it compares parameters, FLOPS (floating-point operations per image) and measured latency on a real CPU. Its Table 4 gives 0.098 seconds for EfficientNet-B1 against 0.554 seconds for ResNet-152, a 5.7 times speedup at similar accuracy.

The problem

A convolutional network has a fixed budget of compute and memory. When a team has more budget, it must choose how to spend it. The paper names three knobs. Depth is the number of layers. Width is the number of channels in each layer. Resolution is the height and width of the input image.

Each knob helps, but for different reasons, and the gains fade. Deeper networks capture richer features but are harder to train, and the paper notes that ResNet-1000 is about as accurate as ResNet-101. Wider networks capture finer detail, but accuracy saturates quickly when they become very wide and shallow. Higher resolution helps, but the gain shrinks for very large inputs. Scaling a single knob is the default practice, and the paper's central observation is that the knobs depend on each other, so scaling only one wastes part of the budget.

How it works

  1. Start with a baseline network. The team designs EfficientNet-B0 with a neural architecture search that optimizes accuracy and FLOPS together. Its main building block is the MBConv Block, with Squeeze-and-Excitation Block added. The network has nine stages, starting with a 3 by 3 convolution on a 224 by 224 image and ending with a fully connected layer.

  2. Choose a compound coefficient. There is one number ϕ\phi that says how many more resources are available. The depth multiplier is αϕ\alpha^\phi, the width multiplier is βϕ\beta^\phi, and the resolution multiplier is γϕ\gamma^\phi.

  3. Pick the three base factors once. On the small baseline, a grid search with ϕ=1\phi = 1 finds α=1.2\alpha = 1.2, β=1.1\beta = 1.1 and γ=1.15\gamma = 1.15. These are constrained so that α⋅β2⋅γ2≈2\alpha \cdot \beta^2 \cdot \gamma^2 \approx 2.

  4. Scale up. The factors are then fixed. Each unit of ϕ\phi multiplies the depth by α\alpha, the width by β\beta and the resolution by γ\gamma, all at once, so ϕ=2\phi = 2 applies the three factors twice. Different values of ϕ\phi give the paper's family, from B1 to B7.

  5. Check the cost. Because a convolution's FLOPS grow with depth, with the square of width, and with the square of resolution, the total cost grows by about (αβ2γ2)ϕ≈2ϕ(\alpha \beta^2 \gamma^2)^\phi \approx 2^\phi. Each extra unit of ϕ\phi roughly doubles the compute.

  6. Train with fixed settings. The paper trains every model on ImageNet with its own recipe, customised for these networks, and it raises Dropout from 0.2 for B0 to 0.5 for B7 as the models grow.

flowchart LR
  B0["Baseline B0 from architecture search"] --> G["Grid search at phi = 1: alpha, beta, gamma"]
  G --> S["Fix alpha, beta, gamma"]
  S --> P["Choose phi"]
  P --> M["Scaled model: depth alpha^phi, width beta^phi, resolution gamma^phi"]

A tiny trace. Take the factors α=1.2\alpha = 1.2, β=1.1\beta = 1.1 and γ=1.15\gamma = 1.15. At ϕ=1\phi = 1, depth multiplies by 1.2, width by 1.1 and resolution by 1.15. The FLOPS multiplier is 1.2×1.12×1.152=1.921.2 \times 1.1^2 \times 1.15^2 = 1.92, close to 2. At ϕ=2\phi = 2 the multipliers are applied twice, and the FLOPS multiplier is about 1.922≈3.71.92^2 \approx 3.7, close to 4.

The math

Scaling as an optimisation. A network is written as a list of stages, where stage ii repeats a layer operator F^i\hat{\mathcal{F}}_i a number of times L^i\hat{L}_i, on inputs of height H^i\hat{H}_i, width W^i\hat{W}_i and channels C^i\hat{C}_i. Model scaling chooses three coefficients dd, ww and rr that multiply the depth, width and resolution of the baseline. The goal is to maximise accuracy under a memory and FLOPS budget.

Compound scaling. The paper ties the three coefficients to one number:

d=αϕ,w=βϕ,r=γϕd = \alpha^{\phi}, \qquad w = \beta^{\phi}, \qquad r = \gamma^{\phi}

with the constraints

α⋅β2⋅γ2≈2,α≥1, β≥1, γ≥1\alpha \cdot \beta^{2} \cdot \gamma^{2} \approx 2, \qquad \alpha \ge 1, \ \beta \ge 1, \ \gamma \ge 1

The square on β\beta and γ\gamma comes from the FLOPS rule. A convolution's cost grows linearly with depth, and with the square of width and of resolution. So the total cost multiplies by about α⋅β2⋅γ2\alpha \cdot \beta^2 \cdot \gamma^2 at each step, which is set to 2 so that the cost grows as 2ϕ2^\phi.

The grid search. The values α=1.2\alpha = 1.2, β=1.1\beta = 1.1 and γ=1.15\gamma = 1.15 satisfy the constraint, since 1.2×1.12×1.152≈1.921.2 \times 1.1^2 \times 1.15^2 \approx 1.92.

Results

All numbers below are from the paper's tables and text. Accuracy is ImageNet top-1, single crop, single model: the model's single highest-scoring class must match the label.

The scaling rule on existing networks (Table 3). For MobileNetV1, the baseline is 70.6 percent at 0.6 billion FLOPS, and the compound-scaled version is 75.6 percent at 2.3 billion FLOPS. For ResNet-50, the baseline is 76.0 percent at 4.1 billion FLOPS, and the compound-scaled version is 78.8 percent at 16.7 billion FLOPS. Scaling only depth reaches 78.1 percent at 16.2 billion FLOPS, and scaling only width reaches 77.7 percent at 14.7 billion. The compound version is the most accurate of the ResNet-50 variants in the table.

The family (Table 2). EfficientNet-B0 reaches 77.1 percent with 5.3 million parameters and 0.39 billion FLOPS. EfficientNet-B1 reaches 79.1 percent with 7.8 million parameters. EfficientNet-B7 reaches 84.3 percent with 66 million parameters and 37 billion FLOPS. GPipe, the previous best at 84.3 percent, has 557 million parameters, so B7 is about 8.4 times smaller at the same accuracy. ResNet-50 has 76.0 percent with 26 million parameters and 4.1 billion FLOPS.

Latency (Table 4). On one CPU core with batch size 1, EfficientNet-B1 takes 0.098 seconds and ResNet-152 takes 0.554 seconds, a 5.7 times speedup at 78.8 against 77.8 percent. EfficientNet-B7 takes 3.1 seconds against 19.0 for GPipe, a 6.1 times speedup at 84.4 against 84.3 percent. The paper notes that its search optimised FLOPS rather than latency, because it did not target one device.

Transfer (Table 5). On eight transfer datasets, the scaled models set new accuracy on five, using 9.6 times fewer parameters on average. For example, the B7 model reaches 91.7 percent on CIFAR-100 and 98.8 percent on Flowers.

Limits. The search for the base factors was done once on the small baseline, and the paper says that searching directly on the large models would be more accurate but far more expensive. Part of the reported gain comes from the training settings, which the paper says were customised for EfficientNet, so the scaling rule alone is not the full story. The latency comparison uses one CPU core, which is one hardware setting, and the search optimised FLOPS rather than latency. Ensembles and models pre-trained on 3.5 billion Instagram images are left out of the comparison.

Reading guide

Check yourself

QuestionWhat are the three dimensions the paper scales, and what does the coefficient phi control?Show answer

The three dimensions are network depth, width (channels per layer) and input resolution. The coefficient phi says how many more resources are available. It sets depth to alpha to the power phi, width to beta to the power phi, and resolution to gamma to the power phi.

QuestionWith alpha = 1.2, beta = 1.1 and gamma = 1.15, what is the FLOPS multiplier at phi = 1?Show answer

The FLOPS multiplier is α⋅β2⋅γ2=1.2×1.21×1.3225\alpha \cdot \beta^2 \cdot \gamma^2 = 1.2 \times 1.21 \times 1.3225. First, 1.21×1.3225=1.6002251.21 \times 1.3225 = 1.600225. Then 1.2×1.600225=1.920271.2 \times 1.600225 = 1.92027, which is close to 2.

QuestionWhy does the paper square beta and gamma but not alpha in the FLOPS constraint?Show answer

A convolution's FLOPS grow linearly with depth, because each layer is applied once more. They grow with the square of width, because the number of channels enters twice, once in and once out. They also grow with the square of resolution, because the spatial area is height times width. So doubling depth doubles the cost, while doubling width or resolution quadruples it.

QuestionResNet-50 with compound scaling reaches 78.8 percent at 16.7 billion FLOPS, and depth-only scaling reaches 78.1 percent at 16.2 billion. Which is better, and by how much?Show answer

Compound scaling is better, by 78.8−78.1=0.778.8 - 78.1 = 0.7 percentage points, and it uses slightly more FLOPS, 16.7−16.2=0.516.7 - 16.2 = 0.5 billion more. The comparison shows that the gain comes from balancing the dimensions, not from using more compute alone.

Sources

Read the full paper

Mingxing Tan, Quoc V. Le, 2019. arXiv:1905.11946