diff --git a/datumaro/datumaro/plugins/coco_format/importer.py b/datumaro/datumaro/plugins/coco_format/importer.py index 42e5be9fc89d..932944fa6a43 100644 --- a/datumaro/datumaro/plugins/coco_format/importer.py +++ b/datumaro/datumaro/plugins/coco_format/importer.py @@ -11,7 +11,7 @@ from datumaro.components.extractor import Importer from datumaro.util.log_utils import logging_disabled -from .format import CocoTask, CocoPath +from .format import CocoTask class CocoImporter(Importer): @@ -55,11 +55,8 @@ def find_subsets(path): if path.endswith('.json') and osp.isfile(path): subset_paths = [path] else: - subset_paths = glob(osp.join(path, '*_*.json')) - - if osp.basename(osp.normpath(path)) != CocoPath.ANNOTATIONS_DIR: - path = osp.join(path, CocoPath.ANNOTATIONS_DIR) - subset_paths += glob(osp.join(path, '*_*.json')) + subset_paths = glob(osp.join(path, '**', '*_*.json'), + recursive=True) subsets = defaultdict(dict) for subset_path in subset_paths: diff --git a/datumaro/datumaro/plugins/cvat_format/importer.py b/datumaro/datumaro/plugins/cvat_format/importer.py index 79be0c610524..31f8dbd44f5a 100644 --- a/datumaro/datumaro/plugins/cvat_format/importer.py +++ b/datumaro/datumaro/plugins/cvat_format/importer.py @@ -9,8 +9,6 @@ from datumaro.components.extractor import Importer -from .format import CvatPath - class CvatImporter(Importer): EXTRACTOR_NAME = 'cvat' @@ -49,9 +47,5 @@ def find_subsets(path): if path.endswith('.xml') and osp.isfile(path): subset_paths = [path] else: - subset_paths = glob(osp.join(path, '*.xml')) - - if osp.basename(osp.normpath(path)) != CvatPath.ANNOTATIONS_DIR: - path = osp.join(path, CvatPath.ANNOTATIONS_DIR) - subset_paths += glob(osp.join(path, '*.xml')) + subset_paths = glob(osp.join(path, '**', '*.xml'), recursive=True) return subset_paths \ No newline at end of file diff --git a/datumaro/datumaro/plugins/tf_detection_api_format/importer.py b/datumaro/datumaro/plugins/tf_detection_api_format/importer.py index 9783a23cb15d..169618ba2db0 100644 --- a/datumaro/datumaro/plugins/tf_detection_api_format/importer.py +++ b/datumaro/datumaro/plugins/tf_detection_api_format/importer.py @@ -47,5 +47,6 @@ def find_subsets(path): if path.endswith('.tfrecord') and osp.isfile(path): subset_paths = [path] else: - subset_paths = glob(osp.join(path, '*.tfrecord')) + subset_paths = glob(osp.join(path, '**', '*.tfrecord'), + recursive=True) return subset_paths \ No newline at end of file diff --git a/datumaro/datumaro/plugins/yolo_format/importer.py b/datumaro/datumaro/plugins/yolo_format/importer.py index 4e14d0315aea..344475c67716 100644 --- a/datumaro/datumaro/plugins/yolo_format/importer.py +++ b/datumaro/datumaro/plugins/yolo_format/importer.py @@ -42,5 +42,5 @@ def find_configs(path): if path.endswith('.data') and osp.isfile(path): config_paths = [path] else: - config_paths = glob(osp.join(path, '*.data')) + config_paths = glob(osp.join(path, '**', '*.data'), recursive=True) return config_paths \ No newline at end of file