-
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' into trainable_amplitude_mask
- Loading branch information
Showing
51 changed files
with
3,597 additions
and
276 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
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,13 @@ | ||
# python scripts/recon/admm.py -cn admm_pnp | ||
defaults: | ||
- defaults_recon | ||
- _self_ | ||
|
||
torch: True | ||
torch_device: 'cuda:1' | ||
|
||
admm: | ||
denoiser: | ||
network: DruNet | ||
noise_level: 0.05 | ||
use_dual: 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
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,32 @@ | ||
# python scripts/recon/dataset.py -cn recon_celeba_digicam | ||
defaults: | ||
- recon_dataset | ||
- _self_ | ||
|
||
torch: True | ||
torch_device: 'cuda:0' | ||
|
||
repo_id: "bezzam/DigiCam-CelebA-10K" | ||
split: "test" # "train", "test", "all" | ||
psf_fn: "psf_measured.png" # in repo root | ||
n_files: 25 # null for all files | ||
|
||
preprocess: | ||
flip_ud: True | ||
flip_lr: 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 | ||
|
||
algo: admm # "admm", "apgd", "null" to just copy over (resized) raw data | ||
admm: | ||
n_iter: 10 | ||
|
||
# extraction region of interest | ||
# roi: null # top, left, bottom, right | ||
# roi: [10, 300, 560, 705] # down 4 | ||
roi: [10, 190, 377, 490] # down 6 | ||
# roi: [5, 150, 280, 352] # down 8 |
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,36 @@ | ||
# python scripts/recon/diffusercam_mirflickr.py | ||
# defaults to plug-and-play | ||
defaults: | ||
- defaults_recon | ||
- _self_ | ||
|
||
|
||
files: | ||
dataset: /scratch/bezzam/DiffuserCam_mirflickr/dataset | ||
psf: data/psf/diffusercam_psf.tiff | ||
diffusercam_psf: True | ||
downsample: 2 | ||
|
||
model_name: null | ||
legacy_denoiser: True | ||
|
||
# defaults to plug-and-play | ||
admm: | ||
# Number of iterations | ||
n_iter: 20 | ||
# Hyperparameters | ||
mu1: 1e-6 | ||
mu2: 1e-5 | ||
mu3: 4e-5 | ||
tau: 0.0001 | ||
# PnP | ||
denoiser: | ||
network: DruNet | ||
noise_level: 0.05 | ||
use_dual: False | ||
|
||
|
||
device: cuda:0 | ||
n_trials: 1 # more if you want to get average inference time | ||
idx: 3 # index from test set to reconstruct | ||
save: True |
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,111 @@ | ||
# Learn mask with HITL training by setting measure configuration (set to null for learning in simulation) | ||
# | ||
# EXAMPLE COMMAND: | ||
# python scripts/recon/train_unrolled.py -cn train_celeba_digicam_hitl measure.rpi_username=USERNAME measure.rpi_hostname=HOSTNAME files.vertical_shift=SHIFT | ||
|
||
defaults: | ||
- train_celeba_digicam | ||
- _self_ | ||
|
||
# Train Dataset | ||
files: | ||
|
||
dataset: CelebA | ||
celeba_root: /scratch/bezzam | ||
n_files: 1000 | ||
|
||
downsample: 8 | ||
# TODO: set appropriately to align | ||
vertical_shift: -520 | ||
horizontal_shift: null | ||
crop: | ||
vertical: [0, 2000] | ||
horizontal: [1200, 2800] | ||
|
||
measure: | ||
# TODO: set for device | ||
rpi_username: null | ||
rpi_hostname: null | ||
|
||
display: | ||
# default to this screen: https://www.dell.com/en-us/work/shop/dell-ultrasharp-usb-c-hub-monitor-u2421e/apd/210-axmg/monitors-monitor-accessories#techspecs_section | ||
screen_res: [1920, 1200] # width, height | ||
pad: 10 | ||
hshift: 0 | ||
vshift: -18 | ||
brightness: 100 | ||
rot90: 3 | ||
|
||
capture: | ||
|
||
# NB: not being used | ||
max_level: 254 | ||
min_level: 150 | ||
max_tries: 4 | ||
delay: 2 | ||
|
||
sensor: rpi_hq | ||
gamma: null # for visualization | ||
exp: 0.8 | ||
script: ~/LenslessPiCam/scripts/measure/on_device_capture.py | ||
iso: 100 | ||
config_pause: 1 | ||
sensor_mode: "0" | ||
nbits_out: 8 | ||
nbits_capture: 12 | ||
legacy: True | ||
gray: False | ||
fn: raw_data | ||
bayer: True | ||
awb_gains: [1.6, 1.2] | ||
rgb: True | ||
down: 8 | ||
flip: True | ||
|
||
|
||
# for prepping ground truth data | ||
simulation: | ||
scene2mask: 0.3 # [m] | ||
mask2sensor: 0.002 # [m] | ||
object_height: 0.38 # [m] | ||
snr_db: 5 | ||
downsample: null | ||
random_vflip: False | ||
random_hflip: False | ||
quantize: False | ||
flip: False | ||
|
||
#Training | ||
training: | ||
batch_size: 4 | ||
epoch: 10 | ||
eval_batch_size: 1 | ||
crop_preloss: True | ||
save_every: 1 | ||
|
||
#Trainable Mask | ||
trainable_mask: | ||
mask_type: AdafruitLCD #Null or "TrainablePSF" or "AdafruitLCD" | ||
# "random" (with shape of config.files.psf) or path to npy file | ||
grayscale: False | ||
mask_lr: 1e-3 | ||
L1_strength: False | ||
min_val: 0 | ||
|
||
train_mask_vals: True | ||
train_color_filter: True | ||
|
||
# -- only for AdafruitLCD | ||
initial_value: data/psf/adafruit_random_pattern_20231107_150902.npy | ||
ap_center: [57, 77] | ||
ap_shape: [18, 26] | ||
rotate: 0 # rotation in degrees | ||
# to align with measured PSF (so reconstruction also aligned) | ||
vertical_shift: 0 # [px] | ||
horizontal_shift: 0 # [px] | ||
|
||
slm: adafruit | ||
sensor: rpi_hq | ||
flipud: True | ||
waveprop: True # TODO: remove if too slow | ||
|
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 |
---|---|---|
|
@@ -3,9 +3,6 @@ defaults: | |
- train_unrolledADMM | ||
- _self_ | ||
|
||
display: | ||
disp: 400 | ||
|
||
reconstruction: | ||
method: unrolled_admm | ||
|
||
|
Oops, something went wrong.