DirDatasetClassification

class easypl.datasets.classification.dir.DirDatasetClassification(root_path: str, label_parser: Callable, transform: Optional = None, return_label: bool = True)

Dataset implementation for images in directory on disk (stored images paths in RAM). Require root_path/…/image_path structure.

root_path

path of directory with images

Type:

str

transform

albumentations transform or None

Type:

Optional

return_label

if True return dict with two keys (image, target), else return dict with one key (image)

Type:

bool

label_parser

function for parsing label from relative path

Type:

Callable

__len__() int

Return length of dataset

Return type:

int

__getitem__(idx: int) Dict

Read object of dataset by index

idx

index of object in dataset

Type:

int

Returns:

{“image”: …} or {“image”: …, “target”: …}

Return type:

Dict