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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

intersection_over_union error #2534

Open
bennymi opened this issue May 10, 2024 · 1 comment
Open

intersection_over_union error #2534

bennymi opened this issue May 10, 2024 · 1 comment
Labels
bug / fix Something isn't working help wanted Extra attention is needed v1.2.x

Comments

@bennymi
Copy link

bennymi commented May 10, 2024

馃悰 Bug

Trying to copy over the Jaccard Index example to use with the functional IoU, results in the following error:

RuntimeError: The size of tensor a (23) must match the size of tensor b (2) at non-singleton dimension 2

To Reproduce

Steps to reproduce the behavior...

from torchmetrics.functional.detection import intersection_over_union

target = torch.randint(0, 2, (10, 25, 25))
preds = torch.tensor(target)
preds[2:5, 7:13, 9:15] = 1 - preds[2:5, 7:13, 9:15]

intersection_over_union(preds=preds[2], target=target[2])

Expected behavior

Expecting to get the same prediction as in the Jaccard Index example.

Environment

  • TorchMetrics version (and how you installed TM, e.g. conda, pip, build from source):
    • installed with pip: torchmetrics 1.2.1
  • Python & PyTorch Version (e.g., 1.0):
    • Python 3.11.6 + PyTorch 2.1.0
  • Any other relevant information such as OS (e.g., Linux):
    • Windows 10
@bennymi bennymi added bug / fix Something isn't working help wanted Extra attention is needed labels May 10, 2024
Copy link

Hi! thanks for your contribution!, great first issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working help wanted Extra attention is needed v1.2.x
Projects
None yet
Development

No branches or pull requests

2 participants