Data collection and annotation are often tedious and time-consuming to achieve satisfactory results in image classification. The transfer learning technique enables to overcome this challenge by reducing the number of images and the training time needed to add a new class. It is applied here to flower classification, but it can be extended to many other use cases. 

Approach

The STM32 model zoo provides everything you need to train and retrain on your own data
The solution uses a technique called "transfer learning" to quickly train a deep learning model to classify images
The model can be easily deployed on the STM32H747 discovery kit with the STM32 model zoo Python scripts
The use case presented is based on flower recognition.

Sensor

Vision: Camera module bundle (reference: B-CAMS-OMV)

Data

Dataset Dataset for flower recognition (License CC BY 2.0)
Data format
5 classes of flowers: daisy, dandelion, rose, sunflower, tulip 
RGB color images 

Results

Model MobileNetV2 alpha 0.35 
Input size: 128x128x3
Memory footprint:
406.86 KB Flash for weights
224.5 KBRAM for activations
Accuracy:
Float model: 86.78%
Quantized model: 86.38% 
Performance on STM32H747 (High-perf) @ 400 MHz 
Inference time: 110.27 ms
Frame rate:  9.0 fps

use-case-stm32-cube-ai-updated-confusion-matrix-flower-recognition use-case-stm32-cube-ai-updated-confusion-matrix-flower-recognition use-case-stm32-cube-ai-updated-confusion-matrix-flower-recognition

Confusion matrix

Resources

Model repository ST Edge AI Model Zoo

A collection of reference AI models optimized to run on ST devices with associated deployment scripts. The model zoo is a valuable resource to add edge AI capabilities to embedded applications.

ST Edge AI Model Zoo ST Edge AI Model Zoo ST Edge AI Model Zoo

Optimized with STM32Cube.AI

A free STM32Cube expansion package, X-CUBE-AI allows developers to convert pretrained AI algorithms automatically, such as neural network and machine learning models, into optimized C code for STM32.

STM32Cube.AI STM32Cube.AI STM32Cube.AI

Compatible with STM32H7 series

The STM32 family of 32-bit microcontrollers based on the Arm Cortex®-M processor is designed to offer new degrees of freedom to MCU users. It offers products combining very high performance, real-time capabilities, digital signal processing, low-power / low-voltage operation, and connectivity, while maintaining full integration and ease of development.

STM32H7 series STM32H7 series STM32H7 series

You might also be interested by

Entertainment | Image recognition | Vision | STM32Cube.AI | Demo | Tutorial | GitHub | Video

Smart mirrors for fitness: pose estimation and multi-person tracking

Track and analyze users' body movements to provide feedback on exercise with STM32N6 at 28 FPS.

Object detection | Vision | STM32Cube.AI | Idea | GitHub | Video | Dataset | Smart building

Personal protective equipment detection

Detection of personal protective equipment on workers using an object detection AI model.

Smart city | Smart home | Smart office | Context awareness | Vision | AI for Linux | Idea | Video

People detection and counting solution

Optimized computer vision using an MPU running at 8 FPS.