Fix unintended zero-only target in iou example (#4262)

This commit is contained in:
Dusan Drevicky 2020-10-21 11:18:25 +02:00 committed by GitHub
parent 5d1583d7f2
commit 73863e9102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1024,11 +1024,11 @@ def iou(
Example:
>>> target = torch.randint(0, 1, (10, 25, 25))
>>> target = torch.randint(0, 2, (10, 25, 25))
>>> pred = torch.tensor(target)
>>> pred[2:5, 7:13, 9:15] = 1 - pred[2:5, 7:13, 9:15]
>>> iou(pred, target)
tensor(0.4914)
tensor(0.9660)
"""
num_classes = get_num_classes(pred=pred, target=target, num_classes=num_classes)