当前位置:网站首页>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 point3 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 point4 [python 3D deep learning] python 3D point cloud from basic to deep learning_Coding's blog-CSDN blog_python 3D point cloud
边栏推荐
猜你喜欢

Thinking about digital transformation of construction enterprises in 2022, the road to digital transformation of construction enterprises

风靡全球25年的重磅IP,新作沦为脚本乐园

一文读懂二十种开关电源拓扑结构
![[Mini Program Column] Summarize the development specifications of uniapp to develop small programs](/img/7b/110d324eba00652e4987bc623a5bc6.png)
[Mini Program Column] Summarize the development specifications of uniapp to develop small programs

经典毕业设计:基于SSM实现高校后勤报修系统

MagicDraw secondary development process

函数(1)

基于JSP实现校园二手交易平台

【Flask框架①】——Flask介绍

回板后,处理器不启动,怎么办?
随机推荐
剖析SGI STL空间配置器(空间配置器的重要性和重要成员及函数)
【无标题】
ES:class 的基本使用
typescript7-typescript常用类型
基于SSM开发实现校园疫情防控管理系统
test111
【无标题】
The difference between typescript3-ts and js
AutoSAR EcuM系列02- Fixed EcuM的状态管理
立创EDA——PCB的走线(五)
【微信小程序】页面事件
typescript8 - type annotations
test3
Detailed explanation of 4D words: C language three-point chess advanced + N-piece chess recursive dynamic judgment of winning or losing
JS中如何阻止事件冒泡和默认行为
SQL injection vulnerability (postgresql injection)
【sleuth + zipkin 服务链路追踪】
hcip第八天
电源完整性基础知识
HashSet和LinkedHashSet