CSVDatasetClassification

class easypl.datasets.classification.csv.CSVDatasetClassification(csv_path: str, image_prefix: str = '', path_transform: Optional[Callable] = None, transform=None, return_label: bool = True, image_column: Optional[str] = None, target_columns: Optional[Union[str, List[str]]] = None)

Csv dataset for classfication

csv_path

path to csv file with paths of images

Type:

str

return_label

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

Type:

bool

image_column

column name or None. If None then will be getting the first column

Type:

Optional[str]

target_columns

column name/names or None. If None then will be getting all but the first column

Type:

Optional[Union[str, List[str]]]

image_prefix

path prefix which will be added to paths of images in csv file

Type:

str

path_transform

None or function for transform of path. Will be os.path.join(image_prefix, path_transform(image_path))

Type:

Optional[Callable]

transform

albumentations transform class or None

Type:

Optional

__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