Skip to content

How to get the iou of each class? #520

Answered by SkafteNicki
zsc1104 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, by setting the reduction parameter you can achieve this:

metric=IoU(num_classes=5, reduction='none')
target = torch.randint(0, 5, (10, 25, 25))
pred = torch.randint(0, 5, (10, 25, 25))
metric(pred, target)
tensor([0.1193, 0.1064, 0.1154, 0.1061, 0.1216])

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SkafteNicki
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants