CBSD68#

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

Bases: Dataset

Dataset for CBSBD68.

Color BSD68 dataset for image restoration benchmarks is part of The Berkeley Segmentation Dataset and Benchmark from Martin et al.[1]. It is used for measuring image restoration algorithms performance. It contains 68 images.

Raw data file structure:

self.root --- data-00000-of-00001.arrow
           -- dataset_info.json
           -- state.json

This dataset wraps the huggingface version of the dataset. HF source : https://huggingface.co/datasets/deepinv/CBSD68

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 CBSD68
>>> dataset = CBSD68(root="CBSB68", 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 68 images
68
>>> shutil.rmtree("CBSB68")                         # remove raw data from disk


References:

check_dataset_exists()[source]#

Verify that the HuggingFace dataset folder exists and contains the raw data file.

self.root should have the following structure:

self.root --- data-00000-of-00001.arrow
           -- xxx
           -- xxx

This is a soft verification as we don’t check all the files in the folder.