class UltralyticsNDJSONParser(BaseParser):
Constructor: UltralyticsNDJSONParser(dataset, dataset_type, task_name, full_warnings)
Parse Ultralytics NDJSON datasets into LDF.
NDJSON records may carry their own split names. When no split is present on an image record, the image is assigned to "train". "valid" and "validation" are normalized to "val".
| 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 | from |
Parse an Ultralytics NDJSON file into dataset records. |
| Method | from |
Parse a single Ultralytics NDJSON file. |
| Method | parse |
Parse a full NDJSON dataset and preserve record-level splits. |
| Method | parse |
Parse an NDJSON file that represents a single parser input. |
| Class Method | _download |
Undocumented |
| Class Method | _load |
Undocumented |
| Class Method | _resolve |
Undocumented |
| Static Method | _fit |
Undocumented |
| Static Method | _get |
Undocumented |
| Static Method | _normalize |
Undocumented |
| Static Method | _resolve |
Undocumented |
| Method | _build |
Undocumented |
| Class Variable | _remote |
Undocumented |
Inherited from BaseParser:
| Class Method | discover |
Return present and valid split directories keyed by their canonical split names. |
| Method | __init__ |
Create a parser for a target dataset. |
| Method | get |
Return parser issue messages collected during the last parse. |
| 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 |
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. |
Path, reuse_cached: bool = True, **kwargs) -> tuple[ list[ Path], list[ Path], list[ Path]]:
¶
Parse an Ultralytics NDJSON file into dataset records.
| Parameters | |
datasetPath | Directory containing exactly one .ndjson file, or a direct path to an .ndjson file. |
reusebool | Whether to reuse cached remote images if they already exist. |
| **kwargs | Parser-specific arguments. |
| Returns | |
tuple[ | Added images for the train, validation, and test splits. |
| Raises | |
ValueError | If no NDJSON dataset file can be resolved, the resolved file has an invalid header, a remote image download directory already exists, or pose annotations cannot infer keypoint dimensionality. |
Parse a single Ultralytics NDJSON file.
| Parameters | |
ndjsonPath | Path to an Ultralytics NDJSON file. |
reusebool | Whether to reuse cached remote images if they already exist. |
| Returns | |
ParserOutput | Parser output containing annotation records, empty skeleton metadata, and added images. |
| Raises | |
ValueError | If the file has an invalid header, a remote image download directory already exists, or pose annotations cannot infer keypoint dimensionality. |
Parse a full NDJSON dataset and preserve record-level splits.
| Parameters | |
datasetPath | Directory containing exactly one .ndjson file, or a direct path to an .ndjson file. |
reusebool | Whether to reuse cached remote images if they already exist. |
| **kwargs | Parser-specific arguments. split_ratios may be supplied to resample split assignments. |
| Returns | |
BaseDataset | Dataset with parsed images and annotations. |
| Raises | |
ValueError | If the NDJSON file cannot be resolved or parsed as a valid Ultralytics dataset. |
str | None = None, random_split: bool = True, split_ratios: dict[ str, float | int] | None = None, reuse_cached: bool = True, **kwargs) -> BaseDataset:
¶
Parse an NDJSON file that represents a single parser input.
| Parameters | |
split:str | None | Optional split name to assign to all parsed images. |
randombool | Whether percentage split_ratios should resample all images. |
splitdict[ | Optional ratios or counts. Float values are treated as ratios; integer values are treated as counts. |
reusebool | Whether to reuse cached remote images if they already exist. |
| **kwargs | Parser-specific arguments. Must include ndjson_path. |
| Returns | |
BaseDataset | Dataset with parsed images and annotations. |
| Raises | |
ValueError | If ndjson_path is missing, the file has an invalid header, a remote image download directory already exists, or pose annotations cannot infer keypoint dimensionality. |
Path, record: dict[ str, Any], *, remote_image_dir: Path) -> Path:
¶
Undocumented
Path, reuse_cached: bool = True) -> tuple[ DatasetIterator, dict[ str, list[ Path]], list[ Path]]:
¶
Undocumented