torch_enhance.datasets

class torch_enhance.datasets.BaseDataset[source]

Base Super Resolution Dataset Class

download_google_drive(data_dir: str, filename: str) → None[source]

Download dataset

Parameters:
  • data_dir (str) – Path to base dataset directory
  • filename (str) – Filename of google drive file being downloaded
Returns:

Return type:

None

get_files(root_dir: str) → List[str][source]

Returns a list of valid image files in a directory

Parameters:root_dir (str) – Path to directory of images.
Returns:List of valid images in root_dir directory.
Return type:List[str]
get_hr_transforms()[source]

Returns HR image transformations

get_lr_transforms()[source]

Returns HR to LR image transformations

is_valid_file(file_path: str) → bool[source]

Returns boolean if the given file_path has a valid image extension

Parameters:file_path (str) – Path to image file
Returns:True if file_path has a valid image extension otherwise False
Return type:bool
load_img(file_path: str) → PIL.Image.Image[source]

Returns a PIL Image of the image located at file_path

Parameters:file_path (str) – Path to image file to be loaded
Returns:Loaded image as PIL Image
Return type:PIL.Image.Image
class torch_enhance.datasets.BSDS300(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', train: bool = True, data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
download(data_dir: str) → None[source]

Download dataset

Parameters:data_dir (str) – Path to base dataset directory
Returns:
Return type:None
extensions = ['.jpg']
url = 'http://www2.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/BSDS300-images.tgz'
class torch_enhance.datasets.BSDS500(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', set_type: str = 'train', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
download(data_dir: str) → None[source]

Download dataset

Parameters:data_dir (str) – Path to base dataset directory
Returns:
Return type:None
extensions = ['.jpg']
url = 'http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/BSR/BSR_bsds500.tgz'
class torch_enhance.datasets.BSDS200(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1N9cK1OScGrACUgCms0f2rFlUOHhgkW0l'
class torch_enhance.datasets.BSDS100(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1nu78kEKoSTti7ynh8pdxa7ae7TvZiNOy'
class torch_enhance.datasets.Set5(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '14g2glfOdkxzZ2RnQZR6jYU5CoClsxQRo'
class torch_enhance.datasets.Set14(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1FSJqQVISh19onL1TUqPNor0uRyp8LlNb'
class torch_enhance.datasets.T91(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1VSG1e5nvdV9UCUSYuaKecNFuk3OPUat4'
class torch_enhance.datasets.Historical(scale_factor: int = 2, image_size: int = 256, color_space: str = 'L', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1sc14tdRslyZsfw1-LpoOCKF72kSWKedx'
class torch_enhance.datasets.Urban100(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1svYMEyfc5mkpnW6JnkF0ZS_KetgEYgLR'
class torch_enhance.datasets.Manga109(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1bEjcSRiT4V6vxjHjhr_jBPmAr3sGS_5l'
class torch_enhance.datasets.General100(scale_factor: int = 2, image_size: int = 256, color_space: str = 'RGB', data_dir: str = '', lr_transforms=None, hr_transforms=None)[source]
extensions = ['.png']
url = '1tD6XBLkV9Qteo2obMRcRueTRwie7Hqae'