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

I have implemented all regularizations, anybody isis interested in same surface-recon and discuss with me? #17

Open
yuedajiong opened this issue Dec 18, 2023 · 8 comments

Comments

@yuedajiong
Copy link

I urgently need a partner for discussion who shares the same direction.

@cdcseacave
Copy link

I am also working on implementing the regularizations, I am at the last one for smothing

@cdcseacave
Copy link

i have experience with poisson reconstruction if that is what you need

@Anttwo
Copy link
Owner

Anttwo commented Dec 18, 2023

Hello guys,

Sorry for not answering a lot recently, I was working hard on several projects.

As I explained in other issues, the code is basically finished and coming soon.
Very, very soon, actually: I plan to release it today.

I just have a few tests to perform to check that the env file is working, and that I've not broken the code when reorganizing it.

Stay tuned, if everything goes well (and no bug is here), the code is out today.

@yuedajiong yuedajiong changed the title I have implemented all regularizations, anybody are interested in same surface-recon and discuss with me? I have implemented all regularizations, anybody isis interested in same surface-recon and discuss with me? Dec 18, 2023
@yuedajiong
Copy link
Author

yuedajiong commented Dec 18, 2023

@Anttwo You're awesome, you're my idol.

Waiting for your code, and try.

If you're willing, I'm happy to serve you by testing and optimizing code.

The surface recon is the most important one.

@XOURTNEY
Copy link

hello @yuedajiong,
I have contacted you via email.
I am looking forward to your reply!

@neneyork
Copy link

Hi @yuedajiong and @cdcseacave , I am trying to implement the sdf and normals regularization on the orginal 3DGS. However, I met the problem that the density would be very large number with the equation in the paper. The code is attached below. Could you please take a look. Thanks!

`# sdf loss
gaussians._xyz

    # 随机取当前高斯点当作sample_points
    valid_indices = torch.arange(30000, device="cuda")
    cum_probs = valid_indices / 29999
    random_indices = torch.multinomial(cum_probs, 30000, replacement=True)

    random_change = torch.randn_like(
        gaussians._xyz[random_indices]) * 10  # 生成与 gaussians._xyz[random_indices] 相同形状的随机数张量
    sdf_samples = gaussians._xyz[random_indices] + random_change

    # 计算sdf estimation
    sdf_samples_z = sdf_samples[..., 2] + 0
    sdf_samples_xy = sdf_samples[..., 0:2] + 0
    proj_mask = sdf_samples_z > viewpoint_cam.znear

    # 获取点在rendered depth上的深度
    # 将点的坐标调整为深度图上的范围(-1到1之间)
    points_normalized = sdf_samples_xy.clone()
    points_normalized[:, 0] = (sdf_samples_xy[:, 0] / (depth.shape[2] - 1))
    points_normalized[:, 1] = (sdf_samples_xy[:, 1] / (depth.shape[1] - 1))

    grid = points_normalized.view(1, -1, 1, 2)  # 将点的坐标构建成形状为 (1, num_points, 1, 2) 的 grid
    sdf_samples_map_z = torch.nn.functional.grid_sample(rendered_depths, grid, mode='bilinear',
                                                        padding_mode='border')[0, 0, :, 0]

    sdf_estimation = sdf_samples_map_z[proj_mask] - sdf_samples_z[proj_mask] 

    # df real
    beta = gaussians._scaling.min(dim=-1)[0][random_indices].mean(dim=0)

    opacity = gaussians._opacity[random_indices]
    distance = sdf_samples - gaussians._xyz[random_indices]
    covariance = gaussians.get_actual_covariance()[random_indices]

    densities = torch.zeros(30000, 1)
    for i in range(0, 29999):
        density = opacity[i] * (
                    -0.5 * distance[i, :].T @ torch.inverse(torch.squeeze(covariance[i, :, :])) @ distance[i, :])
        densities[i, 0] = density

    density_threshold = 1.
    opacity_min_clamp = 1e-16
    clamped_densities = densities.clamp(min=opacity_min_clamp).to("cuda")
    sdf_values = beta * torch.sqrt(-2. * torch.log(clamped_densities)) 

    # sdf standerd deviation

    sdf_estimation_loss = torch.mean((sdf_values - sdf_estimation.abs())) 

@JiajieLi7012
Copy link

Hi @neneyork, do you successfully implement the loss? I'm also trying to do that.

@neneyork
Copy link

Hi @neneyork, do you successfully implement the loss? I'm also trying to do that.

hi @JiajieLi7012 , I have implement the loss. If you have any difficulaties, please refer the EndoGS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants