home/ atoms/ gan-latent-arithmetic

Arithmetic on a GAN's latent vectors edits generated images semantically

In a trained GAN (e.g. BigGAN) the generator maps a latent vector z to an image. Because the latent space is continuous and relatively smooth, arithmetic on vectors carries semantic meaning: linearly interpolating between z1 and z2 morphs one generated image into another; averaging codes for images with an attribute and subtracting the average without it yields a direction that adds that attribute to any code. ml4a’s BigGAN guides demonstrate sampling new images, interpolation videos, and feature arithmetic in Colab notebooks. For live performance this enables controllable generative imagery: a single scalar (slider, sensor, or audio feature) can navigate a meaningful trajectory through image space. The misconception to correct: naive pixel-space interpolation does NOT give the same smooth morph — the smoothness lives in the learned latent space, not in raw pixels.

Examples

Interpolate between two BigGAN latent codes on a slider and route kick-drum amplitude to drive the interpolation position, morphing the generated image in time with the beat.

Assessment

Describe how to build an ‘add smile’ attribute vector from labelled latent codes, and explain why interpolating in pixel space would not produce a smooth morph.

“Arithmetic on GAN features”