LsdirHR#

class deepinv.datasets.LsdirHR(root, mode='train', download=False, transform=None)[source]#

Bases: ImageFolder

Dataset for LSDIR.

Published in Li et al.[1].

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
           |
           |
           -- val1 --- HR --- val --- 0000001.png
           |        -- X2          |
           |        -- X3          -- 0000250.png
           |        -- X4

Warning

Downloading this dataset requires huggingface-hub. It is gated, please request access (https://huggingface.co/ofsoundof/LSDIR) and make sure you are logged in using hf auth login (CLI) or from huggingface_hub import login, login().

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


References:

verify_split_dataset_integrity()[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
        |        -- X2          |
        |        -- X3          -- 0000250.png
        |