# 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

### HailoExporter

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

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

Parameters

 * `config` (`SingleStageConfig`): Configuration of the model being converted.
 * `output_dir` (`Path`): Directory the exported model and the intermediate artifacts are written to.

##### export

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

Translate, calibrate and compile the model.

Returns

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

##### exporter_buildinfo

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

Return Hailo-specific information about the conversion.

Returns

 * `Params`: Dictionary with the version of the Hailo SDK, the optimization and compression levels and the model script (`alls`)
   used for calibration.
