YAMLDataset
YAMLDataset loads Ultralytics/YOLO-style datasets described by a data.yaml file. It exposes train, val, and optional test splits and supports classification, object detection, and instance/semantic segmentation depending on label format.
Label files are parsed in two modes:
- Bounding box —
<class_id> <x_center> <y_center> <width> <height>(normalized). Suitable for classification and detection. - Polygon mask —
<class_id> <x1> <y1> ... <xn> <yn>. For segmentation returns a mask; for detection builds a bounding box from min/max coordinates.
from hyppopipe.data.dataset import YAMLDataset
ds = YAMLDataset("datasets/my_task/data.yaml")
split_data = ds.as_split_data()
train_cls = split_data.train.as_classification_dataset()
Like folder-based datasets, YAMLDataset supports absorb_folders (ignore pre-defined splits) and strict (validate file extensions and MIME types at load time).
Documentation¶
Ultralytics/YOLOv5 YAML facade with lazy per-task split materialization.
Parses data.yaml, exposes train, val, and optional test as
YAMLSplitResource objects, and provides as_split_data for training
pipelines.
Examples:
Load splits and build a classification training set::
ds = YAMLDataset("datasets/my_task/data.yaml")
split_data = ds.as_split_data()
train_set = split_data.train.as_classification_dataset()
__init__(path_to_yaml, *, absorb_folders=False, detection_layout='auto', strict=True)
¶
Load dataset YAML and prepare split resources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_to_yaml
|
str | Path
|
Path to the dataset YAML file. |
required |
absorb_folders
|
bool
|
Allow nested top folders in classification layout. |
False
|
detection_layout
|
str
|
|
'auto'
|
strict
|
bool
|
Passed when loading classification images. |
True
|
as_split_data()
¶
Return train/val (and optional test) resources for Trainer.
Returns:
| Type | Description |
|---|---|
TrainVal | TrainValTest
|
|