diff --git a/configs/benchmark_digicam_celeba.yaml b/configs/benchmark_digicam_celeba.yaml new file mode 100644 index 00000000..bf5612a7 --- /dev/null +++ b/configs/benchmark_digicam_celeba.yaml @@ -0,0 +1,81 @@ +# python scripts/eval/benchmark_recon.py -cn benchmark_digicam_celeba +defaults: + - benchmark + - _self_ + + +dataset: HFDataset # DiffuserCam, DigiCamCelebA, HFDataset +batchsize: 10 +device: "cuda:2" + +algorithms: [ + "ADMM", + # "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", + + # #-- reconstructions trained on other datasets/systems + # "hf:diffusercam:mirflickr:Unet4M+U10+Unet4M", + # "hf:tapecam:mirflickr:Unet4M+U5+Unet4M", + # "hf:diffusercam:mirflickr:Unet4M+U5+Unet4M", + # "hf:tapecam:mirflickr:Unet4M+U10+Unet4M", + # "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave", + # "hf:digicam:mirflickr_single_25k:Unet4M+U10+Unet4M_wave", +] + + +# ## -- reconstructions trained on other datasets/systems +# algorithms: [ +# "hf:diffusercam:mirflickr:Unet4M+U10+Unet4M", +# "hf:tapecam:mirflickr:Unet4M+U10+Unet4M", +# "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave", +# # "hf:digicam:celeba_26k:Unet4M+U5+Unet4M_wave", +# ] + +# # algorithm configuration +# hf:digicam:mirflickr_single_25k:Unet4M+U10+Unet4M_wave: +# skip_post: True +# hf:digicam:mirflickr_single_25k:Unet4M+U10+Unet4M: +# skip_post: True +# hf:digicam:mirflickr_multi_25k:Unet4M+U10+Unet4M: +# skip_post: True +# hf:digicam:mirflickr_multi_25k:Unet4M+U10+Unet4M_wave: +# skip_post: True + +save_idx: [0, 2, 3, 4, 9] +n_iter_range: [100] # for ADMM + +huggingface: + repo: bezzam/DigiCam-CelebA-26K + # cache_dir: /dev/shm + psf: psf_measured.png + # psf: psf_simulated_waveprop.png # psf_simulated_waveprop.png, psf_simulated.png, psf_measured.png + split_seed: 0 + test_size: 0.15 + downsample: 2 + image_res: null + + alignment: + top_left: null + height: null + + # 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" + # shifting when there is no files to downsample + vertical_shift: -117 + horizontal_shift: -25 diff --git a/configs/benchmark_digicam_mirflickr_multi.yaml b/configs/benchmark_digicam_mirflickr_multi.yaml new file mode 100644 index 00000000..0c9d5b8b --- /dev/null +++ b/configs/benchmark_digicam_mirflickr_multi.yaml @@ -0,0 +1,60 @@ +# python scripts/eval/benchmark_recon.py -cn benchmark_digicam_mirflickr_multi +defaults: + - benchmark + - _self_ + + +dataset: HFDataset +batchsize: 4 +device: "cuda:0" + +huggingface: + repo: "bezzam/DigiCam-Mirflickr-MultiMask-25K" + cache_dir: /dev/shm + psf: null # null for simulating PSF + image_res: [900, 1200] # used during measurement + rotate: True # if measurement is upside-down + flipud: False + flip_lensed: False # if rotate or flipud is True, apply to lensed + alignment: + top_left: [80, 100] # height, width + height: 200 + downsample: 1 + +algorithms: [ + # "ADMM", + ## -- reconstructions trained on other datasets/systems + # "hf:diffusercam:mirflickr:Unet4M+U10+Unet4M", + # "hf:tapecam:mirflickr:Unet4M+U10+Unet4M", + # "hf:digicam:mirflickr_single_25k:Unet4M+U10+Unet4M_wave", + # "hf:digicam:celeba_26k:Unet4M+U5+Unet4M_wave", + # "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave", + # "hf:digicam:mirflickr_multi_25k:Unet4M+U5+Unet4M_wave", + # "hf:digicam:mirflickr_multi_25k:Unet4M+U10+Unet4M_wave", + # "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_aux1", + # "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_flips", + # "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_flips_rotate10", + # "hf:digicam:mirflickr_multi_25k:Unet4M+U5+Unet4M_wave_aux1", + # "hf:digicam:mirflickr_multi_25k:Unet4M+U5+Unet4M_wave_flips", + # "hf:tapecam:mirflickr:Unet4M+U5+Unet4M", + # "hf:diffusercam:mirflickr:Unet4M+U5+Unet4M", + "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_ft_flips", + "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_ft_flips_rotate10", +] + + +# -- to only use output from unrolled +hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave_aux1: + skip_post: True + skip_pre: True + +# save_idx: [1, 2, 4, 5, 9] +save_idx: [24, 33, 61] +n_iter_range: [100] # for ADMM + +# simulating PSF +simulation: + use_waveprop: True + deadspace: True + scene2mask: 0.3 + mask2sensor: 0.002 diff --git a/configs/benchmark_tapecam_mirflickr.yaml b/configs/benchmark_tapecam_mirflickr.yaml new file mode 100644 index 00000000..ee966c97 --- /dev/null +++ b/configs/benchmark_tapecam_mirflickr.yaml @@ -0,0 +1,66 @@ +# python scripts/eval/benchmark_recon.py -cn benchmark_tapecam_mirflickr +defaults: + - benchmark + - _self_ + +dataset: HFDataset +batchsize: 4 +device: "cuda:0" + +huggingface: + repo: "bezzam/TapeCam-Mirflickr-25K" + cache_dir: /dev/shm + psf: psf.png + image_res: [900, 1200] # used during measurement + rotate: False # if measurement is upside-down + flipud: False + flip_lensed: False # if rotate or flipud is True, apply to lensed + alignment: + top_left: [45, 95] # height, width + height: 250 + downsample: 1 + single_channel_psf: False + +## -- reconstructions trained with same dataset/system +algorithms: [ +# "ADMM", +# "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:Unet4M+U5+Unet4M_flips_rotate10", + # "hf:tapecam:mirflickr:Unet4M+U5+Unet4M_aux1", + + # single_channel_psf = True +# "hf:tapecam:mirflickr:MWDN8M", +# "hf:tapecam:mirflickr:Unet2M+MWDN6M", + + # # -- generalization + # "hf:tapecam:mirflickr:Unet4M+U5+Unet4M_flips", + # "hf:tapecam:mirflickr:Unet4M+U5+Unet4M_flips_rotate10", + # "hf:diffusercam:mirflickr_sim:Unet4M+U5+Unet4M", + # "hf:diffusercam:mirflickr_sim:Unet4M+U5+Unet4M_ft_tapecam", + # "hf:diffusercam:mirflickr_sim:Unet4M+U5+Unet4M_ft_tapecam_post", + # "hf:diffusercam:mirflickr_sim:Unet4M+U5+Unet4M_ft_tapecam_pre", + # "hf:diffusercam:mirflickr_sim:Unet4M+U5+Unet4M_ft_digicam_multi_post", + # "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", + "hf:diffusercam:mirflickr_sim:Unet4M+U5+Unet4M_ft_digicam_multi_pre", + "hf:diffusercam:mirflickr_sim:Unet4M+U5+Unet4M_ft_digicam_multi", + +## -- reconstructions trained on other datasets/systems + # "hf:diffusercam:mirflickr:Unet4M+U10+Unet4M", + # "hf:diffusercam:mirflickr:Unet4M+U5+Unet4M", + # "hf:digicam:mirflickr_single_25k:Unet4M+U5+Unet4M_wave", + # "hf:digicam:celeba_26k:Unet4M+U5+Unet4M_wave", + # "hf:digicam:mirflickr_single_25k:Unet4M+U10+Unet4M_wave", +] + +save_idx: [1, 2, 4, 5, 9] +n_iter_range: [100] # for ADMM + diff --git a/configs/demo_iccp2024.yaml b/configs/demo_iccp2024.yaml new file mode 100644 index 00000000..04efe2f6 --- /dev/null +++ b/configs/demo_iccp2024.yaml @@ -0,0 +1,37 @@ +defaults: + - demo + - _self_ + + +gamma: 1 # for plotting PSF + +display: + image_res: [700, 700] + vshift: -20 + +capture: + legacy: False + bayer: False + rgb: False + down: 4 + awb_gains: [2.0, 1.1] + +recon: + gamma: null + downsample: 4 + dtype: float32 + use_torch: True + torch_device: cuda:3 + algo: admm + + fista: + n_iter: 300 + + admm: + n_iter: 10 + +postproc: + # crop in percent to extract region of interest + # set to null to skip + crop_hor: [0.3, 0.7] + crop_vert: [0.22, 0.67] \ No newline at end of file diff --git a/configs/finetune_tape_for_diffuser.yaml b/configs/finetune_tape_for_diffuser.yaml new file mode 100644 index 00000000..a564ba6b --- /dev/null +++ b/configs/finetune_tape_for_diffuser.yaml @@ -0,0 +1,32 @@ +# python scripts/recon/train_learning_based.py -cn finetune_tape_for_diffuser +defaults: + - train_unrolledADMM + - _self_ + +torch_device: 'cuda:0' +device_ids: [0, 1, 2, 3] +eval_disp_idx: [0, 1, 3, 4, 8] + +# Dataset +files: + dataset: bezzam/DiffuserCam-Lensless-Mirflickr-Dataset-NORM + huggingface_dataset: True + huggingface_psf: psf.tiff + single_channel_psf: True + downsample: 2 # factor by which to downsample the PSF, note that for DiffuserCam the PSF has 4x the resolution + flipud: True + flip_lensed: True # for measure data + + hf_simulated: True + +training: + batch_size: 4 + epoch: 25 + eval_batch_size: 4 + +reconstruction: + init: hf:tapecam:mirflickr:Unet4M+U5+Unet4M + # init: hf:diffusercam:mirflickr:Unet4M+U5+Unet4M + +optimizer: + lr: 1e-5 diff --git a/configs/telegram_demo_iccp2024.yaml b/configs/telegram_demo_iccp2024.yaml new file mode 100644 index 00000000..f5cec434 --- /dev/null +++ b/configs/telegram_demo_iccp2024.yaml @@ -0,0 +1,54 @@ +defaults: + - telegram_demo + - _self_ + +# for Telegram +token: null +whitelist: [360264201] +setup_fp: voronoi_setup.jpeg + +# usernames and IP address +rpi_username: null +rpi_hostname: null + +config_name: demo_iccp2024 +psf: + fp: data/psf/voronoi_rgb.png + downsample: 4 + +files: + mnist: + fp: data/original/mnist_3.png + exposure: 0.05 + brightness: 100 + thumb: + fp: data/original/thumbs_up.png + exposure: 0.02 + brightness: 80 + face: + fp: data/original/face.jpg + exposure: 0.03 + brightness: 80 + tree: + fp: data/original/tree.png + exposure: 0.08 + brightness: 100 + +overlay: + alpha: 60 + + img1: + fp: data/original/epfl_white.png + scaling: 0.3 + position: [10,10] + + img2: + fp: data/original/iccp.png + scaling: 0.4 + position: [220,15] + + img3: + fp: data/original/lpc.png + scaling: 0.4 + position: [110,300] + \ No newline at end of file diff --git a/configs/train_mirflickr_tape.yaml b/configs/train_mirflickr_tape.yaml new file mode 100644 index 00000000..15ebb178 --- /dev/null +++ b/configs/train_mirflickr_tape.yaml @@ -0,0 +1,49 @@ +# python scripts/recon/train_learning_based.py -cn train_mirflickr_tape +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/TapeCam-Mirflickr-25K + huggingface_dataset: True + huggingface_psf: psf.png + downsample: 1 + # TODO: these parameters should be in the dataset? + image_res: [900, 1200] # used during measurement + rotate: False # if measurement is upside-down + save_psf: True + +# TODO: these parameters should be in the dataset? +alignment: + # when there is no downsampling + top_left: [45, 95] # height, width + height: 250 + +training: + batch_size: 4 + epoch: 25 + eval_batch_size: 4 + +reconstruction: + method: unrolled_admm + unrolled_admm: + # Number of iterations + n_iter: 5 + # 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] diff --git a/configs/upload_tapecam_mirflickr.yaml b/configs/upload_tapecam_mirflickr.yaml new file mode 100644 index 00000000..bb3d806c --- /dev/null +++ b/configs/upload_tapecam_mirflickr.yaml @@ -0,0 +1,21 @@ +# python scripts/data/upload_dataset_huggingface.py -cn upload_tapecam_mirflickr +defaults: + - upload_dataset_huggingface + - _self_ + +repo_id: "bezzam/TapeCam-Mirflickr-25K" +n_files: 25000 +test_size: 0.15 +multimask: False +split: 100 # "first: first `nfiles*test_size` for test, `int`: test_size*split for test (interleaved) as if multimask with this many masks + +lensless: + dir: "/dev/shm/TEST/all_measured_20240527-185211" + ext: ".png" + +lensed: + dir: "/dev/shm/mirflickr" + ext: ".jpg" + +files: + psf: /root/LenslessPiCam/tape_rgb_may27.png