LiteGS

MooreThreads更新放缓

重构版高斯泼溅训练代码库,50 秒即可完成 3DGS 训练,适合快速迭代三维重建实验。

A refactored codebase for Gaussian Splatting. Training 3DGS in 50 seconds!

暂无版本428star41fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
pip install litegs/submodules/simple-knn
pip install litegs/submodules/fused_ssim
pip install litegs/submodules/gaussian_raster
pip install -r requirement.txt
硬件要求按 README 说明

README 未说明最低显存要求;基准测试在 RTX 3090 与 RTX 4090 上完成,未提及其他 GPU 厂商或型号。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

重构版高斯泼溅训练代码库,50 秒训完 3DGS,模块化且支持纯 Python 或 CUDA

重构版高斯泼溅训练代码库,50 秒即可完成 3DGS 训练,适合快速迭代三维重建实验。

核心能力

  • 把前向反向拆成多个 PyTorch 扩展函数,可访问中间变量
  • 提供 Python 与 CUDA 两套 API,Python 版便于快速改逻辑
  • 渲染拆成剔除、压缩、投影、可见表、光栅化五步
  • 相比原版 3DGS 提速 4.7 倍,显存占用降低约 30%
  • 保留核心 3DGS 算法,仅因聚类微调密度控制

容易踩的坑

需先依次安装 simple-knn、fused_ssim、gaussian_raster 三个子模块再装依赖;gaussian_raster 默认走 pip 安装,需 CMake 调试时要单独用 cmake 构建;训练需自备数据集并用 -s/-i/-m 指定数据源、图像目录和输出路径。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    LiteGS

    Fastest(about 50 seconds), Modular, and Available in Pure Python or CUDA

    This repository provides a refactored codebase aimed at improving the flexibility and performance of Gaussian splatting.

    Training 3DGS in about 50 seconds

    python ./scripts/full_eval_aggressive.py --mipnerf360 SOURCE_PATH1 --tanksandtemples SOURCE_PATH2 --deepblending SOURCE_PATH3

    ScenePrimitivesTime_3090(s)Time_4090(s)SSIMPSNRLPIPS
    bicycle1,000,00050330.746725.100.2531
    bonsai1,000,00071450.943032.020.1986
    counter1,000,00084510.910328.980.1952
    drjohnson1,000,00047280.905429.550.2596
    flowers1,000,00060400.601121.750.3500
    garden1,000,00053330.847127.230.1485
    kitchen1,000,00082500.924931.330.1321
    playroom1,000,00048290.912330.820.2434
    room1,000,00064390.922031.630.2130
    stump1,000,00053340.784727.100.2278
    train1,000,00070470.795621.500.2316
    treehill1,000,00057370.638223.170.3479
    truck1,000,00063430.883125.780.1368
    DatasetPrimitivesTime_3090(s)Time_4090(s)SSIMPSNRLPIPS
    mipnerf3601,000,00064400.813127.590.2296
    tat1,000,00067450.839423.640.1842
    db1,000,00047290.908830.190.2515

    Background

    Gaussian splatting is a powerful technique used in various computer graphics and vision applications. It involves representing 3D data as Gaussian distributions in space, allowing for efficient and accurate representation of spatial data. However, the original implementation (https://github.com/graphdeco-inria/gaussian-splatting) of Gaussian splatting in PyTorch faced several limitations:

    1. The forward and backward computations were encapsulated in two distinct PyTorch extension functions. Although this design significantly accelerated training, it restricted access to intermediate variables unless the underlying C code was modified.
    2. Modifying any step of the algorithm required manually deriving gradient formulas and implementing them in the backward pass, adding considerable complexity.

    Features

    1. Modular Design: The refactored codebase breaks forward and backward into multiple PyTorch extension functions, significantly improving modularity and enabling easier access to intermediate variables. Additionally, in some cases, leveraging PyTorch Autograd eliminates the need to manually derive gradient formulas.

    2. Flexible: LiteGS provides two modular APIs—one implemented in CUDA and the other in Python. The Python-based API facilitates straightforward modifications to calculation logic without requiring expertise in C code, enabling rapid prototyping. Additionally, tensor dimensions are permuted to maintain competitive training speeds for the Python API. For performance-critical tasks, the CUDA-based API is fully customizable.

    3. Better Performance and Fewer Resources: LiteGS achieves an 4.7x speed improvement over the original 3DGS implementation while reducing GPU memory usage by around 30%. These optimizations enhance training efficiency without compromising flexibility or readability.

    4. Algorithm Preservation: LiteGS retains the core 3DGS algorithm, making only minor adjustments to the training logic due to culstering.

    Getting Started

    1. Install simple-knn

      pip install litegs/submodules/simple-knn
      
    2. Install fused-ssim

      pip install litegs/submodules/fused_ssim
      
    3. Install litegs_fused

      pip install litegs/submodules/gaussian_raster
      

      If you need the cmake project(e.g. CUDA Debug in Visual Studio):

      cd litegs/submodules/gaussian_raster
      mkdir ./build
      cd ./build
      #for Windows PowerShell: $env:CMAKE_PREFIX_PATH = (python -c "import torch; print(torch.utils.cmake_prefix_path)")
      export CMAKE_PREFIX_PATH=$(python -c "import torch; print(torch.utils.cmake_prefix_path)")
      cmake ../
      cmake --build . --config Release
      
    4. Install requirments

      pip install -r requirement.txt
      

    Train

    Begin training with the following command:

    ./example_train.py --sh_degree 3 -s DATA_SOURCE -i IMAGE_FOLDER -m OUTPUT_PATH

    Faster

    The training results of LiteGS using the Mip-NeRF 360 dataset on an RTX 3090 are presented below. The training and evaluation command used is:

    LiteGS: python ./full_eval.py --mipnerf360 SOURCE_PATH1 --tanksandtemples SOURCE_PATH2 --deepblending SOURCE_PATH3

    image

    Modular

    Unlike the original 3DGS, which encapsulates nearly the entire rendering process into a single PyTorch extension function, LiteGS divides the process into multiple modular functions. This design allows users to access intermediate variables and integrate custom computation logic using Python scripts, eliminating the need to modify C code. The rendering process in LiteGS is broken down into the following steps:

    1. Cluster Culling

      LiteGS divides the Gaussian points into several chunks, with each chunk containing 1,024 points. The first step in the rendering pipeline is frustum culling, where points outside the camera's view are filtered out.

    2. Cluster Compact

      Similar to mesh rendering, LiteGS compacts visible primitives after frustum culling. Each property of the visible points is reorganized into sequential memory to improve processing efficiency.

    3. 3DGS Projection

      Gaussian points are projected into screen space in this step, with no modifications made compared to the original 3DGS implementation.

    4. Create Visibility Table

      A visibility table is created in this step, mapping tiles to their visible primitives, enabling efficient parallel processing in subsequent stages.

    5. Rasterization

      In the final step, each tile rasterizes its visible primitives in parallel, ensuring high computational efficiency.

    LiteGS makes slight adjustments to density control to accommodate its clustering-based approach.

    Flexible

    The gaussian_splatting/wrapper.py file contains two sets of APIs, offering flexibility in choosing between Python-based and CUDA-based implementations. The Python-based API is invoked using call_script(), while the CUDA-based API is available via call_fused(). While the CUDA-based API delivers significant performance improvements, it lacks the flexibility. The choice between these implementations depends on the specific use case:

    • python-based api: Provides greater flexibility, making it ideal for rapid prototyping and development where training speed is less critical.

    • cuda-based api: Offers the highest performance and is recommended for production environments where training speed is a priority.

    Additionally, an interface validate() and the accompanying check_wrapper.py script are provided to verify that both APIs produce consistent gradients.

    Here is an example that demonstrates the flexibility of LiteGS. In this instance, our goal is to create a more precise bounding box for a 2D Gaussian when generating visibility tables. In the original 3DGS implementation, the bounding box is determined as three times the length of the major axis of the Gaussian. However, incorporating opacity can allow for a smaller bounding box.

    To implement this change in the original 3DGS, the following steps are required:

    • Modify the C++ function declarations and definitions
    • Update the CUDA global function
    • Recompile

    In LiteGS, the same change can be achieved by simply editing a Python script.

    original:

    axis_length=(3.0*eigen_val.abs()).sqrt().ceil()
    

    modified:

    coefficient=2*((255*opacity).log())
    axis_length=(coefficient*eigen_val.abs()).sqrt().ceil()
    

    Performance Optimization Detail

    Comming soon.