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

there may be a small bug when the quality is 100 #7

Open
brightendavid opened this issue Jul 8, 2022 · 2 comments
Open

there may be a small bug when the quality is 100 #7

brightendavid opened this issue Jul 8, 2022 · 2 comments

Comments

@brightendavid
Copy link

thank you for your work.
when i train my net in watermark,it gets NaN when the quality setted to be 100.However, it is just a small bug,and not affect the whole.

@jj199603
Copy link

I also find this bug. This is because the quality factor will be 0 if you set quality too 100. Then, the factor will be an DIVISION BY ZERO error in quantization. My solution is add 0.0001 to the factor:
quality/100. + 0.0001 in function quality_to_factor.
Of course, if you use a random quality, such as torch.rand(1)*100, this bug is no problem, because the range is [0, 100). In my experiment, I set this value = 100. - torch.rand(1)*50, although the range is (50, 100], since the probability is continuous, the probability of getting to 100 is almost zero.

@jj199603
Copy link

This is because the quality factor will be 0 if you set quality too 100. Then, the factor will be an DIVISION BY ZERO error in quantization. My solution is add 0.0001 to the factor:

I also find this bug. This is because the quality factor will be 0 if you set quality too 100. Then, the factor will be an DIVISION BY ZERO error in quantization. My solution is add 0.0001 to the factor:
quality/100. + 0.0001 in function quality_to_factor.
Of course, if you use a random quality, such as torch.rand(1)*100, this bug is no problem, because the range is [0, 100). In my experiment, I set this value = 100. - torch.rand(1)*50, although the range is (50, 100], since the probability is continuous, the probability of getting to 100 is almost zero.

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

2 participants