ClassificationImageDataset#
- class ClassificationImageDataset[source]#
Bases:
ImageDataset
Read images and class labels from images stored in class folders.
I.e., all images for a class “A” are stored in directory
A/
, all images for a class “B” are stored in directoryB/
, and so on. And all class directories are located in the same parent directory.- __init__(data_dir: str, class_names: Optional[Iterable[str]], *args, **kwargs)[source]#
Constructor.
- Parameters:
data_dir (str) – Root directory containing class dirs.
class_names (Optional[Iterable[str]]) – Class names. Should match class dir names.
*args – See
ImageDataset.__init__()
.**kwargs – See
ImageDataset.__init__()
.
Methods
__init__
(data_dir, class_names, *args, **kwargs)Constructor.
- __add__(other: Dataset[T_co]) ConcatDataset[T_co] #
- Parameters:
other (Dataset[T_co]) –
- Return type:
ConcatDataset[T_co]
- __getitem__(key) tuple[torch.Tensor, torch.Tensor] #
- Return type:
- __init__(data_dir: str, class_names: Optional[Iterable[str]], *args, **kwargs)[source]#
Constructor.
- Parameters:
data_dir (str) – Root directory containing class dirs.
class_names (Optional[Iterable[str]]) – Class names. Should match class dir names.
*args – See
ImageDataset.__init__()
.**kwargs – See
ImageDataset.__init__()
.