diff --git a/src/otx/algorithms/classification/adapters/mmcls/datasets/pipelines/otx_pipelines.py b/src/otx/algorithms/classification/adapters/mmcls/datasets/pipelines/otx_pipelines.py index e912f8b4f3f..b6ba300301b 100644 --- a/src/otx/algorithms/classification/adapters/mmcls/datasets/pipelines/otx_pipelines.py +++ b/src/otx/algorithms/classification/adapters/mmcls/datasets/pipelines/otx_pipelines.py @@ -27,8 +27,10 @@ class LoadImageFromOTXDataset(load_image_base.LoadImageFromOTXDataset): class LoadResizeDataFromOTXDataset(load_image_base.LoadResizeDataFromOTXDataset): """Load and resize image & annotation with cache support.""" - def _create_load_img_op(self, cfg: Dict) -> Any: + def _create_load_img_op(self, cfg: Optional[Dict]) -> Any: """Creates image loading operation.""" + if cfg is None: + return self return build_from_cfg(cfg, PIPELINES) def _create_resize_op(self, cfg: Optional[Dict]) -> Optional[Any]: diff --git a/src/otx/algorithms/classification/configs/base/data/data_pipeline.py b/src/otx/algorithms/classification/configs/base/data/data_pipeline.py index 3c41ab61003..bb86f3baf64 100644 --- a/src/otx/algorithms/classification/configs/base/data/data_pipeline.py +++ b/src/otx/algorithms/classification/configs/base/data/data_pipeline.py @@ -54,7 +54,7 @@ __test_pipeline = [ dict(type="LoadImageFromOTXDataset"), - dict(type="Resize", size=__resize_target_size), + dict(type="ResizeTo", size=__resize_target_size), dict(type="Normalize", **__img_norm_cfg), dict(type="ImageToTensor", keys=["img"]), dict(type="Collect", keys=["img"]), diff --git a/src/otx/algorithms/common/adapters/mmcv/pipelines/load_image_from_otx_dataset.py b/src/otx/algorithms/common/adapters/mmcv/pipelines/load_image_from_otx_dataset.py index b72defaa4f9..17b0cb476c3 100644 --- a/src/otx/algorithms/common/adapters/mmcv/pipelines/load_image_from_otx_dataset.py +++ b/src/otx/algorithms/common/adapters/mmcv/pipelines/load_image_from_otx_dataset.py @@ -101,7 +101,8 @@ class LoadResizeDataFromOTXDataset(LoadImageFromOTXDataset): Finally, if enabled, cache the result and use pre-computed ones from next iterations. Args: - load_img_cfg (Dict): Creates image loading operation based on the config + load_img_cfg (Dict, optional): Optionally Creates image loading operation that replaces base loading + logic based on the config. Defaults to None. load_ann_cfg (Dict, optional): Optionally creates annotation loading operation based on the config. Defaults to None. resize_cfg (Dict, optional): Optionally creates resize operation based on the config. Defaults to None. @@ -110,7 +111,7 @@ class LoadResizeDataFromOTXDataset(LoadImageFromOTXDataset): def __init__( self, - load_img_cfg: Dict, + load_img_cfg: Optional[Dict] = None, load_ann_cfg: Optional[Dict] = None, resize_cfg: Optional[Dict] = None, **kwargs, @@ -130,8 +131,10 @@ def __init__( else: self._resize_shape = None - def _create_load_img_op(self, cfg: Dict) -> Any: + def _create_load_img_op(self, cfg: Optional[Dict]) -> Any: """Creates image loading operation.""" + if cfg is None: + return self return LoadImageFromOTXDataset(**cfg) # Should be overrided in task-specific implementation if needed def _create_load_ann_op(self, cfg: Optional[Dict]) -> Optional[Any]: