reduced-3dgs 1.8.17__tar.gz → 1.8.19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reduced-3dgs might be problematic. Click here for more details.
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/PKG-INFO +1 -1
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/combinations.py +70 -12
- reduced_3dgs-1.8.19/reduced_3dgs/importance/__init__.py +3 -0
- reduced_3dgs-1.8.19/reduced_3dgs/importance/combinations.py +43 -0
- {reduced_3dgs-1.8.17/reduced_3dgs/pruning → reduced_3dgs-1.8.19/reduced_3dgs}/importance/trainer.py +45 -56
- reduced_3dgs-1.8.19/reduced_3dgs/pruning/__init__.py +2 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/pruning/combinations.py +20 -6
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/pruning/trainer.py +18 -4
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/train.py +8 -11
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs.egg-info/PKG-INFO +1 -1
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs.egg-info/SOURCES.txt +3 -2
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/setup.py +3 -3
- reduced_3dgs-1.8.17/reduced_3dgs/pruning/__init__.py +0 -2
- reduced_3dgs-1.8.17/reduced_3dgs/pruning/importance/__init__.py +0 -1
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/LICENSE.md +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/README.md +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/__init__.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/quantization/__init__.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/quantization/abc.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/quantization/exclude_zeros.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/quantization/quantizer.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/quantization/wrapper.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/quantize.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/shculling/__init__.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/shculling/gaussian_model.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs/shculling/trainer.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs.egg-info/dependency_links.txt +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs.egg-info/requires.txt +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/reduced_3dgs.egg-info/top_level.txt +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/setup.cfg +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/cuda_rasterizer/backward.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/cuda_rasterizer/forward.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/cuda_rasterizer/rasterizer_impl.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/diff_gaussian_rasterization/__init__.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/ext.cpp +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/rasterize_points.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/reduced_3dgs/kmeans.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/reduced_3dgs/redundancy_score.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/reduced_3dgs/sh_culling.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/reduced_3dgs.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/gaussian-importance/cuda_rasterizer/backward.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/gaussian-importance/cuda_rasterizer/forward.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/gaussian-importance/cuda_rasterizer/rasterizer_impl.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/gaussian-importance/diff_gaussian_rasterization/__init__.py +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/gaussian-importance/ext.cpp +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/gaussian-importance/rasterize_points.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/simple-knn/ext.cpp +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/simple-knn/simple_knn.cu +0 -0
- {reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/simple-knn/spatial.cu +0 -0
|
@@ -1,13 +1,67 @@
|
|
|
1
|
+
from typing import List
|
|
1
2
|
from gaussian_splatting import GaussianModel, CameraTrainableGaussianModel, Camera
|
|
2
3
|
from gaussian_splatting.dataset import CameraDataset, TrainableCameraDataset
|
|
3
4
|
from gaussian_splatting.trainer import OpacityResetDensificationTrainer
|
|
4
5
|
# from gaussian_splatting.trainer import BaseOpacityResetDensificationTrainer as OpacityResetDensificationTrainer
|
|
5
|
-
from gaussian_splatting.trainer import OpacityResetTrainerWrapper, CameraTrainerWrapper
|
|
6
|
+
from gaussian_splatting.trainer import OpacityResetTrainerWrapper, CameraTrainerWrapper, NoopDensifier, DepthTrainerWrapper
|
|
6
7
|
from .shculling import VariableSHGaussianModel, SHCullingTrainerWrapper
|
|
7
8
|
from .shculling import SHCullingTrainer
|
|
8
9
|
# from .shculling import BaseSHCullingTrainer as SHCullingTrainer
|
|
9
|
-
from .pruning import
|
|
10
|
+
from .pruning import PruningTrainerWrapper, PrunerInDensifyTrainerWrapper
|
|
10
11
|
# from .pruning import BasePruningTrainer as PruningTrainer, BasePrunerInDensifyTrainer as PrunerInDensifyTrainer
|
|
12
|
+
from .importance import ImportancePruner
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def BaseFullPruningTrainer(
|
|
16
|
+
model: GaussianModel,
|
|
17
|
+
scene_extent: float,
|
|
18
|
+
dataset: List[Camera],
|
|
19
|
+
*args,
|
|
20
|
+
importance_prune_from_iter=1000,
|
|
21
|
+
importance_prune_until_iter=15000,
|
|
22
|
+
importance_prune_interval: int = 100,
|
|
23
|
+
**kwargs):
|
|
24
|
+
return PruningTrainerWrapper(
|
|
25
|
+
lambda model, scene_extent, dataset: ImportancePruner(
|
|
26
|
+
NoopDensifier(model),
|
|
27
|
+
dataset,
|
|
28
|
+
importance_prune_from_iter=importance_prune_from_iter,
|
|
29
|
+
importance_prune_until_iter=importance_prune_until_iter,
|
|
30
|
+
importance_prune_interval=importance_prune_interval,
|
|
31
|
+
),
|
|
32
|
+
model, scene_extent, dataset,
|
|
33
|
+
*args, **kwargs
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def BaseFullPrunerInDensifyTrainer(
|
|
38
|
+
model: GaussianModel,
|
|
39
|
+
scene_extent: float,
|
|
40
|
+
dataset: List[Camera],
|
|
41
|
+
*args,
|
|
42
|
+
importance_prune_from_iter=1000,
|
|
43
|
+
importance_prune_until_iter=15000,
|
|
44
|
+
importance_prune_interval: int = 100,
|
|
45
|
+
**kwargs):
|
|
46
|
+
return PrunerInDensifyTrainerWrapper(
|
|
47
|
+
lambda model, scene_extent, dataset: ImportancePruner(
|
|
48
|
+
NoopDensifier(model),
|
|
49
|
+
dataset,
|
|
50
|
+
importance_prune_from_iter=importance_prune_from_iter,
|
|
51
|
+
importance_prune_until_iter=importance_prune_until_iter,
|
|
52
|
+
importance_prune_interval=importance_prune_interval,
|
|
53
|
+
),
|
|
54
|
+
model, scene_extent, dataset,
|
|
55
|
+
*args, **kwargs
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def DepthFullPruningTrainer(model: GaussianModel, scene_extent: float, dataset: TrainableCameraDataset, *args, **kwargs):
|
|
60
|
+
return DepthTrainerWrapper(BaseFullPruningTrainer, model, scene_extent, *args, dataset=dataset, **kwargs)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def DepthFullPrunerInDensifyTrainer(model: GaussianModel, scene_extent: float, dataset: TrainableCameraDataset, *args, **kwargs):
|
|
64
|
+
return DepthTrainerWrapper(BaseFullPrunerInDensifyTrainer, model, scene_extent, *args, dataset=dataset, **kwargs)
|
|
11
65
|
|
|
12
66
|
|
|
13
67
|
def OpacityResetPruningTrainer(
|
|
@@ -16,7 +70,7 @@ def OpacityResetPruningTrainer(
|
|
|
16
70
|
dataset: CameraDataset,
|
|
17
71
|
*args, **kwargs):
|
|
18
72
|
return OpacityResetTrainerWrapper(
|
|
19
|
-
lambda model, scene_extent, *args, **kwargs:
|
|
73
|
+
lambda model, scene_extent, *args, **kwargs: DepthFullPruningTrainer(model, scene_extent, dataset, *args, **kwargs),
|
|
20
74
|
model, scene_extent,
|
|
21
75
|
*args, **kwargs
|
|
22
76
|
)
|
|
@@ -28,13 +82,17 @@ def OpacityResetPrunerInDensifyTrainer(
|
|
|
28
82
|
dataset: CameraDataset,
|
|
29
83
|
*args, **kwargs):
|
|
30
84
|
return OpacityResetTrainerWrapper(
|
|
31
|
-
lambda model, scene_extent, *args, **kwargs:
|
|
85
|
+
lambda model, scene_extent, *args, **kwargs: DepthFullPrunerInDensifyTrainer(model, scene_extent, dataset, *args, **kwargs),
|
|
32
86
|
model, scene_extent,
|
|
33
87
|
*args, **kwargs
|
|
34
88
|
)
|
|
35
89
|
|
|
36
90
|
|
|
37
|
-
|
|
91
|
+
PruningTrainer = OpacityResetPruningTrainer
|
|
92
|
+
PrunerInDensifyTrainer = OpacityResetPrunerInDensifyTrainer
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def SHCullingDensificationTrainer(
|
|
38
96
|
model: VariableSHGaussianModel,
|
|
39
97
|
scene_extent: float,
|
|
40
98
|
dataset: CameraDataset,
|
|
@@ -46,7 +104,7 @@ def SHCullingDensifyTrainer(
|
|
|
46
104
|
)
|
|
47
105
|
|
|
48
106
|
|
|
49
|
-
def
|
|
107
|
+
def SHCullingPruningTrainer(
|
|
50
108
|
model: VariableSHGaussianModel,
|
|
51
109
|
scene_extent: float,
|
|
52
110
|
dataset: CameraDataset,
|
|
@@ -58,7 +116,7 @@ def SHCullingPruneTrainer(
|
|
|
58
116
|
)
|
|
59
117
|
|
|
60
118
|
|
|
61
|
-
def
|
|
119
|
+
def SHCullingPrunerInDensifyTrainer(
|
|
62
120
|
model: VariableSHGaussianModel,
|
|
63
121
|
scene_extent: float,
|
|
64
122
|
dataset: CameraDataset,
|
|
@@ -99,7 +157,7 @@ def CameraPruningTrainer(
|
|
|
99
157
|
)
|
|
100
158
|
|
|
101
159
|
|
|
102
|
-
def
|
|
160
|
+
def CameraPrunerInDensifyTrainer(
|
|
103
161
|
model: CameraTrainableVariableSHGaussianModel,
|
|
104
162
|
scene_extent: float,
|
|
105
163
|
dataset: TrainableCameraDataset,
|
|
@@ -117,19 +175,19 @@ def CameraSHCullingDensifyTrainer(
|
|
|
117
175
|
dataset: TrainableCameraDataset,
|
|
118
176
|
*args, **kwargs):
|
|
119
177
|
return CameraTrainerWrapper(
|
|
120
|
-
|
|
178
|
+
SHCullingDensificationTrainer,
|
|
121
179
|
model, scene_extent, dataset,
|
|
122
180
|
*args, **kwargs
|
|
123
181
|
)
|
|
124
182
|
|
|
125
183
|
|
|
126
|
-
def
|
|
184
|
+
def CameraSHCullingPruningTrainer(
|
|
127
185
|
model: CameraTrainableVariableSHGaussianModel,
|
|
128
186
|
scene_extent: float,
|
|
129
187
|
dataset: TrainableCameraDataset,
|
|
130
188
|
*args, **kwargs):
|
|
131
189
|
return CameraTrainerWrapper(
|
|
132
|
-
|
|
190
|
+
SHCullingPruningTrainer,
|
|
133
191
|
model, scene_extent, dataset,
|
|
134
192
|
*args, **kwargs
|
|
135
193
|
)
|
|
@@ -141,7 +199,7 @@ def CameraSHCullingPruningDensifyTrainer(
|
|
|
141
199
|
dataset: TrainableCameraDataset,
|
|
142
200
|
*args, **kwargs):
|
|
143
201
|
return CameraTrainerWrapper(
|
|
144
|
-
|
|
202
|
+
SHCullingPrunerInDensifyTrainer,
|
|
145
203
|
model, scene_extent, dataset,
|
|
146
204
|
*args, **kwargs
|
|
147
205
|
)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
from .trainer import ImportancePruner, BaseImportancePruningTrainer
|
|
2
|
+
from .combinations import BaseImportancePrunerInDensifyTrainer, DepthImportancePruningTrainer, DepthImportancePrunerInDensifyTrainer
|
|
3
|
+
from .combinations import ImportancePruningTrainer, ImportancePrunerInDensifyTrainer
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from gaussian_splatting import Camera, GaussianModel
|
|
3
|
+
from gaussian_splatting.dataset import TrainableCameraDataset
|
|
4
|
+
from gaussian_splatting.trainer import DepthTrainerWrapper, NoopDensifier, DensificationTrainerWrapper
|
|
5
|
+
from .trainer import ImportancePruner, BaseImportancePruningTrainer
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def BaseImportancePrunerInDensifyTrainer(
|
|
9
|
+
model: GaussianModel,
|
|
10
|
+
scene_extent: float,
|
|
11
|
+
dataset: List[Camera],
|
|
12
|
+
*args,
|
|
13
|
+
importance_prune_from_iter=1000,
|
|
14
|
+
importance_prune_until_iter=15000,
|
|
15
|
+
importance_prune_interval=100,
|
|
16
|
+
**kwargs):
|
|
17
|
+
return DensificationTrainerWrapper(
|
|
18
|
+
lambda model, scene_extent: ImportancePruner(
|
|
19
|
+
NoopDensifier(model),
|
|
20
|
+
dataset,
|
|
21
|
+
importance_prune_from_iter=importance_prune_from_iter,
|
|
22
|
+
importance_prune_until_iter=importance_prune_until_iter,
|
|
23
|
+
importance_prune_interval=importance_prune_interval,
|
|
24
|
+
),
|
|
25
|
+
model,
|
|
26
|
+
scene_extent,
|
|
27
|
+
*args, **kwargs
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Depth trainer
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def DepthImportancePruningTrainer(model: GaussianModel, scene_extent: float, dataset: TrainableCameraDataset, *args, **kwargs):
|
|
35
|
+
return DepthTrainerWrapper(BaseImportancePruningTrainer, model, scene_extent, *args, dataset=dataset, **kwargs)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def DepthImportancePrunerInDensifyTrainer(model: GaussianModel, scene_extent: float, dataset: TrainableCameraDataset, *args, **kwargs):
|
|
39
|
+
return DepthTrainerWrapper(BaseImportancePrunerInDensifyTrainer, model, scene_extent, *args, dataset=dataset, **kwargs)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
ImportancePruningTrainer = DepthImportancePruningTrainer
|
|
43
|
+
ImportancePrunerInDensifyTrainer = DepthImportancePrunerInDensifyTrainer
|
{reduced_3dgs-1.8.17/reduced_3dgs/pruning → reduced_3dgs-1.8.19/reduced_3dgs}/importance/trainer.py
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import math
|
|
2
|
+
from typing import Callable, List
|
|
2
3
|
import torch
|
|
3
4
|
|
|
4
5
|
from gaussian_splatting import Camera, GaussianModel
|
|
5
|
-
from gaussian_splatting.trainer import
|
|
6
|
+
from gaussian_splatting.trainer import AbstractDensifier, DensifierWrapper, DensificationTrainer, NoopDensifier
|
|
6
7
|
from gaussian_splatting.dataset import CameraDataset
|
|
7
8
|
from .diff_gaussian_rasterization import GaussianRasterizationSettings, GaussianRasterizer
|
|
8
9
|
|
|
@@ -74,68 +75,56 @@ def count_render(self: GaussianModel, viewpoint_camera: Camera):
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
def prune_gaussians(model: GaussianModel, dataset: CameraDataset):
|
|
79
|
+
gaussian_count = torch.zeros(model.get_xyz.shape[0], device=model.get_xyz.device, dtype=torch.int)
|
|
80
|
+
opacity_important_score = torch.zeros(model.get_xyz.shape[0], device=model.get_xyz.device, dtype=torch.float)
|
|
81
|
+
T_alpha_important_score = torch.zeros(model.get_xyz.shape[0], device=model.get_xyz.device, dtype=torch.float)
|
|
82
|
+
for camera in dataset:
|
|
83
|
+
out = count_render(model, camera)
|
|
84
|
+
gaussian_count += out["gaussians_count"]
|
|
85
|
+
opacity_important_score += out["opacity_important_score"]
|
|
86
|
+
T_alpha_important_score += out["T_alpha_important_score"]
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class ImportancePruner(DensifierWrapper):
|
|
78
91
|
def __init__(
|
|
79
|
-
self,
|
|
92
|
+
self, base_densifier: AbstractDensifier,
|
|
80
93
|
dataset: CameraDataset,
|
|
81
|
-
|
|
94
|
+
importance_prune_from_iter=15000,
|
|
95
|
+
importance_prune_until_iter=20000,
|
|
96
|
+
importance_prune_interval: int = 1000,
|
|
82
97
|
):
|
|
83
|
-
super().__init__(
|
|
98
|
+
super().__init__(base_densifier)
|
|
84
99
|
self.dataset = dataset
|
|
85
|
-
self.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
out = count_render(self.model, camera)
|
|
95
|
-
gaussian_count += out["gaussians_count"]
|
|
96
|
-
opacity_important_score += out["opacity_important_score"]
|
|
97
|
-
T_alpha_important_score += out["T_alpha_important_score"]
|
|
98
|
-
pass
|
|
100
|
+
self.importance_prune_from_iter = importance_prune_from_iter
|
|
101
|
+
self.importance_prune_until_iter = importance_prune_until_iter
|
|
102
|
+
self.importance_prune_interval = importance_prune_interval
|
|
103
|
+
|
|
104
|
+
def densify_and_prune(self, loss, out, camera, step: int):
|
|
105
|
+
ret = super().densify_and_prune(loss, out, camera, step)
|
|
106
|
+
if self.importance_prune_from_iter <= step <= self.importance_prune_until_iter and step % self.importance_prune_interval == 0:
|
|
107
|
+
remove_mask = prune_gaussians(self.model, self.dataset)
|
|
108
|
+
ret = ret._replace(remove_mask=remove_mask if ret.remove_mask is None else torch.logical_or(ret.remove_mask, remove_mask))
|
|
99
109
|
return ret
|
|
100
110
|
|
|
101
111
|
|
|
102
|
-
def ImportancePruningTrainerWrapper(
|
|
103
|
-
base_trainer_constructor,
|
|
104
|
-
model: GaussianModel,
|
|
105
|
-
scene_extent: float,
|
|
106
|
-
dataset: CameraDataset,
|
|
107
|
-
importance_prune_at_steps=[15000],
|
|
108
|
-
*args, **kwargs):
|
|
109
|
-
return ImportancePruner(
|
|
110
|
-
base_trainer_constructor(model, scene_extent, dataset, *args, **kwargs),
|
|
111
|
-
dataset,
|
|
112
|
-
importance_prune_at_steps=importance_prune_at_steps,
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
|
|
116
112
|
def BaseImportancePruningTrainer(
|
|
117
|
-
|
|
118
|
-
scene_extent: float,
|
|
119
|
-
dataset: CameraDataset,
|
|
120
|
-
importance_prune_at_steps=[15000],
|
|
121
|
-
*args, **kwargs):
|
|
122
|
-
return ImportancePruningTrainerWrapper(
|
|
123
|
-
lambda model, scene_extent, dataset, *args, **kwargs: BaseTrainer(model, scene_extent, *args, **kwargs),
|
|
124
|
-
model, scene_extent, dataset,
|
|
125
|
-
importance_prune_at_steps=importance_prune_at_steps,
|
|
126
|
-
*args, **kwargs,
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def ImportancePruningTrainer(
|
|
131
|
-
model: GaussianModel,
|
|
113
|
+
model: GaussianModel,
|
|
132
114
|
scene_extent: float,
|
|
133
|
-
dataset:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
115
|
+
dataset: List[Camera],
|
|
116
|
+
*args,
|
|
117
|
+
importance_prune_from_iter=1000,
|
|
118
|
+
importance_prune_until_iter=15000,
|
|
119
|
+
importance_prune_interval: int = 100,
|
|
120
|
+
**kwargs):
|
|
121
|
+
return DensificationTrainer(
|
|
122
|
+
model, scene_extent,
|
|
123
|
+
ImportancePruner(
|
|
124
|
+
NoopDensifier(model),
|
|
125
|
+
dataset,
|
|
126
|
+
importance_prune_from_iter=importance_prune_from_iter,
|
|
127
|
+
importance_prune_until_iter=importance_prune_until_iter,
|
|
128
|
+
importance_prune_interval=importance_prune_interval,
|
|
129
|
+
), *args, **kwargs
|
|
141
130
|
)
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
from typing import List
|
|
2
|
+
from typing import Callable, List
|
|
3
3
|
from gaussian_splatting import Camera, GaussianModel
|
|
4
4
|
from gaussian_splatting.dataset import TrainableCameraDataset
|
|
5
|
-
from gaussian_splatting.trainer import DepthTrainerWrapper, NoopDensifier,
|
|
5
|
+
from gaussian_splatting.trainer import AbstractDensifier, DepthTrainerWrapper, NoopDensifier, SplitCloneDensifierTrainerWrapper
|
|
6
6
|
from .trainer import BasePruner, BasePruningTrainer
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def
|
|
9
|
+
def PrunerInDensifyTrainerWrapper(
|
|
10
|
+
noargs_base_densifier_constructor: Callable[[GaussianModel, float, List[Camera]], AbstractDensifier],
|
|
10
11
|
model: GaussianModel,
|
|
11
12
|
scene_extent: float,
|
|
12
13
|
dataset: List[Camera],
|
|
14
|
+
*args,
|
|
13
15
|
prune_from_iter=1000,
|
|
14
16
|
prune_until_iter=15000,
|
|
15
17
|
prune_interval: int = 100,
|
|
@@ -17,10 +19,10 @@ def BasePrunerInDensifyTrainer(
|
|
|
17
19
|
lambda_mercy=1.,
|
|
18
20
|
mercy_minimum=3,
|
|
19
21
|
mercy_type='redundancy_opacity',
|
|
20
|
-
|
|
21
|
-
return
|
|
22
|
+
**kwargs):
|
|
23
|
+
return SplitCloneDensifierTrainerWrapper(
|
|
22
24
|
lambda model, scene_extent: BasePruner(
|
|
23
|
-
|
|
25
|
+
noargs_base_densifier_constructor(model, scene_extent, dataset),
|
|
24
26
|
dataset,
|
|
25
27
|
prune_from_iter=prune_from_iter,
|
|
26
28
|
prune_until_iter=prune_until_iter,
|
|
@@ -36,6 +38,18 @@ def BasePrunerInDensifyTrainer(
|
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
|
|
41
|
+
def BasePrunerInDensifyTrainer(
|
|
42
|
+
model: GaussianModel,
|
|
43
|
+
scene_extent: float,
|
|
44
|
+
dataset: List[Camera],
|
|
45
|
+
*args, **kwargs):
|
|
46
|
+
return PrunerInDensifyTrainerWrapper(
|
|
47
|
+
lambda model, scene_extent, dataset: NoopDensifier(model),
|
|
48
|
+
model, scene_extent, dataset,
|
|
49
|
+
*args, **kwargs
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
39
53
|
# Depth trainer
|
|
40
54
|
|
|
41
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List
|
|
1
|
+
from typing import Callable, List
|
|
2
2
|
import torch
|
|
3
3
|
from gaussian_splatting import GaussianModel, Camera
|
|
4
4
|
from gaussian_splatting.trainer import AbstractDensifier, DensifierWrapper, DensificationTrainer, NoopDensifier
|
|
@@ -108,10 +108,12 @@ class BasePruner(DensifierWrapper):
|
|
|
108
108
|
return ret
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
def
|
|
111
|
+
def PruningTrainerWrapper(
|
|
112
|
+
noargs_base_densifier_constructor: Callable[[GaussianModel, float, List[Camera]], AbstractDensifier],
|
|
112
113
|
model: GaussianModel,
|
|
113
114
|
scene_extent: float,
|
|
114
115
|
dataset: List[Camera],
|
|
116
|
+
*args,
|
|
115
117
|
prune_from_iter=1000,
|
|
116
118
|
prune_until_iter=15000,
|
|
117
119
|
prune_interval: int = 100,
|
|
@@ -119,11 +121,11 @@ def BasePruningTrainer(
|
|
|
119
121
|
lambda_mercy=1.,
|
|
120
122
|
mercy_minimum=3,
|
|
121
123
|
mercy_type='redundancy_opacity',
|
|
122
|
-
|
|
124
|
+
**kwargs):
|
|
123
125
|
return DensificationTrainer(
|
|
124
126
|
model, scene_extent,
|
|
125
127
|
BasePruner(
|
|
126
|
-
|
|
128
|
+
noargs_base_densifier_constructor(model, scene_extent, dataset),
|
|
127
129
|
dataset,
|
|
128
130
|
prune_from_iter=prune_from_iter,
|
|
129
131
|
prune_until_iter=prune_until_iter,
|
|
@@ -134,3 +136,15 @@ def BasePruningTrainer(
|
|
|
134
136
|
mercy_type=mercy_type,
|
|
135
137
|
), *args, **kwargs
|
|
136
138
|
)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def BasePruningTrainer(
|
|
142
|
+
model: GaussianModel,
|
|
143
|
+
scene_extent: float,
|
|
144
|
+
dataset: List[Camera],
|
|
145
|
+
*args, **kwargs):
|
|
146
|
+
return DensificationTrainer(
|
|
147
|
+
lambda model, scene_extent, dataset: NoopDensifier(model),
|
|
148
|
+
model, scene_extent, dataset,
|
|
149
|
+
*args, **kwargs
|
|
150
|
+
)
|
|
@@ -14,30 +14,27 @@ from gaussian_splatting.trainer.extensions import ScaleRegularizeTrainerWrapper
|
|
|
14
14
|
from reduced_3dgs.quantization import AbstractQuantizer, VectorQuantizeTrainerWrapper
|
|
15
15
|
from reduced_3dgs.shculling import VariableSHGaussianModel, SHCullingTrainer
|
|
16
16
|
from reduced_3dgs.pruning import PruningTrainer
|
|
17
|
-
from reduced_3dgs.
|
|
18
|
-
from reduced_3dgs.combinations import OpacityResetPrunerInDensifyTrainer, SHCullingDensifyTrainer, SHCullingPruneTrainer, SHCullingPruningDensifyTrainer
|
|
17
|
+
from reduced_3dgs.combinations import PrunerInDensifyTrainer, SHCullingDensificationTrainer, SHCullingPruningTrainer, SHCullingPrunerInDensifyTrainer
|
|
19
18
|
from reduced_3dgs.combinations import CameraTrainableVariableSHGaussianModel, CameraSHCullingTrainer, CameraPruningTrainer
|
|
20
|
-
from reduced_3dgs.combinations import
|
|
19
|
+
from reduced_3dgs.combinations import CameraPrunerInDensifyTrainer, CameraSHCullingDensifyTrainer, CameraSHCullingPruningTrainer, CameraSHCullingPruningDensifyTrainer
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
basemodes = {
|
|
24
23
|
"shculling": SHCullingTrainer,
|
|
25
24
|
"pruning": PruningTrainer,
|
|
26
|
-
"densify-pruning":
|
|
27
|
-
"densify-shculling":
|
|
28
|
-
"prune-shculling":
|
|
29
|
-
"densify-prune-shculling":
|
|
25
|
+
"densify-pruning": PrunerInDensifyTrainer,
|
|
26
|
+
"densify-shculling": SHCullingDensificationTrainer,
|
|
27
|
+
"prune-shculling": SHCullingPruningTrainer,
|
|
28
|
+
"densify-prune-shculling": SHCullingPrunerInDensifyTrainer,
|
|
30
29
|
}
|
|
31
|
-
basemodes = {k: lambda *args, **kwargs: ImportancePruningTrainerWrapper(v, *args, **kwargs) for k, v in basemodes.items()}
|
|
32
30
|
cameramodes = {
|
|
33
31
|
"camera-shculling": CameraSHCullingTrainer,
|
|
34
32
|
"camera-pruning": CameraPruningTrainer,
|
|
35
|
-
"camera-densify-pruning":
|
|
33
|
+
"camera-densify-pruning": CameraPrunerInDensifyTrainer,
|
|
36
34
|
"camera-densify-shculling": CameraSHCullingDensifyTrainer,
|
|
37
|
-
"camera-prune-shculling":
|
|
35
|
+
"camera-prune-shculling": CameraSHCullingPruningTrainer,
|
|
38
36
|
"camera-densify-prune-shculling": CameraSHCullingPruningDensifyTrainer,
|
|
39
37
|
}
|
|
40
|
-
cameramodes = {k: lambda *args, **kwargs: ImportancePruningTrainerWrapper(v, *args, **kwargs) for k, v in cameramodes.items()}
|
|
41
38
|
|
|
42
39
|
|
|
43
40
|
def prepare_quantizer(
|
|
@@ -10,11 +10,12 @@ reduced_3dgs.egg-info/SOURCES.txt
|
|
|
10
10
|
reduced_3dgs.egg-info/dependency_links.txt
|
|
11
11
|
reduced_3dgs.egg-info/requires.txt
|
|
12
12
|
reduced_3dgs.egg-info/top_level.txt
|
|
13
|
+
reduced_3dgs/importance/__init__.py
|
|
14
|
+
reduced_3dgs/importance/combinations.py
|
|
15
|
+
reduced_3dgs/importance/trainer.py
|
|
13
16
|
reduced_3dgs/pruning/__init__.py
|
|
14
17
|
reduced_3dgs/pruning/combinations.py
|
|
15
18
|
reduced_3dgs/pruning/trainer.py
|
|
16
|
-
reduced_3dgs/pruning/importance/__init__.py
|
|
17
|
-
reduced_3dgs/pruning/importance/trainer.py
|
|
18
19
|
reduced_3dgs/quantization/__init__.py
|
|
19
20
|
reduced_3dgs/quantization/abc.py
|
|
20
21
|
reduced_3dgs/quantization/exclude_zeros.py
|
|
@@ -48,7 +48,7 @@ importance_sources = [
|
|
|
48
48
|
"rasterize_points.cu",
|
|
49
49
|
"ext.cpp"]
|
|
50
50
|
importance_packages = {
|
|
51
|
-
'reduced_3dgs.
|
|
51
|
+
'reduced_3dgs.importance.diff_gaussian_rasterization': 'submodules/gaussian-importance/diff_gaussian_rasterization',
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
cxx_compiler_flags = []
|
|
@@ -60,7 +60,7 @@ if os.name == 'nt':
|
|
|
60
60
|
|
|
61
61
|
setup(
|
|
62
62
|
name="reduced_3dgs",
|
|
63
|
-
version='1.8.
|
|
63
|
+
version='1.8.19',
|
|
64
64
|
author='yindaheng98',
|
|
65
65
|
author_email='yindaheng98@gmail.com',
|
|
66
66
|
url='https://github.com/yindaheng98/reduced-3dgs',
|
|
@@ -83,7 +83,7 @@ setup(
|
|
|
83
83
|
extra_compile_args={"nvcc": nvcc_compiler_flags + ["-I" + os.path.join(os.path.abspath(rasterizor_root), "third_party/glm/")]}
|
|
84
84
|
),
|
|
85
85
|
CUDAExtension(
|
|
86
|
-
name="reduced_3dgs.
|
|
86
|
+
name="reduced_3dgs.importance.diff_gaussian_rasterization._C",
|
|
87
87
|
sources=[os.path.join(importance_root, source) for source in importance_sources],
|
|
88
88
|
extra_compile_args={"nvcc": nvcc_compiler_flags + ["-I" + os.path.join(os.path.abspath(importance_root), "third_party/glm/")]}
|
|
89
89
|
),
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .trainer import ImportancePruningTrainerWrapper, BaseImportancePruningTrainer, ImportancePruningTrainer
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/diff-gaussian-rasterization/reduced_3dgs.cu
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reduced_3dgs-1.8.17 → reduced_3dgs-1.8.19}/submodules/gaussian-importance/rasterize_points.cu
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|