Set14HR#

class deepinv.datasets.Set14HR(root: str, download: bool = False, transform: Callable | None = None)[source]#

Bases: Dataset

Dataset for Set14.

The Set14 dataset is a dataset consisting of 14 images commonly used for testing performance of image reconstruction algorithms. Images have sizes ranging from 276×276 to 512×768 pixels.

Raw data file structure:

self.root --- Set14 --- image_SRF_2 --- img_001_SRF_2_bicubic.png
           |         |               |
           |         |               -- img_014_SRF_2_SRCNN.png
           |         |
           |         -- image_SRF_3 --- ...
           |         -- image_SRF_4 --- ...
           |
           -- Set14_SR.zip

This dataset wrapper gives access to the 14 high resolution images in the image_SRF_4 folder. Raw dataset source : jbhuang0604/SelfExSR

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

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

Instanciate dataset and download raw data from the Internet

>>> import shutil
>>> from deepinv.datasets import Set14HR
>>> dataset = Set14HR(root="Set14", download=True)  # download raw data at root and load dataset
Dataset has been successfully downloaded.
>>> print(dataset.check_dataset_exists())                # check that raw data has been downloaded correctly
True
>>> print(len(dataset))                                  # check that we have 14 images
14
>>> shutil.rmtree("Set14")                          # remove raw data from disk
check_dataset_exists() bool[source]#

Verify that the image folders exist and contain all the images.

self.root should have the following structure:

self.root --- Set14 --- image_SRF_2 --- img_001_SRF_2_bicubic.png
           |         |               |
           |         |               -- img_014_SRF_2_SRCNN.png
           |         |
           |         -- image_SRF_3 --- ...
           |         -- image_SRF_4 --- ...
           |         -- xxx
           -- xxx