当前位置:网站首页>Pointnet++代码详解(四):index_points函数
Pointnet++代码详解(四):index_points函数
2022-07-17 05:10:00 【weixin_42707080】
index_points函数是按照输入的点云数据和索引返回由索引的点云数据。例如points为B×2048×3的点云,idx为[1,333,1000,2000](S的维度),则返回B个样本中每个样本的第1,333,1000,2000个点组成的B×4×3的点云集。当然如果idx为一个[B,S]维度的,则它会按照idx中的维度结构将其提取成[B,S,C]。
def index_points(points, idx):
"""
Input:
points: input points data, [B, N, C]
idx: sample index data, [B, S]
Return:
new_points:, indexed points data, [B, S, C]
"""
device = points.device
batchsize = points.shape[0]
#view_shape=[B,S]
view_shape = list(idx.shape)
#[1] * (len(view_shape) - 1) -> [1],即view_shape=[B,1]
view_shape[1:] = [1] * (len(view_shape) - 1)
#repeat_shape=[B,S]
repeat_shape = list(idx.shape)
#repeat_shape=[1,S]
repeat_shape[0] = 1
#.view(view_shape)=.view(B,1)
#.repeat(repeat_shape)=.view(1,S)
#batch_indices的维度[B,S]
batch_indices = torch.arange(batchsize, dtype=torch.long).to(device)\
.view(view_shape).repeat(repeat_shape)
new_points = points[batch_indices, idx, :]
return new_points对points[batch_indices, idx, :]的理解:
batch_indices是tensor,维度为[B,S],表示的是样本索引,即取哪个样本,其表示形式如下:
tensor([[0, 0, 0, 0,...],
[1, 1, 1, 1,...],...,
[B-1, B-1, B-1, B-1,...]])
idx也是tensor,维度也为[B,S],其表示的是每一行对应1个样本,该行中的数据就是在points当中数据的索引。
points[batch_indices, idx, :]说的就是从points当中取出每个batch对应索引的数据点。
边栏推荐
- 5. Spark core programming (1)
- 7. Data warehouse environment preparation for data warehouse construction
- Flutter Intl的使用
- [first launch in the whole network] will an abnormal main thread cause the JVM to exit?
- mysql的事务
- Functions and parameters
- Using Flink SQL to fluidize market data 2: intraday var
- 配置tabBar和request网络数据请求
- Object to map
- 【语音识别】kaldi安装心得
猜你喜欢

Configure tabbar and request network data requests

微信小程序的页面导航
![[first launch in the whole network] will an abnormal main thread cause the JVM to exit?](/img/ae/5df25d64c2f29292bbfb21f696bbb0.png)
[first launch in the whole network] will an abnormal main thread cause the JVM to exit?

尝试解决YOLOv5推理rtsp有延迟的一些方法

Common components of wechat applet

运行基于MindSpore的yolov5流程记录

gradle自定义插件

Application of recursion

微信小程序的自定义组件

Composants communs des applets Wechat
随机推荐
svg绘制曲线
Unable to determine Electron version. Please specify an Electron version
Object to map
[bug solution] org apache. ibatis. type. TypeException: The alias ‘xxxx‘ is already mapped to the value ‘xxx‘
6.数据仓库搭建之数据仓库设计
C language & bit field
Use of MySQL
5. Spark core programming (1)
【语音识别入门】基础概念与框架
Flutter Intl的使用
gradle
Ambari cluster expansion node + expansion service operation
Judging prime
kotlin作用域函数
微信小程序之计算器
Parsing bad JSON data using gson
5. Spark核心编程(1)
用facenet源码进行人脸识别测试过程中的一些问题
LiveData浅析
软件过程与管理复习(九)