otx.core.data#
Module for data related objects, such as OTXDataset, OTXDataModule, and Transforms.
Classes
|
LightningDataModule extension for OTX pipeline. |
Factory class for OTXDataset. |
|
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, adaptive_input_size: Literal['auto', 'downscale'] | None = None, input_size_multiplier: int = 1)[source]#
Bases:
LightningDataModule
LightningDataModule extension for OTX pipeline.
- Parameters:
input_size (int | tuple[int, int] | None, optional) – Final image or video shape of data after data transformation. It’ll be applied to all subset configs If it’s not None. Defaults to None.
adaptive_input_size (Literal["auto", "downscale"] | None, optional) – The adaptive input size mode. If it’s set, appropriate input size is found by analyzing dataset. “auto” can find both bigger and smaller input size than current input size and “downscale” uses only smaller size than default setting. Defaults to None.
input_size_multiplier (int, optional) – adaptive_input_size will finds multiple of input_size_multiplier value if it’s set. It’s usefull when a model requries multiple of specific value as input_size. Defaults to 1.
Constructor.
- 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.
- 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.