Skip to main content
Version: BSP 7.x.y

Build Machine Learning Applications with NXP eIQ Software

Introduction

In this article, you will learn how to run Machine Learning demos using the NXP eIQ Machine Learning software on Toradex System-on-Modules (SoMs) based on NXP processors. The NXP eIQ software provides a complete Machine Learning development environment, including the eIQ Toolkit workflow tool, inference engines, neural network compilers, and optimized libraries.

NXP eIQ

NXP eIQ software provides a Machine Learning software stack optimized for NXP i.MX SoCs. It enables the deployment and execution of neural network models on embedded devices using hardware accelerators.

On supported platforms, neural network inference can be accelerated on the GPU or NPU through the OpenVX backend. If hardware acceleration is not available, inference can also run on Arm Cortex-A CPU cores, where eIQ supports multi-threaded execution to improve performance.

More details about supported frameworks, hardware acceleration, and deployment workflows can be found in the i.MX Machine Learning User's Guide, available in the NXP's Embedded Linux Documentation.

Prerequisites

Demonstration

After setting up the environment and building a reference image with the eIQ Machine Learning software integrated, you can run the provided demos to test the NPU capabilities of your SoM.

This article guides you through running a sample image classification demo using the MobileNet V1 model on the i.MX 8M Plus and the i.MX 95 based modules. The demo is included as part of the eIQ software package.

First, get into the demo's directory on the target device:

# cd /usr/bin/tensorflow-lite-2.16.2/examples/
info

The version of TensorFlow Lite included in the reference image may change over time. Make sure to check the version available in your image and adjust the path accordingly.

The NXP demo uses the input image grace_hopper.bmp to perform image classification with a neural network based on the MobileNet V1 model. Check the NXP's i.MX Machine Learning User's Guide for more details.

Run the command below to execute the NXP demonstration on the desired hardware accelerator:

iMX8M Plus

# USE_GPU_INFERENCE=0 ./label_image -m mobilenet_v1_1.0_224_quant.tflite -i grace_hopper.bmp -l labels.txt --external_delegate_path=/usr/lib/libvx_delegate.so

iMX95

# ./label_image -m mobilenet_v1_1.0_224_quant.tflite -i grace_hopper.bmp -l labels.txt --external_delegate_path=/usr/lib/libneutron_delegate.so

Performance Comparison

The following tables show the inference time and frames per second (FPS) for the MobileNet V1 demo running on different Toradex SoMs with NXP-based processors, using NPU, GPU, and CPU acceleration.

SoMInference TimeFPS (1/Inference Time)
Verdin iMX8M Plus3.08 ms324.67 FPS
SMARC iMX8M Plus3.16 ms316.45 FPS
Verdin iMX950.16 ms6172.84 FPS
SMARC iMX950.28 ms3571.42 FPS
iMX95 Verdin EVK1.32 ms754.14 FPS
info

As described in NXP Application Note AN12964, the i.MX 8M Plus SoC requires a warm-up period of approximately 7 seconds before the NPU reaches its expected performance.

Additional Resources

Send Feedback!