(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=43435438

Hacker News 上的一篇文章介绍了开发者 fouronnes3 创建的开源 Python 库 “Torch Lens Maker”。这是一个基于 PyTorch 构建的可微几何光学库,由开发者在 Recurse Center 驻留期间开发完成。该项目利用 PyTorch 的自动微分功能进行光学系统设计。其核心思想是将光学元件(透镜、反射镜)视为神经网络中的层,光线作为数据。光线与表面的碰撞检测代替了 Conv2D 层,折射定律代替了 ReLU。这使得可以使用神经网络训练技术来设计透镜:前向传播模拟光的行为,优化过程则寻找最佳的透镜形状以聚焦光线。该库旨在提供类似于 OpenSCAD 的代码型 API,用于最先进的光学系统优化。用户可以通过 `pip install torchlensmaker` 进行安装,并在文档中探索示例,包括彩虹模拟。


原文
Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Torch Lens Maker – Differentiable Geometric Optics in PyTorch (victorpoughon.github.io)
9 points by fouronnes3 18 minutes ago | hide | past | favorite | 1 comment
Hello HN! For the past 6 months I've been working on an open source python library that implements differentiable geometric optics in PyTorch. It's very experimental still, but eventually the goal is to use it to design optical systems with a state of the art optimization framework and a beautiful code based API. Think OpenSCAD, but for optical systems.

Not only is PyTorch's autograd an amazing general purpose optimizer, but torch.nn (the neural network building blocks) can be used pretty much out of the box to model an optical system. This is because there is a strong analogy to be made between layers of a neural network, and optical elements in a so-called sequential optical system. So the magic is that we can stack lenses as if we were stacking Conv2D and ReLu layers and everything works out. Instead of Conv2D you have ray-surface collision detection, instead of ReLu you have the law of refraction. Designing lenses is surprisingly like training a neural network.

Check out the docs for examples of using the API. My favorite one is the rainbow :) https://victorpoughon.github.io/torchlensmaker/examples/rain...

You should be able to `pip install torchlensmaker` to try it out, but I just set it up so let me know if there's any trouble.

I was part of the Winter 1'24 batch at the Recurse Center (https://www.recurse.com/) working on this project pretty much full time. I'm happy to talk about that experience too!











Very innovative application of NN architecture in a different (physics/optics) domain !

> The key idea is that there is a strong analogy to be made between layers of a neural network, and optical elements in a so-called sequential optical system. If we have a compound optical system made of a series of lenses, mirrors, etc., we can treat each optical element as the layer of a neural network. The data flowing through this network are not images, sounds, or text, but rays of light. Each layer affects light rays depending on its internal parameters (surface shape, refractive material...) and following the very much non‑linear Snell's law. Inference, or the forward model, is the optical simulation where given some input light, we compute the system's output light. Training, or optimization, is finding the best shapes for lenses to focus light where we want it.







Join us for AI Startup School this June 16-17 in San Francisco!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



Search:
联系我们 contact @ memedata.com