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

How to modified the proposed SR to train with y_only input ? #796

Open
vincentweisen1357 opened this issue May 8, 2024 · 0 comments
Open

Comments

@vincentweisen1357
Copy link

vincentweisen1357 commented May 8, 2024

Hi all,

In BasicSR, we can add the 'color: y' option to the .YAML file to train with y_only grayscale image.
For instance:

datasets:
train:
name: DIV2K
type: PairedImageDataset
color: y

However, RealESRGANDataset do not provide this option, so that I tried to modify myself in RealESRGANDataset like this before function return:

    **img_gt = bgr2ycbcr(img_gt, y_only=True)[..., None]**
    img_gt = img2tensor([img_gt], bgr2rgb=True, float32=True)[0]
    kernel = torch.FloatTensor(kernel)
    kernel2 = torch.FloatTensor(kernel2)

But still report an error in realesrnet_model.py

line102 : "Input image tensor permitted channel values are [3], but found 1"
out = random_add_poisson_noise_pt(
out,
scale_range=self.opt['poisson_scale_range'],
gray_prob=gray_noise_prob,
clip=True,
rounds=False)

Anyone can help please?

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