ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices
- Publication
- CVPR 2018Conference
- First submitted to arXiv
- arXiv:1707.01083
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{lightweightshufflenet2017,
title = {{ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices}},
author = {Xiangyu Zhang and Xinyu Zhou and Mengxiao Lin and Jian Sun},
year = {2017},
eprint = {1707.01083},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1707.01083}
}
The competition for lightweight networks had only just begun.
ShuffleNet joined the race at just this point.
MobileNet had reduced cost with depthwise separable convolution, but 1×1 convolutions still consumed most of the multiply-adds in networks with budgets of a few dozen to a little over 100 MFLOPs. This paper asks how to fit more channels into the same budget, and whether the theoretical savings translate into speed on a phone.
Defining the Problem
Computation and Speed Do Not Always Match
The authors face the same practical question as earlier lightweight-network studies:
- How can we keep accuracy high while building an efficient network for mobile devices with very limited computing power?
The paper focuses on small networks around 10–150 MFLOPs. Its FLOP figures count floating-point multiply-adds by the authors' convention; they are not device latency. MobileNet, and SENet in the paper's later revision, had already moved toward lower-cost designs, but the authors saw room to improve accuracy at these tight budgets.
The Cost of 1×1 Convolutions
Since pointwise convolution dominates, making only the 3×3 operation cheap is insufficient. ShuffleNet therefore applies group convolution to 1×1 layers: each group reads a subset of input channels, reducing multiplications per output channel. Repeating the same grouping across layers, however, limits information exchange between groups.
Solving the Problem
Group Convolution and Cross-Group Flow
First count the cost at one spatial position. Suppose a 1×1 convolution has 128 input and 128 output channels. Without grouping it uses multiplications. With eight groups, each group has 16 input and 16 output channels, for multiplications overall, one eighth of the original. A whole output feature map also multiplies this by the number of spatial positions. This example is not a whole-network FLOP count.
But there is no free lunch. In Figure 1(a), the second grouped layer uses the same partition, so outputs from the red group cannot use information from the green or blue groups. Grouping does not destroy channel values; it restricts which features later layers can combine. The shuffle in (b) and (c) rearranges channels between the layers so every new group receives data from different old groups.
Channel Shuffle
The paper's shuffle is deterministic. If the preceding layer has groups of channels, reshape the channel axis to , transpose those two axes, and flatten it again. For a contiguous NCHW tensor, the following teaching example implements that permutation. It assumes a positive integer group count and a channel count divisible by groups; it omits input validation.
import torch
def shuffle_channel(x: torch.Tensor, groups: int) -> torch.Tensor:
batch_size, num_channels, height, width = x.size()
channels_per_group = num_channels // groups
x = x.view(batch_size, groups, channels_per_group, height, width)
x = x.permute(0, 2, 1, 3, 4).contiguous()
x = x.view(batch_size, num_channels, height, width)
return x
For example, label three channel groups AAA, BBB, and CCC. Transposing the group axes yields ABC, ABC, ABC, so each group in the next layer can see channels from all three old groups. Despite the name, this is a regular shuffle, not a random one. The point is to let the groups exchange information. The permutation adds no trainable parameters. Figure 1(c) is about the information path between successive grouped layers.
Where Does the Shuffle Go?
Follow the main path of (b): a grouped 1×1 convolution changes channel width and is followed by BN and ReLU; channels are shuffled; a depthwise 3×3 processes spatial information; another grouped 1×1 restores the channel count. The authors put no ReLU after depthwise convolution and no extra shuffle after the second grouped 1×1. ReLU follows addition to the shortcut. This differs from the ordinary bottleneck in (a).
For downsampling in (c), a 3×3 average pool with stride 2 brings the shortcut to the same spatial size. The two paths are concatenated across channels, not added, allowing the output width to grow. The shuffle appears after the first grouped pointwise convolution, not after depthwise convolution.
Network Architecture
Conv1 reduces 224×224 to 112×112, then MaxPool to 56×56. Stages 2, 3, and 4 output 28×28, 14×14, and 7×7, respectively. The first unit of each stage downsamples; the others retain the size. Table 1 gives 3/7/3 further repeats in those stages. For example, at their output channel counts are 240/480/960. Global pooling and classification finish the network.
As group count rises, the authors also widen channels to keep the comparison near 140 MFLOPs. Thus the different settings in Table 2 do more than change grouping at a fixed width. The paper also leaves the first pointwise layer of Stage 2 ungrouped because it has few input channels. These conditions matter when reading the ablations.
Discussion
Effect of Group Convolution
For the 1× model, error falls from 33.6% at to its best 32.4% at , a 1.2 percentage-point difference. The 0.5× model is best at : 45.1→41.6%, or 3.5 points lower; error rises again to 42.3% at . The 0.25× model reaches 52.7% at , 4.4 points below its 57.1% at .
More groups also mean fewer input channels per filter. The authors suggest that more feature channels help small models, but the rebound for 0.5× means “more groups is always better” is not the finding.
Effect of Channel Shuffle
Across all six settings, shuffle lowers top-1 error by 1.3 to 5.8 percentage points. At 1× and , error drops from 37.6% to 32.4%, a 5.2-point difference. At 0.5× and , it drops from 48.1% to 42.3%, or 5.8 points. This ablation directly supports cross-group flow in the paper's models and training conditions.
Comparison with MobileNet
ShuffleNet 2× () records 26.3%/524 MFLOPs, against 29.4%/569 MFLOPs for 1.0 MobileNet-224. Error is 3.1 points lower at slightly lower theoretical cost. Among smaller models, ShuffleNet 0.5× () records 41.6%/38 MFLOPs, against 49.4%/41 MFLOPs for 0.25 MobileNet-224, a 7.8-point reduction. The 7.8-point result belongs to that small-model comparison, not the full MobileNet.
Actual Inference Speed
ShuffleNet 0.5× () has 43.2% top-1 error, close to AlexNet's 42.8%. At 224×224, they take 15.2/184.0 ms respectively, so ShuffleNet is about 12.1 times faster, against roughly 19 times fewer multiply-adds. At 480×640, they take 87.4/1156.7 ms, about 13.2 times apart, consistent with the paper's “about 13 times” description. The authors also observe that in their implementation a fourfold theoretical cost reduction often yields only about a 2.6-fold speedup.
Larger group counts such as often improve classification but were less efficient in their implementation; the authors favored as an accuracy–latency balance. Table 8 does not enumerate each comparison; that observation comes from the paper's speed evaluation text. Latency and memory must be measured again on a different phone, library, or GPU.
Conclusion
Many lightweight models aimed at mobile devices have a large gap between their expected cost and their actual inference time on hardware. ShuffleNet uses grouped 1×1 convolutions to reduce computation and channel shuffle to keep information flowing between groups. The paper's small-network results show that this can preserve useful accuracy under a tight budget.
This design is worth thinking about. Perhaps we can start from the same question when designing an even more efficient network: which operations are actually expensive on the device? The Snapdragon 820 measurements are a reminder to check final speed on the target hardware.