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 #208

Merged
merged 118 commits into from
Sep 12, 2024
Merged

2DGS #208

Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
086dfe0
cuda legacy with 2DGS
FantasticOven2 Jun 8, 2024
906a955
clean up changes
FantasticOven2 Jun 9, 2024
b288462
add torch implementation
FantasticOven2 Jun 9, 2024
436b424
adding _wrapper for cuda legacy
FantasticOven2 Jun 9, 2024
9a549d4
working on forward (projection)
FantasticOven2 Jun 9, 2024
5764be5
working on forward (rasterization)
FantasticOven2 Jun 10, 2024
cd7786f
rasterize forward continue
FantasticOven2 Jun 10, 2024
f408b13
starting backward (rasterization)
FantasticOven2 Jun 11, 2024
8580e5e
stubs for 2dgs testing
Jun 11, 2024
e596d75
Merge branch 'main' of https://github.com/FantasticOven2/gsplat
FantasticOven2 Jun 12, 2024
fecabc5
ctn.rasterize (backward)
FantasticOven2 Jun 12, 2024
151ee3d
start projection backward
FantasticOven2 Jun 13, 2024
8cb5154
setup simple 2D experiments and debug forward
FantasticOven2 Jun 14, 2024
9a92cca
ctn. forward debugging
FantasticOven2 Jun 15, 2024
d6ead12
ctn. forward debugging
FantasticOven2 Jun 15, 2024
449e1a4
2d example works
FantasticOven2 Jun 15, 2024
af66b5e
add slant view
FantasticOven2 Jun 15, 2024
4c3717c
variable num points for 2D example
FantasticOven2 Jun 15, 2024
f15625b
working on bwd
FantasticOven2 Jun 17, 2024
39ca680
working on backward
FantasticOven2 Jun 17, 2024
966ec1f
working on backward
FantasticOven2 Jun 17, 2024
9530c89
working on bwd
FantasticOven2 Jun 17, 2024
79298a4
continue adding tests and torch impl for 2dgs
Jun 18, 2024
6a0c8c9
pipeline running nning
FantasticOven2 Jun 18, 2024
d7024ec
debugging gradient
FantasticOven2 Jun 22, 2024
3b19b70
image fitting working
FantasticOven2 Jun 23, 2024
f484aa0
3D works
FantasticOven2 Jun 24, 2024
3a00b5f
setting up numerical tests
FantasticOven2 Jun 27, 2024
37a9f3e
add projection numerical test
FantasticOven2 Jun 27, 2024
f2248b6
adding torch impl and tests for rasterization
Jun 28, 2024
0473dc9
updating 2dgs numerical tests -- rasterize_indices_in_range_2dgs is b…
Jun 28, 2024
84ac77a
correct rasterize_to_indices_in_range_2dgs
FantasticOven2 Jun 28, 2024
3909121
working on 2dgs rasterization numerical tests
FantasticOven2 Jun 28, 2024
7fabcf4
resolving rasterization numerical test differences
FantasticOven2 Jun 28, 2024
5ab8391
linter
Jun 29, 2024
406cd6f
migrating main PR 240 for background
Jun 29, 2024
b0b5da1
fixed bug in rasterize_to_indices_2dgs
Jun 29, 2024
0ff18e2
still failing forward but diffs are much smaller ~2e-5
Jun 29, 2024
1d245be
adding gitignore and removing committed images
Jun 29, 2024
39b6e1a
adding backward tests, currently all failing, will look later
Jun 29, 2024
1b25093
fixed viewmat, pass the correct viewmat, not its transpose
FantasticOven2 Jun 29, 2024
fd36aa9
added densification
FantasticOven2 Jun 30, 2024
4c11611
start normal rendering and potential deadlock
FantasticOven2 Jul 1, 2024
b37f171
normal dual visible
FantasticOven2 Jul 2, 2024
780936e
depth to normal
FantasticOven2 Jul 2, 2024
3cd6690
start normal loss gradient
FantasticOven2 Jul 3, 2024
4d68c74
normal loss gradient
FantasticOven2 Jul 4, 2024
37106b8
ctn. normal consistency gradient
FantasticOven2 Jul 4, 2024
9d47e82
normal gradient works, need to debug the output normal
FantasticOven2 Jul 5, 2024
30108ec
normal consistency done
FantasticOven2 Jul 5, 2024
b55ea01
adding depth distortion loss
FantasticOven2 Jul 7, 2024
76fdf71
added L1 distortion
FantasticOven2 Jul 7, 2024
ca9f0e1
fixed normal bug
FantasticOven2 Jul 9, 2024
7101d5f
working on numerical tests, now only v_ray_Ms didn't pass
FantasticOven2 Jul 11, 2024
164c1bc
find the potential deadlock bug
FantasticOven2 Jul 15, 2024
e4646dd
passing basic numerical tests
FantasticOven2 Jul 16, 2024
0bb01b7
working on halting problem
FantasticOven2 Jul 21, 2024
6574f15
fixed hanging problem due to thread sync
FantasticOven2 Jul 21, 2024
6e7b302
code optimization
FantasticOven2 Jul 23, 2024
bb508c0
add normal tests
FantasticOven2 Jul 24, 2024
7afd909
save changes
FantasticOven2 Jul 29, 2024
56d0a81
improve densification gradient, now working on migration to main brac…
FantasticOven2 Jul 30, 2024
6c1dee0
save changes
FantasticOven2 Aug 4, 2024
8bcf6ab
update to main version
FantasticOven2 Aug 4, 2024
eebe72b
clean tests
FantasticOven2 Aug 4, 2024
bc4fdfe
adding packed projection
FantasticOven2 Aug 5, 2024
091fc71
adding distortion
FantasticOven2 Aug 7, 2024
0a62fe8
adding tests for packed version, forward passed, backward bug
FantasticOven2 Aug 7, 2024
7e86657
cleanup
FantasticOven2 Aug 7, 2024
65ce16d
remove submodule
FantasticOven2 Aug 7, 2024
c79a32e
all tests passed
FantasticOven2 Aug 7, 2024
c31a4dc
added packed tests
FantasticOven2 Aug 8, 2024
2a8f0d6
sync with main
FantasticOven2 Aug 9, 2024
7784955
update readme
FantasticOven2 Aug 9, 2024
2b350c9
update default reg params
FantasticOven2 Aug 9, 2024
8345c5d
Merge branch 'main' into 2dgs
Aug 12, 2024
a006f94
remove mcmc script
Aug 12, 2024
c82ce96
minor cleanup
Aug 12, 2024
353fc27
black format
Aug 12, 2024
6e2cc36
fixed bug in packed version, working on cleanup
FantasticOven2 Aug 15, 2024
fd7c866
adding median depth
FantasticOven2 Aug 16, 2024
e0f2879
support median depth
FantasticOven2 Aug 17, 2024
c2420a8
backup
FantasticOven2 Aug 20, 2024
666705b
cleanup
FantasticOven2 Aug 21, 2024
d57b75f
cleaned up most of the code
FantasticOven2 Aug 21, 2024
a57c525
more cleanup
FantasticOven2 Aug 22, 2024
6dfd704
add docstring
FantasticOven2 Aug 22, 2024
48abf70
adding argument for densification gradient variable
FantasticOven2 Aug 23, 2024
2e8da2e
done cleanup
FantasticOven2 Aug 23, 2024
c538b51
update return type
FantasticOven2 Aug 28, 2024
7daa1ef
additional cleanup
FantasticOven2 Aug 28, 2024
d34baa2
fixed floaters in normal rendering
FantasticOven2 Aug 29, 2024
2f9eb75
adding docs
FantasticOven2 Sep 5, 2024
5566aa5
adding docs
FantasticOven2 Sep 5, 2024
bade5bf
generate teaser vid
FantasticOven2 Sep 5, 2024
afe0308
all done
FantasticOven2 Sep 6, 2024
1a91b03
update to align with main
FantasticOven2 Sep 6, 2024
7bb5af9
test passes
Sep 8, 2024
b1697c2
format
Sep 8, 2024
408f16e
cleanup torch_impl
Sep 8, 2024
6987c00
Merge branch 'main' into 2dgs
Sep 8, 2024
217fdc8
cleanup utils and rasterization fn
Sep 8, 2024
896cc45
black format
Sep 8, 2024
4630230
script cleanup
Sep 8, 2024
61ce019
image fitting cleanup
Sep 8, 2024
c5edf16
image fitting cleanup
Sep 8, 2024
4176666
add matplotlib to requirements
Sep 8, 2024
935cb1d
cleanup
FantasticOven2 Sep 8, 2024
cf6b32f
resolve ruilong's note
FantasticOven2 Sep 9, 2024
c5d1449
rename ray_M to ray_transform
FantasticOven2 Sep 9, 2024
75de227
update doc
FantasticOven2 Sep 9, 2024
8f39645
update doc
FantasticOven2 Sep 9, 2024
14a097a
adding docstring
FantasticOven2 Sep 9, 2024
9d80b19
remove renders
FantasticOven2 Sep 11, 2024
24add4d
Merge branch 'main' into main
liruilong940607 Sep 11, 2024
3487c74
black formatting
FantasticOven2 Sep 12, 2024
fd219f8
black format 22.3
FantasticOven2 Sep 12, 2024
8c4efba
remove renders folder in examples
FantasticOven2 Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@ venv.bak/
compile_commands.json
*.dump

data
results
/data
/result
/results
/renders
3 changes: 2 additions & 1 deletion examples/image_fitting.py
liruilong940607 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import time
from pathlib import Path
from typing import Optional
from typing import Optional, Literal

import numpy as np
import torch
Expand Down Expand Up @@ -79,6 +79,7 @@ def train(
iterations: int = 1000,
lr: float = 0.01,
save_imgs: bool = False,
model_type: Literal["3dgs", "2dgs"] = "3dgs",
liruilong940607 marked this conversation as resolved.
Show resolved Hide resolved
):
optimizer = optim.Adam(
[self.rgbs, self.means, self.scales, self.opacities, self.quats], lr
Expand Down
57 changes: 56 additions & 1 deletion gsplat/cuda/csrc/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,59 @@ fully_fused_projection_packed_bwd_tensor(
const torch::Tensor &v_depths, // [nnz]
const torch::Tensor &v_conics, // [nnz, 3]
const at::optional<torch::Tensor> &v_compensations, // [nnz] optional
const bool viewmats_requires_grad, const bool sparse_grad);
const bool viewmats_requires_grad, const bool sparse_grad);

//====== 2DGS ======//
std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor>
fully_fused_projection_fwd_2dgs_tensor(
const int num_points,
const torch::Tensor &means, // [N, 3]
const torch::Tensor &quats, // [N, 4]
const torch::Tensor &scales, // [N, 3]
const torch::Tensor &viewmat, // [C, 4, 4]
const torch::Tensor &Ks, // [C, 3, 3]
const uint32_t image_width, const uint32_t image_height, const float eps2d,
const float near_plane, const float far_plane,
const float radius_clip, const bool calc_compensations
);

std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor,
torch::Tensor, torch::Tensor>
fully_fused_projection_packed_fwd_2dgs_tensor(
const torch::Tensor &means,
const torch::Tensor &quats,
const torch::Tensor &scales,
const torch::Tensor &viewmats,
const torch::Tensor &Ks,
const uint32_t image_width, const uint32_t image_height, const float eps2d,
const float near_plane, const float far_plane, const float radius_clip,
const bool calc_compensations
);

std::tuple<torch::Tensor, torch::Tensor, torch::Tensor> rasterize_to_pixels_fwd_2dgs_tensor(
// Gaussian parameters
const torch::Tensor &means2d,
const torch::Tensor &colors,
const torch::Tensor &ray_transformations,
const torch::Tensor &opacities,
const at::optional<torch::Tensor> &backgrounds,
// image size
const uint32_t image_width, const uint32_t image_height, const uint32_t tile_size,
// intersections
const torch::Tensor &tile_offsets, // [C, tile_height, tile_width]
const torch::Tensor &flatten_ids // [n_isects]
);

std::tuple<torch::Tensor, torch::Tensor> rasterize_to_indices_in_range_2dgs_tensor(
const uint32_t range_start, const uint32_t range_end, // iteration steps
const torch::Tensor transmittances, // [C, image_height, image_width]
// Gaussian parameters
const torch::Tensor &means2d, // [C, N, 2]
const torch::Tensor &ray_transformations, // [C, N, 3, 3]
const torch::Tensor &opacities, // [N]
// image size
const uint32_t image_width, const uint32_t image_height, const uint32_t tile_size,
// intersections
const torch::Tensor &tile_offsets, // [C, tile_height, tile_width]
const torch::Tensor &flatten_ids // [n_isects]
);
Loading