Recommend: replace 'sklearn.neighbors.NearestNeighbors' with 'scipy.spatial.cKDTree' to accerlate
lzhnb opened this issue · comments
Zhihao Liang commented
from sklearn.neighbors import NearestNeighbors
nn = NearestNeighbors(n_neighbors=k_nn+1, algorithm='kd_tree').fit(xyz)
distances, neighbors = nn.kneighbors(xyz)
neighbors = neighbors[:, 1:]
distances = distances[:, 1:]
can be replace with:
from scipy.spatial import cKDTree
tree = cKDTree(xyz)
distances, neighbors = tree.query(xyz, k_nn+1)
neighbors = np.array(neighbors)[:, 1:]
distances = np.array(distances)[:, 1:]
It is faster more than 10x times while the number of input point cloud is around hundreds of thousands. And the result is correct(cKDTree is more efficient than KDTree).
Loic Landrieu commented
Thanks for the tip, I'll look into it.
Loic Landrieu commented
Hi!
We are releasing a new version of SuperPoint Graph called SuperPoint Transformer (SPT).
It is better in any way:
✨ SPT in numbers ✨ |
---|
📊 SOTA results: 76.0 mIoU S3DIS 6-Fold, 63.5 mIoU on KITTI-360 Val, 79.6 mIoU on DALES |
🦋 212k parameters only! |
⚡ Trains on S3DIS in 3h on 1 GPU |
⚡ Preprocessing is x7 faster than SPG! |
🚀 Easy install (no more boost!) |
If you are interested in lightweight, high-performance 3D deep learning, you should check it out. In the meantime, we will finally retire SPG and stop maintaining this repo.