STM32MP1 artificial intelligence expansio

来自百问网嵌入式Linux wiki

The artificial intelligence expansion package contains Linux AI frameworks to enable AI application examples that can be run on STM32MP1 Series devices.
This package consists in an OpenEmbedded meta layer, named meta-st-stm32mpu-ai, to be added on top of the STM32MP1 Distribution Package. It brings a complete and coherent easy-to-build / install environment to take advantage of AI on the STM32MP1 Series.
The meta layer contains frameworks, tools and applications to run AI examples. Different image flavors are to be made available targeting different use cases such as computer vision (CV).

文件:STM32 MPU Embedded Software Distribution Package And OpenSTLinux AI Expansion Package.png
STM32MPU Embedded Software Distribution Package with the OpenSTLinux AI Expansion Package

Prerequisite

Info.png The artificial intelligence expansion package meta-st-stm32mpu-ai has been validated against the ecosystem release v1.1.0{{#set:Ecosystem release=revision of a previous flow 1.1.0}}

Install the STM32MP1 Distribution Package v1.1.0, but do not initialize the OpenEmbedded environment (sourcing the envsetup.sh) before having installed the meta-st-stm32mpu-ai meta layer (see next chapter).

Installation of the meta layer

STM32MP1 DK2 or EV1 boards

Info.png The meta-st-stm32mpu-ai layer depends on the meta-clang layer.
  • Clone following git repositories into <Distribution Package installation directory>/layers/meta-st
PC $> cd <Distribution Package installation directory>/layers
PC $> git clone https://github.com/kraj/meta-clang -b thud
PC $> cd <Distribution Package installation directory>/layers/meta-st
PC $> git clone https://github.com/STMicroelectronics/meta-st-stm32mpu-ai.git -b thud
  • Set up the build environment
PC $> cd ../..
PC $> DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh
  • Add the new layers in that order
PC $> bitbake-layers add-layer ../layers/meta-clang
PC $> bitbake-layers add-layer ../layers/meta-st/meta-st-stm32mpu-ai

STM32MP1 Avenger96 board

Info.png The meta-st-stm32mpu-ai layer depends on the meta-clang layer.
  • Clone following git repositories into <Distribution Package installation directory>/layers/meta-st
PC $> cd <Distribution Package installation directory>/layers
PC $> git clone https://github.com/kraj/meta-clang -b thud
PC $> git clone https://github.com/vinceab/meta-av96.git -b thud
PC $> cd <Distribution Package installation directory>/layers/meta-st
PC $> git clone https://github.com/STMicroelectronics/meta-st-stm32mpu-ai.git -b thud
  • Set up the build environment
PC $> cd ../..
PC $> META_LAYER_ROOT=layers DISTRO=openstlinux-weston MACHINE=stm32mp1-av96 source layers/meta-st/scripts/envsetup.sh
  • Add the new layers in that order
PC $> bitbake-layers add-layer ../layers/meta-av96
PC $> bitbake-layers add-layer ../layers/meta-clang
PC $> bitbake-layers add-layer ../layers/meta-st/meta-st-stm32mpu-ai

Build the software image

Different OpenSTLinux expansion packages are available to target different use cases. The following commands need to be executed in the build environment.

  • X-LINUX-AI-CV for computer vision use case
For further information about this OpenSTLinux expansion package, read this article X-LINUX-AI-CV OpenSTLinux expansion package
To build it, execute the following command:
PC $> bitbake st-image-ai-cv
Info.png Note that building the image could take more than 2 hours depending on the host computer performance.

Flash the built image

Follow this link to know how to flash the built image.

Launch the AI software

The AI demo launcher

The AI demo launcher is a derivative of the GTK demo launcher application.

It is written in python3[1] and uses GTK[2] to display the user interface. It allows easy launching of the AI application examples.
A "single tap" on the touch screen or a "single click" with a mouse connected to the board is sufficient to launch the AI application.

文件:STM32MP15 AI launcher main menu.png
Example of AI demo launcher for Computer Vision

The AI demo launcher is updated with the available examples according the built image.
If a computer vision package is built, the AI demo launcher then contains the supported computer vision application examples.

Info.png Source code of the AI demo launcher is located here:
  • in the meta layer:
meta-st-stm32mpu-ai/recipes-samples/demo/ai-demo-launcher/ai-demo-launcher.py
  • on the target:
/usr/local/demo-ai/ai-demo-launcher.py

References

<securetransclude src="ProtectedTemplate:PublicationRequestId" params="12818 | 29Jul'19 |"></securetransclude>