diff --git a/oodeel/methods/mahalanobis.py b/oodeel/methods/mahalanobis.py index e32d215..3b29ca7 100644 --- a/oodeel/methods/mahalanobis.py +++ b/oodeel/methods/mahalanobis.py @@ -74,9 +74,9 @@ def _fit_to_dataset(self, fit_dataset: DatasetType) -> None: / _zero_f_cls.shape[0] ) if mean_cov is None: - mean_cov = (len(_features_cls) / len(features)) * cov_cls + mean_cov = (len(_features_cls) / len(features[0])) * cov_cls else: - mean_cov += (len(_features_cls) / len(features)) * cov_cls + mean_cov += (len(_features_cls) / len(features[0])) * cov_cls # pseudo-inverse of the mean covariance matrix self._pinv_cov = self.op.pinv(mean_cov) diff --git a/oodeel/methods/rmds.py b/oodeel/methods/rmds.py index c0f5b2f..b08ecf8 100644 --- a/oodeel/methods/rmds.py +++ b/oodeel/methods/rmds.py @@ -96,7 +96,7 @@ def _score_tensor(self, inputs: TensorType) -> Tuple[np.ndarray]: # take the highest score for each sample gaussian_score_corrected = self.op.max( - gaussian_score_bg - gaussian_score_p, dim=1 + gaussian_score_p - gaussian_score_bg, dim=1 ) return -self.op.convert_to_numpy(gaussian_score_corrected)