Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depth_to_3d_v2 batching Bug #2970

Open
ChristophReich1996 opened this issue Jul 28, 2024 · 2 comments
Open

depth_to_3d_v2 batching Bug #2970

ChristophReich1996 opened this issue Jul 28, 2024 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@ChristophReich1996
Copy link
Contributor

Describe the bug

The function depth_to_3d_v2 accepts a camera matrix of the shape (*, 3, 3). However, depth_to_3d_v2 internally uses the unproject_meshgrid fuction that only supports a camera matrix of the shape (3, 3). When feeding a camera matrix of the shape (B, 3, 3) into depth_to_3d_v2, a runtime error occurs.

Reproduction steps

import torch
from kornia.geometry import depth_to_3d_v2

B, H, W = 4, 512, 512

disparity = torch.rand(B, H, W)
intrinsics = torch.tensor([[2262.52, 0.0, 1096.98], [0.0, 2265.3017905988554, 513.137], [0.0, 0.0, 1.0]])[None].repeat(B, 1, 1)

points_3d = depth_to_3d_v2(disparity, intrinsics)

Expected behavior

To fix this bug, either depth_to_3d_v2 should be restricted to a shape of (3, 3) or unproject_meshgrid should be extended to (*, 3, 3).

Environment

The latest Kornia version was used. The bug is independent of the platform.

Additional context

No response

@ChristophReich1996 ChristophReich1996 added the help wanted Extra attention is needed label Jul 28, 2024
@johnnv1
Copy link
Member
johnnv1 commented Jul 29, 2024

it's indeed a bug. I think this one is a duplicate of #2709

@edgarriba
Copy link
Member

@ChristophReich1996 i cannot commit to fix this now -- are you open to send a PR with a solution ? I think that we should remove v2 and just adapt the other to support optional grids

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants