Comments (3)
Hi! thanks for your contribution!, great first issue!
from torchmetrics.
Hi @lgienapp, thanks for opening this issue.
I am not against adding this feature, but maybe we should consider adding:
- an general
MetricInputTransformer
class where user can provide custom functions for transforming the input - then
BinarizedTargetWrapper
can be included as just a subclassMetricInputTransformer
with pre-selected transforms
how does that sound?
from torchmetrics.
Establishing a general class sounds good. Just for clarification: the general MetricInputTransformer
would still subclass the WrapperMetric
to inherit all the "reset-sync" code from there (e.g., live in torchmetrics.wrappers.transformations
)? Or be its own thing (e.g., live in torchmetrics.transformations.abstract
), possibly duplicating the sync code from the wrapper base class?
In either case, I would propose an implementation like this (subclassing wrappers here), assuming that only positional params like preds
and targets
would be interesting to modify (and thus ignoring kwargs e.g. indices
):
class MetricInputTransformer(WrapperMetric):
def __init__(self, wrapped_metric: Union[Metric, MetricCollection], **kwargs: Any):
super().__init__(**kwargs)
self.wrapped_metric = wrapped_metric
def transform(self, *args) -> Tuple[torch.Tensor]:
raise NotImplementedError
def update(self, *args, **kwargs: Any) -> None:
self.wrapped_metric.update(*self.transform(*args), **kwargs)
def compute(self) -> Any:
return self.wrapped_metric.compute()
def forward(self, *args, **kwargs: Any) -> Any:
self.wrapped_metric.forward(*self.transform(*args), **kwargs)
from torchmetrics.
Related Issues (20)
- Mean Average Detection ignores `warn_on_many_detections` set to False HOT 1
- `list` states leak (`Tensor`) memory HOT 1
- Behaviors of AUROC and Average Precision are inconsistent when all labels are equal HOT 4
- The default value of `compute_with_cache` should be `True` . HOT 2
- Bug in ERGAS HOT 2
- Ordinal classification metrics HOT 1
- Binary Classification Expected Calibration Error HOT 2
- `intersection_over_union` error HOT 2
- Clarify that nan is supported in zero_division HOT 4
- Add `_filter_kwargs` in `ClasswiseWrapper` metric wrapper HOT 3
- MetricTracker use higher_is_better as default for maximize HOT 2
- Unpredictable class order when `panoptic_quality(..., return_per_class=True)`
- torchmetrics Accuracy HOT 8
- BootStrapper.reset() does not reset properly
- segmentation.MeanIoU is wrong HOT 3
- DataLoader worker is killed in Docker HOT 4
- MeanAveragePrecision - bug in `max_detection_thresholds` HOT 3
- Documentation of ERGAS HOT 1
- Support for DLM (AIM) metric HOT 1
- Error for index tensor verification in GeneralizedDice if target is zeros HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchmetrics.