plenoptic.process.local_gain_release_dict#

plenoptic.process.local_gain_release_dict(energy, state, residuals=True)[source]#

Spatially local gain release, for each element in a dictionary.

For more details, see local_gain_release.

Parameters:
  • energy (dict) – The dictionary of torch.Tensor containing the local energy of x, with shape (batch, channel, height, width) or (batch, channel, angle, height, width).

  • state (dict) – The dictionary of torch.Tensor containing the local phase of x.

  • residuals (bool (default: True)) – An option to carry around residuals in the energy dict. Note that the transformation is not applied to the residuals, that is dictionary elements with a key starting in “residual”.

Return type:

dict

Returns:

coeff_dict – A dictionary containing the “gain released” tensors, with shapes matching those found in energy.

Raises:

ValueError – If the tensors contained within energy and state do not have 4 or 5 dimensions.

See also

local_gain_release

Same operation on tensors.

local_gain_control_dict

The inverse operation.

polar_to_rectangular_dict

The analogous function for complex-valued signals.

Examples

>>> import plenoptic as po
>>> import torch
>>> img = po.data.einstein()
>>> spyr = po.process.SteerablePyramidFreq(img.shape[-2:], height=3)
>>> coeffs = spyr(img)
>>> energy, state = po.process.local_gain_control_dict(coeffs)
>>> coeffs_dict = po.process.local_gain_release_dict(energy, state)
>>> all([torch.allclose(coeffs[k], coeffs_dict[k]) for k in coeffs.keys()])
True
>>> po.plot.pyrshow(coeffs_dict)
<PyrFigure size ...>

(png, hires.png, pdf)

../../_images/plenoptic-process-local_gain_release_dict-1.png