PatchPrior
- class deepinv.optim.PatchPrior(negative_patch_log_likelihood, n_patches=-1, patch_size=6, pad=False, *args, **kwargs)[source]
Bases:
Prior
Patch prior \(g(x) = \sum_i h(P_i x)\) for some prior \(h(x)\) on the space of patches.
Given a negative log likelihood (NLL) function on the patch space, this builds a prior by summing the NLLs of all (overlapping) patches in the image.
- Parameters:
negative_patch_log_likelihood (callable) – NLL function on the patch space
n_patches (int) – number of randomly selected patches for prior evaluation. -1 for taking all patches
patch_size (int) – size of the patches
pad (bool) – whether to use mirror padding on the boundary to avoid undesired boundary effects
- fn(x, *args, **kwargs)[source]
Computes the value of the potential \(h(x)\).
- Parameters:
x (torch.Tensor) – Variable \(x\) at which the potential is computed.
- Returns:
(torch.tensor) prior \(h(x)\).
Examples using PatchPrior
:
Patch priors for limited-angle computed tomography
Patch priors for limited-angle computed tomography