3D 高斯溅射是时下最新的一项计算机视觉/计算机图形学/深度学习技术,它是“神经渲染”领域的最新的成果。它引入了三项关键技术,使得在保证画质的同时,也能实现实用的训练时间,并能在 1080p 分辨率下达到实时渲染
技术核心
NeRF
SfM
Gaussian Splatting
Differentiable Rasterization
基础数学模型
一个高斯分布中心在 ,协方差矩阵 :
这里:
:某点在该高斯下的"贡献"
投影到 2D 图像平面
通过相机投影矩阵 ,将 和 映射到图像平面:
其中 是投影的雅可比矩阵。
这使得 3D 高斯在屏幕上变成一个 2D 高斯斑点(一个模糊的小椭圆)。
每个高斯还带颜色 和透明度 。
图像上的最终像素值是多个高斯 splat 的加权混合:
其中 表示前面高斯的透射率(类似体积渲染公式)。
与真实照片对比,最小化差异(MSE、SSIM、LPIPS 等损失)。
通过反向传播,更新 等参数,使得渲染结果与真实图像一致。
The default CUDA version on the Ubuntu24 system is 12.9, and latest version is 13.
However, using newer versions of CUDA Toolkit + PyTorch may cause various issues, such as requiring higher Python versions that are not supported by Gaussian Splatting.
Review the Environment.yml before starting, as it contains all the modules required for use.
If you are using servers or computers located within China, please configure a network proxy or set up a download mirror in advance to avoid download failures.
Please ensure that your system has Git installed before executing the command.
Step 1: Git Clone
Note:--recursive
must be included because the project has submodules.
Step 2: Create Conda Environment
Step 3: Install CUDA Tookit
Please check if your CUDA Toolkit version is 12.8. If so, proceed to execute the final command in the "Third Step."
Note: The CUDA version displayed by the nvidia-smi
command refers to the driver version, not the CUDA Toolkit version.
If not, you will need to uninstall the current version and reinstall it. This guide will skip the uninstallation steps and focus solely on the installation process for version 12.8.
Conda will install CUDA Toolkit 12.4, which remains backward-compatible with CUDA 12.8 instructions.
Step 4: Install the C++ Compilation Environment
Step 5: Install Additional Dependencies
and important step:
Installation will be aborted if your Python version is not 3.9.
Finally, ensure numpy==1.22
. If not, please uninstall the current numpy using the pip
and reinstall version 1.22.
Step 6: Modify Modules
First, navigate to and enter your project directory. For example, my directory is ~/Code/gaussian-splatting
.
and edit file to include float.h: #include <float.h>
Step 7: Compile Modules
Final Step
After saving the dataset, you can execute the command to begin training.
git clone https://github.com/graphdeco-inria/gaussian-splatting --recursive
conda create -n gaussian_splattingpython=3.9 ipython
conda activate gaussian_splatting
nvcc --version
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-8
conda install -c nvidia cuda-toolkit=12.4
sudo apt-get update
sudo apt install build-essential ninja-build
conda install -c conda-forge plyfile
conda install tqdm
pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu128
pip install opencv-python joblib
cd ~/Code/gaussian-splatting
vim submodules/simple-knn/simple-knn.cu
pip install submodules/diff-gaussian-rasterization
pip install submodules/simple-knn
pip install submodules/fused-ssim
python train.py -s ./xxx