-
Notifications
You must be signed in to change notification settings - Fork 2
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
use fast-gaussian-rasterization in gaussian-splatting #4
Comments
Hi, sorry for the delayed reply. def convert_to_gaussian_camera(K: torch.Tensor,
R: torch.Tensor,
T: torch.Tensor,
H: torch.Tensor,
W: torch.Tensor,
n: torch.Tensor,
f: torch.Tensor,
cpu_K: torch.Tensor,
cpu_R: torch.Tensor,
cpu_T: torch.Tensor,
cpu_H: int,
cpu_W: int,
cpu_n: float = 0.01,
cpu_f: float = 100.,
):
output = dotdict()
output.image_height = cpu_H
output.image_width = cpu_W
FoVx = focal2fov(cpu_K[0, 0].cpu(), cpu_W.cpu()) # MARK: MIGHT SYNC IN DIST TRAINING, WHY?
FoVy = focal2fov(cpu_K[1, 1].cpu(), cpu_H.cpu()) # MARK: MIGHT SYNC IN DIST TRAINING, WHY?
# Use .float() to avoid AMP issues
output.world_view_transform = getWorld2View(R, T).transpose(0, 1).float() # this is now to be right multiplied
output.projection_matrix = getProjectionMatrix(K, H, W, n, f).transpose(0, 1).float() # this is now to be right multiplied
output.full_proj_transform = torch.matmul(output.world_view_transform, output.projection_matrix).float() # 4, 4
output.camera_center = (-R.mT @ T)[..., 0].float() # B, 3, 1 -> 3,
# Set up rasterization configuration
output.tanfovx = np.tan(FoVx * 0.5)
output.tanfovy = np.tan(FoVy * 0.5)
return output
def convert_to_cpu_gaussian_camera(K: torch.Tensor,
R: torch.Tensor,
T: torch.Tensor,
H: torch.Tensor,
W: torch.Tensor,
n: torch.Tensor,
f: torch.Tensor,
cpu_K: torch.Tensor,
cpu_R: torch.Tensor,
cpu_T: torch.Tensor,
cpu_H: int,
cpu_W: int,
cpu_n: float = 0.01,
cpu_f: float = 100.,
):
output = dotdict()
output.image_height = cpu_H
output.image_width = cpu_W
FoVx = focal2fov(cpu_K[0, 0].cpu(), cpu_W.cpu()) # MARK: MIGHT SYNC IN DIST TRAINING, WHY?
FoVy = focal2fov(cpu_K[1, 1].cpu(), cpu_H.cpu()) # MARK: MIGHT SYNC IN DIST TRAINING, WHY?
# Use .float() to avoid AMP issues
output.world_view_transform = getWorld2View(cpu_R, cpu_T).transpose(0, 1).float() # this is now to be right multiplied
output.projection_matrix = getProjectionMatrix(cpu_K, cpu_H, cpu_W, cpu_n, cpu_f).transpose(0, 1).float() # this is now to be right multiplied
output.full_proj_transform = torch.matmul(output.world_view_transform, output.projection_matrix).float() # 4, 4
output.camera_center = (-cpu_R.mT @ cpu_T)[..., 0].float() # B, 3, 1 -> 3,
# Set up rasterization configuration
output.tanfovx = np.tan(FoVx * 0.5)
output.tanfovy = np.tan(FoVy * 0.5)
return output |
Thanks reply! I will try this |
Great works!
Can I use it directly in gaussian-splatting锛烮 tried but failed馃樋. Maybe I need to modify the training part of the code
The text was updated successfully, but these errors were encountered: