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

Add Bundle Adjustment Module #120

Open
wang-chen opened this issue Aug 29, 2022 · 7 comments
Open

Add Bundle Adjustment Module #120

wang-chen opened this issue Aug 29, 2022 · 7 comments
Labels
new feature New feature or request

Comments

@wang-chen
Copy link
Member

🚀 The feature, motivation and pitch

As stated in the title, a differential bundle adjustment module is required in many SLAM systems.
This module may require the following implemented functionalities.

Alternatives

No response

Additional context

No response

@wang-chen wang-chen added the new feature New feature or request label Sep 4, 2022
@HongLouyemeng HongLouyemeng self-assigned this Jan 8, 2023
@lizimo061
Copy link

lizimo061 commented Apr 11, 2023

Hi there, I wrote a small example based on BAL dataset, but I found it is extremely slow even on the smallest dataset(with the vectorize option off, CUDA out of memory reported if on), any good suggestion?

class BAGraph(nn.Module):

    def __init__(self, cameras, points, intrinsics):
        super().__init__()
        self.cameras = pp.Parameter(cameras)
        self.points = nn.Parameter(points)
        self.intrinsics = nn.Parameter(intrinsics)

    def forward(self, observations, camera_index, pt_index):
        pt_cam = self.cameras[camera_index, ...].Act(self.points[pt_index, ...])
        pt_image = -pt_cam[..., :2] / torch.unsqueeze(pt_cam[..., 2], 1)
        pt_norm = torch.linalg.vector_norm(pt_image, ord=2, dim=1)
        distortion_factors = 1 + self.intrinsics[camera_index, ..., 1] * pt_norm**2 + self.intrinsics[camera_index, ...,
                                                                                                      2] * pt_norm**4
        pt_pixel = torch.unsqueeze(self.intrinsics[camera_index, ..., 0], 1) * torch.unsqueeze(distortion_factors,
                                                                                               1) * pt_image
        error = pt_pixel - observations
        return error

@wang-chen
Copy link
Member Author

Hi, we are currently implementing sparse tensors, which will solve this problem. @zitongzhan

@zitongzhan
Copy link
Contributor

BA is dependent on this issue: #207

@hxu296
Copy link
Member

hxu296 commented Jul 8, 2023

Hi there, I wrote a small example based on BAL dataset, but I found it is extremely slow even on the smallest dataset(with the vectorize option off, CUDA out of memory reported if on), any good suggestion?

class BAGraph(nn.Module):

    def __init__(self, cameras, points, intrinsics):
        super().__init__()
        self.cameras = pp.Parameter(cameras)
        self.points = nn.Parameter(points)
        self.intrinsics = nn.Parameter(intrinsics)

    def forward(self, observations, camera_index, pt_index):
        pt_cam = self.cameras[camera_index, ...].Act(self.points[pt_index, ...])
        pt_image = -pt_cam[..., :2] / torch.unsqueeze(pt_cam[..., 2], 1)
        pt_norm = torch.linalg.vector_norm(pt_image, ord=2, dim=1)
        distortion_factors = 1 + self.intrinsics[camera_index, ..., 1] * pt_norm**2 + self.intrinsics[camera_index, ...,
                                                                                                      2] * pt_norm**4
        pt_pixel = torch.unsqueeze(self.intrinsics[camera_index, ..., 0], 1) * torch.unsqueeze(distortion_factors,
                                                                                               1) * pt_image
        error = pt_pixel - observations
        return error

Hello, you can try an unofficial pypose-native BAL colab example here. The smallest problem (problem-49-7776-pre) works fine on both CPU and GPU, and you can change the problem by using CLI parameters.

@zitongzhan zitongzhan moved this from TODO to In Progress in Towards Next Major Release Aug 31, 2023
@HongLouyemeng HongLouyemeng removed their assignment Oct 22, 2023
@chenjiajie9811
Copy link

Any update on the official implementation for the differentiable BA?

@zitongzhan
Copy link
Contributor

Any update on the official implementation for the differentiable BA?

We are preparing for it and tuning its final APIs.

@jiaming-ai
Copy link

hi, any expected date for releasing this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
Status: In Progress
Status: No status
Development

No branches or pull requests

7 participants