Skip to main content

DeepLens: differentiable optical lens simulator for end-to-end cameras.

Project description

DocsTutorialsCommunityPyPI

DeepLens is a differentiable optical lens simulator. It is developed for (1) differentiable optical design, (2) end-to-end optics-vision co-design, and (3) photorealistic image simulation. DeepLens helps researchers build custom differentiable optical systems and computational imaging pipelines with minimal effort.

Mission

  1. Next-generation optical design software enhanced by differentiable optimization.
  2. Next-generation computational cameras integrating optical encoding with deep learning decoding.

Features

  1. Differentiable Optics. DeepLens leverages gradient backpropagation and differentiable optimization, demonstrating outstanding optimization power compared to classical optical design.
  2. Automated Lens Design. Enables automated lens design using curriculum learning, optical regularization losses, and GPU acceleration.
  3. Hybrid Refractive-Diffractive Optics. Supports accurate simulation and optimization of hybrid refractive-diffractive lenses (e.g., DOEs, metasurfaces).
  4. Accurate Image Simulation. Delivers photorealistic, spatially-varying image simulations, verified against commercial software and real-world experiments.
  5. Optics-Vision Co-Design. Supports end-to-end differentiability from optics, sensor, and ISP to vision algorithms, enabling comprehensive optics-vision co-design.

Additional features (available via collaboration):

  1. Polarization Ray Tracing. Provides polarization ray tracing and differentiable optimization of coating films.
  2. Non-Sequential Ray Tracing. Includes a differentiable non-sequential ray tracing model for stray light analysis and optimization.
  3. Kernel Acceleration. Achieves >10x speedup and >90% GPU memory reduction with custom GPU kernels across NVIDIA and AMD platforms.
  4. Distributed Optimization. Supports distributed simulation and optimization for billions of rays and high-resolution (>100k x 100k) diffractive computations.

Applications

1. Automated lens design

Fully automated lens design from scratch. Try it with AutoLens!

paper quickstart

AutoLens AutoLens

2. End-to-End lens design

Lens-network co-design from scratch using final images (or classification/detection/segmentation) as objective.

paper

End2End

3. Implicit Lens Representation

A surrogate network for fast (aberration + defocus) image simulation.

paper link

Implicit

4. Hybrid Refractive-Difractive Lens Model

Design hybrid refractive-diffractive lenses with a new ray-wave model.

report

Implicit

Installation

Clone this repo:

git clone https://github.com/singer-yang/DeepLens
cd DeepLens

Create a conda environment:

conda create -n deeplens_env python=3.12
conda activate deeplens_env

# Linux and Mac
pip install torch torchvision
# Windows
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128

pip install -r requirements.txt

or

conda env create -f environment.yml -n deeplens_env

Run the demo code:

python 0_hello_deeplens.py

DeepLens repo is structured around three decoupled modules (optics, sensor, and network):

DeepLens/
│
├── deeplens/
│   ├── optics/ (optics simulation and lens models)
│   ├── sensor/ (sensor + ISP simulation)
│   ├── network/ (surrogate and reconstruction networks)
│   ├── camera.py (composes lens and sensor into a camera simulator)
│   └── ...
│
├── 0_hello_deeplens.py (code tutorials)
├── ...
└── write_your_own_code.py

Community

Join our Slack workspace and WeChat Group (singeryang1999) to connect with our core contributors, receive the latest industry updates, and be part of our community. For any inquiries, contact Xinge Yang (xinge.yang@kaust.edu.sa).

Contribution

We welcome all contributions. To get started, please read our Contributing Guide or check out open questions. All project participants are expected to adhere to our Code of Conduct. A list of contributors can be viewed in Contributors and below:

Citation

If you use DeepLens in your research, please cite the paper. See more in History of DeepLens.

@article{yang2024curriculum,
  title={Curriculum learning for ab initio deep learned refractive optics},
  author={Yang, Xinge and Fu, Qiang and Heidrich, Wolfgang},
  journal={Nature communications},
  volume={15},
  number={1},
  pages={6572},
  year={2024},
  publisher={Nature Publishing Group UK London}
}

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

deeplens_core-1.5.1.tar.gz (433.8 kB view details)

Uploaded Source

Built Distribution

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

deeplens_core-1.5.1-py3-none-any.whl (748.8 kB view details)

Uploaded Python 3

File details

Details for the file deeplens_core-1.5.1.tar.gz.

File metadata

  • Download URL: deeplens_core-1.5.1.tar.gz
  • Upload date:
  • Size: 433.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for deeplens_core-1.5.1.tar.gz
Algorithm Hash digest
SHA256 d04a7201dae620c7cee7ab04cc79122c8c813ea6a6eed629f8ae1f7de603d41e
MD5 9f91f6da00e134f61ebf91bbe8662190
BLAKE2b-256 031cb8785341904400cfb000fa40f81ba0fffbbaca1d117e781b1f4dfbf2b253

See more details on using hashes here.

File details

Details for the file deeplens_core-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: deeplens_core-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 748.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for deeplens_core-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f5fbecbcbca4e3767935ccae88e4151e884aaa0d910c7cf3740679f9bcca850
MD5 6b272cfaed1645bdf90eb7b931fe031a
BLAKE2b-256 e243290a34c3c65cf81dc2b99830e89f42732ec3e2309ac20ec0316e4f625793

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