original github repo is by Alessandro Capotondi and Manuele Rusci is here
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.
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.
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.
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 |
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.
Shortly we will release a Python script for the import of pre-trained Tensorflow models.
- Get a STMicroelectronics NUCLEO STM32H743ZI
- Install System Workbench for STM32 for your OS and open it
- Click
File> Import...
, then selectGit> Project from Git
and click the buttonNext
- Select
Clone URI
and click the buttonNext
- Add the URI (original repo)
https://github.com/EEESlab/mobilenet_v1_stm32_cmsis_nn.git
and clickNext
- Add the URI (this modified repo)
https://github.com/toborobot/mobilenet_v1_stm32_cmsis_nn.git
and clickNext
- 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!
The following table show the profiling layer-per-layer of this Mobilenet implementation on the STM32H7 running at 400MHz.
- The project supports only STM32H7 board.
- Input image is statically linked at compile time.
- to check different imsge added 160_input_image1.h with agama lizard (need to change name of file in main.c file ( line 123)
- changed memory allocation addreses and values to fit requirements of Nucleo-H743ZI rev 1137 MB (see file STM32H743ZITx_FLASH.id)
- added imagenet class file to fast checklabel class name
- sample images from 160_input_image.h and 160_input_image1.h files
- added python files for picture<->array image convertation
- debug wb4stm32 mode -> agama lisard detected!