Appearance
Datasets
Image Folder
class relai.datasets.image_folder.ImageFolderDataset(dataset_path: str | Path)
Bases: RELAIClassificationDataset
Dataset wrapper for the relai_algorithms classification pipeline.
Assumes that the dataset is organized as expected by torchvision.datasets.ImageFolder as follows:
```: root/dog/xxx.png root/dog/xxy.png root/dog/[…]/xxz.png
root/cat/123.png root/cat/nsdf3.png root/cat/[…]/
asd932_.png
```See here for more details: https://pytorch.org/vision/stable/generated/torchvision.datasets.ImageFolder.html
- Parameters:dataset_path (Union *[*str , Path ]) – Path to the root directory of the dataset.
property class_name_to_images : dict[str, list[int]]
Mapping from class name to image indices in dataset corresponding to that class.
property classes : list[str]
List of classes in dataset.
relai.datasets.image_folder.navigate_to_root(path: Path)
Navigates to the correct descendant with train/val/test folders. Assumes that there is only one descendant that is not a train/val/test folder.