ProductConvolutionBlurGenerator#
- class deepinv.physics.generator.ProductConvolutionBlurGenerator(psf_generator, img_size, n_eigen_psf=10, spacing=None, device='cpu', **kwargs)[source]#
Bases:
PhysicsGenerator
Generates parameters of space-varying blurs.
Parameters generated:
-
'filters'
: tensor of shape(B, C, n_eigen_psf, psf_size, psf_size)
- ‘multipliers’: tensor of shape(B, C, n_eigen_psf, H, W)
See
deepinv.physics.SpaceVaryingBlur
for more details.- Parameters:
psf_generator (deepinv.physics.generator.PSFGenerator) – A psf generator, such as
motion blur
ordiffraction blur generator
.img_size (tuple) – image size
(H,W)
.n_eigen_psf (int) – each psf in the field of view will be a linear combination of
n_eigen_psf
eigen psf grids. Defaults to 10.spacing (tuple) – steps between the psf grids used for interpolation (defaults
(H//8, W//8)
).padding (str) – boundary conditions in (options =
'valid'
,'circular'
,'replicate'
,'reflect'
). Defaults to'valid'
.
- Examples:
>>> from deepinv.physics.generator import DiffractionBlurGenerator >>> from deepinv.physics.generator import ProductConvolutionBlurGenerator >>> psf_size = 7 >>> psf_generator = DiffractionBlurGenerator((psf_size, psf_size), fc=0.25) >>> pc_generator = ProductConvolutionBlurGenerator(psf_generator, img_size=(64, 64), n_eigen_psf=8) >>> params = pc_generator.step(1) >>> print(params.keys()) dict_keys(['filters', 'multipliers'])
- step(batch_size=1, seed=None, **kwargs)[source]#
Generates a random set of filters and multipliers for space-varying blurs.
- Parameters:
- Returns:
a dictionary containing filters, multipliers and paddings. filters: a tensor of shape (B, C, n_eigen_psf, psf_size, psf_size). multipliers: a tensor of shape (B, C, n_eigen_psf, H, W).