SBCFormer: Lightweight Network Capable of Full-size ImageNet Classification at 1 FPS on Single Board Computers

Xiangyong Lu, Masanori Suganuma, Takayuki Okatani

Abstract

Computer vision has become increasingly prevalent in solving real-world problems across diverse domains, including smart agriculture, fishery, and livestock management. These applications may not require processing many image frames per second, leading practitioners to use single board computers (SBCs). Although many lightweight networks have been developed for mobile/edge devices, they primarily target smartphones with more powerful processors and not SBCs with low-end CPUs. This paper introduces a CNN-ViT hybrid network called SBCFormer, which achieves high accuracy and fast computation on such low-end CPUs. The hardware constraints of these CPUs make the Transformer's attention mechanism preferable to convolution. However, using attention on low-end CPUs presents a challenge: high-resolution internal feature maps demand excessive computational resources, but reducing their resolution results in the loss of local image details. SBCFormer introduces an architectural design to address this issue. As a result, SBCFormer achieves the highest trade-off between accuracy and speed on a Raspberry Pi 4 Model B with an ARM-Cortex A72 CPU. For the first time, it achieves an ImageNet-1K top-1 accuracy of around 80% at a speed of 1.0 frame/sec on the SBC.

Introduction

While the AI world often obsesses over massive models running on high-end GPU clusters, a significant portion of real-world computer vision happens on the "edge"—in smart agriculture, wildlife monitoring, and low-cost robotics. These applications typically rely on Single Board Computers (SBCs) like the Raspberry Pi.

The problem is that most "lightweight" models, such as MobileNet or EfficientNet, are optimized for mid-range smartphones with specialized NPUs. When ported to the low-end CPUs found in SBCs, these models often struggle due to limited parallelism and low memory bandwidth. Complex memory access patterns, like those required for standard convolutions, are highly inefficient on these chips. Tohoku University and RIKEN researchers have introduced SBCFormer, a hybrid architecture designed specifically to bridge this gap.

The SBCFormer Architecture

To address the hardware constraints of low-end CPUs, the authors propose a "two-stream" block design that balances global context with local detail. One of the most surprising insights of this work is that the Transformer's attention mechanism is often preferable to convolution on SBCs because it can be translated into simple matrix multiplications that bypass high I/O throughput bottlenecks.

Detailed architecture of the SBCFormer block and MAttn module.

The architecture consists of two primary paths:

  • The Hourglass Attention Stream: To keep computational costs in check, SBCFormer downsizes the input feature map to a fixed 7x7 grid regardless of the original resolution. It performs attention on this grid to capture global context and then upsamples the result.
  • The Local Pass-Through Stream: To compensate for detail lost in downsampling, a parallel stream uses standard Inverted Residual (InvRes) blocks at full resolution to preserve textures and edges.
  • Modified Attention (MAttn): Standard Transformer blocks are difficult to train on small feature maps. The authors modified the mechanism by integrating CNN-style components—specifically 3x3 Depthwise Convolutions, GeLU activation, and Batch Normalization—directly into the "Value" computation of the attention head.

Key Performance Results

The model was evaluated on ImageNet-1K for classification and COCO 2017 for object detection. The authors compared SBCFormer against a wide array of models on a Raspberry Pi 4 (ARM Cortex-A72).

Top-1 Accuracy vs. Latency on ARM CPU. SBCFormer variants (red) outperform existing models.

SBCFormer-B achieved a breakthrough 80.0% Top-1 accuracy with a latency of 0.93 seconds (roughly 1.07 FPS). Compared to MobileNetV2, SBCFormer is significantly more accurate (80.0% vs 72.0%) at a comparable speed. When compared to EfficientNet-B0, it is both faster (0.93s vs 4.05s) and more accurate (80.0% vs 76.3%). Furthermore, when used as a backbone for RetinaNet on the COCO dataset, SBCFormer-L achieved 41.1 AP, outperforming ResNet-50 (36.3 AP) while maintaining higher efficiency.

Conclusion

SBCFormer demonstrates that global context does not require high-resolution feature maps if a local stream is present to handle fine details. While its performance on high-end GPUs is only mediocre compared to models designed for massive parallelism, it is the current state-of-the-art for low-end CPU environments. Future work may involve INT8 quantization to push the frame rate even higher, potentially enabling multi-FPS performance on standard single-board hardware.

Summary updated

BibTeX
@inproceedings{lu2024sbcformer,
  author = {Xiangyong Lu and Masanori Suganuma and Takayuki Okatani},
  title = {{SBCFormer: Lightweight Network Capable of Full-size ImageNet Classification at 1 FPS on Single Board Computers}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00116},
}
Figure