Skip to content

Commit

Permalink
Merge branch 'modular_exp' into privacy
Browse files Browse the repository at this point in the history
  • Loading branch information
ebezzam committed Nov 14, 2024
2 parents 1bc1ad5 + b546092 commit 061b21d
Show file tree
Hide file tree
Showing 18 changed files with 1,503 additions and 257 deletions.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ LenslessPiCam
:target: https://lensless.readthedocs.io/en/latest/examples.html
:alt: notebooks

.. image:: https://img.shields.io/badge/Google_Slides-yellow
:target: https://docs.google.com/presentation/d/1PcNhMfjATSwcpbHUMrmc88ciQmheBJ7alz8hel8xnGU/edit?usp=sharing
:alt: slides

.. image:: https://huggingface.co/datasets/huggingface/badges/resolve/main/powered-by-huggingface-dark.svg
:target: https://huggingface.co/bezzam
:alt: huggingface
Expand Down
10 changes: 10 additions & 0 deletions configs/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ hydra:
dataset: DiffuserCam # DiffuserCam, DigiCamCelebA, HFDataset
seed: 0
batchsize: 1 # must be 1 for iterative approaches
snr: null

huggingface:
repo: "bezzam/DigiCam-Mirflickr-MultiMask-25K"
Expand Down Expand Up @@ -42,6 +43,7 @@ algorithms: ["ADMM", "ADMM_Monakhova2019", "FISTA"] #["ADMM", "ADMM_Monakhova201
baseline: "MONAKHOVA 100iter"

save_idx: [0, 1, 2, 3, 4] # provide index of files to save e.g. [1, 5, 10]
save_intermediate: False # save intermediate results, i.e. after pre-processor and after camera inversion
gamma_psf: 1.5 # gamma factor for PSF


Expand All @@ -57,6 +59,14 @@ admm:
mu3: 4e-5
tau: 0.0001

# parameterize and perturb (Gilton et. al.)
pnp: null
# pnp:
# mu: 1e-3 # weight for distance from original model parameters
# lr: 3e-3 # learning rate for SGD
# n_iter: 100 # number of iterations
# model_path: null # leave null to be overwritten in script


# for DigiCamCelebA
files:
Expand Down
22 changes: 12 additions & 10 deletions configs/benchmark_diffusercam_mirflickr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ huggingface:
single_channel_psf: True

algorithms: [
"ADMM",
# "ADMM",

## -- reconstructions trained on DiffuserCam measured
"hf:diffusercam:mirflickr:U5+Unet8M",
"hf:diffusercam:mirflickr:TrainInv+Unet8M",
"hf:diffusercam:mirflickr:MMCN4M+Unet4M",
"hf:diffusercam:mirflickr:MWDN8M",
"hf:diffusercam:mirflickr:Unet4M+U5+Unet4M",
"hf:diffusercam:mirflickr:Unet4M+TrainInv+Unet4M",
"hf:diffusercam:mirflickr:Unet2M+MMCN+Unet2M",
"hf:diffusercam:mirflickr:Unet2M+MWDN6M",
"hf:diffusercam:mirflickr:Unet4M+U10+Unet4M",
# "hf:diffusercam:mirflickr:U5+Unet8M",
"hf:diffusercam:mirflickr:Unet8M+U5",
# "hf:diffusercam:mirflickr:TrainInv+Unet8M",
# "hf:diffusercam:mirflickr:MMCN4M+Unet4M",
# "hf:diffusercam:mirflickr:MWDN8M",
# "hf:diffusercam:mirflickr:Unet4M+U5+Unet4M",
# "hf:diffusercam:mirflickr:Unet4M+TrainInv+Unet4M",
# "hf:diffusercam:mirflickr:Unet2M+MMCN+Unet2M",
# "hf:diffusercam:mirflickr:Unet2M+MWDN6M",
# "hf:diffusercam:mirflickr:Unet4M+U10+Unet4M",

# "hf:diffusercam:mirflickr:Unet4M+U5+Unet4M_ft_tapecam",
# "hf:diffusercam:mirflickr:Unet4M+U5+Unet4M_ft_tapecam_post",
# "hf:diffusercam:mirflickr:Unet4M+U5+Unet4M_ft_tapecam_pre",
Expand Down
22 changes: 12 additions & 10 deletions configs/benchmark_digicam_celeba.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ batchsize: 10
device: "cuda:0"

algorithms: [
"ADMM",
# "ADMM",

## -- reconstructions trained on measured data
"hf:digicam:celeba_26k:U5+Unet8M_wave",
"hf:digicam:celeba_26k:TrainInv+Unet8M_wave",
"hf:digicam:celeba_26k:MWDN8M_wave",
"hf:digicam:celeba_26k:MMCN4M+Unet4M_wave",
"hf:digicam:celeba_26k:Unet2M+MWDN6M_wave",
"hf:digicam:celeba_26k:Unet4M+TrainInv+Unet4M_wave",
"hf:digicam:celeba_26k:Unet2M+MMCN+Unet2M_wave",
"hf:digicam:celeba_26k:Unet4M+U5+Unet4M_wave",
"hf:digicam:celeba_26k:Unet4M+U10+Unet4M_wave",
# "hf:digicam:celeba_26k:U5+Unet8M_wave",
"hf:digicam:celeba_26k:Unet8M+U5_wave",
# "hf:digicam:celeba_26k:TrainInv+Unet8M_wave",
# "hf:digicam:celeba_26k:MWDN8M_wave",
# "hf:digicam:celeba_26k:MMCN4M+Unet4M_wave",
# "hf:digicam:celeba_26k:Unet2M+MWDN6M_wave",
# "hf:digicam:celeba_26k:Unet4M+TrainInv+Unet4M_wave",
# "hf:digicam:celeba_26k:Unet2M+MMCN+Unet2M_wave",
# "hf:digicam:celeba_26k:Unet4M+U5+Unet4M_wave",
# "hf:digicam:celeba_26k:Unet4M+U10+Unet4M_wave",

# # -- reconstructions trained on other datasets/systems
# "hf:diffusercam:mirflickr:Unet4M+U10+Unet4M",
Expand All @@ -37,6 +38,7 @@ n_iter_range: [100] # for ADMM
huggingface:
repo: bezzam/DigiCam-CelebA-26K
psf: psf_simulated_waveprop.png # psf_simulated_waveprop.png, psf_simulated.png, psf_measured.png
cache_dir: /dev/shm
split_seed: 0
test_size: 0.15
downsample: 2
Expand Down
33 changes: 17 additions & 16 deletions configs/benchmark_digicam_mirflickr_single.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ device: "cuda:0"

huggingface:
repo: "bezzam/DigiCam-Mirflickr-SingleMask-25K"
cache_dir: /dev/shm
cache_dir: null
psf: null # null for simulating PSF
image_res: [900, 1200] # used during measurement
rotate: True # if measurement is upside-down
Expand All @@ -22,20 +22,21 @@ huggingface:


algorithms: [
"ADMM",

# -- reconstructions trained on measured data
"hf:digicam:mirflickr_single_25k:U5+Unet8M_wave",
"hf:digicam:mirflickr_single_25k:TrainInv+Unet8M_wave",
"hf:digicam:mirflickr_single_25k:MMCN4M+Unet4M_wave",
"hf:digicam:mirflickr_single_25k:MWDN8M_wave",
"hf:digicam:mirflickr_single_25k:Unet4M+TrainInv+Unet4M_wave",
"hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave",
"hf:digicam:mirflickr_single_25k:Unet2M+MMCN+Unet2M_wave",
"hf:digicam:mirflickr_single_25k:Unet2M+MWDN6M_wave",
"hf:digicam:mirflickr_single_25k:Unet4M+U10+Unet4M_wave",
"hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_flips",
"hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_flips_rotate10",
# "ADMM",

# # -- reconstructions trained on measured data
# "hf:digicam:mirflickr_single_25k:U5+Unet8M_wave",
"hf:digicam:mirflickr_single_25k:Unet8M+U5_wave",
# "hf:digicam:mirflickr_single_25k:TrainInv+Unet8M_wave",
# "hf:digicam:mirflickr_single_25k:MMCN4M+Unet4M_wave",
# "hf:digicam:mirflickr_single_25k:MWDN8M_wave",
# "hf:digicam:mirflickr_single_25k:Unet4M+TrainInv+Unet4M_wave",
# "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave",
# "hf:digicam:mirflickr_single_25k:Unet2M+MMCN+Unet2M_wave",
# "hf:digicam:mirflickr_single_25k:Unet2M+MWDN6M_wave",
# "hf:digicam:mirflickr_single_25k:Unet4M+U10+Unet4M_wave",
# "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_flips",
# "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_flips_rotate10",

# ## -- reconstructions trained on other datasets/systems
# "hf:diffusercam:mirflickr:Unet4M+U10+Unet4M",
Expand All @@ -47,7 +48,7 @@ algorithms: [
# "hf:digicam:mirflickr_multi_25k:Unet4M+U5+Unet4M_wave",
]

save_idx: [1, 2, 4, 5, 9]
save_idx: [1, 2, 4, 5, 9, 24, 33, 61]
n_iter_range: [100] # for ADMM

# simulating PSF
Expand Down
19 changes: 10 additions & 9 deletions configs/benchmark_tapecam_mirflickr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ device: "cuda:0"

huggingface:
repo: "bezzam/TapeCam-Mirflickr-25K"
cache_dir: /dev/shm
cache_dir: null #/dev/shm
psf: psf.png
image_res: [900, 1200] # used during measurement
rotate: False # if measurement is upside-down
Expand All @@ -23,16 +23,17 @@ huggingface:

## -- reconstructions trained with same dataset/system
algorithms: [
"ADMM",
# "ADMM",

# -- reconstructions trained on measured data
"hf:tapecam:mirflickr:U5+Unet8M",
"hf:tapecam:mirflickr:TrainInv+Unet8M",
"hf:tapecam:mirflickr:MMCN4M+Unet4M",
"hf:tapecam:mirflickr:Unet4M+U5+Unet4M",
"hf:tapecam:mirflickr:Unet4M+TrainInv+Unet4M",
"hf:tapecam:mirflickr:Unet2M+MMCN+Unet2M",
"hf:tapecam:mirflickr:Unet4M+U10+Unet4M",
# "hf:tapecam:mirflickr:U5+Unet8M",
"hf:tapecam:mirflickr:Unet8M+U5",
# "hf:tapecam:mirflickr:TrainInv+Unet8M",
# "hf:tapecam:mirflickr:MMCN4M+Unet4M",
# "hf:tapecam:mirflickr:Unet4M+U5+Unet4M",
# "hf:tapecam:mirflickr:Unet4M+TrainInv+Unet4M",
# "hf:tapecam:mirflickr:Unet2M+MMCN+Unet2M",
# "hf:tapecam:mirflickr:Unet4M+U10+Unet4M",
# "hf:tapecam:mirflickr:Unet4M+U5+Unet4M_flips_rotate10",
# "hf:tapecam:mirflickr:Unet4M+U5+Unet4M_aux1",
# "hf:tapecam:mirflickr:Unet4M+U5+Unet4M_flips",
Expand Down
21 changes: 11 additions & 10 deletions configs/recon_digicam_mirflickr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ defaults:
- _self_

dataset: mirflickr_single_25k # for loading model, "mirflickr_single_25k" or "mirflickr_multi_25k"
cache_dir: /dev/shm
cache_dir: null #/dev/shm

# fn: null # if not null, download this file from https://huggingface.co/datasets/bezzam/DigiCam-Mirflickr-SingleMask-25K/tree/main
fn: null # if not null, download this file from https://huggingface.co/datasets/bezzam/DigiCam-Mirflickr-SingleMask-25K/tree/main
# fn: raw_box.png
# rotate: False
# alignment:
# dim: [190, 260]
# top_left: [145, 130]

fn: raw_stuffed_animals.png
rotate: False
alignment:
dim: [200, 280]
top_left: [115, 120]
# fn: raw_stuffed_animals.png
# rotate: False
# alignment:
# dim: [200, 280]
# top_left: [115, 120]


# - Learned reconstructions: see "lensless/recon/model_dict.py"
Expand All @@ -26,19 +26,20 @@ alignment:
# model: MMCN4M+Unet4M_wave
# model: MWDN8M_wave
# model: U5+Unet8M_wave
model: Unet8M+U5_wave
# model: Unet4M+TrainInv+Unet4M_wave
# model: Unet2M+MMCN+Unet2M_wave
# model: Unet4M+U5+Unet4M_wave
# model: Unet4M+U10+Unet4M_wave

# --- dataset: mirflickr_multi_25k
model: Unet4M+U5+Unet4M_wave
# # --- dataset: mirflickr_multi_25k
# model: Unet4M+U5+Unet4M_wave

# # -- for ADMM with fixed parameters
# model: admm
# n_iter: 100

device: cuda:0
n_trials: 1 # to get average inference time
n_trials: 100 # to get average inference time
idx: 1 # index from test set to reconstruct
save: True
10 changes: 10 additions & 0 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ but they may not be the best way to get started with the library.
The following notebooks aim to provide a more interactive and intuitive
way to explore the different functionalities of the library.

This notebook provides a general overview of main features
(downloading/using datasets, PSF analysis/design, image recovery)
of the library:
(`GitHub <https://github.com/LCAV/LenslessPiCam/blob/main/notebook/lenslesspicam_demo.ipynb>`__,
`Google Colab <https://colab.research.google.com/drive/1q56Ht647JD5wocnrcT7rH5TCNK7FKmtH?usp=sharing>`__).
`Here <https://docs.google.com/presentation/d/1PcNhMfjATSwcpbHUMrmc88ciQmheBJ7alz8hel8xnGU/edit?pli=1#slide=id.p>`__
are accompanying slides that were given at PhD course to introduce computational lensless imaging.

The ones below are more specific and focus on different aspects of lensless cameras.

System / Hardware
-----------------

Expand Down
Loading

0 comments on commit 061b21d

Please sign in to comment.