# exporter_utils

Python API: `luxonis_ml.data.exporters.exporter_utils`

## Classes

| Name | Description |
| --- | --- |
|
[`ExporterSpec`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| Exporter class and constructor arguments. |
|
[`PreparedLDF`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| Lightweight container for LDF data ready for export. |

### class `ExporterSpec`

```python
class ExporterSpec
```

Exporter class and constructor arguments.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `cls` | `type[BaseExporter]` | Exporter class to instantiate. |
| `kwargs` | `dict` | Keyword arguments passed to the exporter constructor. |

### class `PreparedLDF`

```python
class PreparedLDF
```

Lightweight container for LDF data ready for export.

Attributes

| Name | Description |
| --- | --- |
| `grouped_image_sources` | Unique mapping of group IDs, source names, and file paths. |
| `processed_df` | Annotation dataframe with paths resolved to readable files. |
| `splits` | Split names mapped to group IDs. |

Methods

| Name | Description |
| --- | --- |
|
[`__init__`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| |
|
[`from_dataset`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| Prepare a dataset for export into the LDF representation. |

#### method `__init__`

```python
def __init__(
    splits: dict[str, Any],
    processed_df: pl.DataFrame,
    grouped_image_sources: pl.DataFrame,
)
```

#### class method `from_dataset`

```python
def from_dataset(dataset: LuxonisDataset) -> PreparedLDF
```

Prepare a dataset for export into the LDF representation.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `dataset` | `LuxonisDataset` | Dataset to prepare. | required |

Returns

| Type | Description |
| --- | --- |
| `PreparedLDF` | Prepared LDF container. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If the dataset has no splits. |
| `FileNotFoundError` | If an image path cannot be resolved from either its original location or the dataset media directory. |

## Functions

| Name | Description |
| --- | --- |
|
[`annotation_to_polygons`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| |
|
[`check_group_file_correspondence`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| |
|
[`create_zip_output`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| |
|
[`decode_rle_with_pycoco`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| |
|
[`exporter_specific_annotation_warning`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| |
|
[`get_single_skeleton`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| Return labels and COCO-style edges for the single skeleton. |
|
[`split_of_group`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/exporter_utils.md)
| |

### function `annotation_to_polygons`

```python
def annotation_to_polygons(
    ann: dict[str, Any],
    file_path: Path,
) -> list[list[tuple[float, float]]]
```

### function `check_group_file_correspondence`

```python
def check_group_file_correspondence(prepared_ldf: PreparedLDF)
```

### function `create_zip_output`

```python
def create_zip_output(
    max_partition_size: float | None,
    output_path: Path,
    part: int | None,
    dataset_identifier: str,
) -> Path | list[Path]
```

### function `decode_rle_with_pycoco`

```python
def decode_rle_with_pycoco(ann: dict[str, Any]) -> np.ndarray
```

### function `exporter_specific_annotation_warning`

```python
def exporter_specific_annotation_warning(
    prepared_ldf: PreparedLDF,
    supported_ann_types: list[str],
)
```

### function `get_single_skeleton`

```python
def get_single_skeleton(
    allow_keypoints: bool,
    skeletons: dict[str, Any] | None = None,
) -> tuple[list[str], list[list[int]]]
```

Return labels and COCO-style edges for the single skeleton.

Edges are converted to 1-based indices per COCO spec.

### function `split_of_group`

```python
def split_of_group(prepared_ldf: PreparedLDF, group_id: Any) -> str
```
