Shortcuts

ImageNetDataModule

class torch_uncertainty.datamodules.ImageNetDataModule(root, batch_size, eval_ood=False, eval_shift=False, shift_severity=1, val_split=None, ood_ds='openimage-o', test_alt=None, procedure=None, train_size=224, interpolation='bilinear', basic_augment=True, rand_augment_opt=None, num_workers=1, pin_memory=True, persistent_workers=True)[source]

DataModule for ImageNet.

Parameters:
  • root (str) – Root directory of the datasets.

  • eval_ood (bool) – Whether to evaluate out-of-distribution performance. Defaults to False.

  • eval_shift (bool) – Whether to evaluate on shifted data. Defaults to False.

  • shift_severity – int = 1,

  • batch_size (int) – Number of samples per batch.

  • val_split (float or Path) – Share of samples to use for validation or path to a yaml file containing a list of validation images ids. Defaults to 0.0.

  • ood_ds (str) – Which out-of-distribution dataset to use. Defaults to "openimage-o".

  • test_alt (str) – Which test set to use. Defaults to None.

  • procedure (str) – Which procedure to use. Defaults to None.

  • train_size (int) – Size of training images. Defaults to 224.

  • interpolation (str) – Interpolation method for the Resize Crops. Defaults to "bilinear".

  • basic_augment (bool) – Whether to apply base augmentations. Defaults to True.

  • rand_augment_opt (str) – Which RandAugment to use. Defaults to None.

  • num_workers (int) – Number of workers to use for data loading. Defaults to 1.

  • pin_memory (bool) – Whether to pin memory. Defaults to True.

  • persistent_workers (bool) – Whether to use persistent workers. Defaults to True.

test_dataloader()[source]

Get the test dataloaders for ImageNet.

Returns:

ImageNet test set (in distribution data) and Textures test split (out-of-distribution data).

Return type:

list[DataLoader]