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

Fade output #8

Open
akhalili opened this issue Mar 3, 2023 · 0 comments
Open

Fade output #8

akhalili opened this issue Mar 3, 2023 · 0 comments

Comments

@akhalili
Copy link

akhalili commented Mar 3, 2023

he super-resolution output I get is fade, I appreciate your hints how to get the right output. Here is how I normalize the lr image and transfer the output tensor to numpy to display with opencv

input normalization:

down_sampled_frm = cv.resize(gt_img, (0, 0), fx=1.0 / args.scale[0], fy=1.0 / args.scale[0])

cv.imshow("down sampled", down_sampled_frm)

down_sampled_frm = cv.cvtColor(down_sampled_frm, cv.COLOR_BGR2RGB)

down_sampled_frm = down_sampled_frm.transpose(2, 0, 1)

down_sampled_frm_tensor = torch.from_numpy(down_sampled_frm).float() / 255.

output tensor to opencv numpy:

up_sampled_frm_tensor = model.forward(down_sampled_frm_tensor[None, :])
up_sampled_frm = (up_sampled_frm_tensor[0] * 255).cpu().clamp(0, 255).round().byte().permute(1, 2, 0).numpy()
up_sampled_frm = cv.cvtColor(up_sampled_frm, cv.COLOR_RGB2BGR)

here I get at the end:

test

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