Set14HR#

class deepinv.datasets.Set14HR(root, download=False, transform=None)[source]#

Bases: ImageFolder

Dataset for Set14.

The Set14 dataset [1] 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_HR.tar.gz
        |
        --- Set14_HR --- baboon.png
        |             |
        |             --- butterfly.png
        |             --- face.png
        |             --- ...
        |
        --- xxx

This dataset wrapper gives access to the 14 high resolution images in the Set14_HR folder. Raw dataset source : https://huggingface.co/datasets/eugenesiow/Set14

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:

Instantiate 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


References:

check_dataset_exists()[source]#

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

self.root should have the following structure:

self.root --- Set14_HR --- baboon.png
        |             |
        |             --- butterfly.png
        |             --- face.png
        |             --- ...
        |
        --- xxx