Two-machine workflow
Compiling is expensive and runs once per model on a desktop; inference runs every frame on the device. So the work is split between two machines:
| Stage | Machine | Tool | Runs |
|---|---|---|---|
| 1. Compile | x86_64 Ubuntu host (or a Kaggle notebook), 16 GB RAM or more | DX-COM: converts ONNX to .dxnn and quantises to INT8 | Once per model, on the CPU |
| 2. Run | The device: AI HAT+ or Edge AI Expansion Board on a Raspberry Pi 5, or ALPON X5 AI | DXRT runtime (sixfab-dx package): loads and runs the .dxnn file on the NPU | Every frame, offline; no compiler on the device |
The same .dxnn file runs on all three products: the DX-M1 and DX-M1M share one instruction set. The only limit is NPU memory: a model that fits the 4 GB DX-M1 may not fit the 2 GB DX-M1M on the AI HAT+.
Compiler machine requirements
DX-COM runs on a separate machine, not on the device:
| CPU | x86_64; ARM and aarch64 cannot compile |
| Operating system | Ubuntu 20.04, 22.04, or 24.04 (not 18.04) |
| glibc | 2.31 or newer; check with ldd --version |
| Python | 3.8 to 3.14, required by the DX-COM wheel |
| RAM | 16 GB or more |
| Disk | 20 GB free or more, for the toolchain, dependencies, and build files |
| Internet | Needed for the install (repository clone, pip install); inference runs offline |
| GPU | Not needed: compilation runs on the CPU |
No Ubuntu machine? Compile in Kaggle
Kaggle Notebooks run on Linux x86_64 and meet the requirements above, so the whole ONNX to DXNN compile can run there without a local machine. A notebook for it:
- Clone the
DEEPX-AI/dx-compilerrepository into the working directory. - Run
install.shwith a Docker volume path to stage the toolchain. - Install the DX-COM wheel (
pip install dx_com*.whl). - Install
ultralyticsand export a YOLO model to ONNX (for exampleyolo11n), or bring your own.onnxfile. - Write a
config.jsonwith the input shape, calibration, preprocessing, and PPU settings. - Run
dxcomon the model and the config to produce the.dxnnfile.
Download the .dxnn file from the Kaggle output panel and copy it to the device (step 3 below).
Conversion path: ONNX to DXNN to device
Three stages, each in its own environment with its own output.
-
Export trained model to ONNX
Train the model in any major framework, then export to ONNX on the development machine. ONNX is the only input format DX-COM accepts.
- PyTorch
- Ultralytics YOLO
- TensorFlow
- Keras
- ONNX Model Zoo
The NPU runs vision architectures: detection, classification, segmentation, and pose. LLMs and audio-only transformer architectures are not supported; LLM support depends on the DEEPX roadmap, with no date announced.
PyTorch export
import torch # 1. Load your trained model and switch to eval mode model.eval() # 2. Provide a dummy input matching the production input shape dummy_input = torch.randn(1, 3, 640, 640) # 3. Export to ONNX (opset 11 is widely compatible with DX-COM) torch.onnx.export( model, dummy_input, "my_model.onnx", opset_version=11, input_names=["images"], output_names=["output"] )Ultralytics YOLO export
from ultralytics import YOLO model = YOLO("yolo11n.pt") model.export(format="onnx") # Produces yolo11n.onnx in the working directory.Batch size must be 1. Ultralytics exports with batch size 1 by default. For custom exports, set the batch dimension to
1: DX-COM does not support dynamic or multi-batch compilation via the CLI.Verify the operators in the exported ONNX graph against the DEEPX-supported list before compiling. Full operator and architecture reference: Supported Models Catalog. Upstream source: GitHub: DEEPX-AI/dx-compiler, Building_Models.md.
-
Compile ONNX to DXNN with DX-COM
DX-COM reads the ONNX file, calibrates it for INT8 arithmetic, and produces a
.dxnnbinary that runs natively on the DEEPX DX-M1 family NPU. Quantisation is automatic, with about 2 % accuracy loss against the original FP32 model.Install DX-COM
# 1. Clone the DEEPX compiler repository git clone https://github.com/DEEPX-AI/dx-compiler cd dx-compiler ./install.sh # 2. Install the Python wheel cd dx_com pip install dx_com*.whl # 3. Verify the installation dxcom --version # expected: DX-COM v2.3.0Prepare calibration dataset
Quantisation needs calibration data: a small set of representative images the compiler uses to estimate activation ranges. Use images from your deployment domain; random stock images degrade quantised accuracy. Start with 100 images.
calibration_images/ ├── frame_0001.jpg ├── frame_0002.jpg └── ...Write
config.jsonand compileDX-COM is driven by a JSON configuration file describing input shape, calibration settings, and the preprocessing pipeline. A minimal YOLOv11n configuration:
{ "inputs": {"images": [1, 3, 640, 640]}, "calibration_method": "ema", "calibration_num": 100, "default_loader": { "dataset_path": "./calibration_images", "file_extensions": ["jpeg", "jpg", "png"], "preprocessings": [ {"resize": {"width": 640, "height": 640}}, {"convertColor": {"form": "BGR2RGB"}}, {"div": {"x": 255}}, {"transpose": {"axis": [2, 0, 1]}}, {"expandDim": {"axis": 0}} ] } }dxcom -m ./yolo11n.onnx -c config.json -o yolo11n-output # Successful run ends with: # [INFO] - Compilation complete. # [INFO] - Output: yolo11n-output/yolo11n.dxnnFull parameter reference
For every
config.jsonfield (calibration algorithms, the fullpreprocessingsoperator list, the three PPU types for YOLO models, DXQ accuracy recovery), see the dedicated DX-COM configuration reference.What the compiler does to the model
- Operator mapping. Each ONNX op is mapped to a DEEPX NPU instruction sequence. Unsupported ops either error out or fall back to CPU execution at runtime, depending on architecture.
- INT8 quantisation. Weights and activations are calibrated against your dataset and quantised. No developer configuration required beyond the calibration set.
- Memory planning. The compiler lays out tensors to fit NPU on-chip memory. Models that exceed available NPU memory fail at compile time.
- Optional PPU fusion. For YOLO architectures, the post-processing graph is fused onto the NPU when PPU is enabled.
Compiler upstream reference: GitHub: DEEPX-AI/dx-compiler
-
Deploy
.dxnnartifact and run inferenceThe compiled
.dxnnfile is the deployment artifact. Copy it to the target Sixfab device, then load it with the DEEPX runtime (dxrt-runtime) and run inference. The Python and C++ APIs are functionally equivalent; C++ runs slightly more efficiently on tight inference loops.Transfer artifact to target device
The transfer step is the only stage where the procedure varies by product. The
.dxnnfile itself is identical across all three.Product Copy the file with AI HAT+ SCP from the compile host, for example scp model.dxnn pi@raspberrypi.local:~/Edge AI Expansion Board SCP, as for the AI HAT+ ALPON X5 AI The ALPON Console or SCP, depending on the fleet setup Model size limit. The compiled model must fit in NPU on-chip memory. Models that exceed available NPU memory fail to load on the device. Check the model footprint reported by DX-COM at the end of compilation, then pick a product whose NPU memory fits it: the DX-M1M on the AI HAT+ has 2 GB, while the DX-M1 on the Edge AI Expansion Board and ALPON X5 AI has 4 GB.
Run inference with Python API
from dx_engine import InferenceEngine import cv2, numpy as np # 1. Load the compiled model engine = InferenceEngine("models/my_model.dxnn") # 2. Preprocess input (remove operations the NPU absorbed) img = cv2.imread("frame.jpg") img = cv2.resize(img, (640, 640)) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = np.transpose(img, (2, 0, 1)) img = np.expand_dims(img, 0) # 3. Run inference output = engine.run(img)Run inference with C++ API
#include <dxrt/inference_engine.h> dxrt::InferenceEngine engine("models/my_model.dxnn"); for (const auto& frame : frames) { auto output = engine.Run(frame.data()); // process output }Verify the NPU is being used
On the target device, run
dxrt-cli -sto confirm the NPU is loaded and the model is dispatched correctly. For load, temperature, and fleet monitoring, see System monitoring.NPU-absorbed preprocessing. Operations that the compiler absorbed into the NPU graph (logged at compile time) must be removed from this host-side preprocessing. See the DX-COM configuration reference for which operations can be absorbed.
Already have a compiled .dxnn file? Go to step 3 and run it on the device.
Sixfab × Ultralytics acceleration path
To skip the compile workflow, Sixfab and Ultralytics offer a managed path: bring a labelled dataset, and the trained, optimised model is delivered for your Sixfab hardware, with no DX-COM on your side. See Sixfab × Ultralytics acceleration path and the Ultralytics DEEPX integration.
Compatible libraries
DX-COM takes ONNX from these frameworks; use the one your team already has:
- PyTorch:
torch.onnx.export; opset 11 works well with DX-COM. - TensorFlow: the
tf2onnxconverter. Check that the input and output tensor names matchconfig.json. - Keras:
tf2onnxorkeras2onnx. Check for dynamic dimensions first: DX-COM needs fixed input shapes. - Ultralytics YOLO:
model.export(format="onnx"). The recommended start for detection, classification, segmentation, and pose. - ONNX Model Zoo: download directly. Check its operators against the Supported models catalog first.
OpenCV, NumPy, Pillow, scikit-image, Picamera2, and libcamera work alongside dxrt-runtime on the device.
Limits
- Vision models. The NPU runs convolutional and vision networks. LLMs, audio-only models, and text transformers are not supported; LLM support depends on the DEEPX roadmap, with no date announced.
- INT8 only. The compiler quantises automatically; FP16 and FP32 do not run on the NPU. Expect about 2 % accuracy loss against FP32 and evaluate against that.
- Inference only. No training on the device: train on a GPU machine (or through the Sixfab × Ultralytics path), then compile.
- x86_64 Ubuntu to compile. At least 16 GB RAM; ARM and aarch64 are not supported, so neither a Raspberry Pi 5 nor the ALPON X5 AI can compile.
- Supported operators. A model with an unsupported operator fails to compile or falls back to the CPU at runtime, depending on the architecture. Check the Supported models catalog before exporting.
- Not hot-pluggable. Power off the Raspberry Pi 5 before mounting or removing the AI HAT+ or the Edge AI Expansion Board. The ALPON X5 AI NPU is integrated.
- Hosts. The AI HAT+ and the Edge AI Expansion Board run on the Raspberry Pi 5 only; not on the Raspberry Pi 4, Compute Module 4 or 5, or other single-board computers. The ALPON X5 AI is a complete system on the Compute Module 5.
- Runtime updates. If a runtime release changes the model format, existing
.dxnnfiles must be recompiled; the runtime reports a version mismatch at load time.