Skip to main content

SVETlANNa is an open-source Python library for simulation of free-space optical set-ups and neuromorphic systems such as Diffractive Neural Networks.

Project description

SVETlANNa

SVETlANNa is an open-source Python library for simulation of free-space optical set-ups and neuromorphic systems such as Diffractive Neural Networks. It is primarily built on the PyTorch framework, leveraging key features such as tensor-based computations and efficient parallel processing. At its core, SvetlANNa relies on the Fourier optics, supporting multiple propagation models, including the Angular spectrum method and the Fresnel approximation.

There is a supporting github project SVETlANNa.docs containing numerous application examples in the Jupyter notebook format. This project will be opened upon the release.

The name of the library is composed of the Russian word "svet", which is the "light" in English and the abbreviation ANN standing for an artificial neural network, and simultaneously the whole word sounds like a Russian female name Svetlana.

Abbreviations

NN - Neural Network

ANN - Artificial Neural Network

ONN - Optical Neural Network

DONN - Diffractive Optical Neural Network

DOE - Diffractive Optical Element

SLM - Spatial Light Modulator

Features

  • based on the PyTorch
  • forward propagation models include the Angular spectrum method and the Fresnel approximation
  • possibility to solve the classical DOE/SLM optimization problem with the Gerchberg-Saxton and hybrid input-output algorithms
  • support for custom elements and optimization methods
  • support for various free-space ONN architectures including feed-forward NN, autoencoders, and recurrent NN
  • cross platform
  • full GPU aceleration
  • companion repository with numerous .ipynb examples
  • custom logging, project management, analysis, and visualization tools
  • tests for the whole functionality

Installation, Usage and Examples

Running From Source

  1. Create a virtual environment (e.g., see venv documentation)
  2. Install the PyTorch (it is up to the user to choose a version)
  pip install torch
  1. Istall the Poetry, or check that its version is 2.0.0 or greater
  pip install poetry
  1. In the library folder execute the command
  poetry install

Installation From PIP

pip install svetlanna

Running Tests

To run tests, run the following command

  pytest

Documentation

Documentation

Examples

Result of training the feed-forward optical neural network for the MNIST classification task: The image of the figure "8" is passed through a stack of 10 phase plates with adjusted phase masks. Selected regions of the detector correspond to different classes of figures. The class of the figure is identified by the detector region that measures the maximum optical intensity.

Examples of visualzation of optical set-ups and optical fields:

drawing

Example a of five-layer DONN trained to recognize numbers from the MNIST database:

drawing drawing drawing

Example of

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

Acknowledgements

The work on this repository was initiated within the grant by the Foundation for Assistance to Small Innovative Enterprises

Authors

License

Mozilla Public License Version 2.0

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

svetlanna-1.0.2.tar.gz (60.1 kB view details)

Uploaded Source

Built Distribution

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

svetlanna-1.0.2-py3-none-any.whl (78.6 kB view details)

Uploaded Python 3

File details

Details for the file svetlanna-1.0.2.tar.gz.

File metadata

  • Download URL: svetlanna-1.0.2.tar.gz
  • Upload date:
  • Size: 60.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for svetlanna-1.0.2.tar.gz
Algorithm Hash digest
SHA256 75b1c1928aae828f0dd5ba67a0ac52c12b1a4c7b24c3b897f6580a12cfa6390c
MD5 98b4170c1256624e77197df65122e12b
BLAKE2b-256 7e0957ea9437874943b69d931f0f6eb42e686962cdfec3dac0e9ec7c61c8a64e

See more details on using hashes here.

File details

Details for the file svetlanna-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: svetlanna-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 78.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for svetlanna-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9283750d6828d1a53aa77ec7583f4a808d35f7cde62585195ec5a5813b5a8efc
MD5 8171d05d611e169f38517fb68a68bed9
BLAKE2b-256 4f7d308ce298fac256a643804832c9d7ce59c19b2bd18fb59386b934659890c1

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