RecoveryCoefficient#
- class deepinv.loss.metric.RecoveryCoefficient(eps=None, **kwargs)[source]#
Bases:
MetricRecovery Coefficient metric used in emission tomography.
Computes the ratio between the total reconstructed activity and the total ground-truth activity inside a given region of interest, defined by a mask:
\[RC = \frac{\sum_i \hat{x}_i m_i} {\sum_i x_i m_i + \varepsilon}\]where \(\hat{x}\) is the reconstructed image, \(x\) is the ground-truth image, \(m\) is a binary or weighted mask defining the region of interest, and \(\varepsilon\) is a small constant added for numerical stability.
A value of
1indicates perfect recovery of activity within the masked region. Values below1indicate underestimation, while values above1indicate overestimation.Note
This metric requires a
maskkeyword argument to be provided during evaluation.Note
Higher values are better when they are closer to
1. Therefore,lower_better=False.- Example:
>>> import torch >>> from deepinv.loss.metric import RecoveryCoefficient >>> m = RecoveryCoefficient() >>> x = torch.ones(2, 1, 4, 4) >>> x_net = torch.ones(2, 1, 4, 4) >>> mask = torch.ones_like(x) >>> m(x_net, x, mask=mask) tensor([1., 1.])
- Parameters:
eps (float) – Small constant added to the denominator for numerical stability.
kwargs – Additional keyword arguments passed to the parent
deepinv.loss.metric.Metricclass.