avalanche.benchmarks.utils.AvalancheDataset

class avalanche.benchmarks.utils.AvalancheDataset(datasets: List[IDataset], *, indices: Optional[List[int]] = None, data_attributes: Optional[List[DataAttribute]] = None, transform_groups: Optional[TransformGroups] = None, frozen_transform_groups: Optional[TransformGroups] = None, collate_fn: Optional[Callable[[List], Any]] = None)[source]

Avalanche Dataset.

Avlanche dataset are pytorch-compatible Datasets with some additional functionality such as: - management of transformation groups via AvalancheTransform - support for sample attributes such as class targets and task labels

Data Attributes

Avalanche datasets manage sample-wise information such as class or task labels via DataAttribute.

Transformation Groups

Avalanche datasets manage transformation via transformation groups. Simply put, a transformation group is a named preprocessing function (as in torchvision datasets). By default, Avalanche expects two transformation groups: - ‘train’, which contains transformations applied to training patterns. - ‘eval’, that contain transformations applied to test patterns.

Having both groups allows to use different transformations during training and evaluation and to seamlessly switch between them by using the train() and eval() methods. Arbitrary transformation groups can be added and used. If you define custom groups, you can use them by calling the :func:with_transforms method.

switching to a different transformation group by calling the train(), eval() or ``with_transforms` methods always returns a new dataset, levaing the original one unchanged.

Ttransformation groups can be manipulated by removing, freezing, or replacing transformations. Each operation returns a new dataset, leaving the original one unchanged.

__init__(datasets: List[IDataset], *, indices: Optional[List[int]] = None, data_attributes: Optional[List[DataAttribute]] = None, transform_groups: Optional[TransformGroups] = None, frozen_transform_groups: Optional[TransformGroups] = None, collate_fn: Optional[Callable[[List], Any]] = None)[source]

Creates a AvalancheDataset instance.

Parameters
  • dataset – Original dataset. Beware that AvalancheDataset will not overwrite transformations already applied by this dataset.

  • transform_groups – Avalanche transform groups.

Methods

__init__(datasets, *[, indices, ...])

Creates a AvalancheDataset instance.

concat(other)

Concatenation operation.

eval()

Returns a new dataset with the transformations of the 'eval' group loaded.

freeze_transforms()

Returns a new dataset with the transformation groups frozen.

remove_current_transform_group()

Recursively remove transformation groups from dataset tree.

replace_current_transform_group(transform)

Recursively remove the current transformation group from the dataset tree and replaces it.

subset(indices)

Subsampling operation.

train()

Returns a new dataset with the transformations of the 'train' group loaded.

with_transforms(group_name)

Returns a new dataset with the transformations of a different group loaded.

Attributes

transform