GeneratorMixture
- class deepinv.physics.generator.GeneratorMixture(generators: List[PhysicsGenerator], probs: List[float], rng: Generator | None = None)[source]
Bases:
PhysicsGenerator
Base class for mixing multiple
PhysicsGenerator
.The mixture randomly selects a subset of batch elements to be generated by each generator according to the probabilities given in the constructor.
- Parameters:
generators (list[PhysicsGenerator]) – the generators instantiated from
deepinv.physics.generator.PhysicsGenerator()
.probs (list[float]) – the probability of each generator to be used at each step
- Examples:
Mixing two types of blur
>>> from deepinv.physics.generator import MotionBlurGenerator, DiffractionBlurGenerator >>> from deepinv.physics.generator import GeneratorMixture >>> _ = torch.manual_seed(0) >>> g1 = MotionBlurGenerator(psf_size = (3, 3), num_channels = 1) >>> g2 = DiffractionBlurGenerator(psf_size = (3, 3), num_channels = 1) >>> generator = GeneratorMixture([g1, g2], [0.5, 0.5]) >>> params_dict = generator.step(batch_size=1) >>> print(params_dict.keys()) dict_keys(['filter'])
Examples using GeneratorMixture
:
A tour of blur operators