Blazing fast differentiable DRR rendering in modern PyTorch
Project description
nanodrr
A performance-oriented reimplementation of DiffDRR with the following improvements:
- Optimized, pure PyTorch implementation (~5× faster than
DiffDRRat baseline) - Modular design (freely swap subjects, extrinsics, and intrinsics during rendering)
- Compatibility with
torch.compileand mixed precision - Extensive type hints with
jaxtyping - Standard Python package structure managed with
uv
All projective geometry is implemented internally using the standard Hartley and Zisserman pinhole camera formulation.
Installation
[!NOTE]
On
pytorch<2.9,torch.compilewithbfloat16is slower than eager due to a CUDA graph capture issue (see Benchmarks). Usepytorch>=2.9(Triton ≥3.5) for best results.
To strictly install the renderer:
pip install nanodrr
To install the optional plotting or 3D visualization module:
pip install "nanodrr[plot]" # 2D visualization (matplotlib, opencv)
pip install "nanodrr[scene]" # 3D visualization (VTK, PyVista)
pip install "nanodrr[all]" # All extras
Benchmarks
[!IMPORTANT]
- ~5× faster than
DiffDRRout of the box, without compilation (946 FPS vs 213 FPS)- ~8× faster with
torch.compileandbfloat16onpytorch>=2.9(1,650 FPS vs 213 FPS)- ~2.5× less memory than
DiffDRR(516 MB vs 1,344 MB peak reserved withbfloat16+ compile)
Mean ± std. dev. of 10 runs, 100 loops each. Benchmarked by rendering 200×200 DRRs on an NVIDIA RTX 6000 Ada (48 GB) with Python 3.12. Compile represents
torch.compile(mode="reduce-overhead", fullgraph=True). Full experiment attests/benchmark/.
Docs
To test the docs locally, run
uv run --group docs jupyter nbconvert --to markdown tutorials/*.ipynb --output-dir docs/tutorials/
uv run --group docs zensical serve
Roadmap
- Implement a fully optimized renderer
- Port strictly necessary modules from
DiffDRR(e.g., SE(3) utilities, loss functions, and 2D plotting) - Migrate 3D plotting functions to an optional module
- Integrate with
xvrto speed up network training and registration - Integrate with
polyposeto speed up registration - Release as
v1.0.0ofDiffDRR!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nanodrr-0.1.4.tar.gz.
File metadata
- Download URL: nanodrr-0.1.4.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a791a352f44aa05f8f783bdb6a0b283f0578d61d38d701c478c2433a2de8fde
|
|
| MD5 |
fd4a2bab6d395284ed61eaad5966e29a
|
|
| BLAKE2b-256 |
a1f85fc26b19d8f5e94ec14cc6fd6524f212bfb77385e73b8a2c66a78cfc8cc1
|
Provenance
The following attestation bundles were made for nanodrr-0.1.4.tar.gz:
Publisher:
publish.yml on eigenvivek/nanodrr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanodrr-0.1.4.tar.gz -
Subject digest:
4a791a352f44aa05f8f783bdb6a0b283f0578d61d38d701c478c2433a2de8fde - Sigstore transparency entry: 1061543411
- Sigstore integration time:
-
Permalink:
eigenvivek/nanodrr@ff25db1f901634f647998ef1fbc292162ca6e220 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/eigenvivek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ff25db1f901634f647998ef1fbc292162ca6e220 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nanodrr-0.1.4-py3-none-any.whl.
File metadata
- Download URL: nanodrr-0.1.4-py3-none-any.whl
- Upload date:
- Size: 34.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d69e1ec59a7f3d9c34005e74b5ab06d50909c15f5fe29821bc9997c281e7aac
|
|
| MD5 |
640fdde71e71f01dac8356aabc6be53a
|
|
| BLAKE2b-256 |
b530bfcf57135fcf43aa74b6be166fad21f3210914b7e74f544e0a055c1c2674
|
Provenance
The following attestation bundles were made for nanodrr-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on eigenvivek/nanodrr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanodrr-0.1.4-py3-none-any.whl -
Subject digest:
8d69e1ec59a7f3d9c34005e74b5ab06d50909c15f5fe29821bc9997c281e7aac - Sigstore transparency entry: 1061543416
- Sigstore integration time:
-
Permalink:
eigenvivek/nanodrr@ff25db1f901634f647998ef1fbc292162ca6e220 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/eigenvivek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ff25db1f901634f647998ef1fbc292162ca6e220 -
Trigger Event:
release
-
Statement type: