CLIP模型擅长于将图像与广泛的文本描述相匹配,并取得了显著成效。鉴于此,研究者们开始探究:那些在二维图像与文本对大规模预训练中表现优异的模型,是否同样能够适用于三维知识领域。PointCLIP模型无需依赖渲染过程,而是创造性地将点云数据转换为多视角的深度图像来进行编码,并进一步整合这些视角下的零样本预测结果,以此实现从二维到三维的知识迁移。这一方法有望成为在资源有限和数据稀缺条件下,利用CLIP模型进行高效三维点云解析的一种极具潜力的替代方案。
本文所涉及的所有资源的获取方式:这里
# PointCLIP主体结构
# 目的是为了获得图像和文本之间匹配的概率是多少
def forward(self, pc, label=None):
# Project to multi-view depth maps
images = self.mv_proj(pc).type(self.dtype)
# Image features
image_feat = self.visual_encoder(images)
image_feat = self.adapter(image_feat)
image_feat = image_feat / image_feat.norm(dim=-1, keepdim=True)
# Store for the best ckpt
if self.store:
self.feat_store.append(image_feat)
self.label_store.append(label)
# Text features
text_feat = self.textual_encoder()
text_feat = text_feat / text_feat.norm(dim=-1, keepdim=True)
# Classification logits
logit_scale = self.logit_scale.exp()
logits = logit_scale * image_feat @ text_feat.t() * 1.
return logits
# Adapter的主体结构
def forward(self, feat):
img_feat = feat.reshape(-1, self.num_views, self.in_features)
res_feat = feat.reshape(-1, self.num_views * self.in_features)
# Global feature
global_feat = self.global_f(img_feat * self.fusion_ratio.reshape(1, -1, 1))
# View-wise adapted features
view_feat = self.view_f(global_feat)
# 将全局特征和局部特征进行相加
img_feat = view_feat * self.adapter_ratio + res_feat * (1 - self.adapter_ratio)
return img_feat
git clone https://github.com/ZrrSkywalker/PointCLIP.git
cd PointCLIP
conda create -n pointclip python=3.7
conda activate pointclip
pip install -r requirements.txt
pip install open3d
pip install opencv-python
pip install matplotlib
# Install the according versions of torch and torchvision
conda install pytorch torchvision cudatoolkit
wget https://download.pytorch.org/whl/cu116/torch-1.13.0%2Bcu116-cp37-cp37m-linux_x86_64.whl
pip install torch-1.13.0+cu116-cp37-cp37m-linux_x86_64.whl
wget https://download.pytorch.org/whl/cu116/torchvision-0.13.0%2Bcu116-cp37-cp37m-linux_x86_64.whl
pip torchvision-0.13.0+cu116-cp37-cp37m-linux_x86_64.whl
# Install the modified dassl library (no need to re-build if the source code is changed)
cd Dassl3D/
python setup.py develop
cd ..
编程未来,从这里启航!解锁无限创意,让每一行代码都成为你通往成功的阶梯,帮助更多人欣赏与学习!
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有