ProductConvolutionBlurGenerator
- class deepinv.physics.generator.ProductConvolutionBlurGenerator(psf_generator: PSFGenerator, img_size: Tuple[int], n_eigen_psf: int = 10, spacing: Tuple[int] | None = None, padding: str = 'valid', **kwargs)[source]
Bases:
PhysicsGenerator
Generates parameters of space-varying blurs.
The parameters generated are
{'filters' : torch.tensor(...), 'multipliers': torch.tensor(...), 'padding': str}
seedeepinv.physics.SpaceVaryingBlur()
for more details.- Parameters:
psf_generator (deepinv.physics.generator.PSFGenerator) – A psf generator (e.g.
generator = DiffractionBlurGenerator((1, psf_size, psf_size), fc=0.25)
)img_size (tuple) – image size
H x 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', 'padding'])
- step(batch_size: int = 1, seed: int | None = 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).