/mobilenet_v1_stm32_cmsis_nn

Mobilenet v1 trained on Imagenet for STM32 using extended CMSIS-NN with INT-Q quantization support

Primary LanguageCApache License 2.0Apache-2.0

Mobilenet V1 for STM32 over CMSIS-NN

This project contains an STM32 application for executing a quantized Mobilenet v1 (160x160x3, alpha 0.25) trained for Imangenet on a STM32H7 NUCLEO evaluation board.

Support and Contribution

If you want to collaborate, contribute, or to rise issues and suggestions to this project you can use the Issues page or contact us:

  • Alessandro Capotondi, University of Bologna, email
  • Manuele Rusci, University of Bologna, email

What is a Mobilenet?

MobileNets are small, low-latency, low-power models parameterized to meet the resource constraints of a variety of use cases. They can be built upon for classification, detection, embeddings and segmentation similar to how other popular large scale models, such as Inception, are used. MobileNets can be run efficiently on mobile devices with TensorFlow Mobile. MobileNets trade off between latency, size and accuracy while comparing favorably with popular models from the literature.

mobilenet family performances

Only a limitated set of configurations for MobileNet can be hosted on a ST32H7 device, memory limitation are there (2MB flash + 512kB L2 SRAM). The following chart highlights the subset of configurations compatible for the device.

mobilenet family for STM32H7

The parameters used on this project is image input 160x160x3 and alpha 0.25. The following table show the classification performance of such configuration.

Model Million MACs Million Parameters Top-1 Accuracy Top-5 Accuracy
MobileNet_v1_0.25_160_uint8 21 0.47 43.4 68.5

UINT8 Asymmetric Quantization for CMSIS-NN

To limit the classification error introduced by the quantization this Mobilenet implementation uses our extended CMSIS-NN that support an Asymmetric Quantization methodology mapped on UINT8 datatypes. You find additional information on this article.

How to import a new Tensorflow model

Shortly we will release a Python script for the import of pre-trained Tensorflow models.

Getting-Started on STM Workbench

  • Select Clone URI and click the button Next

  • Add the URI https://github.com/EEESlab/mobilenet_v1_stm32_cmsis_nn.git and click Next

  • Select all the branches and click the button Next

  • Select the local destination and click the button Next

  • Select how to import the project and click the button Next

  • Import the project (finally)!

  • Build and run the application!

Measured Performance

The following table show the profiling layer-per-layer of this Mobilenet implementation on the STM32H7 running at 400MHz.

Limitations

  • The project supports only STM32H7 board.
  • Input image is statically linked at compile time.