DownsamplingGenerator#
- class deepinv.physics.generator.DownsamplingGenerator(filters=['gaussian', 'bilinear', 'bicubic'], factors=[2, 4], rng=None, device='cpu', dtype=torch.float32)[source]#
Bases:
PhysicsGenerator
Random downsampling generator.
Generates random downsampling factors and filters. This can be used for generating parameters to be passed to the
Downsampling
class.>>> from deepinv.physics.generator import DownsamplingGenerator >>> list_filters = ["bilinear", "bicubic", "gaussian"] >>> list_factors = [2, 4] >>> generator = DownsamplingGenerator(filters=list_filters, factors=list_factors) >>> ds = generator.step(batch_size=1) # dict_keys(['filter', 'factor']) >>> filter = ds['filter'] >>> factor = ds['factor']
Note
Each batch element has the same downsampling factor and filter, but these can vary from batch to batch.
- Parameters:
filters (List[str]) – list of filters to use for downsampling. Default is [“gaussian”, “bilinear”, “bicubic”].
factors (List[int]) – list of factors to use for downsampling. Default is [2, 4].
rng (Generator) – random number generator. Default is None.
device (str) – device to use. Default is “cpu”.
dtype (type) – data type to use. Default is torch.float32.
- get_kernel(filter_str=None, factor=None)[source]#
Returns a batched tensor of filters associated to a given filter name and factor.