How to set up ailia SDK on the NXP FRDM i.MX 95 and run inference on the CPU, GPU (Vulkan) and NPU (Neutron).
The NXP i.MX 95 is an application processor for industrial and automotive use with an Arm Cortex-A55 CPU, an Arm Mali-G310 GPU and an NXP eIQ Neutron NPU. This page explains how to set up ailia SDK on Yocto Linux on the FRDM i.MX 95 development board, how to run models, and the benchmark results.
The execution environments ailia SDK can use on the i.MX 95 are:
| Environment | Hardware | ailia SDK public release (pip) | ailia SDK NXP NPU build (beta) |
|---|---|---|---|
| CPU | Arm Cortex-A55 | Supported | Supported |
| VulkanDNN (FP32 / FP16) | Arm Mali-G310 | Supported | Supported |
| Neutron-i.MX95-NPU | NXP eIQ Neutron NPU | Not supported | Supported |
The NXP NPU build is provided as a beta of ailia SDK 1.7.
| Item | Value |
|---|---|
| Board | NXP FRDM-IMX95 (imx95-15x15-lpddr4x-frdm) |
| Architecture | AArch64 |
| Yocto Project | 6.0 Wrynose (LTS) |
| NXP Linux BSP | LF6.18.20 2.0.0 (imx-linux-wrynose / imx-6.18.20-2.0.0.xml) |
| DISTRO | fsl-imx-xwayland |
| Linux kernel | 6.18.20-2.0.0 |
| glibc | 2.43 |
| Python | 3.14.4 |
| ailia SDK | 1.7.0.0 |
For connecting power and USB serial, writing the Linux image to a microSD card, and booting and logging in, see FRDM i.MX 95 Board Setup.
With Ethernet connected, install ailia SDK from pip. The AArch64 wheel (manylinux2014_aarch64) is selected automatically.
pip3 install ailia
After installation, list the available execution environments.
python3 -c "import ailia; [print(i, ailia.get_environment(i)) for i in range(ailia.get_environment_count())]"
0 CPU
1 VulkanDNN-Mali-G310 (FP32)
2 VulkanDNN-Mali-G310 (FP16)
libailia.so actually requires only up to GLIBC 2.27 / GLIBCXX 3.4.22, so it runs as-is on i.MX 95 Yocto (glibc 2.43).
The pip version downloads an evaluation license automatically on the first inference. If the board has no IPv6 default route, the connection to the license server can fail with OSError: [Errno 101] Network is unreachable. In that case, download it over IPv4 explicitly.
mkdir -p ~/.shalo
curl -4 -fL https://axip-console.appspot.com/license/download/product/AILIA -o ~/.shalo/AILIA.lic
Also make sure the system clock is set correctly.
To use the Neutron NPU, use the ailia SDK NXP NPU build (beta). It is distributed in the ailia-sdk-nxp-demo repository. After installing the pip version, replace libailia.so in the package with the NXP NPU build.
git clone https://github.com/ailia-ai/ailia-sdk-nxp-demo.git
cd ailia-sdk-nxp-demo
python3 scripts/copy_sdk.py --install-npu
Close any application that uses ailia before replacing the file.
GLIBC_2.43 and others). On older BSPs, replacing the library alone is not enough.
After replacing the files, Neutron-i.MX95-NPU is added to the environment list when /dev/neutron0 and libNeutronDriver.so are found. On devices without the NPU or the Neutron driver, only CPU and Vulkan are listed.
python3 -c "import ailia; [print(i, ailia.get_environment(i)) for i in range(ailia.get_environment_count())]"
0 CPU
1 VulkanDNN-Mali-G310 (FP32)
2 VulkanDNN-Mali-G310 (FP16)
3 Neutron-i.MX95-NPU
If Neutron-i.MX95-NPU is listed, the installation is complete. If it is not, see Troubleshooting.
When the NPU is first used, ailia allocates one physically contiguous 512 MiB region from CMA (see Memory). The BSP image of the tested environment (imx-image-full) allocates it without additional configuration. If the allocation fails, check the CMA size with grep Cma /proc/meminfo and enlarge it with the cma= kernel boot argument.
To run on the NPU, use a model in which matrix multiplications and convolutions are converted to standard ONNX integer operators (MatMulNBits, MatMulInteger and ConvInteger) (see Creating Models for the NPU). Nodes the NPU does not support run on the CPU automatically. Weights are converted for the NPU on the first inference, so only the first run takes longer.
For how to create models for the NPU by converting matrix multiplications and convolutions to standard ONNX integer operators (MatMulNBits, MatMulInteger and ConvInteger), see Creating Models for the NPU. It covers INT4 weight-only quantization for Transformers (ViT-B/16), static quantization of MatMuls (SAM 2.1 Tiny, Grounding DINO and Depth Anything V2), and static quantization of convolutions for CNNs (YOLOX-S).
Use the samples in ailia-models. Specify the execution environment ID with the -e option.
git clone https://github.com/ailia-ai/ailia-models.git
cd ailia-models
pip3 install -r requirements.txt
cd image_classification/vit
# CPU
python3 vit.py -e 0
# Vulkan (Mali-G310 FP16)
python3 vit.py -e 2
# Benchmark mode (11 inferences)
python3 vit.py -e 0 -b -bc 11
To run on the NPU, use the INT4 (MatMulNBits) model and pass the ID of Neutron-i.MX95-NPU (3 in the listing above) to -e. For ViT, the --quantize int4 option selects the INT4 model.
python3 vit.py --quantize int4 -e <ID of Neutron-i.MX95-NPU> -b -bc 11
-s output.png.
ailia-sdk-nxp-demo is an HDMI demo that uses COCO-calibrated NPU models for SAM 2.1 Tiny, Grounding DINO, Depth Anything V2 and YOLOX-S 320, plus ViT-B/16 (INT4). It compares the speed of four backends, ailia and NXP ONNX Runtime on the CPU and NPU, on the same screen. Connect an HDMI display and a mouse, and run it as the same user as Weston.
cd ailia-sdk-nxp-demo
python3 scripts/download_models.py # Download SAM 2.1 auxiliary models and ViT (first time only)
sh launch.sh # SAM 2.1 Tiny (ailia NPU)
sh launch.sh --model grounding --caption "Horse. Clouds. Grasses. Sky. Hill."
sh launch.sh --model depth
sh launch.sh --model yolox
sh launch.sh --model vit
Press Compare all 4 on the screen to compare the inference time of the four backends. Switch the input with Image / Video / Camera; USB camera frames can be inferred continuously (Video is only for SAM 2.1 five-frame tracking). See the repository README for details.
We compared ailia SDK (NXP NPU build) with ONNX Runtime 1.24.3 (ORT) bundled with the NXP BSP on the FRDM i.MX 95. All models were measured on 2026-11-22. All measurements use 6 CPU threads with profiling disabled, and NPU results include CPU execution of unsupported layers. Each backend uses the same model.
| Model | Main operators on the NPU | ORT CPU | ORT NPU | ailia CPU | ailia NPU | vs. ailia CPU |
|---|---|---|---|---|---|---|
| ViT-B/16 (classification) | MatMulNBits (INT4) | 670.2 ms | 385.9 ms | 780.7 ms | 328.8 ms | 2.4x |
| SAM 2.1 Tiny (still image) | MatMulInteger (fixed weights) | 2,454.4 ms | 2,378.3 ms* | 1,934.2 ms | 1,012.7 ms | 1.9x |
| SAM 2.1 Tiny (video tracking, average per frame) | MatMulInteger (fixed weights, Attention) | 4,064 ms | 3,962 ms* | 2,962 ms | 1,742 ms | 1.7x |
| Grounding DINO (detection) | MatMulInteger (fixed weights) | 7,531.2 ms | 6,979.8 ms | 6,104.4 ms | 3,840.2 ms | 1.6x |
| Depth Anything V2 Small (depth) | MatMulInteger (fixed weights, Attention), ConvInteger (2D) | 2,796.2 ms | 2,575.9 ms | 3,125.7 ms | 2,045.1 ms | 1.5x |
| YOLOX-S 320 (detection) | ConvInteger (2D) | 793.9 ms | 795.7 ms | 436.9 ms | 114.8 ms | 3.8x |
For SAM 2.1, the still image value is the sum of the Image Encoder and Mask Decoder, and the video tracking value is the total time for the 5 Bedroom frames (including pre/post-processing) divided by 5. * The SAM 2.1 ORT NPU result is timing-only because its tracking masks are incorrect. ORT was measured with its NPU CMA allocation fixed to 512 MiB.
For the measurement conditions, per-component breakdowns and accuracy of each model, see Benchmark Details.
ailia SDK takes ONNX as input, parses the graph and instantiates layers. Standard ONNX integer operators that can run on the NPU (MatMulNBits, MatMulInteger and ConvInteger) are replaced with NPU segments when the model is loaded, and the other layers run on the ailia CPU backend. Static QDQ DequantizeLinear → MatMul / Conv patterns are not recognized directly as NPU-supported layers. NPU segments do not go through an ONNX Runtime or TFLite Execution Provider; they call the low-level API of libNeutronDriver.so in the BSP directly. libNeutronDriver.so is loaded at runtime with dlopen, so on devices without the NPU there is no link error and only CPU and Vulkan are used.
ailia obtains and uses the following functions from libNeutronDriver.so.
| Function | Purpose |
|---|---|
allocateBuffer / releaseBuffer | Allocate and release a CMA region the NPU can access |
tiling_solver / weight_packer / compress_weight_tensor, etc. | Convert (pack) and compress weights into the NPU tile format |
clean_cache | Write back the CPU data cache to keep data consistent between the NPU and CPU |
matmul | Run a matrix multiplication on the NPU (synchronous call that waits for completion) |
The i.MX 95 Neutron NPU shares the same DRAM as the Arm CPU. ailia allocates one physically contiguous 512 MiB CMA region with allocateBuffer and receives it as a pointer mapped into the process address space. The CPU reads and writes this region directly and the NPU accesses the same physical memory, so there is no transfer to device memory as with a PCIe GPU.
The settings header records the locations of the weights, inputs and outputs as offsets within the same region. ailia writes back data written by the CPU with clean_cache before calling matmul, and after completion it maintains the cache for the output region before reading it on the CPU. Because the region is shared by multiple models, NPU executions are serialized with a lock.
With NXP ONNX Runtime on Neutron, we confirmed that ViT and SAM 2.1 outputs change from run to run for the same input. ailia achieves zero output variation by splitting large matrices into sizes the NPU processes reliably. This suits products that need reproducibility, such as threshold decisions and regression testing.
With MatMulNBits and MatMulInteger NPU execution, ViT takes 328.8 ms on ailia NPU versus 385.9 ms on ORT NPU (approximately 1.17x faster), and Grounding DINO takes 3,840.2 ms versus 6,979.8 ms (approximately 1.82x faster). For the COCO-calibrated SAM 2.1 model, the Image Encoder takes 886.4 ms on ailia NPU versus 1,807.7 ms on ailia CPU, and video tracking takes 1,742 ms per frame on average versus 2,962 ms.
CNN convolutions also run on the NPU as 2D ConvInteger. The ORT Neutron EP runs ConvInteger on the CPU, so for YOLOX-S ailia NPU takes 114.8 ms versus 795.7 ms on ORT NPU (approximately 6.9x faster). Depth Anything V2, which combines a Transformer and convolutions, also runs both MatMuls and convolutions on the NPU and takes 2,045.1 ms versus 2,575.9 ms on ORT NPU.
The ONNX Runtime Neutron EP can run only matrix multiplications whose right-hand side is a constant weight on the NPU. MatMuls whose two inputs both change at each inference, such as QK and AV in Attention, stay on the CPU. ailia packs the right-hand side for the NPU at each inference, so it can also run MatMulInteger with two dynamic inputs on the NPU. In SAM 2.1 Memory Attention, the Attention matrix multiplications run on the NPU as MatMulInteger. In Depth Anything V2 as well, the 24 Attention MatMulInteger nodes, with both inputs quantized by calibrated QuantizeLinear, run on the NPU. FP32 MatMuls are never implicitly converted to INT8; quantization is expressed explicitly in the model with standard ONNX operators.
Changing the environment ID runs the same model and code on the CPU, Mali-G310 (Vulkan) or the Neutron NPU. The C++ / Python / C# / Flutter API is shared with Windows, macOS, Linux, Android and iOS, so applications developed on a PC can be ported to the i.MX 95 as-is.
You can try more than 400 models from ailia-models on the i.MX 95. Combined with libraries such as ailia Speech (Whisper), ailia Tokenizer and ailia LLM, you can build speech recognition and generative AI into embedded devices.
| Symptom | What to check |
|---|---|
Neutron-i.MX95-NPU is not listed | Check the kernel driver with ls /dev/neutron0 and the Neutron driver with ls /usr/lib/libNeutronDriver.so. Also confirm the BSP is 6.18-wrynose or equivalent and that libailia.so was replaced with copy_sdk.py --install-npu. |
License download fails with Network is unreachable | This happens when the board has no IPv6 default route. Download the license over IPv4 as described in Getting the License, and make sure the system clock is correct. |
| NPU memory allocation fails | ailia allocates one physically contiguous 512 MiB CMA region. Check the total and free CMA with grep Cma /proc/meminfo and enlarge it with the cma= kernel boot argument if needed. |
| Only the first inference is slow | Weights are converted (packed) for the NPU on the first inference. This is normal; subsequent inferences are faster. |
| No speedup when the NPU is selected | Nodes that do not meet the NPU conditions (no zero point, K % 16 == 0, etc.) run on the CPU. Use the check script in Creating Models for the NPU to see which nodes run on the NPU. |