LsdirHR

class deepinv.datasets.LsdirHR(root: str, mode: str = 'train', download: bool = False, transform: Callable | None = None)[source]

Bases: Dataset

Dataset for LSDIR.

A large-scale dataset for image restoration tasks such as image super-resolution (SR), image denoising, JPEG deblocking, deblurring, and demosaicking, and real-world SR.

Raw data file structure:

self.root --- 0001000 --- 0000001.png
           |           |
           |           -- 0001000.png
           |  ...
           |
           -- 0085000 --- 0084001.png
           |           |
           |           -- 0084991.png
           -- shard-00.tar.gz
           |  ...
           -- shard-16.tar.gz
           |
           -- val1 --- HR --- val --- 0000001.png
           |        -- X2          |
           |        -- X3          -- 0000250.png
           |        -- X4
           -- val1.tar.gz

Warning

The official site hosting the dataset is unavailable : https://data.vision.ee.ethz.ch/yawli/. Thus the download argument isn’t working for now.

Parameters:
  • root (str) – Root directory of dataset. Directory path from where we load and save the dataset.

  • mode (str) – Select a split of the dataset between ‘train’ or ‘val’. Default at ‘train’.

  • download (bool) – If True, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again. Default at False.

  • transform (callable, optional) – A function/transform that takes in a PIL image and returns a transformed version. E.g, torchvision.transforms.RandomCrop


Examples:

Instantiate dataset and download raw data from the Internet

from deepinv.datasets import LsdirHR
val_dataset = LsdirHR(root="Lsdir", mode="val", download=True)  # download raw data at root and load dataset
print(val_dataset.verify_split_dataset_integrity())             # check that raw data has been downloaded correctly
print(len(val_dataset))                                         # check that we have 250 images
verify_split_dataset_integrity() bool[source]

Verify the integrity and existence of the specified dataset split.

The expected structure of the dataset directory is as follows:

self.root --- 0001000 --- 0000001.png
           |           |
           |           -- 0001000.png
           |  ...
           |
           -- 0085000 --- 0084001.png
           |           |
           |           -- 0084991.png
           |
           -- val1 --- HR --- val --- 0000001.png
           |                       |
           |                       -- 0000250.png
           -- xxx