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
In this Learning Path, you will build a convolution neural network model for image classification. You will train the model with CIFAR-10 dataset, one of the most popular image datasets, which contains 60,000 images with 10 different categories. The model takes an RGB image and predicts the category of the image.
Set up Anaconda
Anaconda is a Python distribution for data science and machine learning. With Anaconda, you can easily install open-source machine learning packages.
Visit the Anaconda website and download the installer
Run the installer with the default options
With Anaconda installed, you can install the necessary conda packages for data collection and machine learning, including
Jupyter notebook
.
Follow the steps as shown below:
First open Anaconda Prompt
Create an environment by typing:
conda create -n ml_lab python=3.8
- Activate your environment by typing:
conda activate ml_lab
- Add conda-forge channel to install packages:
conda config --add channels conda-forge
- Then install python packages:
conda install jupyter pandas tensorflow matplotlib numpy
- Users have reported issues where the steps below result in
dead kernelerrors. To fix the problem, described as a GitHub issue , use:
conda install nomkl
Get project files
Setup your development machine with the project files.
Download the zip file containing the project files
Unzip the files into a working folder
Open Jupyter Notebook
In the same environment you activated using Anaconda earlier, navigate to the above folder and enter:
jupyter notebook lab.ipynb
You are now ready to train your first neural network model with TensorFlow and deploy the inference with STM Cube AI.