- avalanche.benchmarks.classic.SplitCIFAR10(n_experiences: int, *, first_exp_with_half_classes: bool = False, return_task_id=False, seed: int | None = None, fixed_class_order: ~typing.Sequence[int] | None = None, shuffle: bool = True, class_ids_from_zero_in_each_exp: bool = False, class_ids_from_zero_from_first_exp: bool = False, train_transform: ~typing.Any | None = Compose( RandomCrop(size=(32, 32), padding=4) RandomHorizontalFlip(p=0.5) ToTensor() Normalize(mean=(0.4914, 0.4822, 0.4465), std=(0.2023, 0.1994, 0.201)) ), eval_transform: ~typing.Any | None = Compose( ToTensor() Normalize(mean=(0.4914, 0.4822, 0.4465), std=(0.2023, 0.1994, 0.201)) ), dataset_root: ~pathlib.Path | str | None = None) NCScenario
Creates a CL benchmark using the CIFAR10 dataset.
If the dataset is not present in the computer, this method will automatically download and store it.
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 doesn’t force a choice on the availability of task labels, a choice that is left to the user (see the return_task_id parameter for more info on task labels).
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.
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 in the current benchmark. The value of this parameter should be a divisor of 10 if first_task_with_half_classes is False, a divisor of 5 otherwise.
first_exp_with_half_classes – A boolean value that indicates if a first pretraining step containing half of the classes should be used. If it’s True, the first experience will use half of the classes (5 for cifar10). If this parameter is False, no pretraining step will be used and the dataset is simply split into a the number of experiences defined by the parameter n_experiences. Defaults to False.
return_task_id – if True, a progressive task id is returned for every experience. If False, all experiences will have a task ID of 0.
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. If None, value of
seedwill be used to define the class order. If not None, the
seedparameter will be ignored. Defaults to None.
shuffle – If true, the class order in the incremental experiences is randomly shuffled. Default to True.
class_ids_from_zero_in_each_exp – If True, original class IDs will be mapped to range [0, n_classes_in_exp) for each experience. Defaults to False. Mutually exclusive with the
class_ids_from_zero_from_first_exp – If True, original class IDs will be remapped so that they will appear as having an ascending order. For instance, if the resulting class order after shuffling (or defined by fixed_class_order) is [23, 34, 11, 7, 6, …] and class_ids_from_zero_from_first_exp is True, then all the patterns belonging to class 23 will appear as belonging to class “0”, class “34” will be mapped to “1”, class “11” to “2” and so on. This is very useful when drawing confusion matrices and when dealing with algorithms with dynamic head expansion. Defaults to False. Mutually exclusive with the
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 eval transformation will be used.
dataset_root – The root path of the dataset. Defaults to None, which means that the default location for ‘cifar10’ will be used.
A properly initialized