Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Degradation method didn't match #14

Open
wyf0912 opened this issue Nov 24, 2019 · 1 comment
Open

Degradation method didn't match #14

wyf0912 opened this issue Nov 24, 2019 · 1 comment

Comments

@wyf0912
Copy link

wyf0912 commented Nov 24, 2019

In torchvision the default degradation method is PIL.Image.BILINEAR

@wyf0912
Copy link
Author

wyf0912 commented Nov 24, 2019

def __getitem__(self, index):
    """Read an image from a file and preprocesses it and returns."""
    image_path = self.image_paths[index]
    image = Image.open(image_path).convert('RGB')

    # target (high-resolution image)
    transform = transforms.RandomCrop(self.image_size * self.scale_factor) # transforms.Resize((self.image_size, self.image_size),interpolation=Image.BICUBIC)
    hr_image = transform(image)

    # input (low-resolution image)
    transform = transforms.Compose([
                        transforms.Lambda(lambda x: self.randkern.RandomBlur(x)),
                        **transforms.Resize((self.image_size, self.image_size)),**
                        transforms.Lambda(lambda x: Scaling(x)),
                        transforms.Lambda(lambda x: self.randkern.ConcatDegraInfo(x))
                ])
    lr_image = transform(hr_image)

    transform = transforms.ToTensor()
    lr_image, hr_image = transform(lr_image), transform(hr_image)

    return lr_image.to(torch.float64), hr_image.to(torch.float64)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant