CIFAR10C¶
- class probly.datasets.torch.CIFAR10C(root: str | Path, corruption: str, severity: int, transform: Callable[..., Any] | None = None, target_transform: Callable[..., Any] | None = None, *, download: bool = False)[source]¶
Bases:
VisionDatasetA Dataset class for the CIFAR-10-C corruption benchmark introduced in [HD19].
One instance holds the 10,000 CIFAR-10 test images for a single
corruptiontype at a singleseveritylevel (1-5), with hard integer labels. The data can be found at https://zenodo.org/records/2535967 and fetched withdownload=True(a single ~2.9 GBCIFAR-10-C.tarthat covers all corruption types).Initialize an instance of the CIFAR10C class.
- Parameters:
root – Root directory containing (or to download into) the
CIFAR-10-Cfolder.corruption – Corruption type; must be one of
CIFAR10C.corruptions.severity – Corruption severity in 1..5.
transform – Optional transform to apply to the image.
target_transform – Optional transform to apply to the integer label.
download – Whether to download the CIFAR-10-C tar from Zenodo if missing.
- Raises:
ValueError – If
corruptionis unknown orseverityis not in 1..5.RuntimeError – If the data is missing and
downloadis False.
- base_folder = 'CIFAR-10-C'¶
- corruptions: tuple[str, ...] = ('gaussian_noise', 'shot_noise', 'impulse_noise', 'defocus_blur', 'glass_blur', 'motion_blur', 'zoom_blur', 'snow', 'frost', 'fog', 'brightness', 'contrast', 'elastic_transform', 'pixelate', 'jpeg_compression', 'speckle_noise', 'gaussian_blur', 'spatter', 'saturate')¶
The 19 corruption types shipped with CIFAR-10-C (15 main + 4 extra).
- filename = 'CIFAR-10-C.tar'¶
- tar_md5 = '56bf5dcef84df0e2308c6dcbcbbd8499'¶
- url = 'https://zenodo.org/records/2535967/files/CIFAR-10-C.tar'¶