Skip to main content

Blazing fast differentiable DRR rendering in modern PyTorch

Project description

nanodrr

docs pypi

A performance-oriented reimplementation of DiffDRR with the following improvements:

  • Optimized, pure PyTorch implementation (~5× faster than DiffDRR at baseline)
  • Modular design (freely swap subjects, extrinsics, and intrinsics during rendering)
  • Compatibility with torch.compile and 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.compile with bfloat16 is slower than eager due to a CUDA graph capture issue (see Benchmarks). Use pytorch>=2.9 (Triton ≥3.5) for best results.

To strictly install the renderer:

pip install nanodrr

To install the optional 3D visualization module:

pip install "nanodrr[scene]"

Benchmarks

[!IMPORTANT]

  • ~5× faster than DiffDRR out of the box, without compilation (946 FPS vs 213 FPS)
  • ~8× faster with torch.compile and bfloat16 on pytorch>=2.9 (1,650 FPS vs 213 FPS)
  • ~2.5× less memory than DiffDRR (516 MB vs 1,344 MB peak reserved with bfloat16 + compile)
Benchmarking runtime, FPS, and memory usage.

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 at tests/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 xvr to speed up network training and registration
  • Integrate with polypose to speed up registration
  • Release as v1.0.0 of DiffDRR!

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

nanodrr-0.1.2.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

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

nanodrr-0.1.2-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file nanodrr-0.1.2.tar.gz.

File metadata

  • Download URL: nanodrr-0.1.2.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nanodrr-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1c52c4ea76f166a4398c9cb4b2e5f19ee97c925f8771f85b8c8bb00bd15b128c
MD5 c04bb292b7a3d833a305e86faa3c3ca6
BLAKE2b-256 31034c5246360d2665c9d70518007f7cfe2b5666fd8f243ce9cf78a4dff16dab

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanodrr-0.1.2.tar.gz:

Publisher: publish.yml on eigenvivek/nanodrr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanodrr-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nanodrr-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nanodrr-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f36b57b4bf0b2f90fbc05e215acba0ccd636ce72c4ca978ed4a6871ecd08a3d8
MD5 eaf1ea7d4d309eb17e04ed1d77786671
BLAKE2b-256 87cf857feab0fee1372064f463635932e9b6d2f21bc5529e96f41d5cdc271c11

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanodrr-0.1.2-py3-none-any.whl:

Publisher: publish.yml on eigenvivek/nanodrr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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