ThunderNet: Towards Real-time Generic Object Detection

Zheng Qin, Zeming Li, Zhaoning Zhang, Yiping Bao, Gang Yu, Yuxing Peng, Jian Sun

Abstract

Real-time generic object detection on mobile platforms is a crucial but challenging computer vision task. However, previous CNN-based detectors suffer from enormous computational cost, which hinders them from real-time inference in computation-constrained scenarios. In this paper, we investigate the effectiveness of two-stage detectors in real-time generic detection and propose a lightweight two-stage detector named ThunderNet. In the backbone part, we analyze the drawbacks in previous lightweight backbones and present a lightweight backbone designed for object detection. In the detection part, we exploit an extremely efficient RPN and detection head design. To generate more discriminative feature representation, we design two efficient architecture blocks, Context Enhancement Module and Spatial Attention Module. At last, we investigate the balance between the input resolution, the backbone, and the detection head. Compared with lightweight one-stage detectors, ThunderNet achieves superior performance with only 40% of the computational cost on PASCAL VOC and COCO benchmarks. Without bells and whistles, our model runs at 24.1 fps on an ARM-based device. To the best of our knowledge, this is the first real-time detector reported on ARM platforms.

Introduction

Object detection on mobile devices is a balancing act between accuracy and computational cost. Traditionally, researchers have favored one-stage detectors (like YOLO or SSD) for mobile use because they are inherently faster. Two-stage detectors (like Faster R-CNN) are known for superior localization accuracy but are usually considered too "heavy" for mobile CPUs due to their complex Region Proposal Networks (RPN) and detection heads.

Furthermore, most mobile detectors use "off-the-shelf" backbones designed for image classification (like MobileNet or ShuffleNet). The authors argue this is a mistake: classification backbones often lack the large receptive fields and low-level features necessary for precise object localization. ThunderNet aims to bridge this gap by redesigning the entire pipeline—backbone and head—specifically for the constraints of mobile hardware.

The ThunderNet Architecture

ThunderNet introduces several novel components to make a two-stage pipeline viable for mobile devices, focusing on balancing the computational load across the entire architecture.

The overall architecture of ThunderNet, showcasing the SNet backbone and the detection part including CEM and SAM.

Key Components

  • SNet Backbone: Based on ShuffleNetV2, SNet replaces standard $3\times3$ depthwise convolutions with $5\times5$ depthwise convolutions. This increases the receptive field without a significant hit to computational speed, which is vital for detecting larger objects.
  • Context Enhancement Module (CEM): Instead of using a heavy Feature Pyramid Network (FPN), ThunderNet uses CEM to aggregate multi-scale local and global context. It merges features from three different scales into a single "thin" feature map, providing rich semantic information at a fraction of the cost.
  • Spatial Attention Module (SAM): This module uses the information learned by the RPN to "re-weight" the feature map. It effectively tells the detection head exactly where to look, strengthening foreground features and suppressing background noise.
  • Lightweight Detection Head: The authors compressed the RPN and the R-CNN subnet significantly. They reduced the number of channels in the feature map before RoI warping and used a single 1024-dimensional fully-connected layer for the final classification and localization, eliminating massive amounts of redundant computation.

Experimental Results

The model was trained and evaluated on industry-standard benchmarks: PASCAL VOC and MS COCO. The results demonstrate that a two-stage detector can outperform one-stage detectors in both speed and accuracy when properly optimized.

Comparison of ThunderNet with other lightweight detectors on COCO, showing the superior trade-off between MFLOPs and AP.

Key Performance Metrics

  • Speed: ThunderNet (SNet49) achieves 24.1 fps on an ARM-based Snapdragon 845. This is the first time a real-time detector has been reported on such a platform.
  • Efficiency: On COCO, ThunderNet achieves comparable accuracy to MobileNet-SSD but uses only 22% of the FLOPs (Floating Point Operations).
  • Accuracy: ThunderNet with SNet146 achieves 23.7 AP on COCO, surpassing much heavier models like YOLOv2 while using 37x fewer FLOPs.
  • Localization Superiority: The model shows particularly strong results in $AP_{75}$ (a metric requiring very high localization precision), validating the choice of a two-stage architecture.

Conclusion

ThunderNet demonstrates that two-stage detectors are not inherently slow. By using the RPN to narrow down the search space, the second stage can be extremely "thin" and efficient. The paper highlights that localization is harder than classification for tiny networks; thus, prioritizing receptive fields and spatial detail early in the network is key to high-performance mobile detection. Future work may involve Neural Architecture Search (NAS) to further refine these blocks or hardware-specific tuning for mobile DSPs.

Summary updated

BibTeX
@inproceedings{qin2019thundernet,
  author = {Zheng Qin and Zeming Li and Zhaoning Zhang and Yiping Bao and Gang Yu and Yuxing Peng and Jian Sun},
  title = {{ThunderNet: Towards Real-time Generic Object Detection}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2019},
  doi = {10.1109/iccv.2019.00682},
}
Figure