-
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.
Training with measurements done with multiple masks. (#117)
* Make sensor downsampling consistent with rest of package. * Add support for multimask training. * Add notebook to visualize alignment. * Fix lensed resizing. * Add multi-GPU support to unrolled ADMM. * Same dataset object for multi and single mask. * Cleaner image alignment. * Make sensor downsampling consistent with rest. * Fix admm for multi-gpu support. * Reset after setting PSF. * Fix trainable recon for multi-GPU. * Add support for additional benchmark sets and fix multi-gpu in training script. * Add support to hugging face datasets for benchmarking. * Update hugging face upload script to split single mask dataset like multimask. * Update configurations for multimask experiments. * Support hugging face dataset with PSF. * Training and authentication for ICCP. * Add support for programmable mask to Telegram bot. * Clean up. * Remove alignment notebook. * Add function to plot train-test curves. * Remove commented line. * Add links to Google colab notebooks. * Update CHANGELOG.
- Loading branch information
Showing
40 changed files
with
1,882 additions
and
397 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,17 @@ | ||
# python scripts/data/authenticate.py | ||
hydra: | ||
job: | ||
chdir: True # change to output folder | ||
|
||
# repo_id: "bezzam/DigiCam-Mirflickr-MultiMask-25K" | ||
# repo_id: "bezzam/DigiCam-Mirflickr-MultiMask-1K" | ||
repo_id: "bezzam/DigiCam-Mirflickr-MultiMask-10K" | ||
split: all # "all" (for 100 masks), "test" (for 15 masks) | ||
n_iter: 25 | ||
n_files: 100 # per mask | ||
grayscale: True | ||
font_scale: 1.5 | ||
torch_device: cuda:0 | ||
|
||
cont: null # continue already started file | ||
scores_fp: null # file path to already computed scores |
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,21 @@ | ||
# python scripts/recon/digicam_mirflickr.py | ||
defaults: | ||
- defaults_recon | ||
- _self_ | ||
|
||
# - Learned reconstructions: see "lensless/recon/model_dict.py" | ||
# model: U10 | ||
# model: Unet8M | ||
# model: TrainInv+Unet8M | ||
# model: U10+Unet8M | ||
# model: Unet4M+TrainInv+Unet4M | ||
# model: Unet4M+U10+Unet4M | ||
|
||
# -- for ADMM with fixed parameters | ||
model: admm | ||
n_iter: 10 | ||
|
||
device: cuda:0 | ||
n_trials: 100 # more if you want to get average inference time | ||
idx: 1 # 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 was deleted.
Oops, something went wrong.
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,64 @@ | ||
# python scripts/recon/train_unrolled.py -cn train_digicam_singlemask | ||
defaults: | ||
- train_unrolledADMM | ||
- _self_ | ||
|
||
torch_device: 'cuda:0' | ||
device_ids: [0, 1, 2, 3] | ||
eval_disp_idx: [0, 2, 3, 4, 9] | ||
|
||
# Dataset | ||
files: | ||
dataset: bezzam/DigiCam-CelebA-26K | ||
huggingface_psf: "psf_simulated.png" | ||
huggingface_dataset: True | ||
split_seed: 0 | ||
downsample: 2 | ||
rotate: True # if measurement is upside-down | ||
save_psf: False | ||
|
||
alignment: | ||
# cropping when there is no downsampling | ||
crop: | ||
vertical: [0, 525] | ||
horizontal: [265, 695] | ||
|
||
# for prepping ground truth data | ||
simulation: | ||
scene2mask: 0.25 # [m] | ||
mask2sensor: 0.002 # [m] | ||
object_height: 0.33 # [m] | ||
sensor: "rpi_hq" | ||
snr_db: null | ||
downsample: null | ||
random_vflip: False | ||
random_hflip: False | ||
quantize: False | ||
# shifting when there is no files.downsample | ||
vertical_shift: -117 | ||
horizontal_shift: -25 | ||
|
||
training: | ||
batch_size: 4 | ||
epoch: 25 | ||
eval_batch_size: 4 | ||
crop_preloss: True | ||
|
||
reconstruction: | ||
method: unrolled_admm | ||
unrolled_admm: | ||
# Number of iterations | ||
n_iter: 10 | ||
# Hyperparameters | ||
mu1: 1e-4 | ||
mu2: 1e-4 | ||
mu3: 1e-4 | ||
tau: 2e-4 | ||
pre_process: | ||
network : UnetRes # UnetRes or DruNet or null | ||
depth : 4 # depth of each up/downsampling layer. Ignore if network is DruNet | ||
nc: [32,64,116,128] | ||
post_process: | ||
network : UnetRes # UnetRes or DruNet or null | ||
depth : 4 # depth of each up/downsampling layer. Ignore if network is DruNet | ||
nc: [32,64,116,128] |
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,58 @@ | ||
# python scripts/recon/train_unrolled.py -cn train_digicam_multimask | ||
defaults: | ||
- train_unrolledADMM | ||
- _self_ | ||
|
||
|
||
torch_device: 'cuda:0' | ||
device_ids: [0, 1, 2, 3] | ||
eval_disp_idx: [1, 2, 4, 5, 9] | ||
|
||
# Dataset | ||
files: | ||
dataset: bezzam/DigiCam-Mirflickr-MultiMask-25K | ||
huggingface_dataset: True | ||
downsample: 1 | ||
# TODO: these parameters should be in the dataset? | ||
image_res: [900, 1200] # used during measurement | ||
rotate: True # if measurement is upside-down | ||
save_psf: False | ||
|
||
extra_eval: | ||
singlemask: | ||
huggingface_repo: bezzam/DigiCam-Mirflickr-SingleMask-25K | ||
display_res: [900, 1200] # used during measurement | ||
rotate: True # if measurement is upside-down | ||
alignment: | ||
topright: [80, 100] # height, width | ||
height: 200 | ||
|
||
# TODO: these parameters should be in the dataset? | ||
alignment: | ||
# when there is no downsampling | ||
topright: [80, 100] # height, width | ||
height: 200 | ||
|
||
training: | ||
batch_size: 4 | ||
epoch: 25 | ||
eval_batch_size: 4 | ||
|
||
reconstruction: | ||
method: unrolled_admm | ||
unrolled_admm: | ||
# Number of iterations | ||
n_iter: 10 | ||
# Hyperparameters | ||
mu1: 1e-4 | ||
mu2: 1e-4 | ||
mu3: 1e-4 | ||
tau: 2e-4 | ||
pre_process: | ||
network : UnetRes # UnetRes or DruNet or null | ||
depth : 4 # depth of each up/downsampling layer. Ignore if network is DruNet | ||
nc: [32,64,116,128] | ||
post_process: | ||
network : UnetRes # UnetRes or DruNet or null | ||
depth : 4 # depth of each up/downsampling layer. Ignore if network is DruNet | ||
nc: [32,64,116,128] |
Oops, something went wrong.