facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.7k stars 1.3k forks source link

Farthest Point Sampling to a predefined radius #1798

Closed Chaoqi-LIU closed 4 months ago

Chaoqi-LIU commented 4 months ago

🚀 Feature

Current FPS only downsample points to a predefined number, or ratio, but it is common that we want to downsample the given points so that the pairwise distance within is ≤ a user given radius.

Screenshot 2024-05-22 at 19 31 38

something like this, but written with cpp and cuda.

bottler commented 4 months ago

Would this task naturally use multiple cuda kernels, because you don't know in advance how big the output is? Like how knn is easier than radius-sampling because having k upfront lets everything happen in a single kernel.

Maybe using the current function with a large number of points and just take some of the output is as fast as you'll get.

Chaoqi-LIU commented 4 months ago

Hi, I wrote my own ad-hoc version with cuda/cpu, and yes you are right, we cannot know in advance the # output points. So I provide one more additional arg as the cap on # output points, and use max_dist < r as the early stop signal, it's pretty fast and results was satisfying.

Thanks anyway!