LSUN#

class dmme.data_modules.LSUN(data_dir: str = '.', batch_size: int = 128, class_name: str = 'train', imgsize: int = 256, augs: Optional[List[Callable]] = [RandomHorizontalFlip(p=0.5)])[source]#

LSUN datamodule

Parameters:
  • data_dir – path to cifar10

  • batch_size – batch size

  • class_name – lsun zipfile name to load, specify as list to load multiple classes. Set to "train" to load all train scenes in lsun. Unsupported for objects.

  • imgsize – dataset image size

  • augs (List[Transform]) – augmentations on PIL images only from torchvision. Set to None to disable augmentations

prepare_data()[source]#

Download and extract LSUN dataset

LSUN is downloaded using aria2 to speedup downloads.

download_scenes(out_dir, category: str, set_name: str)[source]#

Download lsun scenes data

Parameters:
  • out_dir – output directory

  • category – category name to download. should match the category names in scenes

  • set_name – either “train”, “val”, or “test”

download_objects(out_dir, category: str)[source]#

Download lsun objects data

Parameters:
  • out_dir – output directory

  • category

    category name to download. should match the category names in scenes

  • set_name – either “train”, “val”, or “test”

download_url(url: str, out_dir, out_name: str)[source]#

Download url and extract zip, will skip if file exists

Parameters:
  • url – url to download

  • out_dir – output directory

  • out_name – file name to download as

setup_train()[source]#

Prepare training set

setup_test()[source]#

Prepare test set