Beyond MACs: Hardware Efficient Architecture Design for Vision Backbones
Organizations: Machine Learning and Perception Lab, University of Udine Via delle Scienze 206, Udine, 33100, UD, Italy. · Centre for Vision Research, York University 4700 Keele St, Toronto, M3J 1P3, ON, Canada.
Abstract
Vision backbone networks play a central role in modern computer vision. Enhancing their efficiency directly benefits a wide range of downstream applications. To measure efficiency, many publications rely on MACs (Multiply Accumulate operations) as a predictor of execution time. In this paper, we experimentally demonstrate the shortcomings of such a metric, especially in the context of edge devices. By contrasting the MAC count and execution time of common architectural design elements, we identify key factors for efficient execution and provide insights to optimize backbone design. Based on these insights, we present LowFormer, a novel vision backbone family. LowFormer features a streamlined macro and micro design that includes Lowtention, a lightweight alternative to Multi-Head Self-Attention. Lowtention not only proves more efficient, but also enables superior results on ImageNet. Additionally, we present an edge GPU version of LowFormer, that can further improve upon its baseline's speed on edge GPU and desktop GPU. We demonstrate LowFormer's wide applicability by evaluating it on smaller image classification datasets, as well as adapting it to several downstream tasks, such as object detection, semantic segmentation, image retrieval, and visual object tracking. LowFormer models consistently achieve remarkable speed-ups across various hardware platforms compared to recent state-of-the-art backbones. Code and models are available at https://github.com/altair199797/LowFormer/blob/main/Beyond_MACs.md.
Figures & tables
| Model | Channel | Depthwise | MACs | GPU Throughput | Latency(ms) | |||
| [C 0 , C 1 , C 2 , C 3 , C 4 ] | (M) | (images/s) | TX2 | GPU | Mobile | ARM CPU | ||
| #1 | [15, 30, 60, 120, 240] | ✗ | 463 | 12,722 | 1.83 | 0.78 | 0.63 | 12.58 |
| #2 | [30, 60, 120, 240, 480] | ✓ | 42 | 10,526 | 3.55 | 0.24 | 0.53 | 17.71 |
| #3 | [30, 50, 100, 160, 160] | ✗ | 956 | 7,142 | 2.90 | 0.78 | 0.64 | 24.29 |
| #4 | [60,120,240,480,480] | ✓ | 82 | 5,422 | 6.16 | 0.39 | 0.67 | 36.59 |
| #5 | [30, 60, 150, 240, 240] | ✗ | 1710 | 5,350 | 4.27 | 0.99 | 1.00 | 48.19 |
| Model | ||
| LowFormer-B0 | ||
| LowFormer-B1 | ||
| LowFormer-B1.5 | ||
| LowFormer-B2 | ||
| LowFormer-B3 |
| Model | Changes | Base model |
| LowFormer-E1 | a), b), c) | LowFormer-B1.5 |
| LowFormer-E2 | a), b), c) | LowFormer-B3 |
| LowFormer-E3 | b) | LowFormer-B3 |
| Device | Metric | Iterations | Framework |
| Nvidia A40 GPU | throughput | 100 | PyTorch |
| Nvidia TITAN RTX GPU | latency | 4000 | TorchScript \tnote 5 |
| ARM Cortex A76 CPU | latency | 400 | ONNX \tnote 6 |
| iPhone13 | latency | - | CoreML |
| Nvidia Jetson TX2 | latency | 200 | ONNX \tnote 6 +TensorRT \tnote 7 |
| Model | Venue | Params | MACs | GPU Throughput | TX2 Latency | ARM CPU | Resolution | Top-1 |
| (M) | (M) | (images/s) | (ms) | (ms) | (pixel) | (%) | ||
| MobileViG-Ti* ( Munir et al., 2023 ) | CVPRW 2023 | 5.3 | 661 | 2500 | 8.5 | 48.2 | 224 | 75.7 |
| FastViT-T8 ( Vasu et al., 2023a ) | CVPR 2023 | 3.6 | 690 | 1694 | 10.1 | 65.9 | 256 | 75.6 |
| EfficientMod-xxs ( Ma et al., 2024 ) | ICLR 2024 | 4.7 | 579 | 2857 | 15.0 | 47.5 | 224 | 76.0 |
| RepViT-M0.9 ( Wang et al., 2024 ) | CVPR 2024 | 5.1 | 816 | 2512 | 11.4 | 40.8 | 224 | 77.4 |
| MobileOne-S2 ( Vasu et al., 2023b ) | CVPR 2023 | 7.8 | 1298 | 2967 | 9.1 | 53.8 | 224 | 77.4 |
| Model version | Params | MACs | GPU Throughput | TX2 Latency | ARM CPU Latency | Top-1 |
| (M) | (M) | (images/s) | (ms) | (ms) | (%) | |
| unfused MBConv | 12.4 | 716 | 3558 (-16%) | 12.8 (+9%) | 55.5 (-6%) | 79.1 (-0.8) |
| relu-linear att | 14.15 | 1210 | 3367 (-20%) | 12.7 (+8%) | 64.8 (+9%) | 79.6 (-0.3) |
| original MHSA | 16.8 | 1460 | 3590 (-15%) | 12.5 (+7%) | 61.2 (+4%) | 79.8 (-0.1) |
| high-res attention | 17.65 | 1494 | 3759 (-11%) | 13.4 (+14%) | 64.0 (+8%) | 79.9 (+0.0) |
| no channel compr. | 20.68 | 1650 | 3921 (-7%) | 13.4 (+14%) | 63.1 (+7%) | 79.9 (+0.0) |
| Model | MLP | Original | Att | GPU Throughput | GPU Latency | TX2 Latency | iPhone 13 | Top-1 |
| Depth | (images/s) | (ms) | (ms) | (ms) | (%) | |||
| LowFormer-B0 | ✓ | ✓ | ✓ | 5988 | 2.9 | 8.5 | 1.5 | 78.4 |
| LowFormer-B1 | ✓ | ✓ | ✓ | 4237 | 4.0 | 11.7 | 1.8 | 79.9 |
| B1_mlpless | ✗ | ✓ | ✓ | 6067 | 2.8 | 8.5 | 1.5 | 78.8 |
| B1_mlpless_shallow | ✗ | ✗ | ✓ | 8254 | 1.8 | 5.9 | 1.3 | 77.2 |
| LowFormer-B1.5 | ✓ | ✓ | ✓ | 2739 | 4.8 | 2.8 | 111.6 | 81.2 |
| Model | MACs | GPU Throughput | GPU latency | TX2 Latency | iPhone 13 | Top-1 |
| (M) | (images/s) | (ms) | (ms) | (ms) | (%) | |
| EfficientMod-xxs ( Ma et al., 2024 ) | 579 | 2857 | 2.1 | 15.0 | 1.71 | 76.0 |
| EdgeViT-XS ( Chen et al., 2022b ) | 1127 | 2127 | 2.7 | 16.0 | 1.5 | 77.5 |
| MobileOne-S3 ( Vasu et al., 2023b ) | 1895 | 2433 | 1.0 | 11.8 | 1.2 | 78.1 |
| EfficientMod-xs ( Ma et al., 2024 ) | 773 | 2352 | 2.5 | 17.7 | 2.2 | 78.3 |
| LowFormer-B0 (ours) | 944 | 5988 | 2.9 | 8.5 | 1.5 | 78.4 |
| Backbone | GPU Throughput | TX2 Latency | mAP | mAP 50 | mAP 75 | mAP s | mAP m | mAP l |
| (images/s) | (ms) | (%) | (%) | (%) | (%) | (%) | (%) | |
| MobileNetV3 ( Howard et al., 2019 ) | 862 | 19.7 | 29.9 | 49.3 | 30.8 | 14.9 | 33.3 | 41.1 |
| MobileNetV4-Conv-M ( Qin et al., 2024 ) | 517 | 27.4 | 32.6 | - | - | - | - | - |
| EfficientViT-M4 ( Liu et al., 2023 ) | 1700 | 17.6 | 32.7 | 52.2 | 34.1 | 17.6 | 35.3 | 46.0 |
| PVTv2-B0 ( Wang et al., 2022 ) | 355 | 96.0 | 37.2 | 57.2 | 39.5 | 23.1 | 40.4 | 49.7 |
| LowFormer-B0 (ours) | 1190 | 22.4 | 38.6 | 59.1 | 40.9 | 21.8 | 41.8 | 51.7 |
| Model | TX2 | GPU | GOT10K-val | LaSOT-Test | TREK-150 | NfS30 | AVisT | UAV123 | ||||||
| fps | fps | AUC | P | AUC | P | AUC | P | AUC | P | AUC | P | AUC | P | |
| SMAT ( Gopal and Amer, 2024 ) | 53 | 90 | 77.0 | 66.3 | 60.4 | 62.8 | 39.6 | 23.2 | 62.4 | 74.0 | 46.0 | 41.5 | 64.1 | 83.7 |
| LowFormer-Track (ours) | 51 | 92 | 78.9 | 69.3 | 61.7 | 64.6 | 39.7 | 22.4 | 63.1 | 75.0 | 47.0 | 42.0 | 65.2 | 85.2 |
Efficient Neural Network Inference
Efficient neural network inference reduces the time, memory, and energy needed to run trained models across hardware and deployment settings.
See all 468 papers