Pytorch - How to speed up data loading

In the Single Image Super Resolution with various prediction networks post, we used DIV2K and Flicker2K dataset for training. Below is a python snippet for both datasets. from glob import glob import torch from torch.utils.data import Dataset import torchvision from PIL import Image import numpy as np class SuperResolutionDataset(Dataset): def __init__(self, dataset_path, dataset_name_HR, dataset_name_LR, scale, name): self.name = name self.dataset_path = dataset_path self.dataset_name_HR = dataset_name_HR self.dataset_name_LR = dataset_name_LR self.scale = scale self....

January 19, 2025 · 6 min · Michał Znaleźniak