当前位置:网站首页>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
边栏推荐
- [Mini Program Column] Summarize the development specifications of uniapp to develop small programs
- MySql Detailed Basics
- SQL injection vulnerability (postgresql injection)
- SQL注入漏洞(postgresql注入)
- 与tcp协议有关的几个知识点
- npm指令
- 【WeChat Mini Program】Page Events
- Leetcode 2.两数相加 两个非空的链表,表示两个非负的整数。它们每位数字都是按照逆序的方式存储的。
- typescript4 - installs a toolkit for compiling ts
- 代币(双代币)系统研究
猜你喜欢
![[GAN]老照片修复Bringing Old Photos Back to Life论文总结](/img/6e/80260ec72029ed6316763bf051fbb4.png)
[GAN]老照片修复Bringing Old Photos Back to Life论文总结

【三子棋】——玩家VS电脑(C语言实现)

JS中对事件流的理解

SwiftUI SQLite 教程之 构建App本地数据库实现创建、读取、更新和删除(教程含完成项目源码)

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

Delphi仿制Web的导航

20个电路能懂5个以上,足以证明你在电子行业混过!

OA Project Pending Meeting & History Meeting & All Meetings

MagicDraw secondary development process

leetcode经典问题——11.盛水最多的容器
随机推荐
svn中文路径 权限设定
The blockbuster IP that has been popular in the world for 25 years, the new work has become a script paradise
注解开发相关
【微信小程序】页面事件
风靡全球25年的重磅IP,新作沦为脚本乐园
【无标题】
SQL窗口函数
20个电路能懂5个以上,足以证明你在电子行业混过!
39.【vector动态数组定义及初始化】
基于JSP实现校园二手交易平台
input标签的tabindex属性 & a标签的tabindex属性
AutoSAR EcuM系列01- EcuM模块的功能概述和变体类型
typescript7-typescript common types
剖析SGI STL空间配置器(allocate内存分配函数)
2022年施工企业数字化转型思考,施工企业数字化转型之路
英语语法-名词性从句
Lenovo Notebook How to Change Windows 10 Boot Logo Icon
Dynamic Lead Time Promising
【sleuth + zipkin 服务链路追踪】
golang grpc protoc 环境配置