Skip to content

Commit 1b7d094

Browse files
author
SAY-5
committed
fix(utils/data_augmentation): correct dangling tgt_fov_max typo in sample_perspective
The absolute-range clamp in sample_perspective was written as: tgt_fov_x_min, tgt_fov_max = max(...), min(..., tgt_fov_x_max) which shadowed the wrong name: tgt_fov_x_max was never overwritten, so the subsequent rng.uniform(..., tgt_fov_x_max) call silently bypassed the absolute maximum clamp and tgt_fov_max became a dangling local. Rename the target to tgt_fov_x_max so the absolute bound is actually applied when drawing tgt_fov_x. Closes #146.
1 parent 0744441 commit 1b7d094

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

moge/utils/data_augmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def sample_perspective(
3434
fov_range_relative_min, fov_range_relative_max = fov_range_relative
3535
tgt_fov_x_min = min(fov_range_relative_min * raw_fov_x, utils3d.focal_to_fov(utils3d.fov_to_focal(fov_range_relative_min * raw_fov_y) / tgt_aspect))
3636
tgt_fov_x_max = min(fov_range_relative_max * raw_fov_x, utils3d.focal_to_fov(utils3d.fov_to_focal(fov_range_relative_max * raw_fov_y) / tgt_aspect))
37-
tgt_fov_x_min, tgt_fov_max = max(np.deg2rad(fov_range_absolute_min), tgt_fov_x_min), min(np.deg2rad(fov_range_absolute_max), tgt_fov_x_max)
37+
tgt_fov_x_min, tgt_fov_x_max = max(np.deg2rad(fov_range_absolute_min), tgt_fov_x_min), min(np.deg2rad(fov_range_absolute_max), tgt_fov_x_max)
3838
tgt_fov_x = rng.uniform(min(tgt_fov_x_min, tgt_fov_x_max), tgt_fov_x_max)
3939
tgt_fov_y = utils3d.focal_to_fov(utils3d.np.fov_to_focal(tgt_fov_x) * tgt_aspect)
4040

0 commit comments

Comments
 (0)