# exporter

Python API: `modelconverter.platforms.hailo.exporter`

Export of models to the Hailo `.hef` format.

Drives the `hailo_sdk_client` toolchain: the model is translated to the Hailo IR, optionally quantized using the configured
calibration images and finally compiled for the selected Hailo hardware architecture. Requires the Hailo Docker image, which
provides the SDK.

## Classes

| Name | Description |
| --- | --- |
| [`HailoExporter`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/platforms/hailo/exporter.md#exporter-Classes-HailoExporter) | Exporter producing models for Hailo devices. |

### class `HailoExporter`

```python
class HailoExporter(Exporter)
```

Exporter producing models for Hailo devices.

Translates the input model to the Hailo IR, calibrates it on the configured calibration images and compiles it into a `.hef`
binary. Calibration and compilation can be disabled individually, in which case an intermediate `.har` model is produced instead.

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/platforms/hailo/exporter.md#exporter-Classes-HailoExporter-__init__) | Initialize the exporter. |
| [`export`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/platforms/hailo/exporter.md#exporter-Classes-HailoExporter-export) | Translate, calibrate and compile the model. |
| [`exporter_buildinfo`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/platforms/hailo/exporter.md#exporter-Classes-HailoExporter-exporter_buildinfo) | Return Hailo-specific information about the conversion. |
| [`get_hn_layer_info`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/platforms/hailo/exporter.md#exporter-Classes-HailoExporter-get_hn_layer_info) | Find the HN layer that an original layer name maps to. |

#### method `__init__`

```python
def __init__(config: SingleStageConfig, output_dir: Path)
```

Initialize the exporter.

If TensorFlow reports no available GPU, the optimization and compression levels are lowered to `0`.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `config` | `SingleStageConfig` | Configuration of the model being converted. | required |
| `output_dir` | `Path` | Directory the exported model and the intermediate artifacts are written to. | required |

Raises

| Type | Description |
| --- | --- |
| `PreprocessingEmbeddingError` | If calibration is disabled and an input requests preprocessing. |

#### method `export`

```python
def export() -> Path
```

Translate, calibrate and compile the model.

Returns

| Type | Description |
| --- | --- |
| `Path` | Path to the compiled `.hef` model. If calibration is disabled, the path to the translated `.har` model is returned instead; if only compilation is disabled, the path to a copy of the quantized `.har` model is returned. |

#### method `exporter_buildinfo`

```python
def exporter_buildinfo() -> Params
```

Return Hailo-specific information about the conversion.

Returns

| Type | Description |
| --- | --- |
| `Params` | Dictionary with the version of the Hailo SDK, the optimization and compression levels and the model script (`alls`) used for calibration. |

#### static method `get_hn_layer_info`

```python
def get_hn_layer_info(runner: ClientRunner, name: str) -> tuple[str, list[int]]
```

Find the HN layer that an original layer name maps to.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `runner` | `ClientRunner` | Runner that holds the translated model. | required |
| `name` | `str` | Name of the layer in the source model. | required |

Returns

| Type | Description |
| --- | --- |
| `tuple[str, list[int]]` | The HN layer name and its input shape, with a batch size of 1. |

Raises

| Type | Description |
| --- | --- |
| `RuntimeError` | If no HN layer has `name` as an original name. |
