Skip to content

Commit

Permalink
Fix a minor bug: use point to point depth for supervising neural rend…
Browse files Browse the repository at this point in the history
…ering
  • Loading branch information
HaoyiZhu authored Mar 15, 2024
1 parent 6576cc1 commit bd8cda8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ponder/models/ponder/ponder_indoor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@ def ray_sample(self, data_dict):
ray_o = ray_o[pixels_y, pixels_x, :]
ray_d = ray_d[pixels_y, pixels_x, :]

# convert plane-to-plane depth to point-to-point depth
cam2lidar = torch.linalg.inv(RT)
plane_dir = (
cam2lidar @ torch.FloatTensor([0, 0, 1, 1]).to(RT.device)[:, None]
)[:3, 0] - ray_o[0]
plane_dir = plane_dir / torch.linalg.norm(plane_dir)
depth = depth / torch.linalg.multi_dot((ray_d, plane_dir))

mask_at_box = torch.from_numpy(
self.get_mask_at_box(ray_o.cpu().numpy(), ray_d.cpu().numpy())
).to(ray_o.device)
Expand Down

0 comments on commit bd8cda8

Please sign in to comment.