{"notes":[{"id":"lightweight/mobilenet-v1","category":"lightweight","legacyPath":"lightweight/1704-mobilenet-v1","legacySlug":"1704-mobilenet-v1","legacyPaths":[],"title":"MobileNet-V1","subtitle":"Pioneers of Depthwise Separable Convolutions","author":"Z. Yuan","paperDate":"2017-04-17","publishedOn":"2024-06-25","paperTitle":"MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications","paperUrl":"https://arxiv.org/abs/1704.04861","bibliography":{"title":"MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications","authors":["Andrew G. Howard","Menglong Zhu","Bo Chen","Dmitry Kalenichenko","Weijun Wang","Tobias Weyand","Marco Andreetto","Hartwig Adam"],"url":"https://arxiv.org/abs/1704.04861","pdfUrl":"https://arxiv.org/pdf/1704.04861","codeUrl":null,"preprint":{"id":"1704.04861","submittedOn":"2017-04-17","url":"https://arxiv.org/abs/1704.04861"},"publication":null,"citation":"@misc{lightweightmobilenetv12017,\n  title = {{MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications}},\n  author = {Andrew G. Howard and Menglong Zhu and Bo Chen and Dmitry Kalenichenko and Weijun Wang and Tobias Weyand and Marco Andreetto and Hartwig Adam},\n  year = {2017},\n  eprint = {1704.04861},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1704.04861}\n}\n","citationPath":"/content/papers/citations/lightweight/mobilenet-v1.e9c4c525fed4.bib"},"thumbnail":{"src":"/content/papers/assets/b8390bd8e0f21f1b1eaa6b2a5d4a1b0d9eba36e2fe5dd0878830d757839d30f1.jpg","width":1064,"height":1080},"locale":"en","path":"/content/papers/en/lightweight/mobilenet-v1.602fe825c0c0.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"solution","text":"Solution","depth":2},{"id":"depthwise-separable-convolution","text":"Depthwise Separable Convolution","depth":3},{"id":"network-architecture","text":"Network Architecture","depth":2},{"id":"training-techniques","text":"Training Techniques","depth":2},{"id":"discussion","text":"Discussion","depth":2},{"id":"cost-of-depthwise-separable-convolution","text":"Cost of Depthwise Separable Convolution","depth":3},{"id":"depth-or-width","text":"Depth or Width?","depth":3},{"id":"comparing-other-models","text":"Comparing Other Models","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"lightweight/mobilenet-v2","relation":"next","topic":"Efficient convolution on mobile devices"}]},{"id":"lightweight/mobilenet-v2","category":"lightweight","legacyPath":"lightweight/1801-mobilenet-v2","legacySlug":"1801-mobilenet-v2","legacyPaths":[],"title":"MobileNet-V2","subtitle":"Refining the Bottleneck","author":"Z. Yuan","paperDate":"2018-01-13","publishedOn":"2024-06-27","paperTitle":"MobileNetV2: Inverted Residuals and Linear Bottlenecks","paperUrl":"https://arxiv.org/abs/1801.04381","bibliography":{"title":"MobileNetV2: Inverted Residuals and Linear Bottlenecks","authors":["Mark Sandler","Andrew Howard","Menglong Zhu","Andrey Zhmoginov","Liang-Chieh Chen"],"url":"https://arxiv.org/abs/1801.04381","pdfUrl":"https://arxiv.org/pdf/1801.04381","codeUrl":null,"preprint":{"id":"1801.04381","submittedOn":"2018-01-13","url":"https://arxiv.org/abs/1801.04381"},"publication":{"venue":"CVPR","year":2018,"kind":"conference","url":"https://arxiv.org/abs/1801.04381"},"citation":"@misc{lightweightmobilenetv22018,\n  title = {{MobileNetV2: Inverted Residuals and Linear Bottlenecks}},\n  author = {Mark Sandler and Andrew Howard and Menglong Zhu and Andrey Zhmoginov and Liang-Chieh Chen},\n  year = {2018},\n  eprint = {1801.04381},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1801.04381}\n}\n","citationPath":"/content/papers/citations/lightweight/mobilenet-v2.a882707cbaa2.bib"},"thumbnail":{"src":"/content/papers/assets/e6bbfb346bb449f83897d76b69c3711d2e9937d40320a7aab0f3843653a688c0.jpg","width":2332,"height":1324},"locale":"en","path":"/content/papers/en/lightweight/mobilenet-v2.db02333fcec2.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"nonlinearity-in-narrow-channels","text":"Nonlinearity in Narrow Channels","depth":3},{"id":"where-does-the-residual-shortcut-connect","text":"Where Does the Residual Shortcut Connect?","depth":3},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"inverted-residual-and-linear-bottleneck","text":"Inverted Residual and Linear Bottleneck","depth":3},{"id":"why-expand-the-bottleneck","text":"Why Expand the Bottleneck?","depth":3},{"id":"from-block-to-network","text":"From Block to Network","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"imagenet-classification-and-phone-latency","text":"ImageNet Classification and Phone Latency","depth":3},{"id":"other-tasks-and-limits","text":"Other Tasks and Limits","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"lightweight/mobilenet-v1","relation":"background","topic":"Efficient convolution on mobile devices"},{"id":"lightweight/mobilenet-v3","relation":"next","topic":"Efficient convolution on mobile devices"}]}],"text":"Depthwise separable convolution splits a standard convolution into spatial filtering within each channel and a 1×1 convolution that mixes channels. It can reduce both multiply-adds and parameters, making ConvNets more practical on mobile devices. This paper asks how to choose a useful model based on accuracy, size, and latency.\n\nMobileNet did not invent the operation. Its paper cites earlier work by Sifre:\n\n- [**Rigid-motion scattering for image classification**](https://arxiv.org/abs/1403.1687)\n\nMobileNet’s contribution is to use this factorization systematically in a lightweight network, offer a family of models with adjustable width and input resolution, and evaluate their tradeoffs on ImageNet and other tasks.\n\nThat is the now famous **MobileNet-V1**.\n\n## Problem Definition\n\nInterest in small, efficient neural networks was growing. But as the authors point out, many papers on small networks focused on **size without considering efficiency**. Clearly, we need a network that is both small and fast. Robotics, autonomous driving, and augmented reality need timely recognition on limited hardware, so model selection should consider size, multiply-adds, and measured latency.\n\n\n> [!TIP]\n> \n> The prior-work section lists [**SqueezeNet**](https://arxiv.org/abs/1602.07360) as a small-parameter model, but does not name it as the target of the “size only” criticism. Table 9 later gives a concrete comparison.\n\n\n## Solution\n\n### Depthwise Separable Convolution\n\n![MobileNet Figure 2 splitting a standard convolution into depthwise and pointwise filters](/content/papers/assets/b8390bd8e0f21f1b1eaa6b2a5d4a1b0d9eba36e2fe5dd0878830d757839d30f1.jpg)\n\n*Paper Figure 2: (a) each output filter spans all input channels; (b) each input channel receives one spatial filter; (c) pointwise convolution combines channels into the desired outputs.*\n\nPart (b) assumes depth multiplier 1. With $M$ input channels, it uses $M$ spatial filters of size $D_K\\times D_K$, one per channel. Part (c) then uses $N$ pointwise 1×1 filters to combine those $M$ channels into $N$ output channels. Spatial and channel mixing become separate steps.\n\nLet the output feature map have side length $D$. A standard convolution requires $D_K^2MND^2$ multiply-adds. The depthwise step requires $D_K^2MD^2$ and the pointwise step $MND^2$, giving this cost ratio:\n\n$$\n\\frac{D_K^2MD^2+MND^2}{D_K^2MND^2}\n=\\frac{1}{N}+\\frac{1}{D_K^2}.\n$$\n\nFor $D_K=3$, $M=N=512$, and $D=14$, the paper’s Table 3 gives about **462M** multiply-adds for standard convolution and **52.3M** for the factorized layer, with parameters falling from about **2.36M to 0.27M**. This is a theoretical single-layer resource comparison. If stride reduces spatial size, $D$ here is the output dimension. Whole-network accuracy and speed require separate experiments.\n\n\n> [!NOTE]\n> \n> \n> Here is a small PyTorch implementation of the operation:\n> \n> ```python\n> import torch\n> import torch.nn as nn\n> import torch.nn.functional as F\n> \n> class DepthwiseSeparableConv(nn.Module):\n> \n>     def __init__(self, n_in, n_out, kernel_size, padding=0, stride=1):\n>         super(DepthwiseSeparableConv, self).__init__()\n>         self.depthwise = nn.Conv2d(n_in, n_in, kernel_size=kernel_size, padding=padding, stride=stride, groups=n_in)\n>         self.pointwise = nn.Conv2d(n_in, n_out, kernel_size=1)\n> \n>     def forward(self, x):\n>         out = self.depthwise(x)\n>         out = self.pointwise(out)\n>         return out\n> ```\n> \n> MobileNet places Batch Normalization and ReLU **after each** depthwise and pointwise convolution, rather than only after the pair:\n> \n> ![MobileNet Figure 3 showing BatchNorm and ReLU after both depthwise and pointwise convolutions](/content/papers/assets/a272daf6d5a3edb79671be1e681681eae0378c5bbf06620446ec957194e73c46.jpg)\n> \n> *Paper Figure 3: on the left, a standard 3×3 convolution is followed by BN and ReLU; on the right, both depthwise 3×3 and pointwise 1×1 have their own BN and ReLU.*\n> \n> We can extend the teaching example to show that order. It does not reproduce the full training setup; convolution bias can usually be omitted when BN follows:\n> \n> ```python\n> import torch\n> import torch.nn as nn\n> import torch.nn.functional as F\n> \n> class DepthwiseSeparableConv(nn.Module):\n> \n>     def __init__(self, n_in, n_out, kernel_size, padding=0, stride=1):\n>         super(DepthwiseSeparableConv, self).__init__()\n>         self.depthwise = nn.Conv2d(n_in, n_in, kernel_size=kernel_size, padding=padding, stride=stride, groups=n_in)\n>         self.pointwise = nn.Conv2d(n_in, n_out, kernel_size=1)\n>         self.depth_bn = nn.BatchNorm2d(n_in)\n>         self.depth_relu = nn.ReLU()\n>         self.point_bn = nn.BatchNorm2d(n_out)\n>         self.point_relu = nn.ReLU()\n> \n>     def forward(self, x):\n>         x = self.depthwise(x)\n>         x = self.depth_bn(x)\n>         x = self.depth_relu(x)\n>         x = self.pointwise(x)\n>         x = self.point_bn(x)\n>         x = self.point_relu(x)\n>         return x\n> ```\n> \n\n\n## Network Architecture\n\nThe first MobileNet layer is a standard 3×3 convolution. Its later main convolutional blocks pair a depthwise 3×3 convolution with a pointwise 1×1 convolution:\n\n> The MobileNet structure is built on depthwise separable convolutions as mentioned in the previous section except for the first layer which is a full convolution.\n\n![MobileNet Table 1 listing the body architecture and strides for a 224×224 input](/content/papers/assets/96bb0fb7d329b112dde22c903e2fa32642a4a29b8e007b480d6ef944d054f332.jpg)\n\n*Paper Table 1: the first 3×3/stride-2 layer is followed by depthwise downsampling and pointwise channel changes. A pair of blocks at 14×14×512 repeats five times, before average pooling and fully connected classification.*\n\nStarting with 224×224×3, the first layer yields 112×112×32. The following depthwise/pointwise pair keeps 112×112 spatial resolution while changing 32 channels to 64. Reading the table this way shows which operation changes spatial size and which changes channel count. Counting depthwise and pointwise convolutions separately, the authors describe a 28-layer network.\n\nOne row near the end of Table 1 marks a stride-2 depthwise convolution at 7×7×1024, yet the next row still lists a 7×7×1024 input. Those dimensions cannot both hold, so this stride should not be copied into a precise shape trace without checking the implementation. Paper Table 2 attributes **94.86%** of network multiply-adds and **74.59%** of parameters to 1×1 convolutions; depthwise 3×3 uses only **3.06%** and **1.06%**, respectively. Pointwise convolution dominates total cost.\n\n## Training Techniques\n\nThe authors describe several choices for training MobileNet-V1:\n\n- Use less regularization and data augmentation than for larger models. They omit auxiliary heads and label smoothing and limit very small random crops.\n- Apply little or no weight decay to the depthwise filters, which contain few parameters.\n- Train with RMSprop in TensorFlow and asynchronous gradient descent similar to Inception-V3.\n\n\n> [!TIP]\n> \n> With asynchronous gradient descent, workers can update shared parameters without waiting for every other worker’s gradient, though some updates may use older parameters. This was a distributed training choice, not a requirement for MobileNet inference.\n\n\n## Discussion\n\nBesides the baseline network, the authors give model builders two controls for shrinking it:\n\n- **Width multiplier $\\alpha$** changes input and output channels $M,N$ to $\\alpha M,\\alpha N$. Typical settings are 1, 0.75, 0.5, and 0.25. Since pointwise convolution dominates, parameters and multiply-adds fall roughly with $\\alpha^2$. The resulting narrower network must be trained afresh.\n- **Resolution multiplier $\\rho$** reduces the input from 224 to 192, 160, or 128 pixels, which also shrinks later feature maps. Convolution multiply-adds fall roughly with $\\rho^2$, while a fixed model’s parameter count does not change with input size.\n\nWith both controls, one depthwise-plus-pointwise layer costs $D_K^2\\alpha M(\\rho D)^2+\\alpha^2MN(\\rho D)^2$ multiply-adds. Width and resolution therefore affect different resources. Tables 6 and 7 show that accuracy falls sharply at $\\alpha=0.25$; theoretical savings alone do not pick the best model.\n\n### Cost of Depthwise Separable Convolution\n\n![MobileNet Table 4 comparing the full-convolution and separable-convolution networks on ImageNet](/content/papers/assets/142ea49129c865e2e093bb994cd15ad68055f430d35b314d6ce70fa95923a37c.jpg)\n\n*Paper Table 4: each row is a whole network, not one layer. Conv MobileNet has 71.7% accuracy, 4,866M multiply-adds, and 29.3M parameters; MobileNet has 70.6%, 569M, and 4.2M.*\n\nReplacing the main convolutions costs **1.1 percentage points** of ImageNet top-1 accuracy, while whole-network multiply-adds fall about **8.6-fold** and parameters about **7-fold**. Device latency requires separate measurement.\n\n### Depth or Width?\n\n![MobileNet Table 5 comparing a 0.75-width model with one that removes five middle blocks](/content/papers/assets/ea604ea51943d65149e5f66724ca777716c27b9d876a7b5256f3ff2fafde6823.jpg)\n\n*Paper Table 5: 0.75 MobileNet has 68.4% accuracy, 325M multiply-adds, and 2.6M parameters. Shallow MobileNet has 65.3%, 307M, and 2.9M; it removes the five repeated blocks at 14×14×512 in Table 1.*\n\nThe models have similar cost, yet the narrower one is **3.1 percentage points** more accurate. Relative to the full MobileNet at 70.6%, narrowing loses 2.2 points and removing layers loses 5.3. These are different comparison baselines. The ablation favors narrowing **for this model and cost range**, not for every architecture.\n\n### Comparing Other Models\n\n![MobileNet Tables 8 and 9 comparing full and reduced models with GoogLeNet, VGG16, SqueezeNet, and AlexNet](/content/papers/assets/751b301a1b2d2396b0200cc00a8cf8d1dd58523e06a386f3a4f0cb219acf4d07.jpg)\n\n*Combined crop of paper Tables 8 and 9: the upper half is 1.0 MobileNet-224; the lower half is 0.5 MobileNet-160, with both narrower width and a smaller input. They are separate model settings.*\n\nThe full MobileNet in Table 8 has **70.6% top-1, 569M multiply-adds, and 4.2M parameters**. VGG16 has **71.5%, 15,300M, and 138M**: MobileNet is 0.9 percentage points less accurate, with about 1/33 the parameters and 1/27 the multiply-adds. GoogLeNet has **69.8%, 1,550M, and 6.8M**; MobileNet is 0.8 points more accurate while using fewer resources. These are model size and operation counts, not mobile-device speed measurements.\n\nIn Table 9, 0.5 MobileNet-160 has **60.2%, 76M, and 1.32M**; SqueezeNet has **57.5%, 1,700M, and 1.25M**. The smaller MobileNet is **2.7 percentage points** more accurate and needs about 1/22 the multiply-adds, but has slightly more parameters. The paper’s prose says “about 4%,” which conflicts with its table, so the difference here is calculated from the rows. Do not carry this reduced model’s result over to the full MobileNet in Table 8.\n\n## Conclusion\n\nMobileNet-V1 brought depthwise separable convolution into the spotlight. It kept relatively high accuracy while greatly reducing model size and computation, giving resource-constrained devices a practical CNN architecture. The paper's ImageNet results support this trade-off, although accuracy falls as width, resolution, or block count is reduced.\n\nIts design also inspired later lightweight architectures and helped bring deep learning models to mobile and edge devices. For a deployment, select $\\alpha$ and input size based on acceptable accuracy, then measure latency and memory on the target device. Theoretical multiply-adds help rank candidates; they do not replace deployment measurements.\n\n\n> [!TIP]\n> \n> MobileNet later gained V2, V3, and V4, improving this family of lightweight models further. It has become a classic line of work. The figures in this note belong to V1; each later version still needs its own measurements.\n","imageSizes":{"/content/papers/assets/b8390bd8e0f21f1b1eaa6b2a5d4a1b0d9eba36e2fe5dd0878830d757839d30f1.jpg":{"width":1064,"height":1080},"/content/papers/assets/a272daf6d5a3edb79671be1e681681eae0378c5bbf06620446ec957194e73c46.jpg":{"width":972,"height":504},"/content/papers/assets/96bb0fb7d329b112dde22c903e2fa32642a4a29b8e007b480d6ef944d054f332.jpg":{"width":932,"height":1080},"/content/papers/assets/142ea49129c865e2e093bb994cd15ad68055f430d35b314d6ce70fa95923a37c.jpg":{"width":988,"height":292},"/content/papers/assets/ea604ea51943d65149e5f66724ca777716c27b9d876a7b5256f3ff2fafde6823.jpg":{"width":972,"height":284},"/content/papers/assets/751b301a1b2d2396b0200cc00a8cf8d1dd58523e06a386f3a4f0cb219acf4d07.jpg":{"width":1012,"height":684}}}
