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

ESRGAN datasets.py problem #198

Open
lizhuoq opened this issue Aug 9, 2023 · 0 comments
Open

ESRGAN datasets.py problem #198

lizhuoq opened this issue Aug 9, 2023 · 0 comments

Comments

@lizhuoq
Copy link

lizhuoq commented Aug 9, 2023

In the denormalize function, the range for clamping the tensor should be between 0 and 1. This is because the input tensors to the function include one tensor processed by the ToTensor function and another tensor generated by the network. The valid value range for both of these tensors is between 0 and 1. Therefore, the denormalize function should be modified accordingl. Modify it as follows:

def denormalize(tensors):
    ''' channel in the second dim'''
    for c in range(3):
        tensors[:, c].mul_(std[c]).add_(mean[c]) # Underscores are in-place operations
    return torch.clamp(tensors, 0, 1)
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