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
Q: Why not use adjust_brightness of torchvision? #36
Comments
Yes, it is because they are not differentiable. |
Do you know why? Because I looked at their code and from first glance I thought they were. |
I had a second look - it seems that torchvision transforms recently have supported torch tensors, which may be differentiable as opposed to PIL images. But they are not implemented to work for GANs, e.g., pixels that are not in [0, 1] after augmentation will be clipped and have no gradients. |
Yeah, all right, I see, thanks. :) But there is still something I don't understand... rand_brigthness outputs a tensor in range [-1.5, 1.5] according to your code (unless I'm mistaken). And then if you apply rand_contrast to this tensor, its input range won't be [-1.0, 1.0] as wanted. Isn't each transform supposed to output a tensor in the same range as the input tensor? |
In our implementation the output range of each transform is not necessarily [-1, 1], though intuitively it should be. |
So do you think I can add a line |
You may have a try, but I'm not sure whether it will work as some pixels will not have gradients. Without clamp it should also work fine. |
All right, thanks! |
Why not use functions from torchvision instead of writing you own? Is it because adjust_brightness, adjust_saturation and adjust_contrast of torchvision are not differentiable? Because I thought they were. Thanks for your answer. :)
The text was updated successfully, but these errors were encountered: