avalanche.benchmarks.classic.CLStream51

avalanche.benchmarks.classic.CLStream51(*, scenario: ~typing.Literal['iid', 'class_iid', 'instance', 'class_instance'] = 'class_instance', seed=10, eval_num=None, bbox_crop=True, ratio: float = 1.1, download=True, train_transform=Compose(     Resize(size=(224, 224), interpolation=bilinear, max_size=None, antialias=None)     ToTensor()     Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ), eval_transform=Compose(     Resize(size=(224, 224), interpolation=bilinear, max_size=None, antialias=None)     ToTensor()     Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ), dataset_root: str | ~pathlib.Path | None = None)[source]

Creates a CL benchmark for Stream-51.

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

This generator can be used to obtain the ‘iid’, ‘class_iid’, ‘instance’, and ‘class_instance’ scenarios.

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. Avalanche will support the “out of distribution” stream in the near future!

Each Experience contains the dataset and the associated task label, which is always 0 for Stream51.

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:
  • scenario – A string defining which Stream-51 scenario to return. Can be chosen between ‘iid’, ‘class_iid’, ‘instance’, and ‘class_instance’. Defaults to ‘class_instance’.

  • bbox_crop – If True, crops the images by using the bounding boxes defined by Stream51. This is needed to ensure that images depict only the required object (for classification purposes). Defaults to True.

  • ratio – A floating point value (>= 1.0) that controls the amount of padding for bounding boxes crop (default: 1.10).

  • seed – Random seed for shuffling classes or instances. Defaults to 10.

  • eval_num – How many samples to see before evaluating the network for instance ordering and how many classes to see before evaluating the network for the class_instance ordering. Defaults to None, which means that “30000” will be used for the ‘instance’ scenario and “10” for the ‘class_instance’ scenario.

  • download – If True, the dataset will automatically downloaded. Defaults to True.

  • 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 ‘stream51’ will be used.

Returns:

A properly initialized GenericCLScenario instance.