Binary class usage #541
Unanswered
tridivb
asked this question in
Classification
Replies: 2 comments
-
I just realized, this seems to be a bug because as per the docstring below, the prediction and target should both be flatttened arrays. The intended classes would then end up being wrong in any case as it only assigns the very first value of the array, in turn failing the class consistency check. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Is there an answer for this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In which format does the library expect Binary logit predictions to be for metric modules like Accuracy? I am a bit confused with the description here,
https://github.com/PyTorchLightning/metrics/blob/3613a21dfaed5257656b18879dc12973027a7caa/torchmetrics/utilities/checks.py#L310
My current binary segmentation model outputs are of the form Nx1xHxW (sigmoids of predicted logits) and targets are NxHxW.
Currently, the following code snippet uses the
pred.ndims
to assign the case i.e. BINARY or others which seems counter-intuitive for my case.https://github.com/PyTorchLightning/metrics/blob/3613a21dfaed5257656b18879dc12973027a7caa/torchmetrics/utilities/checks.py#L74
Moreover, due to my output being single channel sigmoid probabilities, the implied_classes are also assigned wrongly.
https://github.com/PyTorchLightning/metrics/blob/3613a21dfaed5257656b18879dc12973027a7caa/torchmetrics/utilities/checks.py#L83
Previously, with pytorch lightning 1.1, this wasn't an issue as the
_input_format_classification
used to either threshold (for binary) or take the argmax (for multiclass) predictions and assign the num_classes from there.Is there a specific reason to move away from the previous approach and how are we supposed to use the Metrics for the above case now?
Beta Was this translation helpful? Give feedback.
All reactions