Skip to content

Commit b5cf3b0

Browse files
YanNounfacebook-github-bot
authored andcommitted
fix: ignore NaN angular residual
Summary: This Diff fixes edges cases where Nan angular residual could make their way in case of wrecked datasets. Reviewed By: fabianschenk Differential Revision: D28710005 fbshipit-source-id: 91a1e2f193ec430439f367cfd5471438a8d6aebf
1 parent 176d6bd commit b5cf3b0

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

opensfm/stats.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def _projection_error(tracks_manager, reconstructions):
141141
norm_pixels = _norm2d(error_unnormalized * normalizer)
142142
norm_normalized = _norm2d(error_normalized)
143143
norm_angle = error_angular[0]
144-
if norm_pixels > RESIDUAL_PIXEL_CUTOFF:
144+
if norm_pixels > RESIDUAL_PIXEL_CUTOFF or math.isnan(norm_angle):
145145
continue
146146
average_error_normalized += norm_normalized
147147
average_error_pixels += norm_pixels
@@ -801,8 +801,12 @@ def save_residual_grids(
801801

802802
for i in range(len(reconstructions)):
803803
valid_observations = _get_valid_observations(reconstructions, tracks_manager)(i)
804-
errors_scaled = _compute_errors(reconstructions, tracks_manager)(i, pymap.ErrorType.Normalized)
805-
errors_unscaled = _compute_errors(reconstructions, tracks_manager)(i, pymap.ErrorType.Pixel)
804+
errors_scaled = _compute_errors(reconstructions, tracks_manager)(
805+
i, pymap.ErrorType.Normalized
806+
)
807+
errors_unscaled = _compute_errors(reconstructions, tracks_manager)(
808+
i, pymap.ErrorType.Pixel
809+
)
806810

807811
for shot_id, shot_errors in errors_scaled.items():
808812
shot = reconstructions[i].get_shot(shot_id)

0 commit comments

Comments
 (0)