Skip to content

Commit

Permalink
fix features zero division causing nan value
Browse files Browse the repository at this point in the history
  • Loading branch information
originlake committed Sep 6, 2023
1 parent 2211a49 commit 84d9776
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions opensfm/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def root_feature(desc: np.ndarray, l2_normalization: bool = False) -> np.ndarray
desc = (desc.T / s2).T
s = np.sum(desc, 1)
desc = np.sqrt(desc.T / s).T
desc[np.isnan(desc)] = 0
return desc


Expand All @@ -308,6 +309,7 @@ def root_feature_surf(
s_sub = np.sum(np.abs(desc), 1)
desc_sub = np.sqrt(desc_sub.T / s_sub).T
desc[:, ii] = desc_sub * desc_sub_sign
desc[np.isnan(desc)] = 0
return desc


Expand Down

0 comments on commit 84d9776

Please sign in to comment.