class documentation

Export datasets in Ultralytics NDJSON format.

Method __init__ Undocumented
Method export Convert the prepared dataset into the exporter's format.
Method get_split_names Undocumented
Method supported_ann_types Return task types supported by this exporter.
Instance Variable class_names Class names ordered by class ID.
Instance Variable class_to_id Class-name to class-ID mapping.
Instance Variable current_size Undocumented
Instance Variable dataset_type Source dataset type being exported.
Instance Variable keypoint_counts Set of keypoint counts observed while exporting.
Instance Variable ndjson_task Ultralytics task name, one of "detect", "segment", or "pose".
Static Method _bbox_from_keypoints Undocumented
Static Method _bbox_to_line Undocumented
Static Method _flatten_points Undocumented
Method _build_annotations Undocumented
Method _build_image_record Undocumented
Method _dataset_header Undocumented
Method _dump_annotations Undocumented
Method _get_data_path Return the folder path to store data files for this split.
Method _image_size Undocumented
Method _keypoints_to_line Undocumented
Method _maybe_roll_partition Undocumented
Method _segments_to_lines Undocumented
Instance Variable _image_size_cache Undocumented

Inherited from BaseExporter:

Instance Variable dataset_identifier Name or identifier used for exported paths.
Instance Variable image_indices Per-image export indices used by concrete exporters.
Instance Variable max_partition_size Optional maximum partition size in bytes.
Instance Variable max_partition_size_gb Optional maximum partition size in GiB.
Instance Variable output_path Directory where the export is written.
Instance Variable part Current partition index, or None when partitioning is disabled.
def __init__(self, dataset_identifier: str, output_path: Path, max_partition_size_gb: float | None, *, dataset_type: DatasetType, ndjson_task: UltralyticsTask):
def export(self, prepared_ldf: PreparedLDF):

Convert the prepared dataset into the exporter's format.

Parameters
prepared_ldf:PreparedLDFDataset data prepared for export.
Raises
NotImplementedErrorAlways raised by the abstract base implementation.
def get_split_names(self) -> dict[str, str]:

Undocumented

def supported_ann_types(self) -> list[str]:

Return task types supported by this exporter.

Returns
list[str]Supported annotation task types.
Raises
NotImplementedErrorAlways raised by the abstract base implementation.
class_names: list[str] =

Class names ordered by class ID.

class_to_id: dict[str, int] =

Class-name to class-ID mapping.

current_size: int =
dataset_type =

Source dataset type being exported.

keypoint_counts: set[int] =

Set of keypoint counts observed while exporting.

ndjson_task =

Ultralytics task name, one of "detect", "segment", or "pose".

@staticmethod
def _bbox_from_keypoints(keypoints: np.ndarray) -> dict[str, float] | None:

Undocumented

@staticmethod
def _bbox_to_line(class_id: int, bbox: dict[str, Any]) -> list[float | int]:

Undocumented

@staticmethod
def _flatten_points(points: list[tuple[float, float]]) -> list[float]:

Undocumented

def _build_annotations(self, instances: dict[tuple[str, int], dict[str, Any]], file_path: Path) -> dict[str, Any]:

Undocumented

def _build_image_record(self, file_path: Path, relative_file: Path, split: str, group_df: Any) -> dict[str, Any]:

Undocumented

def _dataset_header(self) -> dict[str, Any]:

Undocumented

def _dump_annotations(self, annotation_splits: dict[str, list[dict[str, Any]]], output_path: Path, part: int | None = None):
def _get_data_path(self, output_path: Path, split: str, part: int | None = None) -> Path:

Return the folder path to store data files for this split.

def _image_size(self, file_path: Path) -> tuple[int, int]:

Undocumented

def _keypoints_to_line(self, class_id: int, bbox: dict[str, Any] | None, annotation: dict[str, Any]) -> list[float | int] | None:

Undocumented

def _maybe_roll_partition(self, annotation_splits: dict[str, list[dict[str, Any]]], additional_size: int) -> dict[str, list[dict[str, Any]]]:

Undocumented

def _segments_to_lines(self, class_id: int, annotation: dict[str, Any], file_path: Path) -> list[list[float | int]]:

Undocumented

_image_size_cache: dict[Path, tuple[int, int]] =

Undocumented