datumaro.plugins.data_formats.imagenet#

Classes

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

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

ImagenetImporter()

TorchVision's ImageFolder style importer.

ImagenetPath()

ImagenetWithSubsetDirsExporter(extractor, ...)

ImagenetWithSubsetDirsImporter()

TorchVision ImageFolder style 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: Optional[str] = None, ctx: Optional[ImportContext] = None)[source]#

Bases: SubsetBase

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

Bases: Importer

TorchVision’s ImageFolder style importer. For example, it imports the following directory structure.

root
├── label_0
│   ├── label_0_1.jpg
│   └── label_0_2.jpg
└── label_1
    └── label_1_1.jpg
classmethod detect(context: FormatDetectionContext) FormatDetectionConfidence[source]#
classmethod find_sources(path)[source]#
class datumaro.plugins.data_formats.imagenet.ImagenetWithSubsetDirsImporter[source]#

Bases: ImagenetWithSubsetDirsImporter

TorchVision ImageFolder style importer. For example, it imports the following directory structure.

root
├── train
│   ├── label_0
│   │   ├── label_0_1.jpg
│   │   └── label_0_2.jpg
│   └── label_1
│       └── label_1_1.jpg
├── val
│   ├── label_0
│   │   ├── label_0_1.jpg
│   │   └── label_0_2.jpg
│   └── label_1
│       └── label_1_1.jpg
└── test
    ├── label_0
    │   ├── label_0_1.jpg
    │   └── label_0_2.jpg
    └── label_1
        └── label_1_1.jpg

Then, it will have three subsets: train, val, and test and they have label_0 and label_1 labels.

NAME = 'imagenet_with_subset_dirs'#
classmethod detect(context: FormatDetectionContext) Optional[FormatDetectionConfidence]#
class datumaro.plugins.data_formats.imagenet.ImagenetExporter(extractor: IDataset, save_dir: str, *, save_media: Optional[bool] = None, image_ext: Optional[str] = None, default_image_ext: Optional[str] = None, save_dataset_meta: bool = False, save_hashkey_meta: bool = False, stream: bool = False, ctx: Optional[ExportContext] = 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: Optional[bool] = None, image_ext: Optional[str] = None, default_image_ext: Optional[str] = None, save_dataset_meta: bool = False, save_hashkey_meta: bool = False, stream: bool = False, ctx: Optional[ExportContext] = None)[source]#

Bases: ImagenetExporter

USE_SUBSET_DIRS = True#