This is the public codes for SCIA2025 paper: "Compressing 3D Gaussian Splatting by Noise-Substituted Vector Quantization"
The command to clone our repo: git clone [email protected]:AaltoML/nsvqgs.git --recursive
.
Since the repo contains submodules, please clone it recursively, and make sure the dir submodules
contains non-empty subdirs
The python environment is installed by
conda env create -f environment.yml
with the environment name nsvqgs
This note contains additional information about the environment installation, you can skip it if you have installed it successfully already.
This env is very similar to the environment of Inria-GaussianSplatting repo. The solutions to some installation issues maybe exist in this repo.
We succeed to install the environment by the environment.yml
with cuda=11.6.2, and gcc=9.2.0
. However, this environment is very sensitive to the versions of CUDA, torch and gcc. And there are possibly bugs during the installaion of submodules. If the environment.yml
built by conda fails inside the submodules with cuda version incompatiblility. We recommend to install all packages without submodules, then install cuda tool one by one:
mamba install -c "nvidia/label/cuda-11.6.0" cuda-toolkit
mamba install -c "nvidia/label/cuda-11.6.0" cuda-nvcc
Then make sure the cuda compiler is 11.6 by
nvcc -V
Then install all submodules by pip.
pip install submodules/diff-gaussian-rasterization
pip install submodules/simple-knn
pip install submodules/fused-ssim
All the data could be downlowded by the following command
python scripts/data_download.py
The script will download the main three datasets: Mip-NeRF360 (9 scenes), Tanks & Temples (2 scenes) and Deep Blending (2 scenes).
Note that the data source: Mip-NeRF360 is from Mip-NeRF 360, Tanks & Temples (2 scenes) and Deep Blending are from Inria-3DGS.
There are some default settings following Inria-3DGS:
- Data split: Every 8th image must be selected for testing, specifically those images of index i where i mod 8 ≡ 0. All other images are used for training.
- Resolution: Full-resolution images should be used up to a maximum side length of 1600px. For larger test images, downscaling is required so that the longest dimension is 1600px.
This is an example command of training NSVQ-GS (4k bitrates) model:
CUDA_VISIBLE_DEVICES=0 python train_newvq.py --port 4060 --vq_ncls 4096 --vq_ncls_sh 1024 \
--vq_ncls_dc 1024 --vq_start_iter 20000 --quant_params sh dc rot scale --opacity_reg \
--lambda_reg 1e-7 --max_prune_iter 20000 --eval -s=${path_source} -m=${path_output} \
--total_iterations 45000 --fine_tune
Here ${path_source}
denotes the path of input data, ${path_output}
denotes the path of all output files
This is an example command of rendering and evaluating the trained model
# * rendering
python render.py -m ${path_output} --iteration 45000 --skip_train --load_quant
# * metrics calculation
python metrics.py -m ${path_output}
Here ${path_output}
denotes the path of trained model.
For convenience, we prepare a integrated script to train, render and evaluate NSVQ-GS standalone. you can run it with this command:
source scripts/train.sh