reduced-3dgs 1.10.0__cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

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.

Files changed (31) hide show
  1. reduced_3dgs/__init__.py +0 -0
  2. reduced_3dgs/combinations.py +245 -0
  3. reduced_3dgs/diff_gaussian_rasterization/_C.cpython-310-x86_64-linux-gnu.so +0 -0
  4. reduced_3dgs/diff_gaussian_rasterization/__init__.py +235 -0
  5. reduced_3dgs/importance/__init__.py +3 -0
  6. reduced_3dgs/importance/combinations.py +63 -0
  7. reduced_3dgs/importance/diff_gaussian_rasterization/_C.cpython-310-x86_64-linux-gnu.so +0 -0
  8. reduced_3dgs/importance/diff_gaussian_rasterization/__init__.py +347 -0
  9. reduced_3dgs/importance/trainer.py +269 -0
  10. reduced_3dgs/pruning/__init__.py +2 -0
  11. reduced_3dgs/pruning/combinations.py +65 -0
  12. reduced_3dgs/pruning/trainer.py +145 -0
  13. reduced_3dgs/quantization/__init__.py +4 -0
  14. reduced_3dgs/quantization/abc.py +49 -0
  15. reduced_3dgs/quantization/exclude_zeros.py +41 -0
  16. reduced_3dgs/quantization/quantizer.py +289 -0
  17. reduced_3dgs/quantization/wrapper.py +67 -0
  18. reduced_3dgs/quantize.py +49 -0
  19. reduced_3dgs/shculling/__init__.py +2 -0
  20. reduced_3dgs/shculling/gaussian_model.py +78 -0
  21. reduced_3dgs/shculling/trainer.py +158 -0
  22. reduced_3dgs/simple_knn/_C.cpython-310-x86_64-linux-gnu.so +0 -0
  23. reduced_3dgs/train.py +195 -0
  24. reduced_3dgs-1.10.0.dist-info/LICENSE.md +93 -0
  25. reduced_3dgs-1.10.0.dist-info/METADATA +278 -0
  26. reduced_3dgs-1.10.0.dist-info/RECORD +31 -0
  27. reduced_3dgs-1.10.0.dist-info/WHEEL +6 -0
  28. reduced_3dgs-1.10.0.dist-info/top_level.txt +1 -0
  29. reduced_3dgs.libs/libc10-ff4eddb5.so +0 -0
  30. reduced_3dgs.libs/libc10_cuda-c675d3fb.so +0 -0
  31. reduced_3dgs.libs/libcudart-8774224f.so.12.4.127 +0 -0
@@ -0,0 +1,278 @@
1
+ Metadata-Version: 2.1
2
+ Name: reduced_3dgs
3
+ Version: 1.10.0
4
+ Summary: Refactored code for the paper "Reducing the Memory Footprint of 3D Gaussian Splatting"
5
+ Home-page: https://github.com/yindaheng98/reduced-3dgs
6
+ Author: yindaheng98
7
+ Author-email: yindaheng98@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE.md
11
+ Requires-Dist: tqdm
12
+ Requires-Dist: plyfile
13
+ Requires-Dist: scikit-learn
14
+ Requires-Dist: torch
15
+ Requires-Dist: torchvision
16
+ Requires-Dist: numpy
17
+ Requires-Dist: gaussian-splatting
18
+
19
+ # Reduced-3DGS: Memory Footprint Reduction for 3D Gaussian Splatting (Python Package Version)
20
+
21
+ This repository contains the **refactored Python code for [Reduced-3DGS](https://github.com/graphdeco-inria/reduced-3dgs)**. It is forked from commit [13e7393af8ecd83d69197dec7e4c891b333a7c1c](https://github.com/graphdeco-inria/reduced-3dgs/tree/13e7393af8ecd83d69197dec7e4c891b333a7c1c). The original code has been **refactored to follow the standard Python package structure**, while **maintaining the same algorithms as the original version**.
22
+
23
+ ## Features
24
+
25
+ * [x] Code organized as a standard Python package
26
+ * [x] Pruning
27
+ * [x] SH Culling
28
+ * [x] Vector quantization by K-Means
29
+
30
+ ## Prerequisites
31
+
32
+ * [Pytorch](https://pytorch.org/) (v2.4 or higher recommended)
33
+ * [CUDA Toolkit](https://developer.nvidia.com/cuda-12-4-0-download-archive) (12.4 recommended, should match with PyTorch version)
34
+
35
+ ## Install (PyPI)
36
+
37
+ ```sh
38
+ pip install --upgrade reduced-3dgs
39
+ ```
40
+
41
+ ## Install (Build from source)
42
+
43
+ ```sh
44
+ pip install --upgrade git+https://github.com/yindaheng98/reduced-3dgs.git@main
45
+ ```
46
+ If you have trouble with [`gaussian-splatting`](https://github.com/yindaheng98/gaussian-splatting), you can install it from source:
47
+ ```sh
48
+ pip install --upgrade git+https://github.com/yindaheng98/gaussian-splatting.git@master
49
+ ```
50
+
51
+ ## Install (Development)
52
+
53
+ Install [`gaussian-splatting`](https://github.com/yindaheng98/gaussian-splatting).
54
+ You can download the wheel from [PyPI](https://pypi.org/project/gaussian-splatting/):
55
+ ```shell
56
+ pip install --upgrade gaussian-splatting
57
+ ```
58
+ Alternatively, install the latest version from the source:
59
+ ```sh
60
+ pip install --upgrade git+https://github.com/yindaheng98/gaussian-splatting.git@master
61
+ ```
62
+
63
+ ```shell
64
+ git clone --recursive https://github.com/yindaheng98/reduced-3dgs
65
+ cd reduced-3dgs
66
+ pip install tqdm plyfile scikit-learn numpy tifffile triton xformers
67
+ pip install --target . --upgrade --no-deps .
68
+ ```
69
+
70
+ (Optional) If you prefer not to install `gaussian-splatting` in your environment, you can install it in your `reduced-3dgs` directory:
71
+ ```sh
72
+ pip install --target . --no-deps --upgrade git+https://github.com/yindaheng98/gaussian-splatting.git@master
73
+ ```
74
+
75
+ ## Quick Start
76
+
77
+ 1. Download the dataset (T&T+DB COLMAP dataset, size 650MB):
78
+
79
+ ```shell
80
+ wget https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/input/tandt_db.zip -P ./data
81
+ unzip data/tandt_db.zip -d data/
82
+ ```
83
+
84
+ 2. Train 3DGS with densification, pruning, and SH culling (same as original 3DGS)
85
+ ```shell
86
+ python -m reduced_3dgs.train -s data/truck -d output/truck -i 30000 --mode densify-prune-shculling
87
+ ```
88
+
89
+ 3. Render 3DGS
90
+ ```shell
91
+ python -m gaussian_splatting.render -s data/truck -d output/truck -i 30000 --mode densify
92
+ ```
93
+
94
+ > 💡 Note: This repository does not include code for creating datasets.
95
+ > If you wish to create your own dataset, please refer to [InstantSplat](https://github.com/yindaheng98/InstantSplat) or use [convert.py](https://github.com/graphdeco-inria/gaussian-splatting/blob/main/convert.py).
96
+
97
+ > 💡 See [.vscode/launch.json](.vscode/launch.json) for more examples. Refer to [reduced_3dgs.train](gaussian_splatting/train.py) and [gaussian_splatting.render](gaussian_splatting/render.py) for full options.
98
+
99
+ ## API Usage
100
+
101
+ This project heavily depends on [`gaussian-splatting`](https://github.com/yindaheng98/gaussian-splatting) and only provides some enhanced Trainers and Gaussian models. Therefore, before starting, please refer to [`gaussian-splatting`](https://github.com/yindaheng98/gaussian-splatting) to understand the key concepts about Gaussian models, Dataset, Trainers, and how to use them.
102
+
103
+ ### Pruning
104
+
105
+ `BasePruningTrainer` prunes the trainer at specified training steps.
106
+ ```python
107
+ from reduced_3dgs.pruning import BasePruningTrainer
108
+ trainer = BasePruningTrainer(
109
+ gaussians,
110
+ scene_extent=dataset.scene_extent(),
111
+ dataset=dataset,
112
+ prune_from_iter=1000,
113
+ prune_until_iter=15000,
114
+ prune_interval=100,
115
+ ... # see reduced_3dgs/pruning/trainer.py for full options
116
+ )
117
+ ```
118
+
119
+ `BasePrunerInDensifyTrainer` integrates pruning with densification.
120
+ ```python
121
+ from reduced_3dgs.pruning import BasePrunerInDensifyTrainer
122
+ trainer = BasePrunerInDensifyTrainer(
123
+ gaussians,
124
+ scene_extent=dataset.scene_extent(),
125
+ dataset=dataset,
126
+ mercy_from_iter=3000,
127
+ mercy_until_iter=20000,
128
+ mercy_interval=100,
129
+ densify_from_iter=500,
130
+ densify_until_iter=15000,
131
+ densify_interval=100,
132
+ densify_grad_threshold=0.0002,
133
+ densify_opacity_threshold=0.005,
134
+ prune_from_iter=1000,
135
+ prune_until_iter=15000,
136
+ prune_interval=100,
137
+ prune_screensize_threshold=20,
138
+ ... # see reduced_3dgs/pruning/trainer.py for full options
139
+ )
140
+ ```
141
+
142
+ ### SH Culling
143
+
144
+ `VariableSHGaussianModel` is the 3DGS model that assigns each 3D Gaussian a different SH degree.
145
+
146
+ ```python
147
+ from reduced_3dgs.shculling import VariableSHGaussianModel
148
+ gaussians = VariableSHGaussianModel(sh_degree).to(device)
149
+ ```
150
+
151
+ `BaseSHCullingTrainer` culls the SH degree of each 3D Gaussian at specified training steps.
152
+ ```python
153
+ from reduced_3dgs.shculling import BaseSHCullingTrainer
154
+ trainer = BaseSHCullingTrainer(
155
+ gaussians,
156
+ scene_extent=dataset.scene_extent(),
157
+ dataset=dataset,
158
+ cull_at_steps=[15000],
159
+ ... # see reduced_3dgs/shculling/trainer.py for full options
160
+ )
161
+ ```
162
+
163
+ ### Quantization
164
+
165
+ `VectorQuantizer` is the basic quantization operator:
166
+ ```python
167
+ gaussians.load_ply("output/truck")
168
+ from reduced_3dgs.quantization import VectorQuantizer
169
+ quantizer = VectorQuantizer(gaussians, num_clusters=256)
170
+ quantizer.save_quantized("output/truck-quantized")
171
+ quantizer.load_quantized("output/truck-quantized")
172
+ ```
173
+
174
+ `BaseVectorQuantizeTrainer` quantizes the model at specified training steps.
175
+ ```python
176
+ from reduced_3dgs.shculling import BaseSHCullingTrainer
177
+ trainer = BaseVectorQuantizeTrainer(
178
+ gaussians,
179
+ spatial_lr_scale=dataset.scene_extent(),
180
+ dataset=dataset,
181
+ num_clusters=256,
182
+ quantizate_from_iter=5000,
183
+ quantizate_until_iter=30000,
184
+ quantizate_interval=1000,
185
+ ... # see reduced_3dgs/shculling/trainer.py for full options
186
+ )
187
+ ```
188
+
189
+ `VectorQuantizeTrainerWrapper` is a wrapper that integrates the quantization step into any Trainer:
190
+ ```python
191
+ trainer = VectorQuantizeTrainerWrapper(
192
+ trainer,
193
+
194
+ num_clusters=num_clusters,
195
+ num_clusters_rotation_re=num_clusters_rotation_re,
196
+ num_clusters_rotation_im=num_clusters_rotation_im,
197
+ num_clusters_opacity=num_clusters_opacity,
198
+ num_clusters_scaling=num_clusters_scaling,
199
+ num_clusters_features_dc=num_clusters_features_dc,
200
+ num_clusters_features_rest=num_clusters_features_rest,
201
+
202
+ quantizate_from_iter=quantizate_from_iter,
203
+ quantizate_until_iter=quantizate_until_iter,
204
+ quantizate_interval=quantizate_interval,
205
+ )
206
+ if load_quantized:
207
+ trainer.quantizer.load_quantized(load_quantized)
208
+ # see reduced_3dgs/train.py
209
+ ```
210
+
211
+ #### Quantized PLY Format
212
+
213
+ > 💡 See [reduced_3dgs/quantization/quantizer.py](reduced_3dgs/quantization/quantizer.py) for the code to save and load quantized PLY files.
214
+
215
+ The `save_quantized` function will produce a point cloud stored in a `.ply` format.
216
+
217
+ Previously, the layout of this file was one row per primitive, containing a series of parameters in `vertex` elements, namely
218
+ * 3 floats for position (`x`,`y`,`z`)
219
+ * 3 floats for normal (`nx`,`ny`,`nz`)
220
+ * 1 uint for the real part of the rotation quaternion (`rot_re`)
221
+ * 1 uint for the imaginary part of the rotation quaternion (`rot_im`)
222
+ * 1 uint for opacity (`opacity`)
223
+ * 3 uint for scaling (`scale`)
224
+ * 1 uint for DC color (`f_dc`)
225
+ * 3 uint for SH coefficients (`f_rest_0`, `f_rest_1`, `f_rest_2`)
226
+
227
+ The codebook quantization introduces some additional changes. For different parameters, you can set different lengths of the codebook. Each attribute's codebook will be stored in different elements. The codebooks are ordered as follows:
228
+ * `codebook_rot_re` element contains 1 float for the real part of the rotation quaternion (`rot_re`)
229
+ * `codebook_rot_im` element contains 3 floats for the 3 imaginary parts of the rotation quaternion (`rot_im_0`, `rot_im_1`, `rot_im_2`)
230
+ * `codebook_opacity` element contains 1 float for the opacity (`opacity`)
231
+ * `codebook_scaling` element contains 3 floats for the 3 parameters of scale (`scaling_0`, `scaling_1`, `scaling_2`)
232
+ * `codebook_f_dc` element contains 3 floats for the 3 DC color parameters (`f_dc_0`, `f_dc_1`, `f_dc_2`)
233
+ * 3 elements `codebook_f_rest_<SH degree>` contains floats for SH coefficients of 3 SH degrees (`f_rest_<SH degree>_<SH coefficients at this degree>`).
234
+ SH degree 1 has 3 coefficients `f_rest_0_<0,1,2>` in `codebook_f_rest_0`,
235
+ SH degree 2 has 5 coefficients `f_rest_1_<0,1,2,3,4>` in `codebook_f_rest_1`,
236
+ SH degree 3 has 7 coefficients `f_rest_2_<0,1,2,3,4,5,6>` in `codebook_f_rest_2`.
237
+
238
+ # Reducing the Memory Footprint of 3D Gaussian Splatting
239
+ Panagiotis Papantonakis Georgios Kopanas, Bernhard Kerbl, Alexandre Lanvin, George Drettakis<br>
240
+ | [Webpage](https://repo-sam.inria.fr/fungraph/reduced_3dgs/) | [Full Paper](https://repo-sam.inria.fr/fungraph/reduced_3dgs/reduced_3DGS_i3d.pdf) | [Datasets (TODO)](TODO) | [Video](https://youtu.be/EnKE-d7eMds?si=xWElEPf4JgwOAmbB&t=48) | [Other GRAPHDECO Publications](http://www-sop.inria.fr/reves/publis/gdindex.php) | [FUNGRAPH project page](https://fungraph.inria.fr) | <br>
241
+ ![Teaser image](assets/teaser.jpg)
242
+
243
+ This repository contains the code of the paper "Reducing the Memory Footprint of 3D Gaussian Splatting", which can be found [here](https://repo-sam.inria.fr/fungraph/reduced_3dgs/).
244
+ We also provide the configurations to train the models mentioned in the paper,
245
+ as well as the evaluation script that produces the results.
246
+
247
+ <a href="https://www.inria.fr/"><img height="100" src="assets/logo_inria.png"> </a>
248
+ <a href="https://univ-cotedazur.eu/"><img height="100" src="assets/logo_uca.png"> </a>
249
+ <a href="https://team.inria.fr/graphdeco/"> <img style="width:90%; padding-right: 15px;" src="assets/logo_graphdeco.png"></a>
250
+
251
+ Abstract: *3D Gaussian splatting provides excellent visual quality for novel view synthesis, with fast training and real-time rendering; unfortunately, the memory requirements of this method for storing and transmission are
252
+ unreasonably high. We first analyze the reasons for this, identifying three main areas where storage can
253
+ be reduced: the number of 3D Gaussian primitives used to represent a scene, the number of coefficients for
254
+ the spherical harmonics used to represent directional radiance, and the precision required to store Gaussian
255
+ primitive attributes. We present a solution to each of these issues. First, we propose an efficient, resolution-aware primitive pruning approach, reducing the primitive count by half. Second, we introduce an adaptive
256
+ adjustment method to choose the number of coefficients used to represent directional radiance for each
257
+ Gaussian primitive, and finally a codebook-based quantization method, together with a half-float representation
258
+ for further memory reduction. Taken together, these three components result in a ×27 reduction in overall size
259
+ on disk on the standard datasets we tested, along with a ×1.7 speedup in rendering speed. We demonstrate
260
+ our method on standard datasets and show how our solution results in significantly reduced download times
261
+ when using the method on a mobile device*
262
+
263
+ <section class="section" id="BibTeX">
264
+ <div class="container is-max-desktop content">
265
+ <h2 class="title">BibTeX</h2>
266
+ <pre><code>@Article{papantonakisReduced3DGS,
267
+ author = {Papantonakis, Panagiotis and Kopanas, Georgios and Kerbl, Bernhard and Lanvin, Alexandre and Drettakis, George},
268
+ title = {Reducing the Memory Footprint of 3D Gaussian Splatting},
269
+ journal = {Proceedings of the ACM on Computer Graphics and Interactive Techniques},
270
+ number = {1},
271
+ volume = {7},
272
+ month = {May},
273
+ year = {2024},
274
+ url = {https://repo-sam.inria.fr/fungraph/reduced_3dgs/}
275
+ }</code></pre>
276
+ </div>
277
+ </section>
278
+
@@ -0,0 +1,31 @@
1
+ reduced_3dgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ reduced_3dgs/combinations.py,sha256=Akg4XRlRC3-nKYYnwwzqp3BdMN3URjJYQH-EvLVY194,9156
3
+ reduced_3dgs/quantize.py,sha256=MIgZaZ_pORz1nWjirly2xq0-1PPkdTn1-buprv9Znro,2478
4
+ reduced_3dgs/train.py,sha256=wlv9cjh411chLT_YwnQ_FDcDb0VVt7LQ8NFtDEn-1xc,9608
5
+ reduced_3dgs/diff_gaussian_rasterization/_C.cpython-310-x86_64-linux-gnu.so,sha256=ySQjA-Y2h-CH5Mp-xnrBMrv1zVVpL8QaGIMQ6GyOn9Q,13484585
6
+ reduced_3dgs/diff_gaussian_rasterization/__init__.py,sha256=x1MrgPOmmUifADdxznI27wN8vDgEYGpuYSawhzG30Ws,7697
7
+ reduced_3dgs/importance/__init__.py,sha256=dmrZGaFh3iqx7k74NZZJpNxYBv_daqcG02A8scLq-PU,286
8
+ reduced_3dgs/importance/combinations.py,sha256=hml7jMij0EhaWKHXnAVIRtYL5VWYCss9a0HGB6jQ34A,2859
9
+ reduced_3dgs/importance/trainer.py,sha256=6wFU1NdIpzydtlNuHj8RkPaFX7tVc0VrgXT2eW--M2w,12392
10
+ reduced_3dgs/importance/diff_gaussian_rasterization/_C.cpython-310-x86_64-linux-gnu.so,sha256=uSZRajaQXTbefi3g1iHoGuo-yjc5a6iZPuS7AR37Smg,12602161
11
+ reduced_3dgs/importance/diff_gaussian_rasterization/__init__.py,sha256=EzE1cl19z5MAowNWRdHEO_R_zMykpcMjqlzQhY95huo,12503
12
+ reduced_3dgs/pruning/__init__.py,sha256=knOaLzJIHLMwjzWQJcHIYPFZuNLcKzmByOyCvhR1cd4,199
13
+ reduced_3dgs/pruning/combinations.py,sha256=6OyGkUE_b3c5aDLcyJJt12VXLRWX4xBSd0hEcTra3AE,2280
14
+ reduced_3dgs/pruning/trainer.py,sha256=sznPsG-ROFJnk49M0WU4oLgLUb-IWLGrhJ634u5ODEM,6397
15
+ reduced_3dgs/quantization/__init__.py,sha256=cjgzuhrZMG4y0xE_K1FRyC24fi03MeUAj4B5enVJ8_w,221
16
+ reduced_3dgs/quantization/abc.py,sha256=zETPGJcdjIv4CXuWBhroP1s0rjXOK03O_UtmsNLRER0,1861
17
+ reduced_3dgs/quantization/exclude_zeros.py,sha256=1Lfgo9vyoJxUSGHjOQo6-G29XZDpmY55hYJLQ3RD2H4,2340
18
+ reduced_3dgs/quantization/quantizer.py,sha256=QK5KaUK719vla3nYiF_CC4P0yYISM3mTHgJI_ubl2yc,16423
19
+ reduced_3dgs/quantization/wrapper.py,sha256=tLoGDyHaxoX4c8S6dhQqEbNZw4ss5kW-iPbUTj9H6SU,2482
20
+ reduced_3dgs/shculling/__init__.py,sha256=Q2LCRq4OJMZbkr87b9TbEIxK15_9fXRpWcwRZw8s7lQ,147
21
+ reduced_3dgs/shculling/gaussian_model.py,sha256=XN7GiP41fMwoI6_-dPVxlAcetytycqSPNZ1wEfp8K8g,2799
22
+ reduced_3dgs/shculling/trainer.py,sha256=hF5bLmYLMccqNV4zIUrsaEJWPsZgMVhP9rdRcIgHxDI,6211
23
+ reduced_3dgs/simple_knn/_C.cpython-310-x86_64-linux-gnu.so,sha256=6ndrcBVWuEGGDI1pKcFRyyzoc378BhFw1o2zkyP08IM,12228505
24
+ reduced_3dgs.libs/libc10-ff4eddb5.so,sha256=N8uNWdzJx_re8iyBKdf99-my0cK8p-9oRGzlsW1iR_Y,1521585
25
+ reduced_3dgs.libs/libc10_cuda-c675d3fb.so,sha256=Imurw9nK5zulaaT3tEv6qyHA1WArshhWXgHhOADnE1s,760289
26
+ reduced_3dgs.libs/libcudart-8774224f.so.12.4.127,sha256=0luzq6xQEhdcVtBYMQrT8Jnfh-4X5Cctzsl058kbmHE,724425
27
+ reduced_3dgs-1.10.0.dist-info/LICENSE.md,sha256=vZ27wf6m2PovUazaad7waX6utAWi8ReG8B_IRaQtjwg,4823
28
+ reduced_3dgs-1.10.0.dist-info/METADATA,sha256=5cBQB4NoXFyQoWc0upi2O99_jWOl8c3dCyBF1gPa6H8,12534
29
+ reduced_3dgs-1.10.0.dist-info/WHEEL,sha256=00ZqUltSr86DjA23C3-UwhMTpYtngQxTsng9bbKR2LM,151
30
+ reduced_3dgs-1.10.0.dist-info/top_level.txt,sha256=PpU5aT3-baSCdqCtTaZknoB32H93UeKCkYDkRCCZMEI,13
31
+ reduced_3dgs-1.10.0.dist-info/RECORD,,
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.5.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-cp310-manylinux_2_17_x86_64
5
+ Tag: cp310-cp310-manylinux2014_x86_64
6
+
@@ -0,0 +1 @@
1
+ reduced_3dgs
Binary file