Machine Learning Guide

Introduction

Several of our NXP-based CoMs come with a Neural Processing Unit (NPU) on-board, and the karo-image-ml image (see below) can be used on all of them:

SoC

NPU

Module series

i.MX 8M Plus

VeriSilicon VIPlite NPU

QSXP-ML81, TX8P-ML81, TX8P-ML82

i.MX 93

Arm Ethos-U65 microNPU

QS93, TX93

Alternatively, a Coral Edge TPU accelerator can be attached on QSBASE3 — see the Coral Edge TPU Guide.

There are different Machine Learning demos you can run on the processor’s NPU.

Further information can be read at the i.MX Machine Learning User’s Guide

Demo Video

Precompiled Images

Module

Precompiled Image

Description

QSXP-ML81

qsxp-ml81-ml in Download Area

Machine Learning Demo Image.

TX8P-ML81

tx8p-ml81-ml in Download Area

Machine Learning Demo Image.

TX8P-ML82

tx8p-ml82-ml in Download Area

Machine Learning Demo Image.

QSXP-ML81

qsxp-ml81-basler in Download Area

Machine Learning Demo Image with Basler Camera support.

For the QS93 / TX93 (i.MX93) modules there is no precompiled ML image in the Download Area — build karo-image-ml yourself as described below.

Yocto Setup

For creating the necessary RootFS, a complete Yocto build environment is required.

All modules listed above are built with the NXP BSP — see Yocto Guide — if not already set up, follow that guide first.

  1. Setup the Yocto build-directory as described in the Yocto guide for your machine. Use the following values:

  • DISTRO=karo-xwayland

  • MACHINE=<desired-machine> (e.g. qsxp-ml81, tx8p-ml81, qs93-5210, tx93-5210)

  1. Compile the image:

bitbake karo-image-ml

Tip

If you want to compile the image with basler camera support, follow the additional steps described at Camera Guide.

Demos

Live Object Detection

Note

For this demo a camera is mandatory. The following example was tested on i.MX8M Plus (QSXP/TX8P) with karo-image-basler and a Basler camera.

The pre-trained eIQ DeepViewRT model from NXP allows it, to run a live eIQ DeepViewRT GStreamer Detection Demo on the NPU of the i.MX8M Plus.

  1. Download the eIQ Demo File Archive and unpack it to your target.

  2. On the target, run the following command to show the example using the CPU:

ssdcam-gst -m mobilenet_ssd_v1_1.00_trimmed_quant_anchors.rtm -c /dev/video2
  1. Run the following commands to show the example using the NPU:

 modelrunner -m mobilenet_ssd_v1_1.00_trimmed_quant_anchors.rtm -e ovx -H 10818 &
ssdcam-gst -m mobilenet_ssd_v1_1.00_trimmed_quant_anchors.rtm -r 127.0.0.1 -u 1 -c /dev/video2

Note

On the i.MX93 (QS93/TX93) the NPU is the Arm Ethos-U65 microNPU. Use the Ethos-U delegate of TensorFlow Lite (shipped in karo-image-ml) for your models — the NPU is enabled through the karo-npu devicetree overlay. See the i.MX Machine Learning User’s Guide for details.