Repository logo
 

Data and analysis code for "Camera-in-the-loop gradient descent hologram generation for Fraunhofer diffraction"


Change log

Description

This dataset contains the complete experimental record, simulation record and analysis code from a study of camera-in-the-loop optimization for far-field (Fraunhofer) computer-generated holography, carried out in the Department of Engineering, University of Cambridge.

ORIGIN AND PURPOSE

Phase-only holograms for a liquid-crystal-on-silicon (LCoS) spatial light modulator are normally computed by optimizing against a simulated model of the optical system. No simulation captures every aberration, misalignment and non-linearity of a physical bench, so the reconstruction measured at a camera is consistently worse than the one simulation predicts. The work recorded here measured how much of that shortfall is recovered by closing the optimization loop through the camera itself - using the measured intensity, rather than a simulated one, to supply the loss at every gradient-descent iteration - and what that costs in camera exposures.

DATA COLLECTION

Optical bench. A phase-only LCoS spatial light modulator (1080 x 1920 addressable pixels) displayed each hologram, and a Canon DSLR driven through the manufacturer's SDK photographed the resulting far-field reconstruction. A single rig-wide alignment - a fixed region of interest and a rotation of -0.06 degrees, determined once and never refitted during optimization - was applied to every capture in every session, and is deposited as results/experiments/_rig_calibration/calibration.json. Exposure was taken from a fixed lookup table rather than adjusted per run.

Targets. Eighteen grayscale images at 1000 x 1000 pixels were used throughout, so every condition is measured on the same target set. Fifteen are photographs obtained from Pexels, one was created by the authors, and two derive from a Wikimedia Commons resolution chart. Per-file attribution and license terms are in targets/CREDITS.md.

Optimization. Holograms were optimized by gradient descent (Adam, learning rate 0.03, 750 iterations, amplitude target formulation). Four conditions were recorded for every target:

  • simulation: optimized against the simulated forward model, scored in simulation;
  • plain gradient descent on the bench: that same simulation-optimized hologram displayed once and photographed, with no feedback anywhere in the loop;
  • camera-in-the-loop from uniform random phase;
  • camera-in-the-loop simulation-seeded, beginning from the converged simulated hologram.

In the camera-in-the-loop conditions each of the 750 iterations consumed one camera exposure: the hologram was displayed, photographed, and the measurement supplied the loss while the gradient was taken through the simulated Fraunhofer model. No learned model and no corrector network were used anywhere.

Two internal forward models were run and are never compared against one another: an "ideal" model, a single Fourier transform without padding; and a "faithful" model, which adds the pixel-aperture sinc envelope at the measured areal fill factor of 0.91 and pads by a factor of two. The two prepare targets at different resolutions, so only comparisons made within one model are meaningful.

Simulation sweeps. Alongside the bench work, a simulation sweep across eleven iteration budgets was run for both forward models, and an emulated aberration stress test applied Zernike phase errors of varying magnitude to the modelled system (1,872 records per initialization).

PROCESSING

Camera frames were captured as JPEG and retained at three points per run - the first iteration, the best iteration and the last - alongside a per-iteration convergence trace recording the loss and metrics at every step. Retaining all 750 frames per run would have enlarged the deposit by an order of magnitude without adding information the traces do not already carry.

Captures were registered using the fixed rig alignment and scored against the target by a single function shared between simulation and experiment: peak signal-to-noise ratio and structural similarity after independent min-max normalization of reconstruction and target, and normalized mean-square error and diffraction efficiency after sum normalization. Where the forward model pads, the target is bicubically upsampled to match; a different interpolation will not reproduce the deposited values.

Comparisons are paired across the eighteen targets (n = 18) and assessed with Wilcoxon signed-rank tests fixed in advance. Medians are reported in preference to means because the distributions are right-skewed across the target set, with percentile bootstrap confidence intervals over 10,000 resamples from a fixed seed, and multiplicity controlled by Benjamini-Hochberg at q = 0.05. The statistical helpers are seeded, so repeated runs give identical intervals.

CONTENTS

results/experiments/ - bench runs, one directory per target per condition per initialization: retained camera frames, processed reconstructions, per-iteration convergence trace, run log, and the shared rig calibration. Includes a replay session in which each simulation-optimized hologram was displayed and photographed once with no feedback.

results/simulations/ - the iteration-budget sweep for both forward models and the Zernike aberration stress test.

results/roi.json - magnified-region coordinates, chosen from the targets before any reconstruction was viewed. An input.

code/ - the method (forward model, gradient descent, capture processing, scoring), the analysis scripts, the launcher configuration for each experiment, and the two notebooks that were run.

output/ - everything the analysis produces: the scored results (144 records = 18 targets x 2 forward models x 4 sources), figures, and LaTeX table fragments.

targets/ - the eighteen target images, with attribution in CREDITS.md.

REUSE

Start with README.md at the deposit root. Every path is resolved relative to that root by code/analysis/paths.py, so nothing needs configuring; run verify_deposit.py to confirm the deposit is intact, then run code/notebooks/gd_citl_analysis.ipynb, which regenerates every figure, table and reported number from the deposited files alone.

The acquisition notebook is included as a record of the procedure. It cannot be re-run without the spatial light modulator, the camera and the manufacturers' SDKs, which cannot be redistributed.

The deposit is supplied as four ZIP archives. Each stores paths relative to the deposit root, so unzipping all four into one empty directory reconstructs the tree exactly, in any order.

LICENSING

The record-level licence is CC BY 4.0. File-level terms differ and are stated in full in the deposited files:

results/ and output/ - Data generated by the authors. CC BY 4.0, as recorded in LICENSE-data.txt.

code/ - Analysis and method code written by the authors. MIT Licence, as recorded in LICENSE-code.txt.

targets/ - Third-party material, not covered by the record-level licence. Fifteen of the eighteen target images are photographs obtained from Pexels and used under the Pexels License. One was created by the authors. Two are derived from a Wikimedia Commons file licensed CC BY-SA 3.0 Unported and carry that licence. Per-file attribution, licence links and the modifications made are in targets/CREDITS.md.

The target images are inputs to the experiments rather than results: every hologram was optimized toward one of them and every reported metric is measured against them. README.md at the deposit root describes the layout and how to regenerate every figure and table from the deposited files.

Version

Software / Usage instructions

Python 3 with PyTorch. Direct dependencies with lower bounds are listed in requirements.txt at the deposit root. Full instructions are in README.md: install the requirements, run verify_deposit.py, then run code/notebooks/gd_citl_analysis.ipynb top to bottom. Every path is resolved relative to the deposit root by code/analysis/paths.py. There is nothing to configure. The acquisition notebook (gd_citl_experiments.ipynb) is included as a record of the procedure. It cannot be re-run without the spatial light modulator, the camera and the manufacturers' SDKs, which cannot be redistributed.

Publisher

Rights and licensing

Except where otherwised noted, this item's license is described as Attribution 4.0 International (CC BY 4.0)
Sponsorship
EPSRC (via University College London (UCL)) (EP/S022139/1 554657/178529)
D. Singh is supported by a Cambridge Trust Scholarship. A. J. Wojcik is supported by the EPSRC Centre for Doctoral Training in Connected Electronic and Photonic Systems, grant EP/S022139/1.