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
The target is:
target
[ {'boxes': tensor([[ 8.0000, 70.0000, 76.0000, 110.0000], [247.0000, 131.0000, 315.0000, 175.0000], [361.0000, 177.0000, 395.0000, 203.0000]]), 'labels': tensor([0, 0, 0])} ]
The preds is:
preds
[ {'boxes': empty(size=(0, 4)), 'labels': tensor([], dtype=torch.int64), 'scores': tensor([])} ]
The last item of preds is empty, when using torchmetrics.detection.iou.IntersectionOverUnion to calculate IoU, the result is nan.
import torch from torch import tensor from torch import empty from torchmetrics.detection import IntersectionOverUnion def calc_iou(preds: list, target: list): metric = IntersectionOverUnion() metric.update(preds, target) result = metric.compute() return result target = [ {'boxes': tensor([[ 8.0000, 70.0000, 76.0000, 110.0000], [247.0000, 131.0000, 315.0000, 175.0000], [361.0000, 177.0000, 395.0000, 203.0000]]), 'labels': tensor([0, 0, 0])} ] preds = [ {'boxes': empty(size=(0, 4)), 'labels': tensor([], dtype=torch.int64), 'scores': tensor([])} ] calc_iou(preds, target)
{'iou': tensor(nan)}
A correct iou value, i.e: 0.0
The text was updated successfully, but these errors were encountered:
Hi! thanks for your contribution!, great first issue!
Sorry, something went wrong.
IOU
Successfully merging a pull request may close this issue.
🐛 Bug
To Reproduce
The
target
is:The
preds
is:The last item of preds is empty, when using torchmetrics.detection.iou.IntersectionOverUnion to calculate IoU, the result is nan.
Code sample
{'iou': tensor(nan)}
Expected behavior
A correct iou value, i.e: 0.0
Environment
Additional context
The text was updated successfully, but these errors were encountered: