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

Xiangyong Lu, Masanori Suganuma, Takayuki Okatani

While the AI world often obsesses over massive models running on H100 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? Most "lightweight" models (like MobileNet or EfficientNet) are actually optimized for mid-range smartphones with specialized NPUs. When ported to the low-end CPUs found in SBCs, these models often struggle. A new paper from Tohoku University and RIKEN introduces SBCFormer, a hybrid architecture designed specifically to bridge this gap.

TL;DR

SBCFormer is a CNN-Transformer hybrid optimized for low-end CPUs that achieves a breakthrough: 80% ImageNet-1K top-1 accuracy at 1 frame per second (FPS) on a Raspberry Pi 4. It rethinks the attention mechanism to bypass the memory bandwidth bottlenecks that typically cripple standard vision models on single-board computers.

What Problem Does This Paper Address?

Most research into "mobile" neural networks targets smartphones. However, smartphone processors are significantly more powerful than the CPUs found in SBCs. SBCs suffer from two main constraints:

  1. Limited Parallelism: They lack the massive core counts of GPUs.
  2. Low Memory Bandwidth: Complex memory access patterns—like those required for standard convolutions (the im2col operation)—are highly inefficient on these chips.

While Vision Transformers (ViTs) use attention mechanisms that are mathematically simpler (mostly matrix multiplications), their computational cost scales quadratically with image resolution. This makes high-resolution feature maps too "expensive" for a low-end CPU, but reducing resolution usually destroys the local details needed for high accuracy.

Methods

The authors propose a "two-stream" block design that balances global context with local detail:

  • The Hourglass Attention Stream: To keep the Transformer's quadratic cost in check, SBCFormer downsizes the input feature map to a fixed 7x7 grid regardless of the original resolution. It performs attention on this tiny grid to capture global context and then upsamples the result back to the original size.
  • The Local Pass-Through Stream: To compensate for the detail lost in the 7x7 downsampling, a parallel stream uses standard Inverted Residual (InvRes) blocks at full resolution. This stream "passes through" local textures and edges.
  • Modified Attention (MAttn): The authors found that standard Transformer blocks are hard to train on small feature maps. They modified the attention mechanism by integrating CNN-style components—specifically 3x3 Depthwise Convolutions, GeLU activation, and Batch Normalization—directly into the "Value" computation of the attention head. They also simplified the Query and Key projections to reduce redundant operations.

Datasets

The model was evaluated on two industry-standard benchmarks:

  • ImageNet-1K: Used for the primary image classification task (1.28 million training images).
  • COCO 2017: Used to test the model as a backbone for object detection (using the RetinaNet framework).

Key Insights and Ideas

  • Attention is "CPU-Friendly": One of the most surprising insights is that the Transformer's attention mechanism is often preferable to convolution on SBCs. Because attention can be translated into simple matrix multiplications with smaller dimensions than standard convolutions, it bypasses the high I/O throughput requirements that bottleneck low-end CPUs.
  • Global Context Doesn't Need High Res: The "Hourglass" design proves that you don't need a high-resolution map to understand the global structure of an image. A 7x7 representation is sufficient for the "global" stream if the "local" stream is there to handle the fine details.
  • Hybridization is the Winner: Pure CNNs (like MobileNet) and pure ViTs (like DeiT) both fall short on SBCs. The best trade-off comes from using CNNs for local feature extraction and Transformers for global integration.

Key Results

The authors compared SBCFormer against a wide array of models on a Raspberry Pi 4 (ARM Cortex-A72):

  • Accuracy vs. Speed: SBCFormer-B achieved 80.0% Top-1 accuracy with a latency of 0.93 seconds (roughly 1.07 FPS).
  • Outperforming the Classics: Compared to MobileNetV2, SBCFormer is significantly more accurate (80.0% vs 72.0%) at a comparable speed. Compared to EfficientNet-B0, it is both faster (0.93s vs 4.05s) and more accurate (80.0% vs 76.3%).
  • Object Detection: When used as a backbone for RetinaNet on the COCO dataset, SBCFormer-L achieved 41.1 AP, outperforming ResNet-50 (36.3 AP) while being more efficient.

Limitations and Future Work

  • Hardware Specificity: The authors acknowledge that their primary metric is latency, which is highly dependent on specific compilers, instruction sets (like ARM Neon), and library versions (PyTorch). Results may vary on different SBC architectures.
  • GPU Performance: While SBCFormer is a king on low-end CPUs, its performance on high-end GPUs is only "mediocre" compared to models specifically designed for massive parallelism.
  • Optimization: The current implementation uses 32-bit floating-point numbers. The authors suggest that further quantization (e.g., to INT8) could push the frame rate even higher, potentially enabling multi-FPS performance on the same 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},
}

Loading related content...

Figure