sconce.datasets package — Pytorch-Sconce master documentation

# 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'>)

  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)
  `get_target`(index)
  `num_classes`

## sconce.datasets.simple_dots module

class `sconce.datasets.simple_dots.` `SimpleDots`(circle_radius=4, image_size=(30, 30), num_images=400)

  Bases: `torch.utils.data.dataset.Dataset`

  A Dataset where each image is a white dot on a black background, the targets are the coordinates of the dot.

  Parameters: | image_size (tuple of python:int) – the size of the image (in pixels). num_images (int) – the number of images to generate for this dataset. Best if the sqrt of this number is an integer. circle_radius (float) – the size of the dot (in pixels).

  New in 0.11.0

`sconce.datasets.simple_dots.` `generate_circle_image`(x, y, image_size=(40, 40), circle_radius=4)