TiledBlurGenerator#

class deepinv.physics.generator.TiledBlurGenerator(psf_generator, patch_size, stride=None, rng=None, device='cpu', **kwargs)[source]#

Bases: TiledMixin2d, PSFGenerator

Generates parameters of the deepinv.physics.TiledSpaceVaryingBlur operator. The image is divided into overlapping patches, each local patch is convolved with a different PSF.

This generates a dict with key 'filter', which is tensor of shape (B, C, K, psf_size, psf_size) where K is the number of patches in which the image is divided. It is computed based on the patch_size, stride and the given img_size during the step() function call.

Parameters:
step(batch_size=1, img_size=None, seed=None, **kwargs)[source]#

Generates a random set of filters for the tiled space-varying blur.

Parameters:
  • batch_size (int) – batch size of the PSF parameters to generate. Should be equal to the batch size of the images to be blurred.

  • img_size (int | tuple[int, int]) – size of the image to be blurred (height, width).

  • seed (int | None) – the seed for the random number generator.

Returns:

a dictionary containing filters, with key:

  • filters: a tensor of shape (B, C, K, psf_size, psf_size), where K is the number of patches in which the image is divided.

Return type:

dict

Examples using TiledBlurGenerator:#

Tour of blur operators

Tour of blur operators