Jie Wu et al., Parallel diffusion models promote high detail-fidelity photoacoustic microscopy in sparse sampling, Optics Express 32(16): 27574–27590 (2024). 10.1364/OE.528474, publisher page.
Noise task and Image task are trained in parallel with
PDM maps a sparsely sampled PAM image
- Noise task: predict noise with the variational lower bound /
$L_{\mathrm{simple}}$ $\ell_2$ objective (Eq. 12). - Image task: recover $\tilde{y}0$ from the predicted noise (Eq. 14), then $L{\mathrm{Image}}=1-\mathrm{SSIM}(y_0,\tilde{y}_0)$ (Eq. 16).
High-speed PAM is simulated with step sizes of 2×, 4×, and 8× in the scanning directions. Relative to full sampling this is 4×, 16×, and 64×, with effective pixels of 25%, 6.25%, and 1.5625%.
sparse_step in the config is that scanning step (2 / 4 / 8): keep every sparse_step pixel on both scan axes, then restore the condition image
| Setting | Scan step | Speed-up | Effective pixels | Config |
|---|---|---|---|---|
| 4× high-speed | 2 | 4× | 25% | configs/pdm_pam_4x.json (sparse_step=2) |
| 16× high-speed | 4 | 16× | 6.25% | configs/pdm_pam_16x.json (sparse_step=4) |
| 64× high-speed | 8 | 64× | 1.5625% | configs/pdm_pam_64x.json (sparse_step=8) |
The JSON files use the paper setup: [1,2,4,8], self-attention at -c configs/pdm_pam_16x.json. Noise-task-only ablation is --gamma 0. Reverse sampling is --sample_steps is set. upsample_mode (nearest / bicubic / zero) interpolates the condition image; default nearest.
conda env create -f environment.yml
conda activate pdmIf the conda env already has PyTorch:
pip install -r requirements.txtRequest training and test data from tracy_wufz@163.com.
Public mouse-brain PAM patches (Duke,
python scripts/prepare_data.py --input /path/to/duke_patches --output data --ratio 8:1:1data/train/*.png
data/val/*.png
data/test/*.png
Training uses fully sampled images. Sparse sampling is applied at runtime from sparse_step.
python scripts/train.py -c configs/pdm_pam_16x.json --train_hr data/train --val_hr data/val
python scripts/train.py -c configs/pdm_pam_4x.json
python scripts/train.py -c configs/pdm_pam_64x.json
python scripts/train.py -c configs/pdm_pam_16x.json --gamma 0Checkpoints: experiments/<name>/checkpoint/.
python scripts/infer.py -c configs/pdm_pam_16x.json --ckpt experiments/pdm_pam_16x/checkpoint/latest.pt --input path/to/hr.png --output results/pred.png --from_hr
python scripts/infer.py -c configs/pdm_pam_16x.json --ckpt experiments/pdm_pam_16x/checkpoint/latest.pt --input path/to/sparse.png --output results/pred.png
python scripts/eval_metrics.py --pred results/pred_dir --gt data/test--from_hr: fully sampled input, sparse sampling follows sparse_step. Without it, the input is already a same-size condition image.
Paper Table 1 / Sec. 5.1: Bicubic, UNet, FD-UNet, p2pGAN. In baselines/, --model bicubic / unet / fdunet. The folder also has SRCNN, VDSR, EDSR, FSRCNN, DRCN, SRGAN, DBPN, SubPixelCNN.
python baselines/train.py --model unet --scan_step 4 --train_hr data/train --val_hr data/val
python baselines/infer.py --model unet --scan_step 4 --ckpt experiments/unet_step4/checkpoint/latest.pt --input path/to/hr.png --output results/unet.png --from_hr
python baselines/infer.py --model bicubic --scan_step 4 --input path/to/hr.png --output results/bicubic.png --from_hr--scan_step 2/4/8 is 4× / 16× / 64× speed-up.
@article{Wu:24,
author = {Jie Wu and Kaipeng Zhang and Chengeng Huang and Yuanzheng Ma and Rui Ma and Xin Chen and Ting Guo and Sihua Yang and Zhen Yuan and Zhenhui Zhang},
title = {Parallel diffusion models promote high detail-fidelity photoacoustic microscopy in sparse sampling},
journal = {Opt. Express},
volume = {32},
number = {16},
pages = {27574--27590},
year = {2024},
doi = {10.1364/OE.528474}
}Apache License 2.0 (LICENSE, NOTICE). Paper © 2024 Optica Publishing Group.