当前位置:网站首页>Pointnet++ code explanation (IV): index_ Points function
Pointnet++ code explanation (IV): index_ Points function
2022-07-19 05:44:00 【weixin_ forty-two million seven hundred and seven thousand and 】
index_points The function returns the indexed point cloud data according to the input point cloud data and index . for example points by B×2048×3 Point cloud of ,idx by [1,333,1000,2000](S Dimensions ), Then return to B Number of samples in each sample 1,333,1000,2000 It's made up of dots B×4×3 A cloud of points . Of course, if idx For one [B,S] Dimensional , Then it will follow idx The dimension structure in is extracted into [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], namely 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 Dimensions [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_pointsYes points[batch_indices, idx, :] The understanding of the :
batch_indices yes tensor, Dimension for [B,S], It represents the sample index , That is, which sample to take , Its expression is as follows :
tensor([[0, 0, 0, 0,...],
[1, 1, 1, 1,...],...,
[B-1, B-1, B-1, B-1,...]])
idx It's also tensor, The dimension is also [B,S], It means that each line corresponds to 1 Samples , The data in this row is in points Index of data in .
points[batch_indices, idx, :] That's from points Take out each batch The data point corresponding to the index .
边栏推荐
- Use of MySQL
- 使用OpenCV、ONNXRuntime部署YOLOV7目标检测——记录贴
- 用facenet源码进行人脸识别测试过程中的一些问题
- Scala primary practice - statistics of mobile phone traffic consumption (1)
- [first launch in the whole network] will an abnormal main thread cause the JVM to exit?
- E-commerce user behavior real-time analysis system (flink1.10.1)
- 编程风格
- static 关键字对作用域和生命周期的影响
- 1. Dongsoft Cross - Border E - commerce Data Warehouse Requirement specification document
- SnackBar源码解析及封装
猜你喜欢
随机推荐
Flutter Intl的使用
Bottomsheetdialogfragment imitation Tiktok comment box
MySQL事务
List and map
尝试解决YOLOv5推理rtsp有延迟的一些方法
C language implementation of iteration and binary search
软件过程与管理复习(六)
1.東軟跨境電商數倉需求規格說明文檔
gradle自定义插件
MySQL learning notes (4) - (basic crud) operate the data of tables in the database
Use Flink SQL to transfer market data 1: transfer VWAP
10 question 10 answer: do you really know thread pools?
SnackBar源码解析及封装
跨域和处理跨域
C语言——冒泡排序
SQL time comparison
Idea import local package
CV学习笔记【1】:transforms
利用IDE打jar包
1 SparkSQL概述









