Skip to main content

Sparse local operations for point clouds in any dimension.

Project description


Open In Colab PyPI version Documentation Status

Project visualization

❒ SquareNet

SquareNet maps unstructured point clouds to structured grids through a bijective transformation. It replaces expensive spatial queries (k-NN, radius search) with super fast sliding window operations. Think of it as a powerful alternative to kd-trees, voxelization, rasterization and neighborhood graphs. ✔ Works in any dimension ✔ Handles non-convex geometries ✔ Scales to millions of points (fast processing)


🚀 Why SquareNet?

  • Speed: $O(N)$ local operations via vectorized sliding windows.
  • Memory: Contiguous memory access instead of irregular spatial lookups.
  • Simplicity: Pure NumPy-based logic, no heavy spatial dependencies.

📦 Installation

pip install squarenet

🧠 Quick Start

-> exemples/00_getting_started.ipynb

from squarenet import SquareNet
import numpy as np

# Initialize and Fit
N = 5*11*7*13
d = 4
points = np.random.rand(N, d)

IJKL = (5, 11, 7, 13)
sqnet = SquareNet(IJ_=IJKL) # Define grid dimensions, here 4D
sqnet.fit(points)

# Map any property of the points to the grid e.g. the norm, could be anything else
Xpts = np.linalg.norm(points, axis = 1) #(N, *C)
Xmap = sqnet.map(Xpts) #(5, 11, 7, 13, *C)
Xrec = sqnet.invert_map(Xmap)   #(N, *C) 

Compute Local Views

# views enhance Xpts with a view in a rectangular neighborhood 
# (in the grid) with radius *wr and size *ws = 2wr+1
Xview = sqnet.views(Xpts, wr=5, invert_map = True) #(N, *C, *ws)

🗺️ Visualizing the Mapping

You can use the built-in checkerboard to verify neighborhood preservation:

sqnet = SquareNet(IJ_=(400, 400))
sqnet.fit("france") #require !pip install shapely
sqnet.checkerboard()

📈 Key Applications

  • Point Cloud Processing: Fast local feature aggregation.
  • Kernel Methods: Efficient sparse approximation of large kernels.
  • Deep Learning: Pre-structuring irregular data for CNN/Transformer inputs.

Packing

-----

License: MIT | Author: ArmanddeCacqueray

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

squarenet-0.2.3.tar.gz (109.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

squarenet-0.2.3-py3-none-any.whl (107.5 kB view details)

Uploaded Python 3

File details

Details for the file squarenet-0.2.3.tar.gz.

File metadata

  • Download URL: squarenet-0.2.3.tar.gz
  • Upload date:
  • Size: 109.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for squarenet-0.2.3.tar.gz
Algorithm Hash digest
SHA256 37cf5a66972f70e6060126e0b448c6dd412aa5ad93369957567a0b2f5a118878
MD5 2cfa11a432d60dab1b8b935456b49074
BLAKE2b-256 d0327befb4c0a3aed8e01fc6f056b6b70e99e6c7c1a31552b2df634f1d095ddb

See more details on using hashes here.

File details

Details for the file squarenet-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: squarenet-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 107.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for squarenet-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f33b2eec43aa1317628db2f0d820795a2d3cdc935b4651594623c6a8856aac4e
MD5 282528b4d8fe7f21b1cc2dd718669b5e
BLAKE2b-256 c3ec3d47d8af3d2fa1d12500c5af432a7aed667cb5a19acbb6fa7ca6714ff704

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page