torchelie.datasets

Debug datasets

ColoredColumns

A dataset of precedurally generated images of columns randomly colorized.

ColoredRows

A dataset of precedurally generated images of rows randomly colorized.

MS1M

Pix2PixDataset

Paired images datasets made for the Pix2Pix paper for paired image translation.

Imagenette

Imagenette by Jeremy Howards ( https://github.com/fastai/imagenette ).

Imagewoof

Imagewoof by Jeremy Howards ( https://github.com/fastai/imagenette ).

Loaders

FastImageFolder

Load an ImageFolder dataset faster by caching the file list the first time it is accessed.

UnlabeledImages

Serve all the images contained in a directory and subdirectories without any labels and structure constraint.

ImagesPaths

Serve all the images given in paths.

SideBySideImagePairsDataset

Dataset for side-by-side images.

Datasets wrappers

PairedDataset

A dataset that returns all possible pairs of samples of two datasets

RandomPairsDataset

PairedDataset deterministically constructs all possible pairs of items from both datasets.

MixUpDataset

Linearly mixes two samples and labels from a dataset according to the MixUp algorithm

Subset

Create a subset that is a random ratio of a dataset.

NoexceptDataset

Wrap a dataset and absorbs the exceptions it raises.

WithIndexDataset

Wrap a dataset.

CachedDataset

Wrap a dataset.

HorizontalConcatDataset

Concatenates multiple datasets.

MergedDataset

Functions

torchelie.datasets.mixup(x1, x2, y1, y2, num_classes, mixer=None, alpha=0.4)

Mixes samples x1 and x2 with respective labels y1 and y2 according to MixUp

\(\lambda \sim \text{Beta}(\alpha, \alpha)\)

\(x = \lambda x_1 + (1-\lambda) x_2\)

\(y = \lambda y_1 + (1 - \lambda) y_2\)

Parameters
  • x1 (tensor) – sample 1

  • x2 (tensor) – sample 2

  • y1 (tensor) – label 1

  • y2 (tensor) – label 2

  • num_classes (int) – number of classes

  • mixer (Distribution, optional) – a distribution to sample lambda from. If unspecified, the distribution will be a Beta(alpha, alpha)

  • alpha (float) – if mixer is unspecified, used to parameterize the Beta distribution