当前位置:网站首页>Farthest Point Sampling - D-FPS vs F-FPS
Farthest Point Sampling - D-FPS vs F-FPS
2022-07-30 09:08:00 【Coding leaves】
The advantage of the farthest point sampling FPS (Farthest Point Sampling) method of the point cloud is that it can cover all the point clouds as much as possible, but it needs to calculate the entire distance multiple times, so it is more complex and time-consumingsampling method.
1 Farthest point sampling (FPS) sampling step
The FPS sampling steps are:
(1) Select an initial point: it can be selected randomly or according to certain rules.If randomly selected, the results obtained each time are different, otherwise the results obtained each time are the same.
(2) Calculate the distance between all points and the midpoint of (1), and select the value with the largest distance as the new initial point.
(3) Repeat the first two steps until the number of selected points meets the requirements.
Since each selected distance in (2) is the largest, the maximum distance in the iterative process will gradually decrease.This is the basis for the mask selection in the following code.If this limit is added, the point will be repeatedly selected back and forth.
2 Samples from the farthest point (D-FPS)
The farthest point sampling above is sampled by calculating the distance between points.Sampling of the farthest point refers to calculating the coordinate distance between points, usually taking three coordinates of xyz.
# -*- coding: utf-8 -*-"""Lele Perception School Public [email protected]: https://blog.csdn.net/suiyingyReference: https://github.com/yanx27/Pointnet_Pointnet2_pytorch"""import numpy as npdef farthest_point_sample(point, npoint):"""Input:xyz: pointcloud data, [N, D]npoint: number of samplesReturn:centroids: sampled pointcloud index, [npoint, D]"""N, D = point.shapexyz = point[:,:3]centroids = np.zeros((npoint,))distance = np.ones((N,)) * 1e10farthest = np.random.randint(0, N)for i in range(npoint):centroids[i] = farthestcentroid = xyz[farthest, :]dist = np.sum((xyz - centroid) ** 2, -1)mask = dist < distancedistance[mask] = dist[mask]farthest = np.argmax(distance, -1)point = point[centroids.astype(np.int32)]return point
3 Feature farthest point sampling (F-FPS)
The farthest point sampling above is sampled by calculating the distance between points.Feature farthest point sampling refers to calculating the distance between features of points.Assume that the coordinates of each point are xyz 3 dimensions, and the input features are M dimensions.When calculating the distance from the farthest point of the feature, the xyz coordinates and the feature are often spliced as a new feature, and then the distance between the features is calculated for the farthest point sampling.
# -*- coding: utf-8 -*-"""Lele Perception School Public [email protected]: https://blog.csdn.net/suiyingyReference: https://github.com/yanx27/Pointnet_Pointnet2_pytorch"""import numpy as npdef farthest_point_sample(point, npoint):"""Input:xyz: pointcloud data, [N, D]npoint: number of samplesReturn:centroids: sampled pointcloud index, [npoint, D]"""N, D = point.shapexyz = pointcentroids = np.zeros((npoint,))distance = np.ones((N,)) * 1e10farthest = np.random.randint(0, N)for i in range(npoint):centroids[i] = farthestcentroid = xyz[farthest, :]dist = np.sum((xyz - centroid) ** 2, -1)mask = dist < distancedistance[mask] = dist[mask]farthest = np.argmax(distance, -1)point = point[centroids.astype(np.int32)]return point
4 [python 3D deep learning] python 3D point cloud from basic to deep learning_Coding's blog-CSDN blog_python 3D point cloud
边栏推荐
猜你喜欢
muduo库学习记录(一)
万字详解:C语言三子棋进阶 + N子棋递归动态判断输赢(另附课设大作业参考)
基于SSM实现高校后勤报修系统
C13—使用innosetup工具制作软件安装向导2022-07-23
蓝牙技术|了解蓝牙LE Audio的Auracast广播音频
K-Net:Towards Unified Image Segmentation,基于动态内核的通用分割网络,(NMS-free and Box-free),从语义/实例分割到全景分割。
【愚公系列】2022年07月 Go教学课程 021-Go容器之切片操作
typescript1 - what is typescript
SE11 创建搜索帮助
剖析SGI STL空间配置器(一 、辅助接口函数)
随机推荐
typescript2-typescript为什么给js添加类型支持
[Mini Program Column] Summarize the development specifications of uniapp to develop small programs
【三子棋】——玩家VS电脑(C语言实现)
typescript4 - installs a toolkit for compiling ts
FPGA基础协议二:I2C读写E²PROM
test4
ES: 箭头函数和包裹它的代码共享相同的this
sql 引用变量时第一位的0被去除掉如何处理
剖析SGI STL空间配置器(一 、辅助接口函数)
hcip 第14天学习笔记
研发转至FAE(现场应用工程师),是否远离技术了?有前途吗?
【SQL server速成之路】——身份验证及建立和管理用户账户
elk报错:[syslogs] index has exceeded [1000000]
孙洪鹤讲教材:原点+众筹+产品,逆向营销实战操作方案
ES:解构
test2
Detailed explanation of 4D words: C language three-point chess advanced + N-piece chess recursive dynamic judgment of winning or losing
【小程序专栏】总结uniapp开发小程序的开发规范
Portable small fan PD power chip
C13—使用innosetup工具制作软件安装向导2022-07-23