otx.core.config.data#

Config data type objects for data.

Classes

DataModuleConfig(data_format, data_root, ...)

DTO for data module configuration.

SamplerConfig(class_path, init_args, ...)

Configuration class for defining the sampler used in the data loading process.

SubsetConfig(batch_size, subset_name, ...)

DTO for dataset subset configuration.

TileConfig([enable_tiler, ...])

DTO for tiler configuration.

VisualPromptingConfig([use_bbox, use_point])

DTO for visual prompting data module configuration.

class otx.core.config.data.DataModuleConfig(data_format: str, data_root: str, train_subset: ~otx.core.config.data.SubsetConfig, val_subset: ~otx.core.config.data.SubsetConfig, test_subset: ~otx.core.config.data.SubsetConfig, tile_config: ~otx.core.config.data.TileConfig = <factory>, vpm_config: ~otx.core.config.data.VisualPromptingConfig = <factory>, mem_cache_size: str = '1GB', mem_cache_img_max_size: tuple[int, int] | None = None, image_color_channel: ~otx.core.types.image.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: ~otx.core.types.device.DeviceType = DeviceType.auto)[source]#

Bases: object

DTO for data module configuration.

class otx.core.config.data.SamplerConfig(class_path: str = 'torch.utils.data.RandomSampler', init_args: dict[str, ~typing.Any] = <factory>)[source]#

Bases: object

Configuration class for defining the sampler used in the data loading process.

This is passed in the form of a dataclass, which is instantiated when the dataloader is created.

[TODO]: Need to replace this with a proper Sampler class. Currently, SamplerConfig, which belongs to the sampler of SubsetConfig, belongs to the nested dataclass of dataclass, which is not easy to instantiate from the CLI. So currently replace sampler with a corresponding dataclass that resembles the configuration of another object, providing limited functionality.

class otx.core.config.data.SubsetConfig(batch_size: int, subset_name: str, transforms: list[dict[str, ~typing.Any]], transform_lib_type: ~otx.core.types.transformer_libs.TransformLibType = TransformLibType.TORCHVISION, num_workers: int = 2, sampler: ~otx.core.config.data.SamplerConfig = <factory>, to_tv_image: bool = True)[source]#

Bases: object

DTO for dataset subset configuration.

batch_size#

Batch size produced.

Type:

int

subset_name#

Datumaro Dataset’s subset name for this subset config. It can differ from the actual usage (e.g., ‘val’ for the validation subset config).

Type:

str

transforms#

List of actually used transforms. It accepts a list of torchvision.transforms.v2.* Python objects or torchvision.transforms.v2.Compose for TransformLibType.TORCHVISION. Otherwise, it takes a Python dictionary that fits the configuration style used in mmcv (TransformLibType.MMCV, TransformLibType.MMPRETRAIN, …).

Type:

list[dict[str, Any] | Transform] | Compose

transform_lib_type#

Transform library type used by this subset.

Type:

TransformLibType

num_workers#

Number of workers for the dataloader of this subset.

Type:

int

Example

```python train_subset_config = SubsetConfig(

batch_size=64, subset_name=”train”, transforms=v2.Compose(

[

v2.RandomResizedCrop(size=(224, 224), antialias=True), v2.RandomHorizontalFlip(p=0.5), v2.ToDtype(torch.float32, scale=True), v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),

],

) transform_lib_type=TransformLibType.TORCHVISION, num_workers=2,

)#

class otx.core.config.data.TileConfig(enable_tiler: bool = False, enable_adaptive_tiling: bool = True, tile_size: tuple[int, int] = (400, 400), overlap: float = 0.2, iou_threshold: float = 0.45, max_num_instances: int = 1500, object_tile_ratio: float = 0.03, sampling_ratio: float = 1.0)[source]#

Bases: object

DTO for tiler configuration.

clone() TileConfig[source]#

Return a deep copied one of this instance.

class otx.core.config.data.VisualPromptingConfig(use_bbox: bool = False, use_point: bool = False)[source]#

Bases: object

DTO for visual prompting data module configuration.