Skip to content

Commit

Permalink
Merge branch 'main' into repo_status
Browse files Browse the repository at this point in the history
  • Loading branch information
billbrod authored Feb 21, 2024
2 parents 1a11d88 + fe3dd68 commit 3117997
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ The best way to install `plenoptic` is via `pip`.
$ pip install plenoptic
```

Our dependencies include [pytorch](https://pytorch.org/) and
[pyrtools](https://pyrtools.readthedocs.io/en/latest/). Installation should take
care of them (along with our other dependencies) automatically, but if you have
an installation problem (especially on a non-Linux operating system), it is
likely that the problem lies with one of those packages. [Open an
issue](https://github.com/LabForComputationalVision/plenoptic/issues) and we'll
try to help you figure out the problem!

See the [installation
page](https://plenoptic.readthedocs.io/en/latest/install.html) for more details,
including how to set up a virtual environment and jupyter.
Expand Down
2 changes: 2 additions & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ $ conda create --name plenoptic pip python=3.9
$ conda activate plenoptic
$ pip install plenoptic

Our dependencies include `pytorch <https://pytorch.org/>`_ and `pyrtools <https://pyrtools.readthedocs.io/en/latest/>`_. Installation should take care of them (along with our other dependencies) automatically, but if you have an installation problem (especially on a non-Linux operating system), it is likely that the problem lies with one of those packages. `Open an issue <https://github.com/LabForComputationalVision/plenoptic/issues>`_ and we'll try to help you figure out the problem!

You can also install it directly from source to have a local editable copy. This is most useful for developing (for more info, see `our contributing guide <https://github.com/LabForComputationalVision/plenoptic/blob/main/CONTRIBUTING.md>`_) or if you want to use the most cutting-edge version::

$ conda create --name plenoptic pip python=3.9
Expand Down
3 changes: 2 additions & 1 deletion tests/test_geodesic.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,5 @@ def test_stop_criterion(self, einstein_small_seq, model):
moog = po.synth.Geodesic(einstein_small_seq[:1], einstein_small_seq[-1:],
model, 5)
moog.synthesize(max_iter=10, stop_criterion=.06, stop_iters_to_check=1)
assert len(moog.pixel_change_norm) == 6, "Didn't stop when hit criterion! (or optimization changed)"
assert (abs(moog.pixel_change_norm[-1:]) < .06).all(), "Didn't stop when hit criterion!"
assert (abs(moog.pixel_change_norm[:-1]) > .06).all(), "Stopped after hit criterion!"
3 changes: 2 additions & 1 deletion tests/test_mad.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,5 @@ def test_stop_criterion(self, einstein_img):
po.tools.set_seed(0)
mad = po.synth.MADCompetition(einstein_img, po.metric.mse, dis_ssim, 'min')
mad.synthesize(max_iter=15, stop_criterion=1e-3, stop_iters_to_check=5)
assert len(mad.losses) == 12, "Didn't stop when hit criterion! (or optimization changed)"
assert abs(mad.losses[-5]-mad.losses[-1]) < 1e-3, "Didn't stop when hit criterion!"
assert abs(mad.losses[-6]-mad.losses[-2]) > 1e-3, "Stopped after hit criterion!"
11 changes: 3 additions & 8 deletions tests/test_metamers.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,6 @@ def test_stop_criterion(self, einstein_img, model):
po.tools.set_seed(0)
met = po.synth.Metamer(einstein_img, model)
# takes different numbers of iter to converge on GPU and CPU
if DEVICE.type == 'cuda':
max_iter = 30
check_iter = 25
else:
max_iter = 10
check_iter = 8
met.synthesize(max_iter=max_iter, stop_criterion=1e-5, stop_iters_to_check=5)
assert len(met.losses) == check_iter, "Didn't stop when hit criterion! (or optimization changed)"
met.synthesize(max_iter=30, stop_criterion=1e-5, stop_iters_to_check=5)
assert abs(met.losses[-5]-met.losses[-1]) < 1e-5, "Didn't stop when hit criterion!"
assert abs(met.losses[-6]-met.losses[-2]) > 1e-5, "Stopped after hit criterion!"

0 comments on commit 3117997

Please sign in to comment.