Skip to main content

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 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.

pip install "git+https://github.com/eigenvivek/nanodrr.git"

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/.

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.0.tar.gz (18.0 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.0-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nanodrr-0.1.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nanodrr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2dfdb8544e188e3f9a3eda2aff2fa00d99c5a181c9d1f492bb0994fd9fac4e3c
MD5 4d1eeb73d5e3355e53de855decbb432b
BLAKE2b-256 66fc89d6112c3d12cf222203647de836fba64b0796d956efc4f01fd957cfaff5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nanodrr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nanodrr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c6273f9889c9e1e688ea2ff7c72c68eada3e3b13e96fcf90ab2e34c2aad803c
MD5 db33c28846e453591c3873b68230ea2c
BLAKE2b-256 3b544c328966d9af659984965a63909d41d7f1172dd56d5f71a1b4050f7b68a6

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