CIFAR10C#
- class torch_uncertainty.datasets.classification.CIFAR10C(root, transform=None, target_transform=None, subset='all', shift_severity=1, download=False)[source]#
The corrupted CIFAR-10-C Dataset.
- Parameters:
root (
Path|str) – Root directory of the datasets.transform (
Callable|None) – A function/transform that takes in a PIL image and returns a transformed version. E.g,transforms.RandomCrop. Defaults toNone.target_transform (
Callable|None) – A function/transform that takes in the target and transforms it. Defaults toNone.subset (
str) – The subset to use, one ofallor the keys incifarc_subsets.shift_severity (
int) – The shift_severity of the corruption, between1and5.download (
bool) – IfTrue, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again. Defaults toFalse.
References
- make_dataset(root, subset, shift_severity)[source]#
Make the CIFAR-C dataset.
Build the corrupted dataset according to the chosen subset and shift_severity. If the subset is ‘all’, gather all corruption types in the dataset.
- Parameters:
root (
Path) – The path to the dataset.subset (
str) – The name of the corruption subset to be used. Choose all for the dataset to contain all subsets.shift_severity (
int) – The shift_severity of the corruption applied to the images.
- Returns:
The samples and labels of the chosen.
- Return type:
Tuple[np.ndarray, np.ndarray]