Julia 中的优质高斯溅射
Better Gaussian Splatting in Julia

原始链接: https://pxl-th.github.io/blog/better-gs-julia/

**GaussianSplatting.jl 2.0** 引入了重大的性能与易用性升级,并完全使用 Julia 构建。主要亮点包括: * **多平台支持:** 利用 `KernelAbstractions.jl`,该库现在通过单一代码库支持 NVIDIA、AMD 和 Apple Silicon (Metal) GPU。 * **响应式 UI:** 全新的多线程架构将渲染和训练与 UI 解耦,确保应用在进行 JIT 编译或数据集加载等繁重的后台任务时,仍能保持交互流畅。 * **高级训练策略:** 增加了对 MCMC 稠密化(densification)的支持,以实现对场景几何结构的精确控制;同时引入深度监督和几何正则化,以提高重建质量并减少伪影。 * **背景管理:** 新增的“天空穹顶”(Sky Dome)功能可有效将天空与场景几何结构分离,从而减少浮动伪影。 * **工作流增强:** 本次更新包括实时损失函数绘图、自动检查点保存、显存使用监控,以及保存/加载摄像机路径和超参数配置(`.toml`)的能力,从而提升了实验的可复现性。 这些改进简化了高斯溅射(Gaussian Splatting)的工作流程,为高保真 3D 重建提供了更强大且友好的使用体验。

这场 Hacker News 讨论聚焦于一个在 Julia 中实现高斯溅射(Gaussian Splatting)的新项目,该项目因其跨平台硬件支持(NVIDIA、AMD 和 Apple Metal)而受到称赞。 讨论的重点主要集中在高斯溅射工作流程所面临的技术挑战上。用户指出,目前的“事实”标准要求使用 COLMAP 进行相机姿态估计和初始点云生成,这一预处理步骤通常被认为既繁琐又耗费硬件资源。一位参与者表达了在寻找处理视频素材的非 COLMAP 替代方案时所遇到的困难,尽管其他人也提到 COLMAP 近期通过 HIP 实现了对 AMD 硬件的支持。 此外,技术观察者对该项目的演示效果提出了批评,指出在旋转视角时会出现“残缺”或伪影。用户对此澄清说,这些伪影在原始训练数据中被遮挡的区域是预料之中的,这突显了高斯溅射的本质——即依赖一致的图像覆盖来合成视角。虽然一些用户对 Julia 实现版本所带来的易用性提升印象深刻,但其他人仍在讨论对齐不同相机视角以构建完整 3D 场景的复杂性。
相关文章

原文

GaussianSplatting.jl 2.0 release brings notable quality of life improvements and new capabilities.

Same code, multiple GPU backends

Written entirely in Julia it supports following GPU backends:

  • AMD GPU (AMDGPU.jl)
  • NVIDIA GPU (CUDA.jl)
  • MacBook GPU(Metal.jl)

This is achieved with KernelAbstractions.jl that allows writing a single kernel that get's compiled to a specific target.

Multithreaded UI

To avoid freezing the app during heavy work (such as JIT compilation of GPU kernels, dataset loading, etc.) the app is now split into two threads:

  • Frontend: handles the UI, performs OpenGL rendering, dispatches commands to the backend.
  • Backend: performs Gaussian Splatting rendering, training, dataset loading, etc.

In this way, the UI always stays responsive and user can interact with it, even if there are long-standing jobs in the background. It also shows progress bars that something is happening with tips, instead of becoming frozen like before.

The spinner keeps animating while the dataset loads on the backend thread
and when JIT-compiling kernels for the first training iteration.

UI/UX itself got a big update and is now displays loss plots live during training along with all hyperparameters.

Markov Chain Monte Carlo Strategy

Besides default cloning and splitting densification strategy, we now support MCMC (3D Gaussian Splatting as Markov Chain Monte Carlo) densification strategy.

It allows precise control of the number of Gaussians in the scene and generally relies less on having a good initialization.

Users can select MCMC during dataset loading or in the code with:

Trainer(
    rasterizer, gaussians, dataset, opt_params;
    strategy=MCMCStrategy(; kwargs...),
)

Depth & Geometry Supervision

To improve reconstructed geometry, we can provide depth priors using off-the-shelf depth estimation models. Depth images should be part of the dataset, under <dataset-root>/depths/<FILENAME>.png path.

A dataset image and its estimated depth prior using Depth-Anything 3.

To enable depth supervision, either toggle it in UI or with OptimizationParams(; use_depth_loss=true). Depth maps then provide supervision during training resulting in better geometry and reduced number of floaters.

Since depth may vary between frames, all depth maps are first refitted against prior point cloud to the same scale. The ones that fail refitting are discarded and not used for supervision.

To further improve geometry and smoothness, we can perform geometry regularization to constrain the shape of the surface, while depth supervision constrains only its location. It can be enabled in the UI or with OptimizationParams(; use_normal_loss=true) and performs two things:

  • depth normal consistency pins surface orientation: normals derived from the rendered depth map must align with the per-Gaussian normals.
  • flattening surface: flattening each Gaussian along its smalles axis.
A rendered image, depth and normals of the model with geometry regularization enabled.

Sky Dome

To help disentangle sky / distant background and reduce floaters, GaussianSplatting.jl now supports Sky Dome, which is a frozen shell of Gaussians at a large radius, rendered in its own pass and composited behind the scene.

Sky Dome in a form of a sphere and a hemisphere.

Depending on your environment (e.g. like this fountain above), you may want to prefer hemisphere instead of a sphere, because a full sphere will pull parts of the geometry onto itself, making the ground less opaque. By using hemisphere, the bottom half background is black and does not affect geometry at all.

Comparison of the reconstruction without and with Sky Dome after 3K iterations. With Sky Dome, sky is clearly disentangled from the fountain and does not float around.

The overhead of Sky Dome is negligible (~32K Gaussians) comparing to the rest of the scene (millions of Gaussians).

To further help disentangle the sky, we can use sky segmentation masks obtained from any off-the-shelf sky-segmentation models, which should be part of the dataset under <dataset-root>/sky/<FILENAME>.png path.

A dataset image and its estimated sky mask.

This helps with small details around the edges of geometry, like leaves.

Camera Frustum

Camera frustum visualization got a small quality-of-life update and now shows a miniature picture of the image that the actual camera took.

Some Other Niceties

List of other improvements in no particular order:

  • Automatic checkpointing saves checkpoints every N steps in the selected directory.
  • Custom hyperparameter configuration (learning rate, loss weights, regularization, etc.) can be provided during dataset loading with hyperparameters.toml file (use Load..., Save... buttons). It can also be saved later on if you are satisfied with these values, helping reproducibility.
  • Camera path for Capture Mode can now be saved / loaded and reproduced exactly accross training runs.
  • UI shows how much VRAM is being used by the application.

---

This concludes GaussianSplatting.jl 2.0 update.
Feel free to try and leave the feedback on the GitHub repo.

Thanks! :)

Acknowledgements

← back

联系我们 contact @ memedata.com