otx.core.data.adapter.segmentation_dataset_adapter#

Segmentation Dataset Adapter.

Classes

SegmentationDatasetAdapter(task_type[, ...])

Segmentation adapter inherited from BaseDatasetAdapter.

SelfSLSegmentationDatasetAdapter(task_type)

Self-SL for segmentation adapter inherited from SegmentationDatasetAdapter.

class otx.core.data.adapter.segmentation_dataset_adapter.SegmentationDatasetAdapter(task_type: TaskType, train_data_roots: str | None = None, train_ann_files: str | None = None, val_data_roots: str | None = None, val_ann_files: str | None = None, test_data_roots: str | None = None, test_ann_files: str | None = None, unlabeled_data_roots: str | None = None, unlabeled_file_list: str | None = None, cache_config: Dict[str, Any] | None = None, encryption_key: str | None = None, **kwargs)[source]#

Bases: BaseDatasetAdapter

Segmentation adapter inherited from BaseDatasetAdapter.

It converts DatumaroDataset –> DatasetEntity for semantic segmentation task

get_otx_dataset() DatasetEntity[source]#

Convert DatumaroDataset to DatasetEntity for Segmentation.

set_common_labels()[source]#

Set labels for common_semantic_segmentation dataset.

set_voc_labels()[source]#

Set labels for common_semantic_segmentation dataset.

class otx.core.data.adapter.segmentation_dataset_adapter.SelfSLSegmentationDatasetAdapter(task_type: TaskType, train_data_roots: str | None = None, train_ann_files: str | None = None, val_data_roots: str | None = None, val_ann_files: str | None = None, test_data_roots: str | None = None, test_ann_files: str | None = None, unlabeled_data_roots: str | None = None, unlabeled_file_list: str | None = None, cache_config: Dict[str, Any] | None = None, encryption_key: str | None = None, **kwargs)[source]#

Bases: SegmentationDatasetAdapter

Self-SL for segmentation adapter inherited from SegmentationDatasetAdapter.

create_pseudo_masks(img: ndarray, pseudo_mask_path: str, mode: str = 'FH') None[source]#

Create pseudo masks for self-sl for semantic segmentation using DetCon.

Parameters:
  • img (np.ndarray) – A sample to create a pseudo mask.

  • pseudo_mask_path (Path) – The path to save a pseudo mask.

  • mode (str) – The mode to create a pseudo mask. Defaults to “FH”.

Returns:

a created pseudo mask for item.

Return type:

np.array