We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using JaccardIndex with ClasswiseWrapper results in different values than without ClasswiseWrapper.
JaccardIndex
ClasswiseWrapper
Steps to reproduce the behavior...
Run the code snippet.
from torchmetrics import ClasswiseWrapper, JaccardIndex import torch target = torch.randint(0, 2, (10, 25, 25)) preds = [ torch.randint(0, 2, (10, 25, 25)) for i in range (3)] jaccard_single = JaccardIndex(num_classes=2, average=None) class_wrapper = ClasswiseWrapper( JaccardIndex(num_classes=2, average=None), labels=["class1", "class2"] ) for p in preds: print("Metric ",jaccard_single(p,target)) print("Wraped metric ",class_wrapper(p,target))
The code produces the following output:
Metric tensor([0.3351, 0.3333]) Wraped metric {'jaccardindex_class1': tensor(0.3351), 'jaccardindex_class2': tensor(0.3333)} Metric tensor([0.3293, 0.3357]) Wraped metric {'jaccardindex_class1': tensor(0.3322), 'jaccardindex_class2': tensor(0.3345)} Metric tensor([0.3424, 0.3435]) Wraped metric {'jaccardindex_class1': tensor(0.3356), 'jaccardindex_class2': tensor(0.3375)}
I would expect that the wrapped metric outputs the same values as the simple JaccardIndex.
conda
pip
The text was updated successfully, but these errors were encountered:
Hi! thanks for your contribution!, great first issue!
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
🐛 Bug
Using
JaccardIndex
withClasswiseWrapper
results in different values than withoutClasswiseWrapper
.To Reproduce
Steps to reproduce the behavior...
Run the code snippet.
Code sample
The code produces the following output:
Expected behavior
I would expect that the wrapped metric outputs the same values as the simple
JaccardIndex
.Environment
conda
,pip
, build from source):Installed version 0.9.2 using pip
Tested with Python 3.8.14 and pytorch 1.3.1
Additional context
The text was updated successfully, but these errors were encountered: