---
title: "Model Conversion: ONNX to Hailo"
product: "LumiScan Training"
component: "lumiscan-training"
version: "2.3.0"
display_version: "2.3.0.2"
latest_version: true
language: "en"
url: "https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/model-conversion.html"
---

# Model Conversion: ONNX to Hailo – LumiScan Training

A network that has been trained and exported as an ONNX file can be converted into a Hailo model for execution on a Hailo TPU.

The conversion runs inside the Hailo conversion container. It is therefore only available if the **Hailo PlugIn** (`Installer-LumiScanTraining-HailoPlugIn`) is installed in addition to LumiScan Training. If the plugin is missing, the application reports that the `podman` command or the required conversion image could not be found.

## Starting the Program

Start LumiScan Training as described in [LumiScan Training Installation](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/lumiscan-training-installation.html). The splash screen (Fig. 11) is displayed while the application is loading.

![The LumiScan Training splash screen showing the HD Vision Systems logo, the text Loading LumiScan Training, and a progress bar](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/_images/splashscreen.jpg)

*Figure 1. Fig. 11: LumiScan Training: Splash Screen*

After loading, the main window opens (Fig. 12). Model conversion is started using the **Model Conversion** button.

![The LumiScan Training Framework main window with the Select Config File and Process Status areas and the buttons Start Training, Start Testing, Start Inference, and Model Conversion](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/_images/trainingframework_started.jpg)

*Figure 2. Fig. 12: LumiScan Training Framework: Main Window with Model Conversion Button*

## Preparing the Calibration Images

During conversion, the network is quantized. A set of calibration images is required to determine the value ranges that occur within the network.

> [!IMPORTANT]
> The calibration images must have the **same resolution as the training images**. Images with a different resolution can result in an unusable model.

The quality and representativeness of the calibration images influence the accuracy of the converted model. Therefore:

- Record the images under **real production conditions**, using the same camera, optics, working distance, and objects as in later operation.
- Include representative **lighting conditions**. For example, use different exposure times if the exposure time also varies during operation, or record image sets under different ambient lighting conditions.

Store the images in a single folder, referred to below as the **calibration folder**. Supported image formats include `.png`, `.jpg`, `.jpeg`, `.bmp`, and `.tiff`.

## Performing the Conversion

Click **Model Conversion** to open the **Model Conversion (ONNX → Hailo)** dialog (Fig. 13). Use the corresponding **Browse** buttons to select the three paths described in [Table 3](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/model-conversion.html#model-conversion-parameters).

![The Model Conversion dialog with the fields ONNX model file, Calibration folder, and Output folder, each with a Browse button, as well as the Start Conversion button and the status Ready](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/_images/select_model_and_calibration_dir.jpg)

*Figure 3. Fig. 13: LumiScan Training: Model Conversion Dialog*

**Table 1. Table 3: LumiScan Training Model Conversion Parameters**

| Field | Description |
| --- | --- |
| **ONNX model file** | The trained network in ONNX format. It is normally located in the folder specified by `exportDirectory` in the [JSON Settings](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/json-settings.html). |
| **Calibration folder** | The folder containing the calibration images described in the previous section. |
| **Output folder** | The folder in which the converted model and associated files are stored. By default, the folder containing the ONNX file is selected. |

Click **Start Conversion** to begin the conversion (Fig. 14).

While the conversion is running:

- The status changes to **Converting…**.
- The **Start Conversion** button changes to **Stop Conversion**, which can be used to cancel the running conversion.
- The input fields are disabled.
- The progress of the conversion is displayed in the log console at the bottom of the window.

![The Model Conversion dialog during conversion, showing the Stop Conversion button, the status Converting, and the log console with container output](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/_images/start_conversion.jpg)

*Figure 4. Fig. 14: LumiScan Training: Model Conversion in Progress*

> [!NOTE]
> The first conversion can take longer because the Podman machine is started first if it is not already running.

> [!NOTE]
> The conversion container can access the `C:` drive directly. If the ONNX file, calibration folder, or output folder is located on another drive, for example `E:`, or on a network share, the required files are automatically transferred to the container before conversion. The results are transferred back after conversion is complete. No additional configuration is required. The log console displays the additional transfer steps, and the overall conversion time may increase depending on the size of the calibration data.

When the conversion is complete, the message **Conversion finished successfully.** is displayed.

The following files are created in the output folder, where `<name>` is the name of the ONNX file:

- `<name>.hef` - Model for the Hailo TPU.
- `<name>.har` - Intermediate archive created during conversion.
- `<name>_hailo.onnx` - ONNX model adapted for Hailo.
- `convert_parameters.json` - Parameters used for the conversion.

If the conversion fails, the exit code is displayed in the status line and additional information is shown in the log console.

Problems during the model conversion are described step by step in [Troubleshooting](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/troubleshooting.html):

- [**Model Conversion** is not available, or `podman` or the conversion image cannot be found](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/troubleshooting.html#faq-model-conversion-unavailable)
- [The model conversion fails with exit code 137](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/troubleshooting.html#faq-exit-code-137)
- [The model conversion takes longer than expected](https://docs.hdvisionsystems.com/en/lumiscan-training/2.3.0/troubleshooting.html#faq-conversion-slow)

If you encounter other problems during model conversion, contact HD Vision Systems.
