spyrit.misc.statistics.data_loaders_imagenet

spyrit.misc.statistics.data_loaders_imagenet(train_root, val_root=None, img_size: int = 64, batch_size: int = 512, seed: int = 7, shuffle=False, get_size: str = 'original')[source]
Args:

Both ‘train_root’ and ‘val_root’ need to have images in a subfolder

data_root: path to image database, expected to contain an /stl10_binary/ subfolder with the test*.bin, train*.bin and unlabeled_X.bin files.

img_size: image size

batch_size: batch size

seed: seed, only relevant for random transforms

shuffle: True to shuffle train set (test set is not shuffled)

get_size: specifies how images of size img_size are obtained

  • ‘original’: random crop with padding

  • ‘resize’: resize

  • ‘ccrop’: center crop

  • ‘rcrop’: random crop

The output of torchvision datasets are PILImage images in the range [0, 1]. We transform them to Tensors in the range [-1, 1]. Also RGB images are converted into grayscale images.