question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support list of tensors in Metrics

See original GitHub issue

🚀 Feature

Related to discussion from here: https://github.com/Project-MONAI/MONAI/issues/2220#issuecomment-849250700

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
vfdev-5commented, May 31, 2021

I think once we are OK with details on what to add, we can try to implement it and schedule for this release.

0reactions
Nic-Macommented, Jun 9, 2021

Sounds great!

Thanks for your update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Structure Overview — PyTorch-Metrics 0.11.0 documentation
This pattern is implemented for the following operators (with a being metrics and b being metrics, tensors, integer or floats):. Addition ( a...
Read more >
monai.metrics.metric — MONAI 0.7.0 Documentation
It can support both `list of channel-first Tensor` and `batch-first Tensor`. And users can execute on every batch of data, then accumulate the...
Read more >
tfr.keras.metrics.OPAMetric - Ranking - TensorFlow
This method can be used inside a subclassed layer or model's call function, in which case losses should be a Tensor or list...
Read more >
Two-Dimensional Tensors in Pytorch
Let's demonstrate by converting a 2D list of integers to a 2D tensor object. As an example, we'll create a 2D list and...
Read more >
API reference — TensorLy: Tensor Learning in Python
While in some backends (e.g. NumPy), you can directly combine indexing and assignement, not all backends support this. Instead of tensor[indices] = values ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found