-
Notifications
You must be signed in to change notification settings - Fork 413
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
Add Visual Information Fidelity #1830
Conversation
for more information, see https://pre-commit.ci
@bojobo cool adding, feel free to reach out if you need help with anything :] |
Will do that, thanks :) |
# Conflicts: # src/torchmetrics/functional/image/vif.py # src/torchmetrics/image/vif.py
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I'm sure that I'm on the right path, but I can't quite get the same results as the packages I'm using for reference. Do you see any differences in the implementation? Or any fatal errors? Also, I'm not quite sure how to implement the tests, since I've almost never done that (I know, I know, shame on me). I'm grateful for any form of help :) |
Hi @bojobo, sorry for not responding sooner. import sewar
import torch
import numpy as np
preds = np.random.randint(0, 255, (1, 41, 41, 1), dtype=np.uint8)
target = np.random.randint(0, 255, (1, 41, 41, 1), dtype=np.uint8)
compare = sewar.full_ref.vifp(target.squeeze(), preds.squeeze())
from torchmetrics.functional.image.vif import visual_information_fidelity
tm_res = visual_information_fidelity(
torch.tensor(preds).permute(0,3,1,2),
torch.tensor(target).permute(0,3,1,2),
data_range=255.0
).item()
print(compare)
print(tm_res)
print(abs(compare - tm_res)) I get a difference in result of 1e-7 to 1e-9. So the implementation seems to be working to me. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@SkafteNicki Thanks for the reply!
|
Hi @bojobo, I have fixed the typing issue. These two lines were missing: torchmetrics/src/torchmetrics/image/vif.py Lines 44 to 45 in 45cc591
which informs mypy about the type of the metric states. For the ddp, I have to look further into that. |
# Conflicts: # src/torchmetrics/image/vif.py
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1830 +/- ##
========================================
- Coverage 85% 43% -42%
========================================
Files 260 262 +2
Lines 14912 14998 +86
========================================
- Hits 12669 6378 -6291
- Misses 2243 8620 +6377 |
What does this PR do?
Adds metric visual information fidelity (vif). See #799
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃
📚 Documentation preview 📚: https://torchmetrics--1830.org.readthedocs.build/en/1830/