avalanche.benchmarks.classic.PermutedOmniglot

avalanche.benchmarks.classic.PermutedOmniglot(n_experiences: int, *, seed: ~typing.Optional[int] = None, train_transform: ~typing.Optional[~typing.Any] = Compose(     ToTensor()     Normalize(mean=(0.9221, ), std=(0.2681, )) ), eval_transform: ~typing.Optional[~typing.Any] = Compose(     ToTensor()     Normalize(mean=(0.9221, ), std=(0.2681, )) ), dataset_root: ~typing.Optional[~typing.Union[str, ~pathlib.Path]] = None) NCScenario[source]

Creates a Permuted Omniglot benchmark.

If the dataset is not present in the computer, this method will automatically download and store it.

Random pixel permutations are used to permute the Omniglot images in n_experiences different manners. This means that each experience is composed of all the original 964 Omniglot classes, but the pixel in the images are permuted in a different way.

The benchmark instance returned by this method will have two fields, train_stream and test_stream, which can be iterated to obtain training and test Experience. Each Experience contains the dataset and the associated task label.

A progressive task label, starting from “0”, is applied to each experience.

The benchmark API is quite simple and is uniform across all benchmark generators. It is recommended to check the tutorial of the “benchmark” API, which contains usage examples ranging from “basic” to “advanced”.

Parameters
  • n_experiences – The number of experiences (tasks) in the current benchmark. It indicates how many different permutations of the Omniglot dataset have to be created.

  • seed – A valid int used to initialize the random number generator. Can be None.

  • train_transform – The transformation to apply to the training data before the random permutation, e.g. a random crop, a normalization or a concatenation of different transformations (see torchvision.transform documentation for a comprehensive list of possible transformations). If no transformation is passed, the default train transformation will be used.

  • eval_transform – The transformation to apply to the test data before the random permutation, e.g. a random crop, a normalization or a concatenation of different transformations (see torchvision.transform documentation for a comprehensive list of possible transformations). If no transformation is passed, the default test transformation will be used.

  • dataset_root – The root path of the dataset. Defaults to None, which means that the default location for ‘omniglot’ will be used.

Returns

A properly initialized NCScenario instance.