Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New PR about the inconsistency of numpy and matlab codes #3

Merged
merged 1 commit into from
Dec 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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