Last edited one week ago

X-LINUX-AI tool suite

(Redirected from X-LINUX-AI Tool)

This article provide information about the X-LINUX-AI tool suite, the way to install it, and how to use it.

1. X-LINUX-AI Tool[edit | edit source]

The X-LINUX-AI Tool is a small binary designed to provide users with useful information about the X-LINUX-AI Expansion Package.

It is the entry point to install the packages of X-LINUX-AI on top of the OpenSTLinux Starter Package. It also provides information about the X-LINUX-AI version and supported features.

1.1. X-LINUX-AI Tool installation[edit | edit source]

Warning white.png Warning
The software package is provided AS IS, and by downloading it, you agree to be bound to the terms of the software license agreement (SLA0048). The detailed content licenses can be found here.
   apt-get install x-linux-ai-tool

1.2. How to use X-LINUX-AI Tool[edit | edit source]

Usage:	x-linux-ai -[option]

-v --version            : Show X-LINUX-AI current version if it is installed
-f --supported-features : Print all supported frameworks in this X-LINUX-AI version
-l --list               : Print installed and ready-to-install packages
-i --install <pkg>      : Install X-LINUX-AI package
-r --remove  <pkg>      : Remove X-LINUX-AI package
-h --help               : Show this help

1.2.1. Usage example[edit | edit source]

  • To show the current version of X-LINUX-AI:
x-linux-ai -v

Console output :

X-LINUX-AI version: 6.0.0
  • To display X-LINUX-AI features:
x-linux-ai -f

Console output :

Features:
   * STAI_MPU Unified API based on OpenVX™(STM32MP25x only), TensorFlow™ Lite, and ONNX Runtime™ compatible with all STM32MPU series 
   * TIM-VX™ 1.2.6 (STM32MP25x only) 
   * TensorFlow™ Lite 2.16.2 with XNNPACK delegate activated for CPU execution and VX-delegate External delegate to address STM32MP2 NPU 
   * ONNX Runtime™ 1.19.2 with XNNPACK execution engine activated for CPU execution and VSINPU Execution provider to address STM32MP2 NPU

Find more information on the wiki page: https://wiki.st.com/stm32mpu/wiki/X-LINUX-AI_OpenSTLinux_Expansion_Package

Applications:
   * Image classification : 
     * C++ / Python™ example using STAI_MPU Unified API based on the MobileNet v1 and v2 quantized models 
   * Object detection : 
     * C++ / Python™ example using STAI_MPU Unified API based on the SSD MobileNet v1 and v2 quantized models 
   * Human pose estimation : 
     * Python™ example using STAI_MPU Unified API based on YoloV8n pose quantized model 
   * Semantic segmentation : 
     * Python™ example using STAI_MPU Unified API based on DeepLabV3 quantized model 
   * Face recognition: 
     * C++ example using STAI_MPU unified API based on the BlazeFace and FaceNet quantized models 
   * Note: applications are based on Gstreamer 1.22.x, GTK 3.x, OpenCV 4.9.x, Pillow, Python 3
  • To list of the packages of X-LINUX-AI:
x-linux-ai -l

Console output :

 [installed]	    application-resources
 [installed]	    fd-models-blazeface-128
 [installed]	    fr-models-facenet-512
 [installed]	    img-models-mobilenetv1-05-128
 [installed]	    img-models-mobilenetv2-10-224
 [installed]	    libstai-mpu-ovx6
 [installed]	    libstai-mpu-tools
 [installed]	    libstai-mpu6
 [installed]	    libtensorflow-lite-tools
 [installed]	    libtensorflow-lite2
 [installed]	    nbg-benchmark
 [installed]	    object-detect-models-ssd-mobilenet-v2-10-256-fpnlite
 [installed]	    onnxruntime
 [installed]	    onnxruntime-tools
 [installed]	    ort-vsinpu-ep-example-cpp
 [installed]	    ort-vsinpu-ep-example-python
 [installed]	    packagegroup-x-linux-ai-demo
 [installed]	    packagegroup-x-linux-ai-npu
 [installed]	    pose-estimation-models-yolov8n
 [installed]	    python3-libstai-mpu
 [installed]	    python3-libtensorflow-lite
 [installed]	    python3-onnxruntime
 [installed]	    semantic-seg-models-deeplabv3-257
 [installed]	    stai-mpu-face-recognition-cpp
 [installed]	    stai-mpu-face-recognition-cpp-ovx
 [installed]	    stai-mpu-image-classification-cpp
 [installed]	    stai-mpu-image-classification-cpp-ovx
 [installed]	    stai-mpu-image-classification-python
 [installed]	    stai-mpu-image-classification-python-ovx
 [installed]	    stai-mpu-object-detection-cpp
 [installed]	    stai-mpu-object-detection-cpp-ovx
 [installed]	    stai-mpu-object-detection-python
 [installed]	    stai-mpu-object-detection-python-ovx
 [installed]	    stai-mpu-pose-estimation-python
 [installed]	    stai-mpu-pose-estimation-python-ovx
 [installed]	    stai-mpu-semantic-segmentation-python
 [installed]	    stai-mpu-semantic-segmentation-python-ovx
 [installed]	    tflite-vx-delegate
 [installed]	    tflite-vx-delegate-example
 [installed]	    tim-vx
 [installed]	    tim-vx-tools
 [installed]	    x-linux-ai-application
 [installed]	    x-linux-ai-benchmark

 [not installed]    libstai-mpu-ort6
 [not installed]    libstai-mpu-tflite6
 [not installed]    libstai-mpu-unit-tests
 [not installed]    onnxruntime-unit-tests
 [not installed]    packagegroup-x-linux-ai
 [not installed]    packagegroup-x-linux-ai-onnxruntime
 [not installed]    packagegroup-x-linux-ai-tflite
 [not installed]    stai-mpu-image-classification-cpp-ort
 [not installed]    stai-mpu-image-classification-cpp-tfl
 [not installed]    stai-mpu-image-classification-python-ort
 [not installed]    stai-mpu-image-classification-python-tfl
 [not installed]    stai-mpu-object-detection-cpp-ort
 [not installed]    stai-mpu-object-detection-cpp-tfl
 [not installed]    stai-mpu-object-detection-python-ort
 [not installed]    stai-mpu-object-detection-python-tfl

  • To install packages of X-LINUX-AI:
x-linux-ai -i <package>

Console output :

 {{Board$}}x-linux-ai -i onnxruntime
 Reading package lists... Done
 Building dependency tree... Done
 Reading state information... Done
 The following NEW packages will be installed:
   onnxruntime
 0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded.
 Need to get 0 B/6089 kB of archives.
 After this operation, 0 B of additional disk space will be used.   
 
 The software package is provided AS IS, and by downloading it, you agree to be bound to the terms of the software license agreement (SLA).
 The detailed content licenses can be found at https://wiki.st.com/stm32mpu/wiki/OpenSTLinux_licenses. 
 
 Selecting previously unselected package onnxruntime.
 (Reading database ... 18419 files and directories currently installed.)
 Preparing to unpack .../onnxruntime_1.19.2+git0+ffceed9d44-r0_arm64.deb ...
 Unpacking onnxruntime (1.19.2+git0+ffceed9d44-r0) ...
 Setting up onnxruntime (1.19.2+git0+ffceed9d44-r0) ...
 N: Ignoring file 'packages.openstlinux.st.com.list.tmp' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
 onnxruntime has been installed successfully.
  • To uninstall packages of X-LINUX-AI:
x-linux-ai -r <package>

Console output :

 {{Board$}}x-linux-ai -r onnxruntime
 Reading package lists... Done
 Building dependency tree... Done
 Reading state information... Done
 The following packages will be REMOVED:
   onnxruntime
 0 upgraded, 0 newly installed, 1 to remove and 16 not upgraded.
 After this operation, 0 B of additional disk space will be used.
 
 The software package is provided AS IS, and by downloading it, you agree to be bound to the terms of the software license agreement (SLA).
 The detailed content licenses can be found at https://wiki.st.com/stm32mpu/wiki/OpenSTLinux_licenses.
 
 (Reading database ... 18423 files and directories currently installed.)
 Removing onnxruntime (1.19.2+git0+ffceed9d44-r0) ...
 N: Ignoring file 'packages.openstlinux.st.com.list.tmp' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
 onnxruntime has been removed successfully.

2. X-LINUX-AI Application[edit | edit source]

The X-LINUX-AI application tool is a small binary designed to ease the usage of X-LINUX-AI out-of-the box applications, it allows:

  • to list applications available on the board by providing name of the use-case and installation status
  • to run application by specifying use-case and optionally model-type (NBG/TFLite/ONNX) and language to use (Python/C++)

2.1. X-LINUX-AI Application installation[edit | edit source]

Warning white.png Warning
The software package is provided AS IS, and by downloading it, you agree to be bound to the terms of the software license agreement (SLA0048). The detailed content licenses can be found here.
   x-linux-ai -i x-linux-ai-application

2.2. How to use X-LINUX-AI Application[edit | edit source]

Usage:	'x-linux-ai-application -r <use-case> --model-type <model-type> --language <language>'

-l --list            : list all the available applications
-r --run <str>       : run application with a specific use case
--model-type <str>   : run application with a specific model type
--language <str>     : run application with a specific program language
-h --help            : Show this help

2.2.1. Usage example[edit | edit source]

  • To display X-LINUX-AI applications available:
x-linux-ai-application -l

Console output :

[installed]	face-recognition
[installed]	image-classification
[installed]	object-detection
[installed]	pose-estimation
[installed]	semantic-segmentation
  • To launch X-LINUX-AI applications:
x-linux-ai -r image-classification

Console output :

Running ...
Application: stai-mpu-image-classification-python-ovx
File path: /usr/local/x-linux-ai/image-classification/launch_python_image_classification.sh nbg

...log of the application...

By default, if a use case name is used to launch an application without any specification for model-type and language, the tool will manage to launch the most efficient variant of the application installed.

On STM32MP2x boards the applications will be launched by default with OpenVX to target NPU. On STM32MP1x boards the applications will be launched by default with TensorFlow Lite runtime to target CPU. The C++ application will be preferred if available (else python application will be launched)

By specifying model-type and language it is possible to launch any variant of the application as long as it is well installed on the board. If it is not the case please use the X-LINUX-AI tool to list available packages and install the desired application variant.