---
title: "Model deployment workflow for DEEPX NPU"
description: "Compile your own ONNX model to a .dxnn file with DX-COM on an x86_64 Ubuntu host and run it on the AI HAT+, the Edge AI Expansion Board or the ALPON X5 AI."
url: "https://docs.sixfab.com/edge-ai/ai-model-deployment/custom-models-dxnn-sdk/workflow/"
last_updated: "2026-10-12"
---

# Model deployment workflow for DEEPX NPU

Compile your own ONNX model to a .dxnn file with DX-COM on an x86_64 Ubuntu host and run it on the Sixfab AI HAT+, the Edge AI Expansion Board, or the ALPON X5 AI.

## 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 |

> [!TIP]
> **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:
>
> 1. Clone the `DEEPX-AI/dx-compiler` repository into the working directory.
> 2. Run `install.sh` with a Docker volume path to stage the toolchain.
> 3. Install the DX-COM wheel (`pip install dx_com*.whl`).
> 4. Install `ultralytics` and export a YOLO model to ONNX (for example `yolo11n`), or bring your own `.onnx` file.
> 5. Write a `config.json` with the input shape, calibration, preprocessing, and PPU settings.
> 6. Run `dxcom` on the model and the config to produce the `.dxnn` file.
>
> 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.

1. **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**

   ```python
   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**

   ```python
   from ultralytics import YOLO

   model = YOLO("yolo11n.pt")
   model.export(format="onnx")
   # Produces yolo11n.onnx in the working directory.
   ```

   > [!NOTE]
   > **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](https://docs.sixfab.com/edge-ai/ai-model-deployment/supported-models/). Upstream source: [GitHub: DEEPX-AI/dx-compiler, Building_Models.md](https://github.com/DEEPX-AI/dx-compiler/blob/main/source/docs/03_Building_Models.md).

2. **Compile ONNX to DXNN with DX-COM**

   DX-COM reads the ONNX file, calibrates it for INT8 arithmetic, and produces a `.dxnn` binary 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**

   ```bash
   # 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.0
   ```

   **Prepare 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.

   ```text
   calibration_images/
   ├── frame_0001.jpg
   ├── frame_0002.jpg
   └── ...
   ```

   **Write `config.json` and compile**

   DX-COM is driven by a JSON configuration file describing input shape, calibration settings, and the preprocessing pipeline. A minimal YOLOv11n configuration:

   ```json filename="config.json"
   {
     "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}}
       ]
     }
   }
   ```

   ```bash
   dxcom -m ./yolo11n.onnx -c config.json -o yolo11n-output

   # Successful run ends with:
   # [INFO] - Compilation complete.
   # [INFO] - Output: yolo11n-output/yolo11n.dxnn
   ```

   > [!NOTE]
   > **Full parameter reference**
   >
   > For every `config.json` field (calibration algorithms, the full `preprocessings` operator list, the three PPU types for YOLO models, DXQ accuracy recovery), see the dedicated [DX-COM configuration reference](https://docs.sixfab.com/edge-ai/ai-model-deployment/custom-models-dxnn-sdk/dx-com-configuration/).

   **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](https://github.com/DEEPX-AI/dx-compiler)

3. **Deploy `.dxnn` artifact and run inference**

   The compiled `.dxnn` file 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 `.dxnn` file 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 |

   > [!NOTE]
   > **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**

   ```python
   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**

   ```c
   #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 -s` to confirm the NPU is loaded and the model is dispatched correctly. For load, temperature, and fleet monitoring, see [System monitoring](https://docs.sixfab.com/edge-ai/ai-model-deployment/system-monitoring/).

   > [!NOTE]
   > **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](https://docs.sixfab.com/edge-ai/ai-model-deployment/custom-models-dxnn-sdk/dx-com-configuration/#preprocessing-operations) 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](https://docs.sixfab.com/edge-ai/ai-model-deployment/custom-models-dxnn-sdk/sixfab-ultralytics-acceleration-path/) and the [Ultralytics DEEPX integration](https://docs.ultralytics.com/integrations/deepx#what-is-deepx).

## 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 `tf2onnx` converter. Check that the input and output tensor names match `config.json`.
- **Keras:** `tf2onnx` or `keras2onnx`. 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](https://docs.sixfab.com/edge-ai/ai-model-deployment/supported-models/) 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](https://docs.sixfab.com/edge-ai/ai-model-deployment/custom-models-dxnn-sdk/sixfab-ultralytics-acceleration-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](https://docs.sixfab.com/edge-ai/ai-model-deployment/supported-models/) 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 `.dxnn` files must be recompiled; the runtime reports a version mismatch at load time.

## Next steps

- [DX-COM configuration reference](https://docs.sixfab.com/edge-ai/ai-model-deployment/custom-models-dxnn-sdk/dx-com-configuration/): Every `config.json` field, the three PPU types with Netron walkthroughs, DXQ accuracy recovery, and the preprocessing operators.
