Skip to content

Commit 672ba55

Browse files
authored
Update license and demo files (#172)
* Update demo and add ICME files. * Update license. * Fix link. * Clean up. * Clean up.
1 parent 7d98414 commit 672ba55

File tree

9 files changed

+358
-152
lines changed

9 files changed

+358
-152
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ DiffuserCam_Mirflickr_200_3011302021_11h43_seed11*
88
paper/paper.pdf
99
data/*
1010
models/*
11+
multirun/*
1112
notebooks/models/*
13+
authenticate_admm/*
14+
authenticate_learned/*
1215
*.png
1316
*.jpg
1417
*.npy

LICENSE

Lines changed: 71 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
GNU GENERAL PUBLIC LICENSE
2-
Version 3, 29 June 2007
31

4-
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
2+
GNU AFFERO GENERAL PUBLIC LICENSE
3+
Version 3, 19 November 2007
4+
5+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
56
Everyone is permitted to copy and distribute verbatim copies
67
of this license document, but changing it is not allowed.
78

89
Preamble
910

10-
The GNU General Public License is a free, copyleft license for
11-
software and other kinds of works.
11+
The GNU Affero General Public License is a free, copyleft license for
12+
software and other kinds of works, specifically designed to ensure
13+
cooperation with the community in the case of network server software.
1214

1315
The licenses for most software and other practical works are designed
1416
to take away your freedom to share and change the works. By contrast,
15-
the GNU General Public License is intended to guarantee your freedom to
17+
our General Public Licenses are intended to guarantee your freedom to
1618
share and change all versions of a program--to make sure it remains free
17-
software for all its users. We, the Free Software Foundation, use the
18-
GNU General Public License for most of our software; it applies also to
19-
any other work released this way by its authors. You can apply it to
20-
your programs, too.
19+
software for all its users.
2120

2221
When we speak of free software, we are referring to freedom, not
2322
price. Our General Public Licenses are designed to make sure that you
@@ -26,44 +25,34 @@ them if you wish), that you receive source code or can get it if you
2625
want it, that you can change the software or use pieces of it in new
2726
free programs, and that you know you can do these things.
2827

29-
To protect your rights, we need to prevent others from denying you
30-
these rights or asking you to surrender the rights. Therefore, you have
31-
certain responsibilities if you distribute copies of the software, or if
32-
you modify it: responsibilities to respect the freedom of others.
33-
34-
For example, if you distribute copies of such a program, whether
35-
gratis or for a fee, you must pass on to the recipients the same
36-
freedoms that you received. You must make sure that they, too, receive
37-
or can get the source code. And you must show them these terms so they
38-
know their rights.
39-
40-
Developers that use the GNU GPL protect your rights with two steps:
41-
(1) assert copyright on the software, and (2) offer you this License
42-
giving you legal permission to copy, distribute and/or modify it.
43-
44-
For the developers' and authors' protection, the GPL clearly explains
45-
that there is no warranty for this free software. For both users' and
46-
authors' sake, the GPL requires that modified versions be marked as
47-
changed, so that their problems will not be attributed erroneously to
48-
authors of previous versions.
49-
50-
Some devices are designed to deny users access to install or run
51-
modified versions of the software inside them, although the manufacturer
52-
can do so. This is fundamentally incompatible with the aim of
53-
protecting users' freedom to change the software. The systematic
54-
pattern of such abuse occurs in the area of products for individuals to
55-
use, which is precisely where it is most unacceptable. Therefore, we
56-
have designed this version of the GPL to prohibit the practice for those
57-
products. If such problems arise substantially in other domains, we
58-
stand ready to extend this provision to those domains in future versions
59-
of the GPL, as needed to protect the freedom of users.
60-
61-
Finally, every program is threatened constantly by software patents.
62-
States should not allow patents to restrict development and use of
63-
software on general-purpose computers, but in those that do, we wish to
64-
avoid the special danger that patents applied to a free program could
65-
make it effectively proprietary. To prevent this, the GPL assures that
66-
patents cannot be used to render the program non-free.
28+
Developers that use our General Public Licenses protect your rights
29+
with two steps: (1) assert copyright on the software, and (2) offer
30+
you this License which gives you legal permission to copy, distribute
31+
and/or modify the software.
32+
33+
A secondary benefit of defending all users' freedom is that
34+
improvements made in alternate versions of the program, if they
35+
receive widespread use, become available for other developers to
36+
incorporate. Many developers of free software are heartened and
37+
encouraged by the resulting cooperation. However, in the case of
38+
software used on network servers, this result may fail to come about.
39+
The GNU General Public License permits making a modified version and
40+
letting the public access it on a server without ever releasing its
41+
source code to the public.
42+
43+
The GNU Affero General Public License is designed specifically to
44+
ensure that, in such cases, the modified source code becomes available
45+
to the community. It requires the operator of a network server to
46+
provide the source code of the modified version running there to the
47+
users of that server. Therefore, public use of a modified version, on
48+
a publicly accessible server, gives the public access to the source
49+
code of the modified version.
50+
51+
An older license, called the Affero General Public License and
52+
published by Affero, was designed to accomplish similar goals. This is
53+
a different license, not a version of the Affero GPL, but Affero has
54+
released a new version of the Affero GPL which permits relicensing under
55+
this license.
6756

6857
The precise terms and conditions for copying, distribution and
6958
modification follow.
@@ -72,7 +61,7 @@ modification follow.
7261

7362
0. Definitions.
7463

75-
"This License" refers to version 3 of the GNU General Public License.
64+
"This License" refers to version 3 of the GNU Affero General Public License.
7665

7766
"Copyright" also means copyright-like laws that apply to other kinds of
7867
works, such as semiconductor masks.
@@ -549,35 +538,45 @@ to collect a royalty for further conveying from those to whom you convey
549538
the Program, the only way you could satisfy both those terms and this
550539
License would be to refrain entirely from conveying the Program.
551540

552-
13. Use with the GNU Affero General Public License.
541+
13. Remote Network Interaction; Use with the GNU General Public License.
542+
543+
Notwithstanding any other provision of this License, if you modify the
544+
Program, your modified version must prominently offer all users
545+
interacting with it remotely through a computer network (if your version
546+
supports such interaction) an opportunity to receive the Corresponding
547+
Source of your version by providing access to the Corresponding Source
548+
from a network server at no charge, through some standard or customary
549+
means of facilitating copying of software. This Corresponding Source
550+
shall include the Corresponding Source for any work covered by version 3
551+
of the GNU General Public License that is incorporated pursuant to the
552+
following paragraph.
553553

554554
Notwithstanding any other provision of this License, you have
555555
permission to link or combine any covered work with a work licensed
556-
under version 3 of the GNU Affero General Public License into a single
556+
under version 3 of the GNU General Public License into a single
557557
combined work, and to convey the resulting work. The terms of this
558558
License will continue to apply to the part which is the covered work,
559-
but the special requirements of the GNU Affero General Public License,
560-
section 13, concerning interaction through a network will apply to the
561-
combination as such.
559+
but the work with which it is combined will remain governed by version
560+
3 of the GNU General Public License.
562561

563562
14. Revised Versions of this License.
564563

565564
The Free Software Foundation may publish revised and/or new versions of
566-
the GNU General Public License from time to time. Such new versions will
567-
be similar in spirit to the present version, but may differ in detail to
565+
the GNU Affero General Public License from time to time. Such new versions
566+
will be similar in spirit to the present version, but may differ in detail to
568567
address new problems or concerns.
569568

570569
Each version is given a distinguishing version number. If the
571-
Program specifies that a certain numbered version of the GNU General
570+
Program specifies that a certain numbered version of the GNU Affero General
572571
Public License "or any later version" applies to it, you have the
573572
option of following the terms and conditions either of that numbered
574573
version or of any later version published by the Free Software
575574
Foundation. If the Program does not specify a version number of the
576-
GNU General Public License, you may choose any version ever published
575+
GNU Affero General Public License, you may choose any version ever published
577576
by the Free Software Foundation.
578577

579578
If the Program specifies that a proxy can decide which future
580-
versions of the GNU General Public License can be used, that proxy's
579+
versions of the GNU Affero General Public License can be used, that proxy's
581580
public statement of acceptance of a version permanently authorizes you
582581
to choose that version for the Program.
583582

@@ -635,40 +634,29 @@ the "copyright" line and a pointer to where the full notice is found.
635634
Copyright (C) <year> <name of author>
636635

637636
This program is free software: you can redistribute it and/or modify
638-
it under the terms of the GNU General Public License as published by
637+
it under the terms of the GNU Affero General Public License as published by
639638
the Free Software Foundation, either version 3 of the License, or
640639
(at your option) any later version.
641640

642641
This program is distributed in the hope that it will be useful,
643642
but WITHOUT ANY WARRANTY; without even the implied warranty of
644643
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645-
GNU General Public License for more details.
644+
GNU Affero General Public License for more details.
646645

647-
You should have received a copy of the GNU General Public License
648-
along with this program. If not, see <https://www.gnu.org/licenses/>.
646+
You should have received a copy of the GNU Affero General Public License
647+
along with this program. If not, see <http://www.gnu.org/licenses/>.
649648

650649
Also add information on how to contact you by electronic and paper mail.
651650

652-
If the program does terminal interaction, make it output a short
653-
notice like this when it starts in an interactive mode:
654-
655-
<program> Copyright (C) <year> <name of author>
656-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657-
This is free software, and you are welcome to redistribute it
658-
under certain conditions; type `show c' for details.
659-
660-
The hypothetical commands `show w' and `show c' should show the appropriate
661-
parts of the General Public License. Of course, your program's commands
662-
might be different; for a GUI interface, you would use an "about box".
651+
If your software can interact with users remotely through a computer
652+
network, you should also make sure that it provides a way for users to
653+
get its source. For example, if your program is a web application, its
654+
interface could display a "Source" link that leads users to an archive
655+
of the code. There are many ways you could offer source, and different
656+
solutions will be better for different programs; see section 13 for the
657+
specific requirements.
663658

664659
You should also get your employer (if you work as a programmer) or school,
665660
if any, to sign a "copyright disclaimer" for the program, if necessary.
666-
For more information on this, and how to apply and follow the GNU GPL, see
667-
<https://www.gnu.org/licenses/>.
668-
669-
The GNU General Public License does not permit incorporating your program
670-
into proprietary programs. If your program is a subroutine library, you
671-
may consider it more useful to permit linking proprietary applications with
672-
the library. If this is what you want to do, use the GNU Lesser General
673-
Public License instead of this License. But first, please read
674-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
661+
For more information on this, and how to apply and follow the GNU AGPL, see
662+
<http://www.gnu.org/licenses/>.

README.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,10 @@ References
324324
.. [10] Asif, M. S., Ayremlou, A., Sankaranarayanan, A., Veeraraghavan, A., & Baraniuk, R. G. (2016). Flatcam: Thin, lensless cameras using coded aperture and computation. IEEE Transactions on Computational Imaging, 3(3), 384-397.
325325
.. [11] Boominathan, V., Adams, J. K., Robinson, J. T., & Veeraraghavan, A. (2020). Phlatcam: Designed phase-mask based thin lensless camera. IEEE transactions on pattern analysis and machine intelligence, 42(7), 1618-1629.
326326
.. [12] Lee, K. C., Bae, J., Baek, N., Jung, J., Park, W., & Lee, S. A. (2023). Design and single-shot fabrication of lensless cameras with arbitrary point spread functions. Optica, 10(1), 72-80.
327+
328+
License
329+
-------
330+
331+
The open source license is in the `LICENSE <https://github.com/LCAV/LenslessPiCam/blob/main/LICENSE>`__ file.
332+
333+
If this license is not suitable for your business or project, please contact EPFL-TTO (https://tto.epfl.ch/) for a full commercial license.

configs/benchmark/diffusercam.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# python scripts/eval/benchmark_recon.py -cn diffusercam
2+
#
3+
# To sweep over multiple hyperparameters, e.g. of mu1 and mu2 of ADMM:
4+
# python scripts/eval/benchmark_recon.py -cn diffusercam -m algorithms=[ADMM] n_iter_range=[10,100] admm.mu1=1e-6,1e-5 admm.mu2=1e-6,1e-5 admm.mu3=3e-5 admm.tau=1e-4
5+
#
6+
# Hydra will do a Cartesian product of mu1 and mu2, i.e. it will run 4 experiments.
7+
# Output will be saved to `multirun` folder.
28
defaults:
39
- defaults
410
- _self_
@@ -92,3 +98,9 @@ n_iter_range: [10] # for ADMM
9298
# save_idx: [0, 1, 3, 4, 8, 45, 58, 63]
9399
# n_iter_range: [100] # for ADMM
94100

101+
admm:
102+
mu1: 1e-6
103+
mu2: 1e-5
104+
mu3: 4e-5
105+
tau: 0.0001
106+

configs/digicam_config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ rpi:
99
device: adafruit
1010
virtual: False
1111
save: True
12+
preview: False
1213

1314
# pattern: data/psf/adafruit_random_pattern_20230719.npy
1415
pattern: random
@@ -20,9 +21,7 @@ radius: 20 # if pattern: circ
2021
center: [0, 0]
2122

2223

23-
aperture:
24-
center: null
25-
shape: null
24+
aperture: null
2625
# aperture:
2726
# center: [59,76]
2827
# shape: [19,26]

lensless/recon/gd.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class GradientDescent(ReconstructionAlgorithm):
6464
Object for applying projected gradient descent.
6565
"""
6666

67-
def __init__(self, psf, dtype=None, proj=non_neg, **kwargs):
67+
def __init__(self, psf, dtype=None, proj=non_neg, lip_fact=1.8, **kwargs):
6868
"""
6969
7070
Parameters
@@ -83,6 +83,7 @@ def __init__(self, psf, dtype=None, proj=non_neg, **kwargs):
8383

8484
assert callable(proj)
8585
self._proj = proj
86+
self._lip_fact = lip_fact
8687
super(GradientDescent, self).__init__(psf, dtype, **kwargs)
8788

8889
if self._denoiser is not None:
@@ -106,7 +107,9 @@ def reset(self):
106107
# set step size as < 2 / lipschitz
107108
Hadj_flat = self._convolver._Hadj.reshape(-1, self._psf_shape[3])
108109
H_flat = self._convolver._H.reshape(-1, self._psf_shape[3])
109-
self._alpha = torch.real(1.8 / torch.max(torch.abs(Hadj_flat * H_flat), axis=0).values)
110+
self._alpha = torch.real(
111+
self._lip_fact / torch.max(torch.abs(Hadj_flat * H_flat), axis=0).values
112+
)
110113

111114
else:
112115
if self._initial_est is not None:
@@ -120,7 +123,7 @@ def reset(self):
120123
# set step size as < 2 / lipschitz
121124
Hadj_flat = self._convolver._Hadj.reshape(-1, self._psf_shape[3])
122125
H_flat = self._convolver._H.reshape(-1, self._psf_shape[3])
123-
self._alpha = np.real(1.8 / np.max(Hadj_flat * H_flat, axis=0))
126+
self._alpha = np.real(self._lip_fact / np.max(Hadj_flat * H_flat, axis=0))
124127

125128
def _grad(self):
126129
diff = self._convolver.convolve(self._image_est) - self._data

lensless/utils/plot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def plot_cross_section(
230230
ax.set_xlim([-half_width, half_width])
231231
ax.grid()
232232

233+
ax.set_title("Cross-section")
233234
if dB and plot_db_drop:
234235
cross_section -= np.max(cross_section)
235236
zero_crossings = np.where(np.diff(np.signbit(cross_section + plot_db_drop)))[0]
@@ -244,8 +245,7 @@ def plot_cross_section(
244245
width = 2 * np.abs(first_crossing)
245246
ax.axvline(x=-first_crossing, c="k", linestyle="--")
246247
ax.axvline(x=+first_crossing, c="k", linestyle="--")
247-
print(f"{plot_db_drop}dB width : {width} pixels")
248-
248+
print(f"-{plot_db_drop}dB width = {width} pixels")
249249
ax.set_title("Cross-section")
250250
ax.set_xlabel(f"-{plot_db_drop}dB width = {width}")
251251

@@ -300,7 +300,7 @@ def plot_autocorr2d(vals, pad_mode="reflect", ax=None):
300300
return ax, autocorr
301301

302302

303-
def plot_autocorr_rgb(img, width=3, figsize=None, plot_psf=False, psf_gamma=2.2):
303+
def plot_autocorr_rgb(img, width=3, figsize=None, plot_psf=False, psf_gamma=2.2, verbose=False):
304304
"""
305305
Plot autocorrelation of each channel of an image.
306306
@@ -341,13 +341,15 @@ def plot_autocorr_rgb(img, width=3, figsize=None, plot_psf=False, psf_gamma=2.2)
341341
idx = max_idx[0]
342342
# ax_auto[1][i].axhline(y=idx, c=c, linestyle="--")
343343

344-
ax, _ = plot_cross_section(
344+
ax, cross_section = plot_cross_section(
345345
autocorr_c,
346346
idx=idx,
347347
color=c,
348348
ax=ax_auto[2 if plot_psf else 1][i],
349349
plot_db_drop=width,
350350
)
351+
if verbose:
352+
print(f"Maximum drop in {c} channel: {cross_section.max() - cross_section.min()}")
351353
if i != 0:
352354
ax.set_ylabel("")
353355
return ax

0 commit comments

Comments
 (0)