Advanced Deep Learning with Keras
Chapter 6For continuous codes of a single dimension, the expectation is a double integralover c and x. This is due to the expectation that samples from both disentangledcode distribution and generator distribution. One way of estimating the expectationis by assuming the samples as a good measure of continuous data. Therefore, the lossis estimated as c log Q(c|x).To complete the network of InfoGAN, we should have an implementation of Q(c|x).For simplicity, the network Q is an auxiliary network attached to the second to lastlayer of the discriminator. Therefore, this has a minimal impact on the training of theoriginal GAN. Following figure shows InfoGAN network diagram:Figure 6.1.2: A network diagram showing the discriminator and generator training in InfoGAN[ 165 ]
Disentangled Representation GANsFollowing table shows the loss functions of InfoGAN as compared to the originalGAN. The loss functions of InfoGAN differ from the original GAN by an additionalterm −λI ( c; G ( z,c)) where λ is a small positive constant. Minimizing the lossfunction of InfoGAN translates to minimizing the loss of the original GAN andI c; G z,c .maximizing the mutual information ( ( ))Network Loss Functions NumberGAN ( D)L = −Elog D x − E log 1− D G z4.1.1L( G)x∼pdataz( ( ))= −Elog D G zz( )( ) ( ( ))( ( )) ( ( ))InfoGAN ( D)L = −Ex∼plog D ( x) − Ez,clog 1 − D G ( z, c)− λI c; G z,c( G)data( ( )) ( ( ))L = −Ez, clog D G z, c − λI c; G z,cλ < . In ourFor continuous codes, InfoGAN recommends a value of 1example, we set λ = 0.5 . For discrete codes, InfoGAN recommendsλ = 1.Table 6.1.1: A comparison between the loss functions of GAN and InfoGANIf applied on the MNIST dataset, InfoGAN can learn the disentangled discrete andcontinuous codes in order to modify the generator output attributes. For example,like CGAN and ACGAN, the discrete code in the form of a 10-dim one-hot label willbe used to specify the digit to generate. However, we can add two continuous codes,one for controlling the angle of writing style and another for adjusting the strokewidth. Following figure shows the codes for the MNIST digit in InfoGAN. We retainthe entangled code with a smaller dimensionality to represent all other attributes:4.1.56.1.16.1.2Figure 6.1.3: The codes for both GAN and InfoGAN in the context of MNIST dataset[ 166 ]
- Page 131 and 132: Generative Adversarial Networks (GA
- Page 133 and 134: Generative Adversarial Networks (GA
- Page 135 and 136: Generative Adversarial Networks (GA
- Page 137 and 138: Generative Adversarial Networks (GA
- Page 139 and 140: Generative Adversarial Networks (GA
- Page 141 and 142: Generative Adversarial Networks (GA
- Page 143 and 144: Improved GANsIn summary, the goal o
- Page 145 and 146: Improved GANsThe intuition behind E
- Page 147 and 148: Improved GANsThis makes sense since
- Page 149 and 150: Improved GANsIn the context of GANs
- Page 151 and 152: Improved GANsFigure 5.1.3: Top: Tra
- Page 153 and 154: Improved GANsThe functions include:
- Page 155 and 156: Improved GANsmodels = (generator, d
- Page 157 and 158: Improved GANsfor layer in discrimin
- Page 159 and 160: Improved GANsFollowing figure shows
- Page 161 and 162: Improved GANsThe preceding table sh
- Page 163 and 164: Improved GANsFollowing figure shows
- Page 165 and 166: Improved GANsEssentially, in CGAN w
- Page 167 and 168: Improved GANslayer = Dense(layer_fi
- Page 169 and 170: Improved GANsx = BatchNormalization
- Page 171 and 172: Improved GANsdiscriminator.compile(
- Page 173 and 174: Improved GANssize=batch_size)real_i
- Page 175 and 176: Improved GANsUnlike CGAN, the sampl
- Page 177 and 178: Improved GANsConclusionIn this chap
- Page 179 and 180: Disentangled Representation GANsIn
- Page 181: Disentangled Representation GANsInf
- Page 185 and 186: Disentangled Representation GANs# A
- Page 187 and 188: Disentangled Representation GANsif
- Page 189 and 190: Disentangled Representation GANsLis
- Page 191 and 192: Disentangled Representation GANsdat
- Page 193 and 194: Disentangled Representation GANsy[b
- Page 195 and 196: Disentangled Representation GANspyt
- Page 197 and 198: Disentangled Representation GANsThe
- Page 199 and 200: Disentangled Representation GANsSta
- Page 201 and 202: Disentangled Representation GANs( )
- Page 203 and 204: Disentangled Representation GANsThe
- Page 205 and 206: Disentangled Representation GANsfea
- Page 207 and 208: Disentangled Representation GANs# f
- Page 209 and 210: Disentangled Representation GANslat
- Page 211 and 212: Disentangled Representation GANsDis
- Page 213 and 214: Disentangled Representation GANsz_d
- Page 215 and 216: Disentangled Representation GANs2.
- Page 217 and 218: Disentangled Representation GANsFig
- Page 220 and 221: Cross-Domain GANsIn computer vision
- Page 222 and 223: Chapter 7There are many more exampl
- Page 224 and 225: The CycleGAN ModelFigure 7.1.3 show
- Page 226 and 227: Chapter 7Repeat for n training step
- Page 228 and 229: Chapter 7Implementing CycleGAN usin
- Page 230 and 231: filters=16,kernel_size=3,strides=2,
Chapter 6
For continuous codes of a single dimension, the expectation is a double integral
over c and x. This is due to the expectation that samples from both disentangled
code distribution and generator distribution. One way of estimating the expectation
is by assuming the samples as a good measure of continuous data. Therefore, the loss
is estimated as c log Q(c|x).
To complete the network of InfoGAN, we should have an implementation of Q(c|x).
For simplicity, the network Q is an auxiliary network attached to the second to last
layer of the discriminator. Therefore, this has a minimal impact on the training of the
original GAN. Following figure shows InfoGAN network diagram:
Figure 6.1.2: A network diagram showing the discriminator and generator training in InfoGAN
[ 165 ]