-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:LCAV/LenslessPiCam into main
- Loading branch information
Showing
66 changed files
with
4,344 additions
and
696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ data/* | |
models/* | ||
*.png | ||
*.jpg | ||
*.npy | ||
|
||
configs/telegram_demo_secret.yaml | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defaults: | ||
- demo | ||
- _self_ | ||
|
||
plot: True | ||
|
||
capture: | ||
exp: 5.0 | ||
awb_gains: [1, 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# python scripts/recon/admm.py -cn diffusercam_mirflickr_single_admm | ||
defaults: | ||
- defaults_recon | ||
- _self_ | ||
|
||
|
||
display: | ||
gamma: null | ||
|
||
input: | ||
# File path for recorded PSF | ||
psf: data/DiffuserCam_Test/psf.tiff | ||
# File path for raw data | ||
data: data/DiffuserCam_Test/diffuser/im5.npy | ||
dtype: float32 | ||
original: data/DiffuserCam_Test/lensed/im5.npy | ||
|
||
torch: True | ||
torch_device: 'cuda:0' | ||
|
||
preprocess: | ||
downsample: 8 # factor for PSF, which is 4x resolution of image | ||
normalize: False | ||
|
||
admm: | ||
# Number of iterations | ||
n_iter: 20 | ||
# Hyperparameters | ||
mu1: 1e-6 | ||
mu2: 1e-5 | ||
mu3: 4e-5 | ||
tau: 0.0001 | ||
#Loading unrolled model | ||
unrolled: True | ||
# checkpoint_fp: pretrained_models/Pre_Unrolled_Post-DiffuserCam/model_weights.pt | ||
checkpoint_fp: outputs/2023-09-11/22-06-49/recon.pt # pre unet and post drunet | ||
pre_process_model: | ||
network : UnetRes # UnetRes or DruNet or null | ||
depth : 2 # depth of each up/downsampling layer. Ignore if network is DruNet | ||
post_process_model: | ||
network : DruNet # UnetRes or DruNet or null | ||
depth : 2 # depth of each up/downsampling layer. Ignore if network is DruNet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
rpi: | ||
username: null | ||
hostname: null | ||
|
||
device: adafruit | ||
virtual: False | ||
save: True | ||
|
||
# pattern: data/psf/adafruit_random_pattern_20230719.npy | ||
pattern: random | ||
# pattern: rect | ||
# pattern: circ | ||
min_val: 0 # if pattern: random, min for range(0,1) | ||
rect_shape: [20, 10] # if pattern: rect | ||
radius: 20 # if pattern: circ | ||
center: [0, 0] | ||
|
||
|
||
aperture: | ||
center: [59,76] | ||
shape: [19,26] | ||
|
||
z: 4 # mask to sensor distance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# python scripts/recon/train_unrolled.py -cn fine-tune_PSF | ||
defaults: | ||
- train_unrolledADMM | ||
- _self_ | ||
|
||
#Trainable Mask | ||
trainable_mask: | ||
mask_type: TrainablePSF #Null or "TrainablePSF" | ||
initial_value: psf | ||
mask_lr: 1e-3 | ||
L1_strength: 1.0 #False or float | ||
|
||
#Training | ||
training: | ||
save_every: 5 | ||
|
||
display: | ||
gamma: 2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# python scripts/recon/dataset.py | ||
defaults: | ||
- defaults_recon | ||
- _self_ | ||
|
||
torch: True | ||
torch_device: 'cuda:0' | ||
|
||
input: | ||
# https://drive.switch.ch/index.php/s/NdgHlcDeHVDH5ww?path=%2Fpsf | ||
psf: data/psf/adafruit_random_2mm_20231907.png | ||
# https://drive.switch.ch/index.php/s/m89D1tFEfktQueS | ||
raw_data: data/celeba_adafruit_random_2mm_20230720_1K | ||
|
||
n_files: 25 # null for all files | ||
output_folder: data/celeba_adafruit_recon | ||
|
||
# extraction region of interest | ||
roi: null # top, left, bottom, right | ||
# -- values for `data/celeba_adafruit_random_2mm_20230720_1K` | ||
# roi: [10, 300, 560, 705] # down 4 | ||
# roi: [6, 200, 373, 470] # down 6 | ||
# roi: [5, 150, 280, 352] # down 8 | ||
|
||
preprocess: | ||
flip: True | ||
downsample: 6 | ||
|
||
# to have different data shape than PSF | ||
data_dim: null | ||
# data_dim: [48, 64] # down 64 | ||
# data_dim: [506, 676] # down 6 | ||
|
||
display: | ||
disp: -1 | ||
plot: False | ||
|
||
algo: admm # "admm", "apgd", "null" to just copy over (resized) raw data | ||
|
||
apgd: | ||
n_jobs: 1 # run in parallel as algo is slow | ||
max_iter: 500 | ||
|
||
admm: | ||
n_iter: 10 | ||
|
||
save: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# python scripts/sim/digicam_psf.py | ||
hydra: | ||
job: | ||
chdir: True # change to output folder | ||
|
||
use_torch: False | ||
dtype: float32 | ||
torch_device: cuda | ||
requires_grad: True | ||
|
||
digicam: | ||
|
||
slm: adafruit | ||
sensor: rpi_hq | ||
|
||
# https://drive.switch.ch/index.php/s/NdgHlcDeHVDH5ww?path=%2Fpsf | ||
pattern: data/psf/adafruit_random_pattern_20230719.npy | ||
ap_center: [59, 76] | ||
ap_shape: [19, 26] | ||
rotate: -0.8 # rotation in degrees | ||
|
||
# optionally provide measured PSF for side-by-side comparison | ||
# https://drive.switch.ch/index.php/s/NdgHlcDeHVDH5ww?path=%2Fpsf | ||
psf: data/psf/adafruit_random_2mm_20231907.png | ||
gamma: 2 # for plotting measured | ||
|
||
sim: | ||
|
||
# whether SLM is fliped | ||
flipud: True | ||
|
||
# in practice found waveprop=True or False doesn't make difference | ||
waveprop: False | ||
|
||
# below are ignored if waveprop=False | ||
scene2mask: 0.03 # [m] | ||
mask2sensor: 0.002 # [m] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
hydra: | ||
job: | ||
chdir: True # change to output folder | ||
|
||
seed: 0 | ||
|
||
data: | ||
# -- path to original CelebA (parent directory) | ||
original: /scratch/bezzam | ||
|
||
output_dir: "./vit-celeba" # basename for model output | ||
|
||
# -- raw | ||
# https://drive.switch.ch/index.php/s/m89D1tFEfktQueS | ||
measured: data/celeba_adafruit_random_2mm_20230720_10K | ||
raw: True | ||
|
||
# # -- reconstructed | ||
# # run `python scripts/recon/dataset.py` to get a reconstructed dataset | ||
# measured: null | ||
# raw: False | ||
|
||
n_files: null # null to use all in measured_folder | ||
test_size: 0.15 | ||
attr: Male # "Male", "Smiling", etc | ||
|
||
augmentation: | ||
|
||
random_resize_crop: False | ||
horizontal_flip: True # cannot be used with raw measurement! | ||
|
||
train: | ||
|
||
prev: null # path to previously trained model | ||
n_epochs: 4 | ||
dropout: 0.1 | ||
batch_size: 16 | ||
learning_rate: 2e-4 |
Oops, something went wrong.