# solo_parser

Python API: `luxonis_ml.data.parsers.solo_parser`

## Classes

### SOLOParser

Parse a directory with SOLO annotations into LDF.

Expected format:

```text
dataset_dir/
├── train/
│   ├── metadata.json
│   ├── sensor_definitions.json
│   ├── annotation_definitions.json
│   ├── metric_definitions.json
│   └── sequence.<SequenceNUM>/
│       ├── step<StepNUM>.camera.jpg
│       ├── step<StepNUM>.frame_data.json
│       └── (OPTIONAL: step<StepNUM>.camera.semantic segmentation.jpg)
├── valid/
└── test/
```

This is the default format returned by Unity simulation engine.

#### Methods

##### from_dir

```python
def from_dir(dataset_dir: Path) -> tuple[list[Path], list[Path], list[Path]]:
```

Parse all SOLO data in a source dataset directory.

Parameters

 * `dataset_dir` (`Path`): Source dataset directory.

Returns

 * `tuple[list[Path], list[Path], list[Path]]`: Added images for the train, validation, and test splits.

##### from_split

```python
def from_split(split_path: Path) -> ParserOutput:
```

Parse one SOLO split into LDF records.

Parameters

 * `split_path` (`Path`): Directory with SOLO sequences and annotations.

Returns

 * `ParserOutput`: Parser output containing annotation records, skeleton metadata, and added images.

Raises

 * `FileNotFoundError`: If the split directory, annotation definitions file, referenced image, or referenced mask does not exist.
 * `ValueError`: If no bounding-box class names can be identified from `annotation_definitions.json`.

##### validate_split

```python
def validate_split(split_path: Path) -> dict[str, Any] | None:
```

Validate whether a split directory has the expected SOLO format.

Parameters

 * `split_path` (`Path`): Path to a split directory.

Returns

 * `dict[str, Any] | None`: Keyword arguments for `from_split`, or `None` if the split is not in the expected format.
