peal.data.custom_datasets.Camelyon17AugmentedDataset¶
- class peal.data.custom_datasets.Camelyon17AugmentedDataset[source]¶
Bases:
Image2MixedDatasetCamelyon17 exported into PEAL’s
imgs/plusdata.csvlayout.On first use every WILDS sample is written to
<dataset_path>/imgs/<7 digit index>.pngand adata.csvwith the columnsimg, tumor, hospitalis created, the hospital id acting as the confounder of the tumour label. A latent oracle is loaded from$PEAL_RUNS/camelyon17/latent_oracle/model.cpl, falling back to thelatent_oracle_old_20250417_150756run, and backssample_to_2d_latent.- Parameters:
config (
DataConfig) – Usesdataset_pathandconfounding_factors.**kwargs – Forwarded to
Image2MixedDataset.
- Variables:
oracle (
torch.nn.Module) – Attribute predictor in eval mode.
Methods
Oracle attribute readout, reduced to the confounding factors.
Attributes
- __init__(config, **kwargs)[source]¶
Export the WILDS images if missing and load the latent oracle.
- Raises:
ImportError – If the images still have to be exported and the optional
wildsdependency is not installed.
- sample_to_2d_latent(sample, mask=None)[source]¶
Oracle attribute readout, reduced to the confounding factors.
- Parameters:
sample (
torch.Tensor) – Image[C, H, W]or batch[N, C, H, W]; a single image is unsqueezed for the oracle and squeezed again afterwards.mask (
torch.Tensor, optional) – Ignored; kept for interface compatibility.
- Returns:
Oracle outputs for the attributes named in
config.confounding_factors, or all outputs if that is unset.- Return type: