datumaro.plugins.data_formats.imagenet#

Classes

ImagenetBase(path, *[, subset, ctx, ...])

ImagenetExporter(extractor, save_dir, *[, ...])

ImagenetImporter()

Multi-level version of ImagenetImporter.

ImagenetPath()

ImagenetWithSubsetDirsExporter(extractor, ...)

ImagenetWithSubsetDirsImporter()

Multi-level image directory structure importer.

class datumaro.plugins.data_formats.imagenet.ImagenetPath[source]#

Bases: object

IMAGE_DIR_NO_LABEL = 'no_label'#
SEP_TOKEN = ':'#
class datumaro.plugins.data_formats.imagenet.ImagenetBase(path: str, *, subset: str | None = None, ctx: ImportContext | None = None, min_depth: int | None = None, max_depth: int | None = None)[source]#

Bases: SubsetBase

property is_stream: bool#

Boolean indicating whether the dataset is a stream

If the dataset is a stream, the dataset item is generated on demand from its iterator.

class datumaro.plugins.data_formats.imagenet.ImagenetImporter[source]#

Bases: Importer

Multi-level version of ImagenetImporter. For example, it imports the following directory structure.

root
├── label_0
│   ├── label_0_1
│   │   └── img1.jpg
│   └── label_0_2
│       └── img2.jpg
└── label_1
    └── img3.jpg
DETECT_CONFIDENCE = 5#
classmethod detect(context: FormatDetectionContext) FormatDetectionConfidence[source]#
classmethod contains_only_images(path: str | Path)[source]#
classmethod find_sources(path)[source]#
classmethod get_file_extensions() List[str][source]#
classmethod build_cmdline_parser(**kwargs)[source]#
class datumaro.plugins.data_formats.imagenet.ImagenetWithSubsetDirsImporter[source]#

Bases: ImagenetWithSubsetDirsImporter

Multi-level image directory structure importer. Example:

root
├── train
│   ├── label_0
│   │   ├── label_0_1
│   │   │   └── img1.jpg
│   │   └── label_0_2
│   │       └── img2.jpg
│   └── label_1
│       └── img3.jpg
├── val
│   ├── label_0
│   │   ├── label_0_1
│   │   │   └── img1.jpg
│   │   └── label_0_2
│   │       └── img2.jpg
│   └── label_1
│       └── img3.jpg
└── test
    │   ├── label_0
    │   ├── label_0_1
    │   │   └── img1.jpg
    │   └── label_0_2
    │       └── img2.jpg
    └── label_1
        └── img3.jpg
NAME = 'imagenet_with_subset_dirs'#
classmethod detect(context: FormatDetectionContext) FormatDetectionConfidence | None#
class datumaro.plugins.data_formats.imagenet.ImagenetExporter(extractor: IDataset, save_dir: str, *, save_media: bool | None = None, image_ext: str | None = None, default_image_ext: str | None = None, save_dataset_meta: bool = False, save_hashkey_meta: bool = False, stream: bool = False, ctx: ExportContext | None = None)[source]#

Bases: Exporter

DEFAULT_IMAGE_EXT = '.jpg'#
USE_SUBSET_DIRS = False#
class datumaro.plugins.data_formats.imagenet.ImagenetWithSubsetDirsExporter(extractor: IDataset, save_dir: str, *, save_media: bool | None = None, image_ext: str | None = None, default_image_ext: str | None = None, save_dataset_meta: bool = False, save_hashkey_meta: bool = False, stream: bool = False, ctx: ExportContext | None = None)[source]#

Bases: ImagenetExporter

USE_SUBSET_DIRS = True#