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

[2DGS,Bug] Median depth and normals broken for batched cameras #425

Closed
keunhong opened this issue Sep 28, 2024 · 2 comments
Closed

[2DGS,Bug] Median depth and normals broken for batched cameras #425

keunhong opened this issue Sep 28, 2024 · 2 comments

Comments

@keunhong
Copy link
Contributor

keunhong commented Sep 28, 2024

Hi Team,

The median depth seems to be corrupt for the renderings beyond the first camera when using batched cameras.

Here's a small repro:

import gsplat
import torch
from torch.nn import functional as F
import mediapy as media

num_gaussians = 1000
means = F.normalize(torch.randn(num_gaussians, 3, device="cuda"), dim=-1)
means[..., 2] = torch.rand(num_gaussians) * 3 + 2
scales = torch.rand_like(means) * 0.1 + 0.05
quaternions = torch.tensor([1.0, 0.0, 0.0, 0.0], device="cuda")[None, :].expand(
    num_gaussians, 4
)
opacities = torch.rand_like(scales[..., 0])
rgbs = torch.rand_like(means)

num_cameras = 4
viewmats = torch.eye(4, device="cuda")[None].expand(num_cameras, 4, 4)
Ks = torch.tensor(
    [
        [300.0, 0.0, 150.0],
        [0.0, 300.0, 100.0],
        [0.0, 0.0, 1.0],
    ],
    device="cuda",
)[None, :, :].expand(num_cameras, 3, 3)
width, height = 300, 200

features, alphas, normals, surf_normals, dist_loss, depth_median, _ = gsplat.rasterization_2dgs(
    means=means,
    quats=quaternions,
    opacities=opacities,
    colors=rgbs,
    scales=scales,
    viewmats=viewmats,
    Ks=Ks,
    width=width,
    height=height,
    render_mode="RGB+D",
)
media.show_images(features[..., :3].numpy(force=True))
media.show_images(features[..., 3:].numpy(force=True), vmin=0, vmax=5)
media.show_images(depth_median.numpy(force=True), vmin=0, vmax=5)
media.show_images(normals.numpy(force=True)*0.5+0.5)
media.show_images(surf_normals.numpy(force=True)*0.5+0.5)

image

@keunhong keunhong changed the title [2DGS] Median depth broken for batched cameras [2DGS] Median depth and normals broken for batched cameras Sep 28, 2024
@keunhong keunhong changed the title [2DGS] Median depth and normals broken for batched cameras [2DGS,Bug] Median depth and normals broken for batched cameras Sep 28, 2024
@FantasticOven2
Copy link
Contributor

Thanks for pointing this out! I will take a look.

@liruilong940607
Copy link
Collaborator

Should be fixed in #430

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

3 participants