Skip to content

Instantly share code, notes, and snippets.

@ElishaAz
Last active February 6, 2024 13:54
Show Gist options
  • Select an option

  • Save ElishaAz/03051a8df0031b03c066f4f5467ef2b8 to your computer and use it in GitHub Desktop.

Select an option

Save ElishaAz/03051a8df0031b03c066f4f5467ef2b8 to your computer and use it in GitHub Desktop.
Gaussian Splatting HowTo

Gaussian Splatting

Build the model

Install

# Make sure CUDA 12.1 is installed first
apt list cuda-12-1

git clone --recurse-submodules https://github.com/graphdeco-inria/gaussian-splatting
cd gaussian-splatting

# install dependencies
pip install plyfile torch pillow tqdm

# install submodules
pip install submodules/diff-gaussian-rasterization
pip install submodules/simple-knn

sudo apt install colmap # used when pre-processing the images

Run

DATA_DIR=data

mkdir $DATA_DIR

# copy your images into $DATA_DIR/input

python convert.py --source_path $DATA_DIR # preprocess the images (create optimization-ready Sfm data set)

python train.py -s $DATA_DIR # create thet gaussian model (the hard part). Requires around 24Gb of VRAM.

# To use less VRAM, run (replace 7000 with the iteration a bit before the one where it runs out of VRAM):
python train.py -s $DATA_DIR --test_iterations -1 --densify_until_iter 7000

Viewer

Install

cd gaussian-splatting
cd SIBR_viewers

# install dependencies
sudo apt install libglew-dev libassimp-dev libboost-all-dev libgtk-3-dev libopencv-dev libglfw3-dev libavdevice-dev libavcodec-dev libeigen3-dev libxxf86vm-dev libembree-dev build-essential cmake ninja-build

# compile
export CUDACXX=/usr/local/cuda-12.1/bin/nvcc
cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release -G Ninja
cmake --build build -j24 --target install

Run

cd gaussian-splatting/SIBR_viewers/install/bin
./SIBR_gaussianViewer_app -m ../../../output/<model id>
# on a laptop with hybrid graphics, run the graphics on the gpu:
switcherooctl ./SIBR_gaussianViewer_app -m ../../../output/<model id>

Viewer controls

Move:

  • W - forward
  • S - back
  • A - right
  • D - left
  • Q - down
  • E - up

Turn:

  • I - pitch up
  • K - pitch down
  • L - roll right
  • J - roll left
  • U - turn clockwise
  • O - turn counterclockwise

Modes:

  • V - toggle interp. mode (play the model as a video)
  • B - toggle orbit mode
  • Y - toggle trackball mode (move with mouse)
  • Space - toggle snap to images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment