- avalanche.benchmarks.classic.RotatedMNIST(n_experiences: int, *, return_task_id: bool = False, seed: int | None = None, rotations_list: Sequence[int] | None = None, train_transform: Any | None = Compose(Normalize(mean=(0.1307,), std=(0.3081,))), eval_transform: Any | None = Compose(Normalize(mean=(0.1307,), std=(0.3081,))), dataset_root: Path | str | None = None) NCScenario
Creates a Rotated MNIST benchmark.
If the dataset is not present in the computer, this method will automatically download and store it.
Random angles are used to rotate the MNIST images in
n_experiencesdifferent manners. This means that each experience is composed of all the original 10 MNIST classes, but each image is rotated 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”.
n_experiences – The number of experiences (tasks) in the current benchmark. It indicates how many different rotations of the MNIST dataset have to be created. The value of this parameter should be a divisor of 10.
seed – A valid int used to initialize the random number generator. Can be None.
rotations_list – A list of rotations values in degrees (from -180 to 180) used to define the rotations. The rotation specified in position 0 of the list will be applied to the task 0, the rotation specified in position 1 will be applied to task 1 and so on. If None, value of
seedwill be used to define the rotations. If non-None,
seedparameter will be ignored. Defaults to None.
train_transform – The transformation to apply to the training data after the random rotation, 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 after the random rotation, 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 ‘mnist’ will be used.
A properly initialized