# native_exporter

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

## Classes

| Name | Description |
| --- | --- |
|
[`NativeExporter`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/native_exporter.md)
| Exporter for native LDF directory format. |

### class `NativeExporter`

```python
class NativeExporter(BaseExporter)
```

Exporter for native LDF directory format.

Native export writes split directories with copied media and an `annotations.json` file. Each annotation entry follows the same
record-level shape accepted by
[NativeParser](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/parsers/native_parser.md)
and
[LuxonisDataset.add](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/datasets/luxonis_dataset.md).

`sample_metadata` is exported as a JSON object next to `file` or `files`. It is record-level metadata, not an annotation label.

The export root also holds a `metadata.json` version stamp, such as `{"ldf_version": "2.1.0"}`. It is not the full
[Metadata](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/datasets/metadata.md)
model a dataset keeps in its own storage.

Passing an older `ldf_version` strips the fields that version does not know -- exporting LDF 2.0 omits `sample_metadata`. See
[LDFDowngrader](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/ldf_downgrade.md).

> **Example**
> ```json
{
  "file": "images/0.jpg",
  "task_name": "detection",

  "sample_metadata": {
    "record_id": 123,
    "camera": "left",
    "tags": ["night", "warehouse"]
  },

  "annotation": {
    "instance_id": 0,
    "class": "person",
    "boundingbox": {
      "x": 0.1,
      "y": 0.2,
      "w": 0.3,
      "h": 0.4
    }
  }
}
```

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `current_size` | `int` |  |
| `ldf_version` |  |  |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/native_exporter.md) |  |
| [`export`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/native_exporter.md) | Convert the prepared dataset into the exporter's format. |
| [`get_split_names`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/native_exporter.md) |  |
| [`supported_ann_types`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/data/exporters/native_exporter.md) | Return task types supported by this exporter. |

#### method `__init__`

```python
def __init__(
    dataset_identifier: str,
    output_path: Path,
    max_partition_size_gb: float | None,
    *,
    ldf_version: Version | None = None,
)
```

#### method `export`

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

Convert the prepared dataset into the exporter's format.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `prepared_ldf` | `PreparedLDF` | Dataset data prepared for export. | required |

Raises

| Type | Description |
| --- | --- |
| `NotImplementedError` | Always raised by the abstract base implementation. |

#### static method `get_split_names`

```python
def get_split_names() -> dict[str, str]
```

#### method `supported_ann_types`

```python
def supported_ann_types() -> list[str]
```

Return task types supported by this exporter.

Returns

| Type | Description |
| --- | --- |
| `list[str]` | Supported annotation task types. |

Raises

| Type | Description |
| --- | --- |
| `NotImplementedError` | Always raised by the abstract base implementation. |
