Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pooled texture model #284

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
59b9e9e
initialize masked
billbrod Aug 9, 2024
1528fa5
adds mask to model
billbrod Aug 9, 2024
966d8ad
changes compute_pixel_stats to weighted version
billbrod Aug 9, 2024
09a4e43
create mask per scale, updates pixel stats
billbrod Aug 13, 2024
ded8204
adds masked autocorr computation
billbrod Aug 13, 2024
ad79bcf
bugfix: need extra scale for reconstructed image autocorr
billbrod Aug 13, 2024
0d61ded
updates comments describing shapes
billbrod Aug 13, 2024
e5851a2
makes compute_skew_kurtosis_recon work with masks
billbrod Aug 13, 2024
dff122d
update name: m -> scale_mask to be consistent
billbrod Aug 14, 2024
2c7cfc9
Merge branch 'portilla_simoncelli_vars' of github.com:LabForComputati…
billbrod Aug 14, 2024
885a17c
sets _compute_cross_correlation to new version
billbrod Aug 14, 2024
230ecf1
updates docstring
billbrod Aug 14, 2024
fa9135f
update masked autocorr function for dim rearrangement
billbrod Aug 14, 2024
1f33f73
gets masked version working!
billbrod Aug 14, 2024
153000a
fix portilla_simoncelli.update_plot for GPU
billbrod Aug 15, 2024
69e1796
add masked model back to init
billbrod Aug 15, 2024
c8f6285
changes to ps_masked plotting
billbrod Aug 15, 2024
44592d3
gets working with GPU, correct across-scale issue
billbrod Aug 15, 2024
5793aed
compute_pixel_stats now expects single-scale mask
billbrod Aug 15, 2024
62e5f6d
normalize skew/kurtosis recon with variance, which brings them to sim…
billbrod Aug 15, 2024
9063395
bugfix: get blur_downsample working with other dtypes
billbrod Aug 16, 2024
f6d75ae
improve how masks are handled across scales
billbrod Aug 16, 2024
e8cb3dc
Make division/sqrt more stable, remove redundant autocorrs
billbrod Aug 16, 2024
53cb7f0
Merge branch 'main' of github.com:LabForComputationalVision/plenoptic…
billbrod Aug 16, 2024
888dc8c
makes PS.plot_representation defaults more reasonable
billbrod Aug 16, 2024
6255bb4
simplify how we handle stability
billbrod Aug 19, 2024
dc3a700
adds example notebook
billbrod Aug 19, 2024
46f5a1e
adds nblink file
billbrod Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/tutorials/models/pooled_texture_model.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "../../../examples/pooled_texture_model.ipynb"
}
14,222 changes: 14,222 additions & 0 deletions examples/pooled_texture_model.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/plenoptic/simulate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .frontend import *
from .naive import *
from .portilla_simoncelli import PortillaSimoncelli
from .portilla_simoncelli_masked import PortillaSimoncelliMasked
13 changes: 4 additions & 9 deletions src/plenoptic/simulate/models/portilla_simoncelli.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,7 @@ def forward(

# Compute the central autocorrelation of the coefficient magnitudes. This is a
# tensor of shape: (batch, channel, spatial_corr_width, spatial_corr_width,
# n_orientations, n_scales). var_mags is a tensor of shape (batch, channel,
# n_orientations, n_scales)
# n_orientations, n_scales).
autocorr_mags, mags_var = self._compute_autocorr(mag_pyr_coeffs)
# mags_var is the variance of the magnitude coefficients at each scale (it's an
# intermediary of the computation of the auto-correlations). We take the square
Expand Down Expand Up @@ -892,8 +891,8 @@ def plot_representation(
self,
data: Tensor,
ax: Optional[plt.Axes] = None,
figsize: Tuple[float, float] = (15, 15),
ylim: Optional[Union[Tuple[float, float], Literal[False]]] = None,
figsize: Tuple[float, float] = (15, 5),
ylim: Optional[Union[Tuple[float, float], Literal[False]]] = False,
batch_idx: int = 0,
title: Optional[str] = None,
) -> Tuple[plt.Figure, List[plt.Axes]]:
Expand Down Expand Up @@ -1113,11 +1112,7 @@ def update_plot(
rep = {k: v[0, 0] for k, v in self.convert_to_dict(data).items()}
rep = self._representation_for_plotting(rep)
for ax, d in zip(axes, rep.values()):
if isinstance(d, dict):
vals = np.array([dd.detach() for dd in d.values()])
else:
vals = d.flatten().detach().numpy()

vals = to_numpy(d.flatten())
sc = update_stem(ax.containers[0], vals)
stem_artists.extend([sc.markerline, sc.stemlines])
return stem_artists
Loading
Loading