In this Learning Path, you will build a neural network model with TensorFlow and deploy the model on the STM32 B-L475E-IOT01A2 board . This board has an MCU based on the Arm Cortex-M4 processor.
You will implement a letter recognition model which takes accelerometer data from the board and predicts the letter based on the accelerometer data.
Anaconda is a distribution of Python language for data science and machine learning. With Anaconda, you can easily install open-source machine learning packages.
With Anaconda installed, you will now install the necessary conda
packages for data collection and machine learning including
Jupyter notebook
.
Follow the steps as shown below:
Anaconda Prompt
conda create -n ml_lab python=3.8
conda activate ml_lab
conda-forge
channel to install packages:
conda config --add channels conda-forge
conda install jupyter pandas pyserial scikit-learn tensorflow matplotlib
Next, you need to program the STM32 B-L475E-IOT01A2
board to acquire accelerometer data for your neural network model.
The data collection code for this Learning Path is provided, so you can just import the project and program the board using STM32CubeIDE .
Download the
zip file
and extract it into a tf_stm32
folder.
Download and run the installer from the Get Software
section of the
STMicroelectronics website
.
Within STM32CubeIDE
follow the steps below:
Import project
and navigate to General
> Existing Projects into Workspace
.MCU Dataset Creation
folder from the unzipped package as the root directory, and select Dataset_Creation
project. Click Finish
to import.Run As
. The project will rebuild, and be flashed to the device. If prompted, accept any suggested firmware updates.In the same environment you activated using Anaconda earlier, navigate to your tf_stm32
folder and enter:
jupyter notebook tf_stm32.ipynb
You are now ready to train your first neural network model with TensorFlow and deploy the inference with STM Cube AI.