otx.core.data#

Module for data related objects, such as OTXDataset, OTXDataModule, and Transforms.

Classes

OTXDataModule(task, data_format, data_root, ...)

LightningDataModule extension for OTX pipeline.

OTXDatasetFactory()

Factory class for OTXDataset.

TransformLibFactory()

Factory class for transform.

class otx.core.data.OTXDataModule(task: OTXTaskType, data_format: str, data_root: str, train_subset: SubsetConfig, val_subset: SubsetConfig, test_subset: SubsetConfig, unlabeled_subset: UnlabeledDataConfig = UnlabeledDataConfig(batch_size=0, subset_name='unlabeled', transforms={}, transform_lib_type=<TransformLibType.TORCHVISION: 'TORCHVISION'>, num_workers=2, sampler=SamplerConfig(class_path='torch.utils.data.RandomSampler', init_args={}), to_tv_image=True, input_size=None, data_root=None, data_format='image_dir'), tile_config: TileConfig = TileConfig(enable_tiler=False, enable_adaptive_tiling=True, tile_size=(400, 400), overlap=0.2, iou_threshold=0.45, max_num_instances=1500, object_tile_ratio=0.03, sampling_ratio=1.0, with_full_img=False), vpm_config: VisualPromptingConfig = VisualPromptingConfig(use_bbox=False, use_point=False), mem_cache_size: str = '1GB', mem_cache_img_max_size: tuple[int, int] | None = None, image_color_channel: ImageColorChannel = ImageColorChannel.RGB, stack_images: bool = True, include_polygons: bool = False, ignore_index: int = 255, unannotated_items_ratio: float = 0.0, auto_num_workers: bool = False, device: DeviceType = DeviceType.auto, input_size: int | tuple[int, int] | None = None)[source]#

Bases: LightningDataModule

LightningDataModule extension for OTX pipeline.

Constructor.

predict_dataloader() DataLoader[source]#

Get test dataloader.

setup(stage: str) None[source]#

Setup for each stage.

teardown(stage: str) None[source]#

Teardown for each stage.

test_dataloader() DataLoader[source]#

Get test dataloader.

train_dataloader() Iterable[source]#

Get train dataloader.

unlabeled_dataloader() dict[str, DataLoader] | None[source]#

Returns a dictionary of unlabeled dataloaders.

The method creates and returns dataloaders for unlabeled datasets based on the configuration settings. If the data root is not specified in the configuration, it returns None.

Returns:

A dictionary containing unlabeled dataloaders, where the keys are the names of the datasets and the values are the corresponding DataLoader objects.

Return type:

dict[str, DataLoader] | None

val_dataloader() DataLoader[source]#

Get val dataloader.

property hparams_initial: AttributeDict#

The collection of hyperparameters saved with save_hyperparameters(). It is read-only.

The reason why we override is that we have some custom resolvers for DictConfig. Some resolved Python objects has not a primitive type, so that is not loggable without errors. Therefore, we need to unresolve it this time.

class otx.core.data.OTXDatasetFactory[source]#

Bases: object

Factory class for OTXDataset.

classmethod create(task: OTXTaskType, dm_subset: DmDataset, cfg_subset: SubsetConfig, mem_cache_handler: MemCacheHandlerBase, mem_cache_img_max_size: tuple[int, int] | None = None, image_color_channel: ImageColorChannel = ImageColorChannel.RGB, stack_images: bool = True, include_polygons: bool = False, ignore_index: int = 255, vpm_config: VisualPromptingConfig = VisualPromptingConfig(use_bbox=False, use_point=False)) OTXDataset[source]#

Create OTXDataset.

class otx.core.data.TransformLibFactory[source]#

Bases: object

Factory class for transform.

classmethod generate(config: SubsetConfig) Transforms[source]#

Create transforms from factory.