GithubHelp home page GithubHelp logo

eeeslab / mobilenet_v1_stm32_cmsis_nn Goto Github PK

View Code? Open in Web Editor NEW
84.0 17.0 29.0 1.6 MB

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

License: Apache License 2.0

C 99.08% C++ 0.41% Assembly 0.51%
stm32 cmsis-nn edge-computing neural-network mobilenet convolutional-neural-networks quantized-neural-network quantized-neural-networks deep-neural-networks deeplearning

mobilenet_v1_stm32_cmsis_nn's Introduction

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.

mobilenet_v1_stm32_cmsis_nn's People

Contributors

alessandrocapotondi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobilenet_v1_stm32_cmsis_nn's Issues

core_cm7.h: No such file or directory

I cannot build the project because I get the following error:
mobilenet_v1_stm32_cmsis_nn/Drivers/Device/ST/STM32H7xx/Include/stm32h743xx.h:238:10: fatal error: core_cm7.h: No such file or directory
how can I fix it?

Port to CMix-NN

Hy dear,

I did a little port to CMix-NN with 8-8-8 bit precision.
However, it is hard to understand how did you define the quantization layers to improve the accuracy in the CMix-NN paper.
Could you provide any detail about this configuration?
Also, could you provide the scripts to generate the quantization data from tensorflow?

Best Regards,
Geancarlo Abich

How to inference on a new custom image?

Hi sir,

I wonder if there are any ways to use a new image to convert to the C array and then it can be replaced in the 160_input_image.h file?
I want to use my own image for testing the inferencing of your model on MCU. It would be appreciated if you could help take a look and guide me.

Best Regards,
Trieu Huynh

Is it single or dual coare M7?

Hi,
Thanks for sharing your code. I wish to try it on STM board.
May I know 165ms@400MHz is on NUCLEO board with single or dual M7 core?
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.