DeepLens
DeepLens is a PyTorch-based differentiable optical lens simulator for end-to-end computational imaging, supporting multiple optical models — geometric ray tracing, diffractive wave propagation, hybrid ray-wave, and surrogate PSF networks.
DeepLens supports three main use cases:
- Differentiable optics — accurate and efficient gradient computation for optical parameters via differentiable simulation and backpropagation.
- Automated optical design — fully automated optical design driven by gradient information and advanced optimization algorithms.
- Computational imaging — physically accurate image simulation and end-to-end optimization with downstream image reconstruction algorithms.
DeepLens computes the point spread function (PSF) of an optical lens in a fully differentiable manner:
DeepLens also serves as the differentiable optics engine in an end-to-end computational imaging pipeline such as End2endImaging, where the optics, sensor, and a reconstruction network form a single differentiable graph that can be optimized jointly:
Scene Image → [ DeepLens ] → Spectral Image → [ Sensor ] → Raw Image → [ Network ] → Output Image
│ │ │
GeoLens RGBSensor UNet
HybridLens MonoSensor Restormer
DiffractiveLens NAFNet
ParaxialLens
PSFNetLens
Key Features
- Differentiable Optics — differentiable optical simulation for accurate, efficient gradient computation, enabling lens inverse design.
- Automated Design — fully automated optical design via gradient-based and advanced optimization, shortening the development cycle for a wide range of systems (highly aspherical lenses, metasurfaces, AR/VR displays).
- Multiple Optical Models — geometric ray tracing (
GeoLens), hybrid ray-wave (HybridLens), pure diffractive (DiffractiveLens), neural surrogate (PSFNetLens), and defocus (DefocusLens) models. - Image Simulation — photorealistic rendering with spatially-varying, depth-dependent aberrations, closing the sim-to-real gap when combined with End2endImaging.
Advanced Features
Additional capabilities, customizable upon request:
- GPU Kernel Acceleration — custom GPU kernels deliver >10× speedup and >90% memory reduction across NVIDIA and AMD platforms, making deployment on local laptops practical.
- Polarization Ray Tracing — polarization ray tracing and inverse design of thin films via DiffTMM.
- Non-Sequential Ray Tracing — differentiable non-sequential ray tracing for stray-light analysis and optimization.
- Distributed Optimization — distributed simulation and optimization for billion-scale ray tracing and high-resolution (>100k × 100k) diffractive propagation.
Getting Started
-
Setup
Create the environment and run your first lens demo.
-
Quickstart
Load a lens, compute a PSF, and render an image in minutes.
-
API Reference
Full class and function documentation for the optics engine.
-
Examples
Lens design, end-to-end optimization, and image simulation.