SAM and ERGAS for images with zero-value pixels #1127
Unanswered
maciejzj
asked this question in
CompVision
Replies: 1 comment
-
Also, adding EPS to the divider may be a solution too. |
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
-
Hi, I am using SAM and ERGAS from TorchMetrics with images that happen to be padded with zero values (which is quite common in remote sensing). The pixels with value zero cause the metrics to (maybe?) break. SAM becomes
nan
and EGASinf
. The cause of this lies in the math formulas (zero divisions) so theoretically speaking the functions work correctly.However, this is rather inconvenient. Would you consider letting the behavior of these functions change so they can handle pixels with zero value? I think it can be fixed with changing
torch.sum
andtorch.mean
totorch.nansum
andtorch.nanmean
in several places. I am not sure what is the approach you have for the edge cases like this in the metrics.Example of this problem in Python REPL:
This can be easily mitigated on the user side for SAM (
sam(pred, target, reduction=None).nanmean()
), but I am not so sure about ERGAS.Beta Was this translation helpful? Give feedback.
All reactions