liveBook · Manning

Noise

As explained in Deep Learning with Python, Third Edition

An initial image-like input made of unstructured random values rather than meaningful visual content.

Noise is an image-shaped starting point filled with random values rather than meaningful visual content. Diffusion generation progressively transforms it into a high-signal, low-noise image. section 17.2.5 section 17.4

Starting a generation run

A generator creates a random tensor shaped like one or more RGB images, then repeatedly calls denoise(). With text conditioning, the same process can turn pure noise into an image matching a previously unseen prompt. section 17.2.5 section 17.3

    def generate(self, num_images, diffusion_steps):
        noisy_images = keras.random.normal(
            (num_images, self.image_size, self.image_size, 3),        #1
            seed=self.seed_generator,                                  #1
        )                                                               #1
        step_size = 1.0 / diffusion_steps
        for step in range(diffusion_steps):
            diffusion_times = ops.ones((num_images, 1, 1, 1)) - step * step_size#2
            noise_rates, signal_rates = diffusion_schedule(diffusion_times) #2
            pred_images, pred_noises = self.denoise(                  #3
                noisy_images, noise_rates, signal_rates               #3
            )                                                           #3
            next_diffusion_times = diffusion_times - step_size        #4
            next_noise_rates, next_signal_rates = diffusion_schedule(  #4
                next_diffusion_times                                   #4
            )                                                           #4
            noisy_images = (
                next_signal_rates * pred_images + next_noise_rates * pred_noises
            )
        images = (                                                     #5
            self.normalizer.mean + pred_images * self.normalizer.variance**0.5 #5
        )                                                               #5
        return ops.clip(images, 0.0, 255.0)

Inspect the generation loop that initializes random image values and updates them through successive denoising steps. section 17.2.5

Use noise as the practical starting point for diffusion generation:

  • Initialize a random image-shaped tensor. section 17.2.5
  • Apply denoising repeatedly rather than expecting a finished image in one pass. section 17.2.5
  • Condition denoising with text embeddings when generating text-to-image outputs. section 17.3

How Deep Learning with Python, Third Edition covers it

How deep it goes
Defines random initialization and its denoising role, but does not derive the diffusion schedule mathematically.
Examples
Uses random RGB tensors, Stable Diffusion prompts, and progressively denoised generated images.
What you can do after
Apply it via KerasHub Stable Diffusion by generating images from text-conditioned pure noise.
How it connects
Connects noise to diffusion models, denoising, text-to-image models, and text embeddings.

Also explained in

Compare how 11 books explain noise →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.