Skip to content

InfoGAN, CycleGAN and StyleGAN: steering what a GAN makes

Three GANs that add control. InfoGAN ties part of the noise to something visible, CycleGAN translates between unpaired collections with a round-trip loss, and StyleGAN injects a style code at every layer. All three are explained here.

Advanced ~12 min7 steps

What runs in CodeSplash

You will be able to

  • Explain InfoGAN's mutual-information term and why a recovered code needn't mean a real factor
  • Write the cycle-consistency loss and say what it can't guarantee
  • Describe adaptive instance normalization and how StyleGAN uses it
  • Say why these image methods are explained, not run, in CodeSplash

Read first

01

Make part of the noise mean something

Read

In a plain GAN, nothing says which noise coordinate controls what. InfoGANInfoGANA GAN that also asks a helper network to recover part of the noise from each fake, so that part controls something visible. splits the input into ordinary noise zz and a short code cc, then adds a helper network QQ that tries to recover cc from each fake. The generator is rewarded when QQ succeeds:

min⁡G,Qmax⁡D  V(D,G)−λ E[log⁡Q(c∣G(z,c))].\min_{G, Q} \max_D \; V(D, G) - \lambda\, \mathbb{E}\left[\log Q(c \mid G(z, c))\right].

That term is a lower bound on the mutual information between the code and the fake, up to the code's own entropy. In the reference's example, a helper that mostly recovers three categorical codes gives a bound of 0.786 nats.

Reference · DNN048 · Explained hereInfoGANInfoGAN adds structured latent codes and a mutual-information incentive so that generated observations retain information about those codes.
02

A recovered code isn't a real factor

Predict

Predict first

InfoGAN learns a code coordinate that, when swept, changes stroke thickness in generated digits. Has it discovered a true factor of how digits vary?

Yes: the code found a true factorNot necessarily: it found something the generator can make visible
Reveal

Not necessarily. The term only asks that the code be recoverable from the fake. Which visible change it ends up controlling depends on the architecture, the seed and the data. Sweep the code and look; don't name factors from the objective alone.

03

Translate without pairs

Read

CycleGAN learns two maps, G:A→BG: A \to B and F:B→AF: B \to A, between two collections with no matched pairs, such as photos and paintings. Each direction has its own discriminator. A cycle-consistency lossCycle-consistency lossFor unpaired translation, mapping A→B→A (and B→A→B) should return the input; the loss is the round trip's error. asks that a round trip comes back:

Lcyc=Ea∥F(G(a))−a∥1+Eb∥G(F(b))−b∥1.\mathcal{L}_{\text{cyc}} = \mathbb{E}_{a}\lVert F(G(a)) - a \rVert_1 + \mathbb{E}_{b}\lVert G(F(b)) - b \rVert_1 .

In the reference's example the two round trips miss by a combined 0.30. A small cycle loss shows the maps undo each other. It doesn't show they are faithful: a map can hide information in tiny details and still round-trip.

Reference · DNN049 · Explained hereCycleGANCycleGAN learns translation between two unpaired domains using two generators and discriminators. Cycle consistency discourages arbitrary mappings by asking translation in the reverse direction to recover the original…
04

A style code at every layer

Read

StyleGAN maps noise through a small network to a style code ww, then feeds ww into every layer of the generator through adaptive instance normalizationAdaptive instance normalizationNormalizes each channel of a feature map, then rescales and shifts it with values computed from a style code. (AdaIN): normalize each channel of a feature map to mean 0 and SD 1, then scale and shift it by values computed from ww.

In the reference's example two channels are normalized and restyled. Each channel's new mean equals its shift exactly; the first channel's values become −1.81 to 2.21. Early layers set coarse features such as pose; later layers set fine detail.

Reference · DNN050 · Explained hereStyleGANStyleGAN separates the input latent distribution from intermediate style controls and injects styles at multiple generator scales. This improves control over image synthesis;
05

What runs here

Read

The tabular GAN that does run, the Synthetic studio's GAN, has no code sweep or style input. To steer what it makes, filter or condition the table you feed it.

06

Check: steering GANs

Checkpoint

Check yourself

What does InfoGAN's helper network Q do?

Show the answer

Answer: a

The generator is rewarded when Q can recover c, which forces c to have a visible effect on the sample.

Check yourself

Which claim can InfoGAN's training objective support on its own?

Show the answer

Answer: b

The term rewards recoverability. Interpreting a coordinate as a real factor needs inspection and outside evidence.

Check yourself

What does CycleGAN's cycle-consistency loss measure?

Show the answer

Answer: b

Each round trip, A to B to A and B to A to B, should return the input. The discriminators separately judge realism.

Check yourself

A CycleGAN has a near-zero cycle loss. What doesn't that guarantee?

Show the answer

Answer: a

The maps can encode information in tiny, invisible details and still round-trip. Faithfulness needs checks on the content itself.

Check yourself

After adaptive instance normalization, what is each channel's mean?

Show the answer

Answer: c

AdaIN normalizes each channel to mean 0 and SD 1, then scales and shifts it. The shift becomes the new mean, the scale the new SD.

Check yourself

In StyleGAN, what tends to change when you alter the style input to the early layers rather than the late ones?

Show the answer

Answer: a

Early layers work at low resolution and set coarse structure; later layers refine detail. Mixing styles across layers shows this.

07

Recap

Recap
  • InfoGAN rewards recovering a code from fakes; a controllable coordinate isn't proof of a real factor.
  • CycleGAN translates unpaired collections with a round-trip loss that doesn't guarantee faithful content.
  • StyleGAN injects a style code into every layer through AdaIN.
  • All three are explained here; CodeSplash's GAN generates tables.

Concepts in this lesson