Shortcuts

ImageNetDataModule

class torch_uncertainty.datamodules.ImageNetDataModule(root, batch_size, eval_ood=False, val_split=None, ood_ds='openimage-o', test_alt=None, procedure=None, train_size=224, 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.

  • 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.

  • 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.

  • kwargs – Additional arguments.

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]