GithubHelp home page GithubHelp logo

shiukaheng / mings Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 4.38 MB

Minimalistically refactored reference Gaussian splatting library

Python 51.50% Shell 0.08% CMake 0.61% C++ 9.10% Cuda 37.33% C 0.49% Dockerfile 0.89%
gaussian-splatting ibr image-based-rendering nerf novel-view-synthesis novel-viewpoint-synthesis research

mings's Introduction

minGS

This is a minimalistic refactor of the original 3D Gaussian splatting codebase that follows PyTorch conventions and allow for easy customization and extension, based on the original 3DGS official repository.

It is meant for researchers who want to experiment with 3D Gaussian splatting and need a clean and easy to understand codebase to start from.

Features

  • ๐Ÿง‘๐Ÿปโ€๐Ÿ’ป Typed and commented
  • ๐Ÿ“ฆ .devcontainer Docker provided
  • ๐Ÿ“„ Separation of model and training logic
    • A nn.module GaussianModel only for storing parameters and forward pass (rendering)
    • Reference training logic and hyperparameters is defined in train() in gs.trainers.basic
  • ๐Ÿ“ธ Viser web-based frontend for viewing model during and after training

Examples

Minimal Custom Training Example

To customize the pipeline GaussianModel can be used just like any other PyTorch model and the training loop can be written from scratch. Below is a minimal example:

import torch
from gs.core.GaussianModel import GaussianModel
from gs.helpers.loss import l1_loss
from gs.io.colmap import load

cameras, pointcloud = load('your_dataset/')
model = GaussianModel.from_point_cloud(pointcloud).cuda()
optimizer = torch.optim.Adam(model.parameters(), lr=0.001, eps=1e-15)

for i in range(5000):

    camera = cameras[i % len(cameras)]
    rendered = model.forward(camera)

    loss = l1_loss(rendered, camera.image)
    loss.backward()

    optimizer.step()
    optimizer.zero_grad(set_to_none=True) 

    torch.cuda.empty_cache()

Structure

The codebase is structured as follows:

  • gs/: The Gaussian splatting module.
    • core/: Core data structures and functions for rendering 3DGS models
      • BaseCamera.py: Base class that represents a camera used for training 3DGS models
      • BasePointCloud.py: Base class for point clouds used for initializing 3DGS models
      • GaussianModel.py: 3DGS model refactored as a nn.Module. Use forward with a camera to render the model
    • io/: Functions for importing and exporting image and point cloud data
      • colmap/: Functions for importing COLMAP reconstructions into BaseCamera and BasePointCloud compliant objects
    • trainers/: Training scripts for 3DGS models
      • basic/: Re-implementations of the original training script
    • visualization/: Classes for visualizing 3DGS models
      • Viewer.py: Class for starting a web-based 3DGS viewer for a GaussianModel
      • TrainingViewer.py Extension of Viewer to be integrated into a training loop for live viewing during training
    • helpers/: General functions for rendering and training 3DGS models

Installing dependencies

Only tested for Linux, but may work for Windows too. Using devcontainers should make getting the dependencies easier.

Method 1: Local environment (Tested on Python 3.8)

  • CUDA Toolkit
  • pip install numpy scipy torch torchvision torchaudio plyfile lpips pybind11 viser
  • Installing PyBind11 submodules
    • pip install -e ./submodules/diff-gaussian-rasterization/
    • pip install -e ./submodules/simple-knn/

Method 2: .devcontainer

Devcontainers automatically recreate the development environment using Docker. It is mainly supported by VSCode but there is also limited support for other editors. Install the relevant extensions, and when you open the repository you should be prompted to enter the container environment. First time running might take around 5 minutes to build the environment.

mings's People

Contributors

shiukaheng avatar

Stargazers

Ivan Puhachov avatar  avatar

Watchers

 avatar

Forkers

poonono

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.