This repository provides a guide on how to compress neural network models to reduce their memory footprints and computational requirements, making deployment on STM32 targets easier. The particular compression method highlighted in this repository is structural pruning, achieved by using NetsPresso. Please browse the Docs for details about it
The tutorials are presented as Jupyter notebooks and config files, which will guide you through the process of training, pruning, fine-tuning, and quantizing a deep learning model using NetsPresso and the STM32AI Model Zoo. You can then benchmark the models by using the STM32Cube.AI Developer Cloud. The notebooks provide a step-by-step guide for users, making it easy for anyone to compress their neural network models efficiently and deploy them on STM32 targets.
For a more interactive learning experience, a video tutorial can walk you through the entire process visually, from training your deep learning model to deploying it on STM32 targets using NetsPresso and the STM32AI Model Zoo. Watch the full tutorial on YouTube to see each step.
The repository contains the following folders:
- utils: Contains utility functions used in the notebooks.
- image_classification:
netspresso_model_pruning.ipynb
: a notebook for image classification model pruning.- config_files : contains the yaml config files to use with the notebook.
- experiments_outputs : contains the directories and files created during the runs.
- pretrained_models : contains several baseline models and NetsPresso pruned models with their performances listed in the README
- object_detection: Coming soon.
- Create an account on myST and then sign in to STM32Cube.AI Developer Cloud to be able access the service.
- Alternatively, install STM32Cube.AI locally by following the instructions provided in the user manual in section 2, and get the path to
stm32ai
executable. - Create an account on NetsPresso.
- If you don't have python already installed, you can download and install it from here, a Python Version <= 3.10 is required to be able to use TensorFlow later on, we recommand using Python v3.9 or v3.10. (For Windows systems make sure to check the Add python.exe to PATH option during the installation process).
- Install Jupyter server and notebook libraries to run the Jupyter notebooks.
- Clone this repository using the following command:
git clone https://github.com/STMicroelectronics/stm32ai-nota.git
- Create a python virtual environment for the project:
cd stm32ai-nota python -m venv <env-name>