HoloPASWIN v3
HoloPASWIN (Physics-Aware Swin Transformer for Holographic Reconstruction) is a state-of-the-art model for eliminating twin-image artifacts and recovering complex object fields (amplitude and phase) from single-shot in-line holograms.
Architecture
The model combines the exact physical model of free-space propagation with the powerful representation learning of a Swin Transformer.
- Physics Module: The input hologram intensity is linearly back-propagated to the object plane using the Angular Spectrum Method (ASM). This creates a "dirty" complex field that contains the focused object but is corrupted by the defocused out-of-focus twin image.
- Swin Transformer Encoder-Decoder: The dirty field (split into real and imaginary parts) is passed through a hierarchical Swin Transformer U-Net architecture.
- Residual Correction: Instead of predicting the clean field directly, the network predicts the twin-image artifacts. These are subtracted (via a residual connection) from the dirty input to yield the final, high-fidelity clean reconstruction.
Model Details
- Input: 1-channel Hologram Intensity (B, 1, H, W)
- Output: 2-channel Complex Field (Real, Imaginary) mapped to Amplitude and Phase (B, 2, H, W)
- Encoder Stages: 4 stages with channels [96, 192, 384, 768]
- Parameters: ~30.88M
- Inference Time: ~13.7 ms per image (on modern GPU)
Advancements
HoloPASWIN v3 improves upon traditional CNN-based approaches and iterative solvers:
- Physics-Informed: By letting an exact physical solver handle the propagation mapping, the neural network only has to learn the artifact removal, greatly simplifying the learning objective.
- Global Receptive Field: The Swin Transformer backbone captures long-range spatial dependencies critical in holography, where twin-image interference spreads globally across the entire field of view.
- Single-Shot: Unlike iterative Phase Retrieval algorithms (like Gerchberg-Saxton) that can take hundreds of iterations, this method recovers the field in a single forward pass (~13.7ms).
Outcomes and Results
Evaluated on a test set of 496 holographic samples, HoloPASWIN v3 achieves excellent reconstruction fidelity in both amplitude and phase domains.
Qualitative Results
Below are sample reconstructions showing the Ground-Truth arrays juxtaposed against the Ground-Truth Amplitude & Phase, Zoomed Details, and Error Maps.
Quantitative Metrics
| Metric | HoloPASWIN (Ours) | U-Net | ASM (Dirty) | GS (100 iter) |
|---|---|---|---|---|
| Phase SSIM | 0.9862 | 0.9915 | 0.3038 | 0.3038 |
| Phase PSNR (dB) | 46.55 | 46.43 | 34.69 | 34.69 |
| Amp SSIM | 0.9625 | 0.9917 | 0.6128 | 0.6128 |
| Amp PSNR (dB) | 41.98 | 46.43 | 30.96 | 30.96 |
| Complex MSE | 0.000968 | 0.000608 | 0.0158 | 0.0158 |
| Inference Time | 13.68 ms | 23.14 ms | 2.40 ms | 95.84 ms |
Note: While a significantly larger classic U-Net baseline achieves slightly higher raw SSIM metrics on this particular dataset split, HoloPASWIN operates twice as fast (13.7ms vs 23.1ms) while avoiding the common over-smoothing associated with standard CNNs.
How to use
You can load the required classes directly from the repository.
from huggingface_hub import hf_hub_download
import torch
# Load the weights
model_path = hf_hub_download(repo_id="gokhankocmarli/holopaswin-v3", filename="pytorch_model.bin")
# Import the model architecture provided in the same repo
# (Ensure src/holopaswin is in your PYTHONPATH)
from holopaswin.model import HoloPASWIN
# Initialize model
model = HoloPASWIN(
img_size=224,
in_chans=1,
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
)
# Load state dict
model.load_state_dict(torch.load(model_path))
model.eval()
# Dummy input
dummy_hologram = torch.randn(1, 1, 224, 224)
with torch.no_grad():
clean_real_imag = model(dummy_hologram)
Citation
If you find this work useful, please cite our paper:
@misc{kocmarli2026holopaswin,
title={HoloPASWIN: Robust Inline Holographic Reconstruction via Physics-Aware Swin Transformers},
author={Gokhan Kocmarli},
year={2026},
eprint={2603.04926},
archivePrefix={arXiv},
primaryClass={eess.IV}
}
Or view the paper directly: HoloPASWIN: Robust Inline Holographic Reconstruction via Physics-Aware Swin Transformers
Model tree for gokhankocmarli/holopaswin-v3
Base model
microsoft/swin-tiny-patch4-window7-224
