- Last edited 3 months ago ago
X-LINUX-AI Developer package
Contents
1 Developer package : build AI application from the X-LINUX-AI add-on SDK[edit]
In order to easily develop and build an AI application without using the Yocto build system, X-LINUX-AI comes with a SDK add-on extending the OpenSTLinux SDK with AI functionality. To install and use the X-LINUX-AI SDK Add-on please refer to the following steps.
2 Prerequisites[edit]
2.1 Install the OpenSTLinux SDK[edit]
First of all, you must download and install the OpenSTLinux SDK, which contains all the basis needed for the X-LINUX-AI add-on. To do this, follow instructions given in STM32MP1 Developer Package : Installing the SDK chapter. Once this has been done, you should have a directory containing the OpenSTLinux SDK.
3 X-LINUX-AI SDK add-on installation[edit]
3.1 Download the X-LINUX-AI SDK add-on[edit]
To add the Artificial Intelligence part into the OpenSTLinux SDK, you must download and install the X-LINUX-AI SDK add-on. The add-on is delivered through a tarball file that can be downloaded here: X-LINUX-AI SDK add-on.
3.2 Install the X-LINUX-AI SDK add-on[edit]
Once the X-LINUX-AI SDK add-on is downloaded, uncompress the add-on:
cd ~/Downloads/
tar xzf en.SDK-x86_64-stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21-addon-x-linux-ai-v5.0.0.tar.gz
Then, copy the .sh script to your OpenSTLinux SDK directory:
cp stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21-addon-x-linux-ai-v5.0.0/st-image-ai-openstlinux-weston-stm32mp1-x86_64-toolchain-4.2.1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21-addon-x-linux-ai-v5.0.0.sh $HOME/STM32MPU_workspace/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK
Finally, run the script contained in the tarball:
cd $HOME/STM32MPU_workspace/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK
./st-image-ai-openstlinux-weston-stm32mp1-x86_64-toolchain-4.2.1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21-addon-x-linux-ai-v5.0.0.sh
Optionally, once the script is executed, you can delete it.
rm *.sh
3.3 Start the SDK[edit]
The add-on is now installed into the OpenSTLinux SDK. You can start the SDK. Go to your OpenSTLinux SDK directory and source the environment:
cd $HOME/STM32MPU_workspace/STM32MPU_workspace/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK
source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
Check that the SDK is properly installed:
x-linux-ai -v
X-LINUX-AI version: v5.0.0
4 Use the SDK[edit]
4.1 Build an application with the SDK[edit]
Once the SDK is correctly set up, the applications can be built easily. In this example, it is the image classification application that is built.
Download the github repository:
git clone https://github.com/STMicroelectronics/meta-st-x-linux-ai.git
Go to the image classification directory:
cd meta-st-x-linux-ai/recipes-samples/tflite-cv-apps/files/image-classification/src
Then, use the make command to build the application:
make
A new file is displayed, named label_tfl_gst_gtk. This is a binary file, which has been generated using the make command. It is compiled for the STM32MP1x architecture. It must now be transferred to the board.
4.2 Use the application[edit]
Once the STM32MP1x board is correctly set up and the X-LINUX-AI packages are installed with the right version, it is possible to send the application to the board.
To do it, use the following command using your own IP address:
scp -r -p label_tfl_gst_gtk root@<ip_address>:/usr/local/demo-ai/computer-vision/tflite-image-classification/bin/
Then, use the ssh protocol to connect to the board:
ssh root@<ip_address>
On the board, go to the right directory and use the image classification script to launch the application:
cd /usr/local/demo-ai/computer-vision/tflite-image-classification/bin/ ./launch_bin_label_tfl_mobilenet.sh
This script is using the label_tfl_gst_gtk application that has been compiled before.