{"notes":[{"id":"lightweight/pp-lcnet","category":"lightweight","legacyPath":"lightweight/2109-pp-lcnet","legacySlug":"2109-pp-lcnet","legacyPaths":[],"title":"PP-LCNet","subtitle":"Exploring the Boundaries of Speed","author":"Z. Yuan","paperDate":"2021-09-17","publishedOn":"2024-06-25","paperTitle":"PP-LCNet: A Lightweight CPU Convolutional Neural Network","paperUrl":"https://arxiv.org/abs/2109.15099","bibliography":{"title":"PP-LCNet: A Lightweight CPU Convolutional Neural Network","authors":["Cheng Cui","Tingquan Gao","Shengyu Wei","Yuning Du","Ruoyu Guo","Shuilong Dong","Bin Lu","Ying Zhou","Xueying Lv","Qiwen Liu","Xiaoguang Hu","Dianhai Yu","Yanjun Ma"],"url":"https://arxiv.org/abs/2109.15099","pdfUrl":"https://arxiv.org/pdf/2109.15099","codeUrl":null,"preprint":{"id":"2109.15099","submittedOn":"2021-09-17","url":"https://arxiv.org/abs/2109.15099"},"publication":null,"citation":"@misc{lightweightpplcnet2021,\n  title = {{PP-LCNet: A Lightweight CPU Convolutional Neural Network}},\n  author = {Cheng Cui and Tingquan Gao and Shengyu Wei and Yuning Du and Ruoyu Guo and Shuilong Dong and Bin Lu and Ying Zhou and Xueying Lv and Qiwen Liu and Xiaoguang Hu and Dianhai Yu and Yanjun Ma},\n  year = {2021},\n  eprint = {2109.15099},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2109.15099}\n}\n","citationPath":"/content/papers/citations/lightweight/pp-lcnet.2f8ae63c431a.bib"},"thumbnail":{"src":"/content/papers/assets/bba59bbde82b2b9237b883b28433cb3ac5b8dc0ff1fe8b70b81c04b2581078c3.jpg","width":1224,"height":708},"locale":"en","path":"/content/papers/en/lightweight/pp-lcnet.e4f3ad98b05f.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"solution","text":"Solution","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"experimental-results","text":"Experimental Results","depth":3},{"id":"ablation-studies","text":"Ablation Studies","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["lightweight","image-classification","classic-cnns","real-time","baidu"],"relatedReading":[{"id":"lightweight/shufflenet","relation":"comparison","topic":"Reducing convolution and channel cost"},{"id":"lightweight/ghostnet","relation":"comparison","topic":"Reducing convolution and channel cost"},{"id":"lightweight/senet","relation":"comparison","topic":"Channel attention in lightweight networks"}]},{"id":"lightweight/shufflenet","category":"lightweight","legacyPath":"lightweight/1707-shufflenet","legacySlug":"1707-shufflenet","legacyPaths":[],"title":"ShuffleNet","subtitle":"Channel Shuffling Network","author":"Z. Yuan","paperDate":"2017-07-04","publishedOn":"2024-06-26","paperTitle":"ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices","paperUrl":"https://arxiv.org/abs/1707.01083","bibliography":{"title":"ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices","authors":["Xiangyu Zhang","Xinyu Zhou","Mengxiao Lin","Jian Sun"],"url":"https://arxiv.org/abs/1707.01083","pdfUrl":"https://arxiv.org/pdf/1707.01083","codeUrl":null,"preprint":{"id":"1707.01083","submittedOn":"2017-07-04","url":"https://arxiv.org/abs/1707.01083"},"publication":{"venue":"CVPR","year":2018,"kind":"conference","url":"https://doi.org/10.1109/cvpr.2018.00716"},"citation":"@misc{lightweightshufflenet2017,\n  title = {{ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices}},\n  author = {Xiangyu Zhang and Xinyu Zhou and Mengxiao Lin and Jian Sun},\n  year = {2017},\n  eprint = {1707.01083},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1707.01083}\n}\n","citationPath":"/content/papers/citations/lightweight/shufflenet.1e5a6869f5a9.bib"},"thumbnail":{"src":"/content/papers/assets/6d0c746d403d2823809ffbd52c9b3614cc2063afee07608d6d0cb26b11fc3ac8.jpg","width":1746,"height":678},"locale":"en","path":"/content/papers/en/lightweight/shufflenet.faaefe20498b.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"computation-and-speed-do-not-always-match","text":"Computation and Speed Do Not Always Match","depth":3},{"id":"the-cost-of-11-convolutions","text":"The Cost of 1×1 Convolutions","depth":3},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"group-convolution-and-cross-group-flow","text":"Group Convolution and Cross-Group Flow","depth":3},{"id":"channel-shuffle","text":"Channel Shuffle","depth":3},{"id":"where-does-the-shuffle-go","text":"Where Does the Shuffle Go?","depth":3},{"id":"network-architecture","text":"Network Architecture","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"effect-of-group-convolution","text":"Effect of Group Convolution","depth":3},{"id":"effect-of-channel-shuffle","text":"Effect of Channel Shuffle","depth":3},{"id":"comparison-with-mobilenet","text":"Comparison with MobileNet","depth":3},{"id":"actual-inference-speed","text":"Actual Inference Speed","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["lightweight","image-classification","classic-cnns","megvii"],"relatedReading":[{"id":"lightweight/ghostnet","relation":"comparison","topic":"Reducing convolution and channel cost"},{"id":"lightweight/pp-lcnet","relation":"comparison","topic":"Reducing convolution and channel cost"}]},{"id":"lightweight/ghostnet","category":"lightweight","legacyPath":"lightweight/1911-ghostnet","legacySlug":"1911-ghostnet","legacyPaths":[],"title":"GhostNet","subtitle":"Ghost in Feature Maps","author":"Z. Yuan","paperDate":"2019-11-27","publishedOn":"2024-07-23","paperTitle":"GhostNet: More Features from Cheap Operations","paperUrl":"https://arxiv.org/abs/1911.11907","bibliography":{"title":"GhostNet: More Features from Cheap Operations","authors":["Kai Han","Yunhe Wang","Qi Tian","Jianyuan Guo","Chunjing Xu","Chang Xu"],"url":"https://arxiv.org/abs/1911.11907","pdfUrl":"https://arxiv.org/pdf/1911.11907","codeUrl":"https://github.com/huawei-noah/ghostnet","preprint":{"id":"1911.11907","submittedOn":"2019-11-27","url":"https://arxiv.org/abs/1911.11907"},"publication":{"venue":"CVPR","year":2020,"kind":"conference","url":"https://arxiv.org/abs/1911.11907"},"citation":"@misc{lightweightghostnet2019,\n  title = {{GhostNet: More Features from Cheap Operations}},\n  author = {Kai Han and Yunhe Wang and Qi Tian and Jianyuan Guo and Chunjing Xu and Chang Xu},\n  year = {2019},\n  eprint = {1911.11907},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1911.11907}\n}\n","citationPath":"/content/papers/citations/lightweight/ghostnet.4dd65d9540bb.bib"},"thumbnail":{"src":"/content/papers/assets/22fa9d36b042deb7995e9695a803de3a973542f58cd9cd48e37ef13167df2222.jpg","width":972,"height":904},"locale":"en","path":"/content/papers/en/lightweight/ghostnet.fb6ae4b0873d.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"module-configuration","text":"Module Configuration","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"performance-on-imagenet","text":"Performance on ImageNet","depth":3},{"id":"actual-inference-speed","text":"Actual Inference Speed","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["lightweight","image-classification","classic-cnns","huawei"],"relatedReading":[{"id":"lightweight/shufflenet","relation":"comparison","topic":"Reducing convolution and channel cost"},{"id":"lightweight/pp-lcnet","relation":"comparison","topic":"Reducing convolution and channel cost"}]},{"id":"lightweight/senet","category":"lightweight","legacyPath":"lightweight/1709-senet","legacySlug":"1709-senet","legacyPaths":[],"title":"SENet","subtitle":"Squeeze and Excitation Network","author":"Z. Yuan","paperDate":"2017-09-05","publishedOn":"2024-06-28","paperTitle":"Squeeze-and-Excitation Networks","paperUrl":"https://arxiv.org/abs/1709.01507","bibliography":{"title":"Squeeze-and-Excitation Networks","authors":["Jie Hu","Li Shen","Samuel Albanie","Gang Sun","Enhua Wu"],"url":"https://arxiv.org/abs/1709.01507","pdfUrl":"https://arxiv.org/pdf/1709.01507","codeUrl":null,"preprint":{"id":"1709.01507","submittedOn":"2017-09-05","url":"https://arxiv.org/abs/1709.01507"},"publication":{"venue":"CVPR","year":2018,"kind":"conference","url":"https://arxiv.org/abs/1709.01507"},"citation":"@misc{lightweightsenet2017,\n  title = {{Squeeze-and-Excitation Networks}},\n  author = {Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu},\n  year = {2017},\n  eprint = {1709.01507},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1709.01507}\n}\n","citationPath":"/content/papers/citations/lightweight/senet.1766a7978dde.bib"},"thumbnail":{"src":"/content/papers/assets/322f16ed8c782ffbdd7d7db3e8292c991908e3543dc69e1addd9238e22484363.jpg","width":1688,"height":394},"locale":"en","path":"/content/papers/en/lightweight/senet.20270339ffe6.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"image-classification-results","text":"Image Classification Results","depth":3},{"id":"results-on-lightweight-models","text":"Results on Lightweight Models","depth":3},{"id":"importance-of-squeeze","text":"Importance of Squeeze","depth":3},{"id":"importance-of-excitation","text":"Importance of Excitation","depth":3},{"id":"other-experimental-results","text":"Other Experimental Results","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"tags":["lightweight","image-classification","classic-cnns","attention-mechanisms","cas","momenta"],"relatedReading":[{"id":"lightweight/mobilenet-v3","relation":"comparison","topic":"Channel attention in lightweight networks"},{"id":"lightweight/pp-lcnet","relation":"comparison","topic":"Channel attention in lightweight networks"}]}],"text":"In the race for lightweight models, several main directions have emerged:\n\n- **Optimizing parameter count** to reduce model size.\n- **Optimizing computation (FLOPs)** to lower computational requirements and improve model speed.\n- **Optimizing inference time**.\n\nWait, what?\n\nIsn't optimizing parameter count and computation the same as optimizing inference time?\n\nMost people would think that reducing parameter count and computation would naturally lead to faster inference times.\n\n- **The answer is: Not necessarily!**\n\n---\n\nHere's a simple example:\n\n- Residual connections in ResNet.\n- Inception modules in GoogLeNet.\n- Shared parameters between different modules.\n\nBranches, tensor movement and synchronization can change latency even at equal parameter counts or arithmetic costs. Weight sharing itself does not necessarily add latency; it makes parameter count a less direct measure of execution cost.\n\nThis paper does not go deeply into that issue, though. We can return to it when we come across other related papers.\n\n## Problem Definition\n\nThis paper aims to address a few key issues:\n\n1. **How to enhance feature representation without increasing latency?**\n2. **What are the key factors in improving the accuracy of lightweight models on CPUs?**\n3. **How to effectively combine different strategies to design lightweight models on CPUs?**\n\n## Solution\n\n### Model Architecture\n\n![Paper Figure 2: PP-LCNet stem, DepthSepConv blocks, tail SE and classification head](/content/papers/assets/bba59bbde82b2b9237b883b28433cb3ac5b8dc0ff1fe8b70b81c04b2581078c3.jpg \"Cui et al., PP-LCNet, arXiv:2109.15099v1, Figure 2\")\n\nSource: [PP-LCNet paper, Figure 2](https://arxiv.org/pdf/2109.15099v1). Dashed boxes mark optional modules; the main path shows the change from 3×3 to tail 5×5 blocks and the 1280-dimensional projection after GAP.\n\nThe authors propose several strategies to address the above issues.\n\n1. **DepthSepConv**\n\n   The authors use DepthSepConv from [**MobileNetV1**](https://arxiv.org/abs/1704.04861) as the basic block. This approach avoids using shortcuts and concatenations, thereby improving computational efficiency.\n\n   The authors favor a simple sequential structure for their small-model and CPU setting.\n\n   The relevant optimization is for **DepthSepConv** in the Intel CPU MKLDNN library. In the authors' tests, it runs faster than inverted or ShuffleNet blocks.\n\n2. **HSwish**\n\n   ReLU is simple, but neither the fastest implementation nor the best accuracy is guaranteed across all runtimes and tasks.\n\n   Other activations include Swish, Mish, and GELU; whether they help depends on the model and runtime.\n\n   The authors take HSwish from [**MobileNetV3**](https://arxiv.org/abs/1905.02244). In this paper's ablation it improves accuracy with a small latency increase when added on its own.\n\n\n> [!TIP]\n> \n> The HSwish function is expressed as follows:\n> \n> $$ \\text{Hswish}(x) = x \\frac{\\text{ReLU6}(x+3)}{6}, \\text{ReLU6}(x) = \\min(\\max(x, 0), 6) $$\n> \n> Here $\\text{ReLU6}(x)$ is a ReLU variant whose **output** is limited to the range from 0 to 6.\n> \n> The characteristics of this function include:\n> \n> - **Nonlinearity**: It provides the nonlinear processing capability necessary for deep learning models to learn complex data patterns.\n> - **Piecewise structure**: HSwish equals 0 for $x\\leq-3$, $x(x+3)/6$ for $-3<x<3$, and $x$ for $x\\geq3$. It is continuous but not differentiable at $\\pm3$, and has no upper bound. The bounded component is its ReLU6 gate.\n> - **Computational Efficiency**: Its relatively simple structure makes it computationally efficient, making it particularly suitable for resource-constrained devices.\n\n\n3. **SEBlock**\n\n   This module comes from the following paper:\n\n   - [**Squeeze-and-excitation networks**](https://arxiv.org/abs/1709.01507)\n\n   This module also helped SENet win the 2017 ImageNet challenge.\n\n   However, on Intel CPUs, this module increases inference time, so the authors simplified it by placing it only at the network's end.\n\n   The experiments show a useful accuracy–latency trade-off, not a complete absence of extra runtime cost.\n\n4. **Large Kernel Convolutions**\n\n   In [**MixNet**](https://arxiv.org/abs/1907.09595), the authors analyzed the impact of different kernel sizes on network performance and ultimately mixed different kernel sizes within the same network layer.\n\n   However, this mixing reduces inference speed, so the authors use one kernel size per layer and reserve 5×5 kernels mainly for the network's later blocks.\n\n   Replacing 3x3 convolutions with 5x5 convolutions at the network's end improved model accuracy.\n\n5. **Additional Fully Connected Layer**\n\n   After global average pooling and before classification, the authors add a 1×1 convolution with 1280 output channels. On a 1×1 feature map this is equivalent to a fully connected layer, increasing capacity at a modest latency cost.\n\n## Discussion\n\n### Experimental Results\n\n![Paper Figure 1: ImageNet top-1 versus latency of lightweight networks on an Intel CPU](/content/papers/assets/bfb0c513b37d67c231006760f588470a4b33930d1bcccf1e2d9b120868f24f5c.jpg \"Cui et al., arXiv:2109.15099v1, Figure 1\")\n\nSource: [PP-LCNet paper, Figure 1](https://arxiv.org/pdf/2109.15099v1). The horizontal axis gives milliseconds in the specified Intel CPU setting, not FLOPs or phone speed.\n\n![Paper Table 3: parameters, FLOPs, ImageNet top-1/top-5 and latency of lightweight backbones](/content/papers/assets/3f20296939798f3d639e4e9cb84d79edbc370500fe7c653a5004e5159b9e3dc6.jpg \"Cui et al., arXiv:2109.15099v1, Table 3\")\n\nSource: [PP-LCNet paper, Table 3](https://arxiv.org/pdf/2109.15099v1). Accuracy, parameter count and FLOPs vary across rows, so read them together with latency.\n\nThe authors conducted experiments on the ImageNet-1k dataset, which includes 1.28 million training images and 50,000 validation images across 1,000 categories.\n\n- **Training Configuration**:\n\n  - Used SGD (stochastic gradient descent) as the optimizer, with a momentum of 0.9 and weight decay of 3e-5 (4e-5 for larger models).\n  - Batch size of 2048, with an initial learning rate of 0.8, adjusted using a cosine annealing schedule.\n  - The entire training process includes 360 epochs with 5 linear warm-up epochs.\n  - Image preprocessing involved random cropping to 224×224 pixels and random horizontal flipping.\n\n- **Evaluation Phase**:\n\n  - During evaluation, images were first resized along the short edge to 256 pixels, followed by center cropping to 224×224 pixels.\n\n- **Accuracy Enhancement Techniques**:\n\n  - Using the SSLD distillation method significantly improved PP-LCNet's accuracy. Those results are in paper Table 2; the pictured Table 3 compares unstarred models without that distillation.\n\nLatency was measured on an Intel Xeon Gold 6148 with MKLDNN, 10 threads and batch size 1. For example, PP-LCNet-1x reaches 71.32% top-1 at 2.46 ms, while MobileNetV2-1x reaches 72.15% at 4.26 ms. PP-LCNet is about 1.73 times as fast here, with 0.83 percentage points lower accuracy. Accuracy, parameters and FLOPs are not identical across these rows. These are not phone measurements.\n\n### Ablation Studies\n\n![Paper Table 9: cumulative H-Swish, large-kernel, SE, final 1×1 and dropout ablation for PP-LCNet-0.5x](/content/papers/assets/9cc7a76fdaccbaaa485ac49ef0e15e12153bba2c666d5c567b1c3984e6c3411d.jpg \"Cui et al., arXiv:2109.15099v1, Table 9\")\n\nSource: [PP-LCNet paper, Table 9](https://arxiv.org/pdf/2109.15099v1). The rows **add strategies in sequence**; they are not five independent one-factor additions to BaseNet.\n\nReading down the table, BaseNet gives **55.58%/1.61 ms**; H-Swish changes this to **58.18%/1.66 ms**, the larger kernel to **59.09%/1.70 ms**, and SE to **59.91%/1.85 ms**. The final 1×1 convolution reaches **62.50%/2.05 ms** before dropout and **63.14%/2.05 ms** with dropout. The full configuration gains **7.56 percentage points** while latency rises **0.44 ms**, about **27%**. “Almost no latency increase” fits some steps, not the full sequence.\n\n1. **SE Module (Squeeze-and-Excitation)**:\n\n   - The SE module enhances the model's attention to relationships between channels, thereby improving model accuracy.\n   - In Table 7, adding SE only to the final two blocks gives **63.14%/2.05 ms**; adding it to every block gives **64.27%/3.80 ms**.\n\n   Therefore, PP-LCNet prioritizes adding SE modules in the last two blocks to balance inference speed and accuracy.\n\n2. **Use of Large Kernels**:\n\n   - While large kernels (such as 5×5) can improve accuracy, they are not suitable for adding to all positions in the network.\n   - In Table 8, tail placement gives **63.14%/2.05 ms**; using 5×5 kernels throughout gives **63.22%/2.08 ms**. Tail placement gives a better accuracy–latency balance here.\n\n   Thus, specific layers use 5×5 depthwise convolutions, while other layers retain 3×3 kernels.\n\n3. **Combined Effect of Different Techniques**:\n\n   - H-Swish and large kernels can enhance performance with minimal impact on inference time.\n   - Adding SE modules appropriately further enhances performance.\n   - The 1280-channel 1×1 layer after global average pooling (GAP) reaches **62.50%/2.05 ms**.\n   - Adding dropout then reaches **63.14%/2.05 ms**.\n\n## Conclusion\n\nThe authors study lightweight networks on Intel CPUs, seeking more accuracy for a limited increase in latency. Table 9 shows that the full configuration has a measurable runtime cost.\n\nThrough extensive experiments and method optimization, they proposed a network architecture that performs well on various visual tasks, particularly excelling in the balance of accuracy and speed.\n\n\n> [!NOTE]\n> \n> This model is indeed small, accurate, and has fast inference speed.\n> \n> I would put it high on the candidate list for a phone app or a tightly constrained model, then measure latency on the target device. The paper's CPU figures come from its specified Intel runtime.\n","imageSizes":{"/content/papers/assets/bba59bbde82b2b9237b883b28433cb3ac5b8dc0ff1fe8b70b81c04b2581078c3.jpg":{"width":1224,"height":708},"/content/papers/assets/bfb0c513b37d67c231006760f588470a4b33930d1bcccf1e2d9b120868f24f5c.jpg":{"width":944,"height":780},"/content/papers/assets/3f20296939798f3d639e4e9cb84d79edbc370500fe7c653a5004e5159b9e3dc6.jpg":{"width":1224,"height":516},"/content/papers/assets/9cc7a76fdaccbaaa485ac49ef0e15e12153bba2c666d5c567b1c3984e6c3411d.jpg":{"width":2992,"height":1054}}}
