Build and run an image classification NN model on an STM32L4 Discovery board
Introduction
Prepare environment
Build an image classification NN model trained with the CIFAR-10 dataset
Deploy the image classification NN model on STM32
Run the image classification NN model on STM32
Next Steps
Build and run an image classification NN model on an STM32L4 Discovery board
Who is this for?
This is an advanced topic for embedded software developers interested in building neural network models for microcontrollers.
What will you learn?
Upon completion of this Learning Path, you will be able to:
- Build a convolution neural network(CNN) model for image classification.
- Run the CNN model on an STM32 B-L475E-IOT01A2 board using STM Cube AI
Prerequisites
Before starting, you will need the following:
- Familiarity with ML concepts
- Familiarity with C programming on microcontrollers
- STM32 B-L475E-IOT01A2 board
Summary
This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
You’ll build a CIFAR-10 convolutional neural network in Jupyter and deploy it to an STM32 B-L475E-IOT01A2 board. First, you’ll prepare an Anaconda environment, train the model, and import it into STM32Cube.AI within STM32CubeMX. Then, you’ll deploy the generated project and use a Python utility to send images to the board and exercise the classifier.
Frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
Open Anaconda Prompt and run
jupyter notebook. In the browser, navigate to the extracted project files and open lab.ipynb.Check the indicator to the left of the cell:
In[] before running, In[*] while running, and In[N] (a number) when complete.Select X-CUBE-AI 7.0.0. Later versions might not connect successfully.
Activate the Conda environment with
conda activate ml_lab and install opencv-python, protobuf==3.20, and tqdm==4.50.2. Then, go to the working folder’s Misc directory.From the
Misc folder, run python ui_python_ai_runner.py. If the board isn’t detected, press the black button on the board to reset and try again.