2D Gaussian Splatting for Geometrically Accurate Radiance Fields
代码地址
https://github.com/hbb1/2d-gaussian-splatting
其实直接按照readme的介绍即可配置
# 下载代码
git clone https://github.com/hbb1/2d-gaussian-splatting.git --recursive
如果之前有配置好的3DGS环境,那么下面这两步可以直接跳过,后面缺啥包直接pip install即可
# 如果有3DGS环境,直接激活3dgs的环境即可。跳过这两步
conda env create --file environment.yml
conda activate surfel_splatting
训练自己的数据集
和3dgs一样,用colmap先跑一遍。
然后
python train.py -s <数据集路径>
python render.py -m <output里生成的模型,一般是乱码> -s <数据集路径>
栗子
python train.py -s /data/gaussian-splatting/data/xxx/
python render.py -s /data/gaussian-splatting/data/xxx/ -m /data/2d-gaussian-splatting/output/xxx
可视化
3dgs的可视化软件打开会有问题,2dgs的软件作者说在开发中。不过可以把生成的ply文件导入到传统mesh查看器里。
比如下边使用meshlab打开,效果如图
或者用下面的代码生成演示视频
python render.py -s <> -m <> --skip_mesh --skip_test --skip_train --render_path
遇到的问题
render videos ...
reconstruct radiance fields: 240it [00:02, 85.01it/s]
The estimated bounding radius is 6.22
Use at least 12.45 for depth_trunc
export images: 240it [01:12, 3.30it/s]
Video shape is (462, 624)
Making video /data/2d-gaussian-splatting/output/tum_desk/traj/ours_30000/render_traj_depth.mp4...
0%| | 0/240 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/data/2d-gaussian-splatting/utils/render_utils.py", line 264, in create_videos
img = cm.get_cmap('turbo')(img)[..., :3]
AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/2d-gaussian-splatting/render.py", line 81, in <module>
create_videos(base_dir=traj_dir,
File "/data/2d-gaussian-splatting/utils/render_utils.py", line 247, in create_videos
with media.VideoWriter(
File "/home/zf/anaconda3/envs/gaussian_splatting/lib/python3.10/site-packages/mediapy/__init__.py", line 1614, in __exit__
self.close()
File "/home/zf/anaconda3/envs/gaussian_splatting/lib/python3.10/site-packages/mediapy/__init__.py", line 1671, in close
raise RuntimeError(f"Error writing '{self.path}': {s}")
RuntimeError: Error writing '/data/2d-gaussian-splatting/output/tum_desk/traj/ours_30000/render_traj_depth.mp4': Unrecognized option 'crf'.
Error splitting the argument list: Option not found
第一个问题是matplotlib版本更新了,没有get_cmap,直接安装旧版本的即可
pip install matplotlib==3.3.4
第二个问题是ffmpeg版本问题
pip install ffmpeg==4.2.2