sconce.datasets package

sconce.datasets.csv_image_folder module

class sconce.datasets.csv_image_folder.CsvImageFolder(root, csv_path, filename_key='image_name', classes_key='tags', csv_delimiter=',', classes_delimiter=' ', loader=<function default_loader>, extensions=['.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif'], transform=None, target_transform=<class 'sconce.transforms.NHot'>)[source]

Bases: torch.utils.data.dataset.Dataset

A Dataset that reads images from a folder and classes from a csv file.

Parameters:
  • root (string) – directory where the images can be found.
  • csv_path (string) – the path to the csv file containing image filenames and classes.
  • filename_key (string, optional) – the column header of the csv for the column that contains image filenames (without extensions).
  • classes_key (string, optional) – the column header of the csv for the column that contains classes for each image.
  • csv_delimiter (string, optional) – the character(s) used to separate fields in the csv file.
  • loader (callable, optional) – a function to load a sample given its path.
  • extensions (list[string], optinoal) – a list of allowed extensions. E.g, ['.jpg', '.tif']
  • transform (callable, optional) – A function/transform that takes in a sample and returns a transformed version. E.g, transforms.RandomCrop for images.
  • target_transform (callable, optional) – A function/transform that takes in the target and transforms it.
Variables:
  • class_to_idx (dict) – a dictionary mapping class names to indices.
  • classes (list[string]) – the human readable names of the classes that images can belong to.
  • paths (list[string]) – for each image, the path to the image on disk.
  • targets (list[list[int]]) – for each image, a list of class indices to which that image belongs.
found_extensions
get_sample(index)[source]
get_target(index)[source]
num_classes