Skip to content

Commit

Permalink
adapt torch1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
anhtu293 committed Apr 5, 2023
1 parent f084b9f commit 13fda15
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions aloscene/depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def __new__(
names=("C", "H", "W"),
**kwargs
):

if isinstance(x, str):
x = load_depth(x)
names = ("C", "H", "W")
Expand Down Expand Up @@ -152,10 +151,10 @@ def encode_absolute(
depth = torch.clamp(depth, min=prior_clamp_min, max=prior_clamp_max)

if keep_negative and self.is_planar:
depth[torch.unsqueeze((depth < 1e-8) & (depth >= 0), dim=0)] = 1e-8
depth[torch.unsqueeze((depth >= -1e-8) & (depth < 0), dim=0)] = -1e-8
depth[(depth < 1e-8) & (depth >= 0)] = 1e-8
depth[(depth >= -1e-8) & (depth < 0)] = -1e-8
else:
depth[torch.unsqueeze(depth < 1e-8, dim=0)] = 1e-8
depth[depth < 1e-8] = 1e-8

depth.scale = scale
depth.shift = shift
Expand Down Expand Up @@ -234,7 +233,11 @@ def as_points3d(
intrinsic = camera_intrinsic if camera_intrinsic is not None else self.cam_intrinsic
projection = projection if projection is not None else self.projection
distortion = distortion if distortion is not None else self.distortion
assert projection in ["pinhole", "equidistant", "kumler_bauer"], "Only pinhole, equidistant and kumler_bauer are supported."
assert projection in [
"pinhole",
"equidistant",
"kumler_bauer",
], "Only pinhole, equidistant and kumler_bauer are supported."

# if self is not planar depth, we must convert to planar depth before projecting to 3d points
if self.is_planar:
Expand Down

0 comments on commit 13fda15

Please sign in to comment.