3DGS语义分割之LangSplat

LangSplat是CVPR2024的paper. 实现3DGS的语义分割(可文本检索语义)
github: https://github.com/minghanqin/LangSplat?tab=readme-ov-file

主要思想是在3DGS中加入了CLIP的降维语义特征,可用文本检索目标,实现分割。

配置环境:
environment.yml一步一步执行。

conda create -n langsplat python=3.7.13
conda activate langsplat

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
pip install numpy
pip install tqdm
pip install matplotlib
pip install submodules/langsplat-rasterization
pip install submodules/simple-knn
pip install open-clip-torch
pip install mediapy
pip install tensorboard
pip install opencv-python

pip install submodules/segment-anything-langsplat
pip install submodules/langsplat-rasterization
pip install submodules/simple-knn

作者有训练好的ckpt 和 output, 直接下载下来,按照issues里面的step操作了一下。
https://github.com/minghanqin/LangSplat/issues/18

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

执行成功,但是在本机效果很差,有点像模型没有被训练,直接用随机值预测的一样。
iou=0.02, localization accuracy=0.1

结果图

RGB:
在这里插入图片描述

apple gt:

在这里插入图片描述

预测的:

在这里插入图片描述

其他的目标也都一样效果不好。

于是决定重新训练一遍。

首先,准备数据集:
下载lerf_ovs。

刚开始里面是images, sparse这两个要用到的文件夹。

然后按github的说明,运行3DGS, 得到一个权重和点云文件。
也就是output这个文件夹全部。
在这里插入图片描述

进入到3DGS的github:https://github.com/graphdeco-inria/gaussian-splatting
按照它的说明。

# HTTPS
git clone https://github.com/graphdeco-inria/gaussian-splatting --recursive

python train.py -s ~/dataset/lerf_ovs/teatime

这个模块是要安装的,每修改一次都要重新安装,

pip install submodules/diff-gaussian-rasterization

训练好了,但是没有pth文件
需要这样训练才会保存pth文件

python train.py -s ~/dataset/lerf_ovs/teatime --checkpoint_iterations 30000

然后把输出的output文件夹整个copy到~/dataset/lerf_ovs/teatime下面。

下一步,
提取语言特征

python preprocess.py --dataset_path ~/dataset/lerf_ovs/teatime

训练autoencoder
autoencoder文件夹下的train.py

cd autoencoder
python train.py --dataset_path ~/dataset/lerf_ovs/teatime --dataset_name teatime --encoder_dims 256 128 64 32 3 --decoder_dims 16 32 64 128 256 256 512 --lr 0.0007

训练3D语义特征
autoencoder文件夹下的test.py

python test.py --dataset_path ~/dataset/lerf_ovs/teatime --dataset_name teatime

下面要训练不同feature_level的LangSplat模型
–start_checkpoint是上面训练的3DGS模型
LangSplat文件夹下的train.py,
为了防止重名,可把这个改为train_model.py

python train.py -s ~/dataset/lerf_ovs/teatime -m output/teatime --start_checkpoint ~/dataset/lerf_ovs/teatime/output/teatime/chkpnt30000.pth --feature_level 1
#同样的训练level 2 和 level 3

渲染

 python render.py -s ~/dataset/lerf_ovs/teatime -m output/teatime_1 --include_feature
 #同样的渲染level 2 和 level 3

最后eval, 需要改一下eval.sh中的gt路径。

cd eval
sh eval.sh

现在的效果好多了。
iou=0.5514, localization accuracy=0.7966

现在产生的apple mask

在这里插入图片描述

render.py产生的并不是ply文件,而是npy和png文件, 每张图片分别对应一个.

output/teatime_1/train/ours_None/renders里面是png文件,
是3DGS根据相机的位姿生成对应的渲染语义图片。

在这里插入图片描述
所以其实LangSplat生成的结果是3DGS,
即output/teatime下面的cnkpnt30000.pth,
里面存的有语义信息,通过渲染可以得到不同视角下的语义图片。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蓝羽飞鸟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值