otx.data.dataset#

Module defines OTXDatasets.

Classes

OTXAnomalyDataset(task_type, dm_subset, ...)

OTXDataset class for anomaly classification task.

OTXMulticlassClsDataset(dm_subset, transforms)

OTXDataset class for multi-class classification task.

OTXHlabelClsDataset(**kwargs)

OTXDataset class for H-label classification task.

OTXMultilabelClsDataset(**kwargs)

OTXDataset class for multi-label classification task.

OTXDetectionDataset(dm_subset, transforms[, ...])

OTXDataset class for detection task.

OTXInstanceSegDataset(dm_subset, transforms, ...)

OTXDataset class for instance segmentation.

OTXKeypointDetectionDataset(dm_subset, ...)

OTXDataset class for keypoint detection task.

OTXSegmentationDataset(dm_subset, transforms)

OTXDataset class for segmentation task.

OTXTileDatasetFactory()

OTX tile dataset factory.

class otx.data.dataset.OTXAnomalyDataset(task_type: OTXTaskType, dm_subset: Dataset, transforms: Compose | Callable | List[Callable] | dict[str, Compose | Callable | List[Callable]], max_refetch: int = 1000, image_color_channel: ImageColorChannel = ImageColorChannel.RGB, stack_images: bool = True, to_tv_image: bool = True, data_format: str = '')[source]#

Bases: OTXDataset

OTXDataset class for anomaly classification task.

class otx.data.dataset.OTXDetectionDataset(dm_subset: DatasetSubset, transforms: Transforms, max_refetch: int = 1000, image_color_channel: ImageColorChannel = ImageColorChannel.RGB, stack_images: bool = True, to_tv_image: bool = True, data_format: str = '')[source]#

Bases: OTXDataset, DataAugSwitchMixin

OTXDataset class for detection task.

class otx.data.dataset.OTXHlabelClsDataset(**kwargs)[source]#

Bases: OTXDataset

OTXDataset class for H-label classification task.

class otx.data.dataset.OTXInstanceSegDataset(dm_subset: Dataset, transforms: Compose | Callable | List[Callable] | dict[str, Compose | Callable | List[Callable]], include_polygons: bool, **kwargs)[source]#

Bases: OTXDataset

OTXDataset class for instance segmentation.

Parameters:
  • dm_subset (DmDataset) – The subset of the dataset.

  • transforms (Transforms) – Data transformations to be applied.

  • include_polygons (bool) – Flag indicating whether to include polygons in the dataset. If set to False, polygons will be converted to bitmaps, and bitmaps will be used for training.

  • **kwargs – Additional keyword arguments passed to the base class.

class otx.data.dataset.OTXKeypointDetectionDataset(dm_subset: DatasetSubset, transforms: Compose | Callable | List[Callable] | dict[str, Compose | Callable | List[Callable]], max_refetch: int = 1000, image_color_channel: ImageColorChannel = ImageColorChannel.RGB, stack_images: bool = True, to_tv_image: bool = True, data_format: str = '')[source]#

Bases: OTXDataset

OTXDataset class for keypoint detection task.

class otx.data.dataset.OTXMulticlassClsDataset(dm_subset: DatasetSubset, transforms: Transforms, max_refetch: int = 1000, image_color_channel: ImageColorChannel = ImageColorChannel.RGB, stack_images: bool = True, to_tv_image: bool = True, data_format: str = '')[source]#

Bases: OTXDataset

OTXDataset class for multi-class classification task.

property collate_fn: Callable#

Collection function to collect MulticlassClsDataEntity into MulticlassClsBatchDataEntity in data loader.

class otx.data.dataset.OTXMultilabelClsDataset(**kwargs)[source]#

Bases: OTXDataset

OTXDataset class for multi-label classification task.

class otx.data.dataset.OTXSegmentationDataset(dm_subset: DmDataset, transforms: Transforms, max_refetch: int = 1000, image_color_channel: ImageColorChannel = ImageColorChannel.RGB, to_tv_image: bool = True, ignore_index: int = 255, data_format: str = '')[source]#

Bases: OTXDataset

OTXDataset class for segmentation task.

property has_polygons: bool#

Check if the dataset has polygons in annotations.

class otx.data.dataset.OTXTileDatasetFactory[source]#

Bases: object

OTX tile dataset factory.

classmethod create(task: OTXTaskType, dataset: OTXDataset, tile_config: TileConfig) OTXTileDataset[source]#

Create a tile dataset based on the task type and subset type.

NOte: All task utilize the same OTXTileTrainDataset for training.

In testing, we use different tile dataset for different task type due to different annotation format and data entity.

Parameters:
  • task (OTXTaskType) – OTX task type.

  • dataset (OTXDataset) – OTX dataset.

  • tile_config (TilerConfig) – Tile configuration.

Returns:

Tile dataset.

Return type:

OTXTileDataset