avalanche.benchmarks.classic.SplitCIFAR110

avalanche.benchmarks.classic.SplitCIFAR110(n_experiences: int, *, seed: int | None = None, fixed_class_order: ~typing.Sequence[int] | None = None, train_transform: ~typing.Any | None = Compose(     RandomCrop(size=(32, 32), padding=4)     RandomHorizontalFlip(p=0.5)     ToTensor()     Normalize(mean=(0.5071, 0.4865, 0.4409), std=(0.2673, 0.2564, 0.2762)) ), eval_transform: ~typing.Any | None = Compose(     ToTensor()     Normalize(mean=(0.5071, 0.4865, 0.4409), std=(0.2673, 0.2564, 0.2762)) ), dataset_root_cifar10: str | ~pathlib.Path | None = None, dataset_root_cifar100: str | ~pathlib.Path | None = None) NCScenario[source]

Creates a CL benchmark using both the CIFAR100 and CIFAR10 datasets.

If the datasets are not present in the computer, this method will automatically download and store them in the data folder.

The CIFAR10 dataset is used to create the first experience, while the remaining n_experiences-1 experiences will be created from CIFAR100.

The returned benchmark will return experiences containing all patterns of a subset of classes, which means that each class is only seen “once”. This is one of the most common scenarios in the Continual Learning literature. Common names used in literature to describe this kind of scenario are “Class Incremental”, “New Classes”, etc. By default, an equal amount of classes will be assigned to each experience.

This generator will apply a task label 0 to all experiences.

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 (always 0 for this specific benchmark).

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 for the entire benchmark. The first experience will contain the entire CIFAR10 dataset, while the other n-1 experiences will be obtained from CIFAR100.

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

  • fixed_class_order – A list of class IDs used to define the class order ONLY for the incremental part, which is based on cifar100. The classes must be in range 0-99. If None, value of seed will be used to define the class order for the incremental batches on cifar100. If non-None, seed parameter will be ignored. Defaults to None.

  • train_transform – The transformation to apply to the training data, 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, 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_cifar10 – The root path of the CIFAR-10 dataset. Defaults to None, which means that the default location for ‘cifar10’ will be used.

  • dataset_root_cifar100 – The root path of the CIFAR-100 dataset. Defaults to None, which means that the default location for ‘cifar100’ will be used.

Returns:

A properly initialized NCScenario instance.