Giter Site home page Giter Site logo

alessandrocapotondi / mobilenet_v1_stmcube_ai Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 2.0 11.94 MB

Mobilenet v1 (3,128,128, alpha=0.25) on STMH7 using STMCube AI

License: Apache License 2.0

Jupyter Notebook 4.29% C 95.18% C++ 0.35% Assembly 0.18%
stm32 stmcubemx edge-computing neural-network cubemxai mobilenet keras deep-neural-networks imagenet cortex-m7

mobilenet_v1_stmcube_ai's Introduction

Mobilenet on STMH7 using STMCubeMX.AI

(new version is located here: https://github.com/alessandrocapotondi/MobileNet_v1_x_cube_ai_4.1.0)

The repo contains a STMWorkbench project that aims to fit a Mobilenet v1 (3,128,128, alpha=0.25) into a MCU STM32H7 using the STMCubeMX.AI flow. Note that the selected Mobilenet version is the biggest model that can be fitted on the MCU STM32H7 using the STMCubeMX.AI flow.

This project will be used as reference benchmark of our Quantized Mobilenet based onCMSIS-NN: https://github.com/EEESlab/mobilenet_v1_stm32_cmsis_nn

Current Status

Mobilenet v1 (3,128,128, alpha=0.25) compiles and works on STMicroelectronics STM32 Nucleo-144.

Content

The project folder structure follows the classic STMWorkbench project template. In addition it contains the code generated by STMCubeMX.AI for the Mobilenet included inside the folder keras_model/:

  • Drivers/: (generated) The Folder contains the ARM CMSIS and additional drivers for the MCU;
  • Middlewares/ST/AI/AI/: (generated) STMCubeMX.AI generated code for the Mobilenet.
  • Src/: (generated) Sources.
  • Inc/usr_mobilenet.h: user-space header file for Mobilenet application execution.
  • Src/usr_mobilenet.c: user-space applications and utilities for Mobilenet application execution.
  • keras_model/: The folder contains a Python notebook used to fix and convert the Keras Mobilenet pre-trained model to a model that can be imported into the STMCubeMX.AI flow. According to the discussion [1], keras.advanced_activations.ReLU layers are not usable directly in STCubemx.ai. The function remove such layers and it substitutes to supported keras.activations.relu.
  • mobilenet_cubemx_ai.ioc: STMCubeMX project file.

Measured Performances

Million MACs Million Parameters Top-1 Accuracy Top-5 Accuracy CPU Cycles (MCycles) Latency @400MHz (s) MMACs/s MMACs/s/W*
14 0.47 41.5 66.3 99 0.247 56.7 84.6
  • This number refers to an average power consumption of 0.68 Watt measured at the power source, so it CANNOT be considered as efficiency metric of the MCU, but it is the efficiency of this particular solution, which includes LED activations, GPIO triggering, and all the other peripherals on the board.

Execution Screenshot

mobilenet_v1_stmcube_ai's People

Contributors

alessandrocapotondi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

eeeslab wjyhumor

mobilenet_v1_stmcube_ai's Issues

Is benchmark available?

I noticed you were going to benchmark CubeAI solution you used in this project with CMSIS NN solution you used in your other project. Do you have the first results? I'm also interested in CubeAI vs CMSIS NN.

Currently, CubeAI supports float32 only. But they are planning to support quantization as well in the near future.

MobileNetV2

Thanks for the example, but a number of questions arise:

  1. Will such a method work correctly on an already trained MobileNet model ? After all, we violated the internal architecture of the model. Or do I need to train this model again ?

  2. You have an example on the MobileNet model. Will your method work for MobileNetV2 ?

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.