COCOJATICObjectDetectionDataset

class nrtk.interop.maite.interop.object_detection.dataset.COCOJATICObjectDetectionDataset(kwcoco_dataset: CocoDataset, image_metadata: Sequence[DatumMetadata], skip_no_anns: bool = False, dataset_id: str | None = None)

Dataset class to convert a COCO dataset to a dataset compliant with JATIC’s Object Detection protocol.

Parameters

metadata: DatasetMetadata

Metadata of this dataset.

Methods

get_categories

Returns the list of categories for this dataset.

get_img_path_list

Returns the sorted list of absolute paths for the input images.

is_usable

Checks if the required kwcoco and MAITE modules are available.

__getitem__(index: int) tuple[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], ObjectDetectionTarget, COCOMetadata]

Returns the dataset object at the given index.

__init__(kwcoco_dataset: CocoDataset, image_metadata: Sequence[DatumMetadata], skip_no_anns: bool = False, dataset_id: str | None = None) None

Initialize MAITE-compliant dataset from a COCO dataset.

Args:

kwcoco_dataset (kwcoco.CocoDataset): The COCO dataset object. image_metadata (Sequence[DatumMetadataType]): Metadata for each image. skip_no_anns (bool): Whether to skip images without annotations. Defaults to False. dataset_id (str): Dataset ID, defaults to filepath.

Raises:

ImportError: If required dependencies are not installed. ValueError: If metadata is missing for any image in the dataset.

__len__() int

Returns the number of images in the dataset.

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

get_categories() list[dict[str, Any]]

Returns the list of categories for this dataset.

get_img_path_list() list[Path]

Returns the sorted list of absolute paths for the input images.

classmethod is_usable() bool

Checks if the required kwcoco and MAITE modules are available.

Returns:

bool: True if kwcoco and MAITE are installed; False otherwise.