Skip to content

Commit

Permalink
Merge pull request #3 from GewelsJI/main
Browse files Browse the repository at this point in the history
New PR about the inconsistency of numpy and matlab codes

Thanks!
  • Loading branch information
lartpang authored Dec 20, 2021
2 parents f5ce652 + dbeba62 commit 6f257b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py_sod_metrics/sod_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from scipy.ndimage import convolve
from scipy.ndimage import distance_transform_edt as bwdist

_EPS = 1e-16
_EPS = np.spacing(1) # the different implementation of epsilon (extreme min value) between numpy and matlab
_TYPE = np.float64


Expand Down Expand Up @@ -238,7 +238,7 @@ def object(self, pred: np.ndarray, gt: np.ndarray) -> float:

def s_object(self, pred: np.ndarray, gt: np.ndarray) -> float:
x = np.mean(pred[gt == 1])
sigma_x = np.std(pred[gt == 1])
sigma_x = np.std(pred[gt == 1], ddof=1)
score = 2 * x / (np.power(x, 2) + 1 + sigma_x + _EPS)
return score

Expand Down

0 comments on commit 6f257b6

Please sign in to comment.