TL;DR
This paper introduces μYOLO, a highly optimized version of the YOLO object detection model designed to run on resource-constrained microcontrollers. The authors demonstrate its feasibility by achieving real-time object detection at approximately 3.5 FPS on a Cortex-M microcontroller with minimal Flash and RAM usage, opening doors for AI on embedded devices.
What Problem Does This Paper Address?
Object detection, a crucial task in computer vision for identifying and localizing objects within images, has traditionally relied on powerful hardware like GPUs due to the computational demands of complex deep learning models. While single-shot detectors like YOLO offer efficiency, their deployment on low-power, embedded systems like microcontrollers has remained a significant challenge. These microcontrollers have severe limitations in terms of processing power, memory (Flash and RAM), and energy consumption, making it difficult to run even moderately complex neural networks. This paper tackles the problem of bringing effective object detection capabilities to these ubiquitous, low-cost embedded platforms.
Methods
The core of the paper is the development of μYOLO, a significantly modified YOLO architecture tailored for microcontrollers. Key modifications include:
- Reduced Input Resolution: The input image resolution is drastically reduced to 128x128 pixels.
- Simplified Backbone: The convolutional backbone network is streamlined, primarily using depthwise separable convolutions, which are known for their efficiency in reducing trainable parameters and computational cost.
- Optimized Detection Head: The grid size (S) and the number of bounding box predictors per cell (B) are reduced. The authors found S=5 and B=2 to be a good compromise for their target platform and input resolution.
- Activation Functions: ReLU is used as the activation function.
- Model Compression: To further reduce the model's footprint, network pruning (iterative gradual pruning with L1 norm heuristic) and 8-bit quantization are applied post-training.
- Deployment Pipeline: A pipeline is used to convert the compressed model into deployable C-code for the target microcontroller.
Datasets
The authors evaluated μYOLO on three object detection tasks:
- Human Detection: Derived from a subset of the Microsoft COCO dataset.
- Vehicle Detection: Derived from a subset of the Microsoft COCO dataset, including trucks, buses, cars, bicycles, and motorcycles.
- Toy Groceries Detection: A custom dataset recorded by the authors, featuring items like water, milk, chocolate milk, and orange juice in a mini-fridge.
Key Insights and Ideas
- Feasibility of Real-Time Detection on Microcontrollers: The most significant insight is that real-time object detection, previously thought to be out of reach for microcontrollers, is indeed achievable with careful model optimization and architectural choices.
- Impact of Scene Complexity vs. Input Resolution: While reducing input resolution is crucial for fitting models onto microcontrollers, the complexity of the scene and the relative size of objects play a more significant role in detection accuracy. Increasing input resolution beyond a certain point (e.g., 128x128) did not yield substantial improvements in mAP0.5 for the vehicle detection task, suggesting a trade-off point exists.
- Pruning and Quantization Effectiveness: The paper demonstrates that aggressive pruning and 8-bit quantization can significantly reduce model size without catastrophic loss of accuracy, making deployment feasible.
- Error Analysis Highlights Limitations: The error analysis reveals that μYOLO's primary failure mode is missing objects (false negatives), especially in complex scenes with occlusions or distant objects. This is a direct consequence of the reduced resolution and model capacity.
Key Results
- Performance on OpenMV H7 R2: μYOLO achieved approximately 3.5 FPS on a Cortex-M7 based OpenMV H7 R2 microcontroller running at 480 MHz.
- Memory Footprint: The model requires less than 800 KB of Flash and less than 350 KB of RAM.
- Accuracy:
- On the fridge detection task (4 classes), μYOLO achieved an average mAP0.5 of 56.4%.
- On the human detection task (1 class), it achieved an average mAP0.5 of 27.7%.
- On the unrestricted vehicle detection task (5 classes), it achieved an average mAP0.5 of 12.3%.
- Input Resolution Trade-off: For the vehicle task, an 88x88 px input achieved 8.40 FPS with 152 KB RAM, while 128x128 px achieved 3.45 FPS with 324 KB RAM. Larger resolutions quickly became infeasible due to RAM constraints.
- Error Analysis: False negatives were the most common error, particularly in the more complex COCO vehicle detection task.
Limitations and Future Work
- Accuracy Trade-off: The significant reduction in accuracy for more complex tasks like vehicle detection (12.3% mAP0.5) highlights the inherent trade-off between model size/speed and precision.
- Limited Input Resolution: The necessity of a low input resolution (128x128) limits the ability to detect small objects.
- Future Work: The authors suggest exploring more aggressive pruning schedules to potentially achieve higher FPS (up to 8 FPS was observed with degraded mAP0.5) and further investigate the trade-off between model performance and precision for specific detection applications. They also plan to continue exploring the feasibility of object detection on microcontrollers.
Summary updated