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.

Using TochMetrics for code simplification

See original GitHub issue

🛠️ Proposed Refactor

We have been developing TorchMetrics to be a general-purpose metric and some domain-specific use-cases. In many cases, we have an exact mapping to scikit-learn with verification/testing to the reference metric for its correctness. The TM includes functional as well as nn.Module versions and for the most/standard metrics, the only dependency is PyTorch (for the domain-specific metrics you need to install related extras).

Suggest a potential alternative/fix

WIth using TM metrics you may rely on the widely tested correctness (testing against good standard pycocotools in multiple OS environments and all PyTorch versions above v1.4), and later you can use nn.Module to leverage update and compute. Moreover, the recent release v0.8 allows re-using/sharing common compete similar as you leverage confusion matrix.

Overall if you are fine with it, we are happy to draft a PR with a suggested change to verify in place the impact. If you have any questions, happy to follow up with me or @aniketmaurya

What I have quickly checked, all this segmentation_models_pytorch.metrics can be replaced by TM

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:7
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
qubvelcommented, Aug 22, 2022

Hi @aniketmaurya Let’s try to intargate it, it could be a great feature!

2reactions
Bordacommented, Jun 21, 2022

Mind have look @@aniketmaurya ^^

Read more comments on GitHub >

github_iconTop Results From Across the Web

Structure Overview — PyTorch-Metrics 0.11.0 documentation
TorchMetrics is a Metrics API created for easy metric development and usage in PyTorch and PyTorch Lightning. It is rigorously tested for all...
Read more >
Simplify your PyTorch code with PyTorch Lightning - Medium
Simplify your PyTorch code with PyTorch Lightning. An introduction to PyTorch Lightning, a framework for making deep learning model training easier and ...
Read more >
Simplify And Scale Your PyTorch Code With PyTorch Lighting
This code will quickly blow up and become very complicated. This is where PyTorch Lightning comes in. Step 1: Design the LightningModule. To ......
Read more >
How to Simplify Code in One Minute - YouTube
I hear ya @thnkwww! Let's go back into our “How to Play a Sounds in Swift” and let's shrink that duplicate code !...
Read more >
Writing better code with pytorch+einops
The last thing left is get rid of conv1x1 and conv3x3 in the code - those are not better than standard. Simplifying ResNet....
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