MIT License

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

深度分析:DFlat - 用于平光学的正向和逆向设计框架

项目背景与痛点

在光学领域,平光学技术正成为一个日益重要的话题。传统的光学系统往往需要复杂的折射和反射路径,而平光学技术通过专门设计的表面来实现复杂的光学功能,无需复杂的折射或反射层叠。DFlat 就是一个专注于平光学设计的框架,特别适用于对元表面光学的设计,但同样可以应用于任何端到端的成像和传感任务中。面对复杂的光学设计需求,DFlat 为开发者提供了一套完整的工具,简化了设计流程并提升了设计效率。

核心技术揭秘

DFlat 的架构设计从数据流的角度出发,简化了从设计到实现的流程。基于其设计原理,框架大量使用了先进的计算成像技术和机器学习算法,从数学模型到实际设计,再到数据处理和优化。

graph TD A[用户输入设计需求] --> B[初始化参数] B --> C{"执行模式"} C -->|"前向设计"| D[生成元表面] C -->|"逆向设计"| E[优化元表面] D --> F[性能分析] E --> F F --> G[输出设计]

技术栈与设计模式

DFlat 在技术栈的选择上注重高效性和灵活性。框架核心部分采用 Python 语言编写,以确保开发者的高效率和跨平台兼容性。设计中采用了模块化设计模式,允许用户根据实际需要增减功能模块。同时,DFlat 特别强调数值优化算法的重要性,通过精确控制元表面特性,达到最优性能。

功能亮点与差异

与其他同类工具和框架相比,DFlat 在设计平光学时不仅支持前向设计,也支持逆向设计。后者的独特性在于可以允许用户从性能指标出发反向推算所需的元表面特性,这是商业化设计过程中一个非常重要的灵活性。此外,DFlat 的计算效率也是一大亮点,它通过高效的算法实现模型快速收敛,大幅减少了计算瓶颈。

应用场景与落地建议

虽然框架提供了一套完备的工具链,但在具体的生产部署中,使用者需要根据自身业务对配置和参数进行适配。比如,在处理大规模设计任务时,需要合理分配计算资源。此外,结合具体的应用需求,用户可能需要调整逆向设计过程中的性能目标,使之与实际应用场景的需求更紧密结合。

综合评价

DFlat 在解决平光学设计的复杂问题上展示出了强大的实力。其前向和逆向设计的能力使得设计流程更加灵活,满足不同的应用场景需求。强大的计算能力和高效的优化算法也是其显著优势。然而,灵活性的同时也带来了配置的复杂性,用户需要较高水平的专业知识来正确使用,并根据具体应用场景调整配置。总体而言,DFlat 是一个强大的工具,对于需要设计先进平光学系统的开发者来说是一个很好的选择。

关于

GitHub 原始描述(英文)

DFlat is a forward and inverse design framework for flat optics. Although specially geared for the design of metasurface optics, it may be used for any end-to-end imaging and sensing task.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
160
价值分
78
活跃状态
活跃

语言占比

Jupyter Notebook
Python

Release

README

Dflat
Dflat

An End-to-End Design Framework for Diffractive Optics and Metasurface-Based Vision Systems

Auto-differentiable RCWA, Field Propagation, Rendering, Neural Surrogate Models

Python PyTorch License: MIT

Version PyPI version Pytest Workflow codecov

DFlat is an auto-differentiable design framework for flat optics, specially geared to the design of dielectric metasurfaces for imaging and sensing tasks. This package was first introduced in a 2022 manuscript available at arxiv. It was later published alongside our paper, Polarization Multi-Image Synthesis with Birefringent Metasurfaces, in the proceedings of the 2023 IEEE International Conference of Computational Photography (ICCP). It was rewritten in 2024 with Version 2.0 and subsequent releases. V2 onwards has been released under the MIT License.

DFlat provides users with:

  • A validated, auto-differentiable framework for field propagation, point-spread function calculations, and image rendering built on Pytorch.
  • A growing set of pre-trained, efficient neural networks to model the optical response of metasurface cells (alongside the released datasets).
  • A new and simple design architecture for adding your own datasets and training your own models.
  • A autodifferentiable field solver (RCWA) to optimize structures on cells or generate new libraries

By treating optical layers in the same fashion as standard, differentiable neural layers, deep learning pipelines can be built to simultaneously optimize optical hardware and ML computational back-ends for the next generation of computational imaging devices.

Installation

You can install this package from the PyPI index simply via:

pip install dflat_opt

You may also find it beneficial to work directly with the repository in editable mode via:

git clone https://github.com/DeanHazineh/DFlat
pip install -e .

Version Notes

Updated on July 12, 2024 | V3 -> V4

  • (v4) An autodifferentiable RCWA field solver class is added.
  • (v3) Memory problems? Gradient checkpointing is added throughout, reducing memory when using DFlat.
  • (v3) You can now download this package from the PyPi Index!
  • (v3) Datasets and pre-trained models are now downloaded when called instead of during install. Models are now initialized by their name instead of by paths to config files.
  • (v2) This repository is the home for the new and maintained version of DFlat. It replaces DFlat-Tensorflow. Note that this package is no longer a direct port of DFlat-tensorflow but is a complete rewrite (re-)released in February 2024. I recommend switching! The structure of the software is completely revamped and the algorithms used throughout are not the same as before. The initial pytorch port (now deprecated) is archived and kept as a branch.

Usage and Documentation

Detailed documentation for the rewritten package and a new project page will be released in the future. For now, we highlight two resources for developers and researchers:

  • A script used to train neural models can be found in scripts/trainer.ipynb. The model architecture is specified in the config.yaml file and you can play around with editing it.
  • A simple demo of the workflow can be found at scripts/demo.ipynb.
  • A demo of field-propagation is given in scripts/field_propagation.ipynb

Pretrained Models and datasets

List of pretrained neural models inlcuded at this time are noted below. You can see the dataset used, training parameters, and model info in the respective config.yaml files when the model is downloaded after calling load_optical_model(MODEL_NAME). If you would like to contribute your own data or models to this open-source repository, please email me and I can add it with acknowledgements. We aim to make this repository a centralized location for sharing meta-atom datasets and pre-trained neural representations.

Si3N4 Models TiO2 Models
Nanocylinders_TiO2_U200H600
Nanocylinders_Si3N4_U250H600 Nanocylinders_TiO2_U250H600
Nanocylinders_Si3N4_U300H600 Nanocylinders_TiO2_U300H600
Nanocylinders_Si3N4_U350H600 Nanocylinders_TiO2_U350H600
Nanoellipse_TiO2_U350H600
Nanofins_TiO2_U350H600

The datasets will be downloaded and can be played with simply by calling the classes in dflat/metasurface/datsets. For example, when you call Nanoellipse_TiO2_U350nm_H600nm(), the corresponding dataset will be downloaded and you can play around with the data and visualizations within that class.

Contact:

This repository is intended to be accessible and community driven. It may not be fully error-proof. If you have improvements, fixes, or contributions, please branch and initiate a merge request to master (or email me)! For any questions, functionality requests, or other concerns, don’t hesitate to contact me at [email protected].

Credits and Acknowledgements:

This work was funded in part by the NSF and SONY. If you utilize DFlat or included data sets for your own work, please consider citing it by using:

@misc{hazineh2022dflat,
      title={D-Flat: A Differentiable Flat-Optics Framework for End-to-End Metasurface Visual Sensor Design},
      author={Dean S. Hazineh and Soon Wei Daniel Lim and Zhujun Shi and Federico Capasso and Todd Zickler and Qi Guo},
      year={2022},
      eprint={2207.14780},
      archivePrefix={arXiv},
      primaryClass={physics.optics}
}

This work has pulled inspiration from and/or benefitted from previous open-source contributions including:

  • Lucidrain - Siren-pytorch
  • Manuel Guizar-Sicairos and Julio C. Guitierrez-Vega - Pyhank
  • Shane Colburn - RCWA_TF

评论

暂无评论