class YOLOv8Parser(BaseParser):
Constructor: YOLOv8Parser(dataset, dataset_type, task_name, full_warnings)
Parse YOLOv8 and Ultralytics annotations into LDF.
Expected format:
dataset_dir/ ├── images/ │ ├── train/ │ │ ├── img1.jpg │ │ ├── img2.jpg │ │ └── ... │ ├── val/ │ └── test/ ├── labels/ │ ├── train/ │ │ ├── img1.txt │ │ ├── img2.txt │ │ └── ... │ ├── val/ │ └── test/ └── *.yaml OR:: dataset_dir/ ├── train/ │ ├── images/ │ │ ├── img1.jpg │ │ ├── img2.jpg │ │ └── ... │ ├── labels/ │ │ ├── img1.txt │ │ ├── img2.txt │ │ └── ... ├── valid/ │ ├── images/ │ │ ├── img1.txt │ │ ├── img2.txt │ │ └── ... │ ├── labels/ │ │ ├── img1.txt │ │ ├── img2.txt │ │ └── ... ├── test/ │ ├── images/ │ │ ├── img1.txt │ │ ├── img2.txt │ │ └── ... │ ├── labels/ │ │ ├── img1.txt │ │ ├── img2.txt │ │ └── ... └── *.yaml
*.yaml contains all class names.
This is one of the formats that Roboflow can generate.
| Class Method | discover |
Return present and valid split directories keyed by their canonical split names. |
| Class Method | validate |
Validate whether the dataset directory has the expected format. |
| Static Method | validate |
Validate whether a split directory has the expected format. |
| Method | fit |
Fit a bounding box around a polygon mask. |
| Method | from |
Parse all YOLOv8 splits in a source dataset directory. |
| Method | from |
Parse YOLOv8 or Ultralytics annotations into LDF records. |
| Static Method | _detect |
Detect whether a dataset uses Ultralytics or Roboflow layout. |
Inherited from BaseParser:
| Method | __init__ |
Create a parser for a target dataset. |
| Method | get |
Return parser issue messages collected during the last parse. |
| Method | parse |
Parse an entire dataset directory into the target dataset. |
| Method | parse |
Parse one split subdirectory into the target dataset. |
| Method | reset |
Clear collected parser issue messages. |
| Static Method | _apply |
Distribute images across splits based on requested counts. |
| Static Method | _apply |
Apply count-based split requests to existing splits. |
| Static Method | _canonicalize |
All current parsers use train and test split names whereas validation splits can vary in name between val valid and validation. |
| Static Method | _compare |
Compare sets of files by stem. |
| Static Method | _get |
Return unique images yielded by a dataset generator. |
| Static Method | _list |
List OpenCV-supported images in a directory. |
| Static Method | _sample |
Sample from each original split independently. |
| Method | _get |
Return parser issue messages collected during the last parse. |
| Method | _log |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Parse data in one split subdirectory. |
| Method | _remove |
Remove records that are not assigned to any split. |
| Method | _reset |
Clear collected parser issue messages and warning counters. |
| Method | _warn |
Undocumented |
| Method | _wrap |
Add configured task names to generated records. |
| Constant | _CANONICAL |
Undocumented |
| Constant | _SKIPPED |
Undocumented |
| Constant | _SPLIT |
Undocumented |
| Instance Variable | _dataset |
Undocumented |
| Instance Variable | _dataset |
Undocumented |
| Instance Variable | _full |
Undocumented |
| Instance Variable | _logged |
Undocumented |
| Instance Variable | _parser |
Undocumented |
| Instance Variable | _seen |
Undocumented |
| Instance Variable | _skipped |
Undocumented |
| Instance Variable | _suppressed |
Undocumented |
| Instance Variable | _task |
Undocumented |
@override
Path) -> dict[ str, dict[ str, Any]]:
¶
Return present and valid split directories keyed by their canonical split names.
Validate whether the dataset directory has the expected format.
| Parameters | |
datasetPath | Source dataset directory. |
| Returns | |
bool | Whether the dataset is in the expected format. |
Validate whether a split directory has the expected format.
| Parameters | |
splitPath | Path to a split directory. |
| Returns | |
dict[ | Keyword arguments for from_split, or None if the split is not in the expected format. |
Parse all YOLOv8 splits in a source dataset directory.
| Parameters | |
datasetPath | Source dataset directory containing split folders and one class YAML file. |
| Returns | |
tuple[ | Added images for the train, validation, and test splits. |
| Raises | |
ValueError | If the dataset directory does not contain a class YAML file. |
Parse YOLOv8 or Ultralytics annotations into LDF records.
Annotations include object detection, instance segmentation and keypoints.
| Parameters | |
imagePath | Directory with images. |
annotationPath | Directory with annotations. |
classesPath | YAML file with class names. |
| Returns | |
ParserOutput | Parser output containing annotation records, skeleton metadata, and added images. |
Path) -> tuple[ Format | None, list[ str]]:
¶
Detect whether a dataset uses Ultralytics or Roboflow layout.