peal.data.custom_datasets¶
Dataset classes for the concrete benchmarks PEAL experiments run on.
Every class here wraps one dataset behind the loaders of peal.data.datasets
and materialises it first when necessary: the synthetic generators of
peal.data.dataset_generators (square, sparse numbers, funny nodules,
stamped-on confounders) are run on demand, and the public benchmarks (MNIST,
CelebA, Waterbirds, Camelyon17, RxRx1, NICO++, SkinCon, ISIC, …) are
downloaded and rewritten into PEAL’s imgs/ plus data.csv layout.
Datasets with a known confounder additionally provide the oracle hooks
(sample_to_2d_latent, has_confounder) that the counterfactual
explainers and the decision boundary plots call back into.
Functions
Line-wise variant of |
|
Download the Kaggle CelebA release and lay it out the way PEAL expects. |
|
Read a CelebA-HQ style annotation file into one whitespace-separated table. |
|
Scatter factual and counterfactual 2D latents and connect them by arrows. |
Classes
Camelyon17 exported into PEAL's |
|
Thin wrapper around the WILDS Camelyon17 tumour dataset. |
|
CelebA with a copyright tag stamped into part of the images. |
|
CelebA with its 40 binary face attributes. |
|
CelebA-HQ with the CelebAMask-HQ attribute annotations. |
|
MNIST with a red tint as a controllable confounder. |
|
|
|
Ovarian follicle images with expert annotations, taken from Hugging Face. |
|
Synthetic nodules whose internal structure is confounded by roundness. |
|
ISIC skin lesions with the annotated lesion size as confounder. |
|
Plain MNIST in the ImageFolder layout, without any confounder. |
|
NICO++ subset in which the object category is confounded by its context. |
|
Synthetic images showing a 2x4 grid of numbers and nothing else. |
|
OnlySparseNumbers dataset where target numbers are distributed according to Zipf's law. |
|
RxRx1 exported into PEAL's |
|
Thin wrapper around the WILDS RxRx1 cell-imaging dataset. |
|
Fitzpatrick17k skin lesions with the skin tone as confounder. |
|
Number-grid images with eight additional dense red intensities. |
|
Alias/Subclass of SparseNumbersDataset with 8 dense red intensity attributes and sparse numbers. |
|
Alias/Subclass of SparseNumbersZipfDataset. |
|
SparseNumbers dataset (8 dense red intensity attributes + sparse numbers) where sparse numbers follow Zipf distribution. |
|
Synthetic 64x64 squares whose colour is confounded by the background. |
|
Waterbirds: the bird species is confounded by the background scene. |