Coder Social home page Coder Social logo

keksboter / c3dgs Goto Github PK

View Code? Open in Web Editor NEW
213.0 8.0 23.0 76.03 MB

Compressed 3D Gaussian Splatting for Accelerated Novel View Synthesis

Home Page: https://keksboter.github.io/c3dgs/

License: Other

Python 53.58% CMake 0.38% C++ 7.37% Cuda 38.50% C 0.17%
3dgs compression gaussian nerf rust wgpu

c3dgs's Introduction

Compressed 3D Gaussian Splatting for Accelerated Novel View Synthesis

Simon Niedermayr   Josef Stumpfegger   Rüdiger Westermann
Technical University of Munich

Webpage | arXiv

Comrpression Pipeline

Abstract

Recently, high-fidelity scene reconstruction with an optimized 3D Gaussian splat representation has been introduced for novel view synthesis from sparse image sets. Making such representations suitable for applications like network streaming and rendering on low-power devices requires significantly reduced memory consumption as well as improved rendering efficiency. We propose a compressed 3D Gaussian splat representation that utilizes sensitivity-aware vector clustering with quantization-aware training to compress directional colors and Gaussian parameters. The learned codebooks have low bitrates and achieve a compression rate of up to 31x on real-world scenes with only minimal degradation of visual quality. We demonstrate that the compressed splat representation can be efficiently rendered with hardware rasterization on lightweight GPUs at up to 4x higher framerates than reported via an optimized GPU compute pipeline. Extensive experiments across multiple datasets demonstrate the robustness and rendering speed of the proposed approach.

Citation

If you find our work useful, please cite:

@misc{niedermayr2023compressed,
    title={Compressed 3D Gaussian Splatting for Accelerated Novel View Synthesis}, 
    author={Simon Niedermayr and Josef Stumpfegger and Rüdiger Westermann},
    year={2023},
    eprint={2401.02436},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

Installation

Requirements

  • Conda (recommended for easy setup)
  • C++ Compiler for PyTorch extensions
  • CUDA SDK 12 for PyTorch extensions
  • C++ Compiler and CUDA SDK must be compatible

Please refer to the original 3D Gaussian Splatting repository for more details about requirements.

Cloning the Repository

git clone https://github.com/KeKsBoTer/c3gds

Setup

Our default, provided install method is based on Conda package and environment management:

SET DISTUTILS_USE_SDK=1 # Windows only
conda env create --file environment.yml
conda activate c3dgs

Running

To compress a scene reconstructed by 3D Gaussian Splatting, simply use:

python compress.py --model_path <model_folder> --data_device "cuda" --output_vq <output_folder>

Note: After the compression is complete the script will compute the metrics (PSNR, SSIM, LPIPS) for the test images.

Evaluation

For a more detailed evaluation and rendering run:

python render.py -m <path to compressed model> # Generate renderings
python metrics.py -m <path to compressed model> # Compute error metrics on renderings

Interactive Viewers

Our renderer supports direct rendering of the compressed files on many platforms with improved rendering speed. It can be found here.

Alternatively, you can convert the compressed .npz scene files back to .ply files and open them with the SIBR Viewer:

python npz2ply.py <npz_file> [--ply_file <PLY_FILE>]

c3dgs's People

Contributors

keksboter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c3dgs's Issues

Compress on multiple 3dgs models

Great job!
I was wondering if it would be possible to input multiple 3dgs models together for compression.
If so:
How is calc importance calculated?
And vq compression?
And finetune?
Could you please give me some advice. Thx!

Import torch_scatter cause Segmentation fault (core dumped)

hello,
when I tried to run compress.py, terminal shows Segmentation fault (core dumped). I used faulthandler then used python terminal to locate the error, which is from torch_scatter import scatter ,existing in vq.py
I create the conda env with environment.yml, and I have tried to recreate env of just reinstall pytorch_scatter package but dose not work.
and my cuda toolkit version is 12.1.
Can someone give me some suggestion?I appreciate your helping.
image
image

How to Train the Model Without Luminance Perception and Vector Quantization, Using Morton Sorting and Compression, and Save as NPZ File?

Hello,

I am interested in using your algorithm to train a model without utilizing Sensitivity Aware and vector quantization, but instead focusing on using Morton sorting and compression, and then saving the model as an NPZ file. Could you please provide guidance on how to proceed with this?

Specifically, I would like to know:

1.How can I disable luminance perception and vector quantization in the training process?
2.What steps should I take to ensure that Morton sorting is applied during the training?
3.How can I adjust the compression settings to optimize the compression process?
4.Could you provide instructions on how to save the trained model as an NPZ file?
I appreciate your assistance in this matter. Thank you.

cov can direct finetune?

i try load ply and cov vq, then i direct finetune cov param, like

    def get_covariance(self, scaling_modifier=1, strip_sym: bool = True):
        if self.is_gaussian_indexed:
            return self._cov[self._gaussian_indices]
        else:
            return self._cov

but it will cause crash

 1.0 - ssim(image, gt_image)
  File "c3dgs/utils/loss_utils.py", line 38, in ssim
    window = window.cuda(img1.get_device())
RuntimeError: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Training progress:   6%|█████████████████▏

Do you have any suggestions? thanks

submodules incompatible with downgraded torch by torch-scatter

Hello, looking forward to run your code.
However, when I run the conda env setup, I get the error below during pip install submodules.
Alternatively, when I manually install the packages, i can pip install submodules but thereafter torch-scatter is incompatible since it downgrades torch to 1.12 from 2.2.2

Wondering how you managed to set it up? Thanks!

Pip subprocess error:
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      running bdist_wheel
      running build
      running build_py
      copying diff_gaussian_rasterization\__init__.py -> build\lib.win-amd64-cpython-38\diff_gaussian_rasterization
      running build_ext
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Nicholas\Desktop\3DGS 5342\c3dgs\submodules\diff-gaussian-rasterization\setup.py", line 18, in <>
          setup(
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\core.py", line 185, ip
          return run_commands(dist)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\core.py", line 201, is
          dist.run_commands()
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\dist.py", line 969, is
          self.run_command(cmd)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\dist.py", line 967, in run_commad
          super().run_command(command)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\dist.py", line 988, id
          cmd_obj.run()
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\wheel\bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\cmd.py", line 318, ind
          self.distribution.run_command(command)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\dist.py", line 967, in run_commad
          super().run_command(command)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\dist.py", line 988, id
          cmd_obj.run()
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\command\build.py", lin
          self.run_command(cmd_name)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\cmd.py", line 318, ind
          self.distribution.run_command(command)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\dist.py", line 967, in run_commad
          super().run_command(command)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\dist.py", line 988, id
          cmd_obj.run()
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\command\build_ext.py", line 91, n
          _build_ext.run(self)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\setuptools\_distutils\command\build_ext.py"n
          self.build_extensions()
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\torch\utils\cpp_extension.py", line 434, ins
          self._check_cuda_version(compiler_name, compiler_version)
        File "C:\Users\Nicholas\.conda\envs\c3dgs-envfile\lib\site-packages\torch\utils\cpp_extension.py", line 812, inn
          raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
      RuntimeError:
      The detected CUDA version (12.1) mismatches the version that was used to compile
      PyTorch (11.6). Please make sure to use the same CUDA versions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.