spatialhub
A lightweight computer vision library built around ONNX Runtime.
spatialhub is a open-source computer vision library that collects useful perception models behind a simple and consistent Python API. The focus is on lightweight inference, minimal dependencies, and easy deployment.
Status: Work in progress. The library is actively being developed by a single maintainer. APIs may change, and only a small number of models are currently available.
Why this project?
Many computer vision models are easy to use in research but harder to deploy because of large dependencies and different APIs.
The goal of spatialhub is to provide a simpler alternative by:
- Using ONNX Runtime for inference.
- Avoiding a direct PyTorch dependency where possible.
- Downloading model weights automatically.
- Providing a consistent interface across different models.
- Supporting headless environments with
opencv-python-headless.
The project is still growing, and the feature set will expand over time.
Available Models
Currently supported:
- EfficientLoFTR — Semi-dense local feature matching.
- DepthAnything-3 — Monocular relative and metric depth estimation.
Roadmap
Some models and utilities planned for future releases include:
- Monocular depth estimation
- Pose estimation
- Object tracking
- Point cloud utilities
These are ideas, not promises, and development depends on available time.
Installation
Requires Python 3.12+.
Install from PyPI:
pip install spatialhub
Optional GPU support:
pip install "spatialhub[gpu]"
Quick Start
All models follow a consistent, unified API pattern: Initialize the engine, pass inputs, and receive structured predictions.
1. Feature Matching (EfficientLoFTR)
from spatialhub import EfficientLoFTR
matcher = EfficientLoFTR()
result = matcher.match("image1.jpg", "image2.jpg", max_dim=1024,)
result.visualize(
top_k=50,
save_path="output.png",
)
2. Depth & Pose Estimation (Depth Anything 3)
import cv2
from spatialhub import DepthAnything3
estimator = DepthAnything3(model_name="da3_base")
depth_result = estimator.estimate_depth(images=["view1.png", "view2.png"])
# Render colored depth map
depth_viz = estimator.visualize(depth_result.depth[0])
cv2.imwrite("depth.png", depth_viz)
Project Goals
- Simple Python API
- Lightweight inference
- Consistent model interfaces
- Automatic model weight management
- Easy deployment in scripts, servers, and containers
License
The core spatialhub library is licensed under the Apache 2.0 License.
Model architectures and pretrained weights keep the licenses provided by their original authors. See the documentation for each model for licensing details.
Release files for spatialhub 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spatialhub-0.1.3.tar.gz | 1.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spatialhub-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.3 MB
Release files / spatialhub-0.1.3.tar.gz
| Download URL | spatialhub-0.1.3.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
432e91d1a5af613429ec9c5b04cb38ba7c159f6d4c40ee61b4beb94095fabd07
|
|
BLAKE2b-256 checksum How to use checksums |
e8e9c6e3a94256d1736456d36abe6e561e6c0d6b547a70207d1a70f0d8c2d678
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / spatialhub-0.1.3-py3-none-any.whl
| Download URL | spatialhub-0.1.3-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0371939b1808592dbbb3b44774e0ac38d4a96bba9dcaf3126935571a95fcbeb0
|
|
BLAKE2b-256 checksum How to use checksums |
54d92d0023a858545db55e00a14aec762e91eecaaf4566fc9a3699a349ccf217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|