iter_splits#
- Dataset.iter_splits() Iterator[tuple[str | None, Self]][source]#
Iterate though split values of the dataset, by yielding for each split the split name and the corresponding sub-dataset.
If no split is available, the split value is assumed to be
Nonefor the whole dataset.- Yields:
tuple containing – - the name of the split - the corresponding subset of the original dataset
See also
:meth`get_split`
Example
>>> from lours.utils.doc_utils import dummy_dataset >>> example = dummy_dataset(2, 2, seed=2) >>> example Dataset object containing 2 images and 2 objects Name : argue_be_structure Images root : what/way Images : width height relative_path type split id 0 368 832 police/enter.jpeg .jpeg train 1 472 506 also/policy.gif .gif train Annotations : image_id category_str category_id ... box_y_min box_width box_height id ... 0 0 table 7 ... 228.774514 137.766169 131.174304 1 0 relationship 3 ... 546.984268 34.928954 9.871084 [2 rows x 8 columns] Label map : {3: 'relationship', 7: 'table', 25: 'simply'} >>> for split_name, split in example.iter_splits(): ... print(f"Split: {split_name}") ... print(split) ... Split: train Dataset object containing 2 images and 2 objects Name : argue_be_structure Images root : what/way Images : width height relative_path type split id 0 368 832 police/enter.jpeg .jpeg train 1 472 506 also/policy.gif .gif train Annotations : image_id category_str category_id ... box_y_min box_width box_height id ... 0 0 table 7 ... 228.774514 137.766169 131.174304 1 0 relationship 3 ... 546.984268 34.928954 9.871084 [2 rows x 8 columns] Label map : {3: 'relationship', 7: 'table', 25: 'simply'}