CSAILVision / CSAILVision/semantic-segmentation-pytorch

Using TochMetrics for code simplification

Open
#276 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
5.1k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

# :hammer_and_wrench: Proposed Refactor
We have been developing [TorchMetrics](https://github.com/PyTorchLightning/metrics) 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](https://torchmetrics.readthedocs.io/en/stable/) you may rely on the widely tested correctness (testing against gold standards 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 compute](https://devblog.pytorchlightning.ai/torchmetrics-v0-8-paper-faster-collection-and-more-metrics-4a040619eb1d) for 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 [mit_semseg.utils](https://github.com/CSAILVision/semantic-segmentation-pytorch/tree/master/mit_semseg/utils.py) can be simplified with TM

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.