# solo_parser

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

## 类

### SOLOParser

将带有 SOLO 注释的目录解析为 LDF。

预期格式：

```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
│       └── (可选: step<StepNUM>.camera.semantic segmentation.jpg)
├── valid/
└── test/
```

这是 Unity 模拟引擎返回的默认格式。

#### 方法

##### from_dir

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

解析源数据集目录中的所有 SOLO 数据。

参数

 * `dataset_dir` (`Path`): 源数据集目录。

返回

 * `tuple[list[Path], list[Path], list[Path]]`: 训练、验证和测试拆分中添加的图像。

##### from_split

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

将一个 SOLO 拆分解析为 LDF 记录。

参数

 * `split_path` (`Path`): 包含 SOLO 序列和注释的目录。

返回

 * `ParserOutput`: 包含注释记录、骨架元数据和添加图像的解析器输出。

引发

 * `FileNotFoundError`: 如果拆分目录、注释定义文件、引用的图像或引用的掩码不存在。
 * `ValueError`: 如果无法从 `annotation_definitions.json` 识别边界框类名。

##### validate_split

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

验证拆分目录是否具有预期的 SOLO 格式。

参数

 * `split_path` (`Path`): 拆分目录的路径。

返回

 * `dict[str, Any] | None`: `from_split` 的关键字参数，如果拆分不是预期格式，则为 `None`。
