# types

Python API: `hubai_sdk.utils.types`

Enums used by model metadata and conversion configuration.

Service APIs generally accept these enums directly. Their `value` is the spelling sent to HubAI, while `name` is used by a few
list filters. Use [Target](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md)
to choose conversion hardware and
[ModelType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) to describe an
existing artifact.

## Classes

| Name | Description |
| --- | --- |
| [`DataType`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) | Tensor
element type shared by supported model formats. |
| [`Encoding`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) | Channel
ordering for image tensors and preprocessing. |
| [`InputFileType`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Supported source model container or framework format. |
| [`ModelType`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) | Artifact
type stored by a HubAI model instance. |
| [`PotDevice`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) | Target
device used by OpenVINO Post-training Optimization Tool. |
| [`ResizeMethod`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Strategy for adapting image dimensions to a model input. |
| [`Target`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) | Hardware
family accepted by hosted conversion. |

### class `DataType`

```python
class DataType(Enum)
```

Tensor element type shared by supported model formats.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `BOOLEAN` | `str` |  |
| `FLOAT16` | `str` |  |
| `FLOAT32` | `str` |  |
| `FLOAT64` | `str` |  |
| `FXP16` | `str` |  |
| `FXP32` | `str` |  |
| `FXP64` | `str` |  |
| `FXP8` | `str` |  |
| `INT16` | `str` |  |
| `INT32` | `str` |  |
| `INT4` | `str` |  |
| `INT64` | `str` |  |
| `INT8` | `str` |  |
| `STRING` | `str` |  |
| `UFXP16` | `str` |  |
| `UFXP32` | `str` |  |
| `UFXP64` | `str` |  |
| `UFXP8` | `str` |  |
| `UINT16` | `str` |  |
| `UINT32` | `str` |  |
| `UINT64` | `str` |  |
| `UINT8` | `str` |  |

Methods

| Name | Description |
| --- | --- |
| [`as_nn_archive_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Convert this data type to the NN Archive dtype spelling. |
| [`as_numpy_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Convert this data type to the corresponding NumPy dtype. |
| [`as_openvino_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Convert this data type to the corresponding OpenVINO dtype. |
| [`as_snpe_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Convert this data type to the corresponding SNPE dtype. |
| [`from_dlc_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
SNPE DLC dtype name. |
| [`from_ir_ie_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
OpenVINO IR dtype string. |
| [`from_ir_runtime_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md)
| Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from
an OpenVINO runtime dtype string. |
| [`from_numpy_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from a
NumPy dtype. |
| [`from_onnx_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) |
Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
ONNX tensor dtype value. |
| [`from_tensorflow_dtype`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md)
| Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from a
TFLite tensor dtype value. |

#### method `as_nn_archive_dtype`

```python
def as_nn_archive_dtype() -> str
```

Convert this data type to the NN Archive dtype spelling.

#### method `as_numpy_dtype`

```python
def as_numpy_dtype() -> np.dtype
```

Convert this data type to the corresponding NumPy dtype.

#### method `as_openvino_dtype`

```python
def as_openvino_dtype() -> str
```

Convert this data type to the corresponding OpenVINO dtype.

#### method `as_snpe_dtype`

```python
def as_snpe_dtype() -> str
```

Convert this data type to the corresponding SNPE dtype.

#### class method `from_dlc_dtype`

```python
def from_dlc_dtype(dtype: str) -> DataType
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
SNPE DLC dtype name.

#### class method `from_ir_ie_dtype`

```python
def from_ir_ie_dtype(dtype: str) -> DataType
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
OpenVINO IR dtype string.

#### class method `from_ir_runtime_dtype`

```python
def from_ir_runtime_dtype(dtype: str) -> DataType
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
OpenVINO runtime dtype string.

#### class method `from_numpy_dtype`

```python
def from_numpy_dtype(dtype: np.dtype) -> DataType
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from a
NumPy dtype.

#### class method `from_onnx_dtype`

```python
def from_onnx_dtype(dtype: int) -> DataType
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
ONNX tensor dtype value.

#### class method `from_tensorflow_dtype`

```python
def from_tensorflow_dtype(dtype: int) -> DataType
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from a
TFLite tensor dtype value.

### class `Encoding`

```python
class Encoding(Enum)
```

Channel ordering for image tensors and preprocessing.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `BGR` | `str` |  |
| `GRAY` | `str` |  |
| `NONE` | `str` |  |
| `RGB` | `str` |  |

### class `InputFileType`

```python
class InputFileType(Enum)
```

Supported source model container or framework format.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `DLC` | `str` |  |
| `HAR` | `str` |  |
| `IR` | `str` |  |
| `ONNX` | `str` |  |
| `PYTORCH` | `str` |  |
| `TFLITE` | `str` |  |

Methods

| Name | Description |
| --- | --- |
| [`from_path`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) | Infer the
input file type from a model path suffix. |

#### class method `from_path`

```python
def from_path(path: str | Path) -> InputFileType
```

Infer the input file type from a model path suffix.

### class `ModelType`

```python
class ModelType(str, Enum)
```

Artifact type stored by a HubAI model instance.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `HAILO` | `str` |  |
| `IR` | `str` |  |
| `ONNX` | `str` |  |
| `PYTORCH` | `str` |  |
| `RVC2` | `str` |  |
| `RVC3` | `str` |  |
| `RVC4` | `str` |  |
| `TFLITE` | `str` |  |

Methods

| Name | Description |
| --- | --- |
| [`from_suffix`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) | Infer a
model type from a file suffix. |

#### class method `from_suffix`

```python
def from_suffix(suffix: str) -> ModelType
```

Infer a model type from a file suffix.

### class `PotDevice`

```python
class PotDevice(Enum)
```

Target device used by OpenVINO Post-training Optimization Tool.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `ANY` | `str` |  |
| `VPU` | `str` |  |

### class `ResizeMethod`

```python
class ResizeMethod(Enum)
```

Strategy for adapting image dimensions to a model input.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `CROP` | `str` |  |
| `PAD` | `str` |  |
| `RESIZE` | `str` |  |

### class `Target`

```python
class Target(Enum)
```

Hardware family accepted by hosted conversion.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `HAILO` | `str` |  |
| `RVC2` | `str` |  |
| `RVC3` | `str` |  |
| `RVC4` | `str` |  |
