Skip to main content
QUICK REVIEW

[Paper Review] Efficient Neural Network Deployment for Microcontroller

Hasan Unlu|arXiv (Cornell University)|Jul 2, 2020
Advanced Neural Network ApplicationsComputer Science3 references9 citations
TL;DR

This paper proposes two novel optimizations—fused in-place max-pooling and ping-pong buffering—for efficient deployment of neural networks on microcontrollers. By eliminating intermediate buffers in stride≥kernel-size max-pooling and reusing memory across layers, the framework reduces RAM usage by 74% compared to CMSIS-NN, enabling inference on sub-100KB SRAM devices with minimal performance loss.

ABSTRACT

Edge computing for neural networks is getting important especially for low power applications and offline devices. TensorFlow Lite and PyTorch Mobile were released for this purpose. But they mainly support mobile devices instead of microcontroller level yet. Microcontroller support is an emerging area now. There are many approaches to reduce network size and compute load like pruning, binarization and layer manipulation i.e. operator reordering. This paper is going to explore and generalize convolution neural network deployment for microcontrollers with two novel optimization proposals offering memory saving and compute efficiency in 2D convolutions as well as fully connected layers. The first one is in-place max-pooling, if the stride is greater than or equal to pooling kernel size. The second optimization is to use ping-pong buffers between layers to reduce memory consumption significantly. The memory savings and performance will be compared with CMSIS-NN framework developed for ARM Cortex-M CPUs. The final purpose is to develop a tool consuming PyTorch model with trained network weights, and it turns into an optimized inference engine(forward pass) in C/C++ for low memory(kilobyte level) and limited computing capable microcontrollers.

Motivation & Objective

  • To enable efficient inference of neural networks on microcontrollers with limited SRAM (kilobyte-level) and constrained compute resources.
  • To reduce memory footprint and improve memory reuse in sequential neural network execution on single-core microcontrollers.
  • To develop a toolchain that converts trained PyTorch models into optimized C/C++ inference code for microcontrollers.
  • To outperform existing frameworks like CMSIS-NN in RAM efficiency while maintaining comparable ROM usage.

Proposed method

  • Fuses max-pooling into the convolutional layer output by writing results directly into the input buffer when stride ≥ pooling kernel size, eliminating intermediate storage.
  • Employs a ping-pong buffer strategy between layers, reusing the largest intermediate activation buffer across multiple layers to minimize peak memory usage.
  • Moves model weights into the .text section (ROM) instead of .bss or .data, reducing SRAM consumption by avoiding runtime allocation.
  • Uses a custom memory layout and buffer scheduling to limit peak memory to the maximum of the first two layer outputs, rather than the largest individual output.
  • Optimizes memory access by fusing ReLU activation into convolution kernels, avoiding additional memory or computation.
  • Compiles the optimized model into C/C++ code for RISC-V and ARM Cortex-M platforms, targeting embedded deployment.

Experimental results

Research questions

  • RQ1Can in-place max-pooling reduce memory usage in convolutional neural networks on microcontrollers when stride ≥ pooling kernel size?
  • RQ2To what extent can ping-pong buffering reduce peak memory consumption in sequential neural network inference on microcontrollers?
  • RQ3How does the proposed framework compare to CMSIS-NN in terms of RAM and ROM utilization for a standard CNN like LeNet-5?
  • RQ4Can model weights be safely stored in read-only memory (ROM) without degrading inference performance on microcontrollers?
  • RQ5What is the maximum memory reduction achievable for a 32-bit floating-point LeNet-5 model on a microcontroller with <100KB SRAM?

Key findings

  • The proposed framework reduces peak RAM usage to 11.2 KB, a 74% reduction compared to CMSIS-NN’s 44 KB, while maintaining identical ROM usage of 36 KB.
  • The fused in-place max-pooling optimization eliminates the need for intermediate buffers when stride ≥ pooling kernel size, directly writing results into the convolution output buffer.
  • The ping-pong buffer strategy limits peak memory to the maximum of the first two layer outputs, significantly reducing memory footprint compared to allocating full-sized scratch buffers.
  • The total memory requirement for LeNet-5 is reduced from 283 KB (246 KB parameters + 37 KB activations) to 11.2 KB of SRAM, with 36 KB of ROM for weights.
  • The framework successfully deploys LeNet-5 for real-time inference on a SiFive FE310-G000 RISC-V microcontroller with a camera input, achieving correct classification via UART output.
  • The method is compatible with both RISC-V and ARM Cortex-M platforms, with minimal performance impact and no loss in model accuracy.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.