Skip to main content

serial-neighbor

A lightweight and fast implementation of spatial neighbor search using serialization encoding from space filling curves (e.g., Z-order, Hilbert curves).
Designed for 3D point cloud applications, fully compatible with PyTorch.


🚀 Installation

pip install serial-neighbor

🧠 Function Description

serial_neighbor(...)

Finds k nearest neighbors for each query point using serial encoding. We propose to retrieve a neighborhood from a 1-D ordered list, by serializing points along a space-filling curve, and excluding the impact of points distant from the query (i.e. remove false positives).

Arguments:

  • points (Tensor):
    Tensor of shape (M, 3) giving the source point cloud with M points in 3D space.

  • query_xyz (Tensor):
    Tensor of shape (N, 3) giving the query points (N points in 3D space).

  • serial_orders (List[str]):
    Serialization orders to use, e.g., ["z"], ["z", "hilbert"], etc.
    Using multiple orders can improve neighbor search accuracy.

  • k_neighbors (int):
    Number of nearest neighbors to find for each query point.

  • grid_size (float, optional):
    Grid cell size for point discretization.
    Smaller values give more accurate results but slower performance. Default: 0.01

  • mask_threshold (float, optional):
    Maximum distance threshold. Neighbors farther than this will be masked with -1.
    Default: None

Returns:

  • combined_idx (LongTensor):
    Shape: (N, K * O)
    Indices of the nearest neighbors for each query point.
    O is the number of serial orders used. Invalid neighbors are marked as -1.

  • neighbor_dists (Tensor):
    Shape: (N, K * O)
    Euclidean distances to the neighbors.


🧪 Usage Example

import torch
from serial_neighbor import serial_neighbor

points = torch.rand(1000, 3).cuda()
query_xyz = torch.rand(100, 3).cuda()
idx, dists = serial_neighbor(points, query_xyz, ["z"], k_neighbors=8)

print("Neighbor indices:", idx.shape)
print("Neighbor distances:", dists.shape)

📄 Based on NoKSR

This module is part of the work described in the paper:

NoKSR: Kernel-Free Neural Surface Reconstruction via Point Cloud Serialization
Zhen Li, Weiwei Sun †, Shrisudhan Govindarajan, Shaobo Xia, Daniel Rebain, Kwang Moo Yi, Andrea Tagliasacchi
📄 Paper | 🔗 Project Page

We present a novel approach to large-scale point cloud surface reconstruction by converting an irregular point cloud into a signed distance field (SDF) through serialization-based neighbor search. This framework achieves state-of-the-art performance in both accuracy and efficiency, particularly on large-scale outdoor datasets.


📰 News

  • [2025/03/22] The package serial-neighbor is released.
  • [2025/02/21] Code released!
  • [2025/02/19] ArXiv version is released.

📬 Contact

For questions, comments, or bug reports, please contact:

Zhen Li (SFU) – zhen_li@sfu.ca


🛡 License

This project is licensed under the Apache License 2.0 – see the LICENSE file for details.

Metadata

Release files for serial-neighbor 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serial-neighbor 0.1.1
File Size Uploaded
serial_neighbor-0.1.1.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serial-neighbor 0.1.1
File Interpreter ABI Platform
serial_neighbor-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.2 kB

Release files / serial_neighbor-0.1.1.tar.gz

Download URL serial_neighbor-0.1.1.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cfb1fe75aed337fde2d5472d73054ffff2577abc7eb5872fbddb2244fae3e157
BLAKE2b-256 checksum
How to use checksums
5e82b6edf49212c713ff57f8f36e3f07a2253b72ce593816c918a99f053f6320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / serial_neighbor-0.1.1-py3-none-any.whl

Download URL serial_neighbor-0.1.1-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1e2c8ac8469f9fe8d5745a7598624dd295985f929af0905e3cafc5e866fd416
BLAKE2b-256 checksum
How to use checksums
953257587ef2288faeaba4c8ccf83d062a5a664a616b86c78fd091e4659b12ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page