neodroidvision.data.classification.dict_image_folder.DictImageFolder

class neodroidvision.data.classification.dict_image_folder.DictImageFolder(root: ~pathlib.Path, transform: callable = ToTensor(), target_transform: ~typing.Optional[callable] = None, loader=<function default_loader>, is_valid_file: ~typing.Optional[callable] = None)[source]

Bases: DictDatasetFolder

A generic data loader where the images are arranged in this way:

root/dog/xxx.png
root/dog/xxy.png
root/dog/xxz.png

root/cat/123.png
root/cat/nsdf3.png
root/cat/asd932_.png
Parameters
  • root (string) – Root directory path.

  • transform (callable, optional) – A function/transform that takes in an PIL image and returns a transformed version. E.g, transforms.RandomCrop

  • target_transform (callable, optional) – A function/transform that takes in the target and transforms it.

  • loader (callable, optional) – A function to load an image given its path.

  • is_valid_file (callable, optional) – A function that takes path of an Image file and check if the file is a valid file (used to check of corrupt files)

Variables
  • classes (list) – List of the class names sorted alphabetically.

  • imgs (list) – List of (image path, class_index) tuples

__init__(root: ~pathlib.Path, transform: callable = ToTensor(), target_transform: ~typing.Optional[callable] = None, loader=<function default_loader>, is_valid_file: ~typing.Optional[callable] = None)[source]

Methods

__init__(root[, transform, ...])

extra_repr()

sample(target, index)

description

sample(target, index) Tuple

description