This repository demonstrate how to implement CNN on MCU by using STM32 X-Cube-AI.
Environment | |
---|---|
OS | Win11 |
MCU | NUCLEO-F411RE |
Python | 3.9.12 |
Keras | 2.6.0 |
Tensorflow | 2.8.0 |
X-Cube-AI | 7.2.0 |
IDE | VScode, STM32CubeIDE |
Workflow:
- Using Keras build classification model.
- Create STM32 project.
- Testing classification performance on MCU
python3 train_model.py
Layer (type) | Output Shape | Param # |
---|---|---|
input_1 (InputLayer) | [(None, 28, 28, 1)] | 0 |
conv2d (Conv2D) | (None, 8, 8, 8) | 208 |
conv2d_1 (Conv2D) | (None, 3, 3, 16) | 1168 |
flatten (Flatten) | (None, 144) | 0 |
dense (Dense) | (None, 10) | 1450 |
Total params: 2,826
Trainable params: 2,826
Non-trainable params: 0
- Click Software Packs -> Select Components
- Enable X-CUBE-AI Core
- Add Network
- Software Packs -> STMicroelectronics.X-CUBE-AI.7.2.0 -> Show graph\
- Core/Inc/main.h
- Core/Src/main.c
- Core/Src/stm32f4xx_it.c
This repository testing architecture shown as below figure.
python3 testing_on_mcu.py
- [Using Keras build classification model]
- [Create STM32 project]
- [Testing classification performance on MCU]
- TensorFlow 2 quickstart for beginners
- TensorFlow 2 quickstart for experts
- TinyML: Gettting Started with STM32 X-CUBE-AI
- X-CUBE-AI Expansion Package Embedded Documentation