Skip to content

Support list of tensors in Metrics #2013

@vfdev-5

Description

@vfdev-5

🚀 Feature

Related to discussion from here: Project-MONAI/MONAI#2220 (comment)

The feature request is to support list of tensors or scalars as input for metrics:
a) classification problem:

acc = Accuracy()
output = (
    [torch.rand(10), torch.rand(10), torch.rand(10)],  # predictions
    [4, 5, 1],  # ground truth
)
acc.update(output)
print(acc.compute())

b) segmentation problem:

acc = Accuracy()
output = (
    [torch.rand(10, 32, 32), torch.rand(10, 40, 30), torch.rand(10, 30, 24)],  # predictions
    [torch.randint(0, 10, size=(32, 32)), torch.randint(0, 10, size=(40, 30)),  torch.randint(0, 10, size=(30, 24))],  # ground truth
)
acc.update(output)
print(acc.compute())

c) Same for API with Engine.

cc @Nic-Ma

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions