GANs in Action
{"all_nodes":"stitched from OCR output; frontier verification status per node"}local graph
GANs in Action: Deep learning with Generative Adversarial Networks — Jakub Langr and Vladimir Bok
Section titled “GANs in Action: Deep learning with Generative Adversarial Networks — Jakub Langr and Vladimir Bok”chapter_01
Section titled “chapter_01”node-book_gans-in-action_chapter-01-introduction-to-gans — Introduction to GANs
chapter_02
Section titled “chapter_02”node-book_gans-in-action_chapter-02-intro-to-generative-modeling-with-autoencoders — Intro to generative modeling with autoencoders
chapter_03
Section titled “chapter_03”node-book_gans-in-action_chapter-03-your-first-gan-generating-handwritten-digits — Your first GAN: Generating handwritten digits
chapter_04
Section titled “chapter_04”node-book_gans-in-action_chapter-04-deep-convolutional-gan — Deep Convolutional GAN
chapter_05
Section titled “chapter_05”node-book_gans-in-action_chapter-05-training-and-common-challenges-ganing-for-success — Training and common challenges: GANing for success
chapter_06
Section titled “chapter_06”node-book_gans-in-action_chapter-06-progressing-with-gans — Progressing with GANs
chapter_07
Section titled “chapter_07”node-book_gans-in-action_chapter-07-semi-supervised-gan — Semi-Supervised GAN
chapter_08
Section titled “chapter_08”node-book_gans-in-action_chapter-08-conditional-gan — Conditional GAN
chapter_09
Section titled “chapter_09”node-book_gans-in-action_chapter-09-cyclegan — CycleGAN
chapter_10
Section titled “chapter_10”node-book_gans-in-action_chapter-10-adversarial-examples — Adversarial examples
chapter_11
Section titled “chapter_11”node-book_gans-in-action_chapter-11-practical-applications-of-gans — Practical applications of GANs
chapter_12
Section titled “chapter_12”node-book_gans-in-action_chapter-12-looking-ahead — Looking ahead
Title page visual conversion
Section titled “Title page visual conversion”[!visual-conversion] Markdown-native visual conversion added. Raster source retained below for visual audit. source_asset:
assets/page_0001.pngvisual_type: title page conversion_status: best-effort_semantic_projection
Title page: GANs in Action — Deep learning with Generative Adversarial Networks — Jakub Langr and Vladimir Bok — Manning.
Raster source retained for verification
![[inferencesystems/organism/imagineworld/corpus/12_engineer/deep-learning-foundations/by_publication/gans-in-action/assets/pages/page_0001.png]]
Title Page
Section titled “Title Page”Deep learning with Generative Adversarial Networks
GANs IN ACTION
Jakub Langr Vladimir Bok
MANNING
Brief Contents
Section titled “Brief Contents”PART 1 INTRODUCTION TO GANS AND GENERATIVE MODELING… 1 1 ■ Introduction to GANs 3 2 ■ Intro to generative modeling with autoencoders 16 3 ■ Your first GAN: Generating handwritten digits 36 4 ■ Deep Convolutional GAN 51
PART 2 ADVANCED TOPICS IN GANS…67 5 ■ Training and common challenges: GANing for success 69 6 ■ Progressing with GANs 92 7 ■ Semi-Supervised GAN 110 8 ■ Conditional GAN 127 9 ■ CycleGAN 143
PART 3 WHERE TO GO FROM HERE …163 10 ■ Adversarial examples 165 11 ■ Practical applications of GANs 181 12 ■ Looking ahead 196
Contents
Section titled “Contents”preface xiii acknowledgments xv about this book xvii about the cover illustration xxiii
PART 1 INTRODUCTION TO GANs AND GENERATIVE MODELING …1
1 Introduction to GANs 3 1.1 What are Generative Adversarial Networks? 5 1.2 How do GANs work? 5 1.3 GANs in action 6 GAN training 8 ▪ Reaching equilibrium 11 1.4 Why study GANs? 12
2 Intro to generative modeling with autoencoders 16 2.1 Introduction to generative modeling 17 2.2 How do autoencoders function on a high level? 18 2.3 What are autoencoders to GANs? 19 2.4 What is an autoencoder made of? 20
2.5 Usage of autoencoders 21 2.6 Unsupervised learning 22 New take on an old idea 23 ▪ Generation using an autoencoder 24 ▪ Variational autoencoder 25 2.7 Code is life 25 2.8 Why did we try aGAN? 32
3 Your first GAN: Generating handwritten digits 36 3.1 Foundations of GANs: Adversarial training 37 Cost functions 38 ▪ Training process 39 3.2 The Generator and the Discriminator 40 Conflicting objectives 41 ▪ Confusion matrix 41 3.3 GAN training algorithm 42 3.4 Tutorial: Generating handwritten digits 43 Importing modules and specifying model input dimensions 44 Implementing the Generator 44 ▪ Implementing the Discriminator 45 ▪ Building the model 45 ▪ Training 46 Outputting sample images 48 ▪ Running the model 48 Inspecting the results 49 3.5 Conclusion 50
4 Deep Convolutional GAN 51 4.1 Convolutional neural networks 52 Convolutional filters 52 ▪ Parameter sharing 52 ConvNets visualized 52 4.2 Brief history of the DCGAN 54 4.3 Batch normalization 54 Understanding normalization 55 ▪ Computing batch normalization 55 4.4 Tutorial: Generating handwritten digits with DCGAN 56 Importing modules and specifying model input dimensions 57 Implementing the Generator 58 ▪ Implementing the Discriminator 60 ▪ Building and running the DCGAN 61 Model output 64 4.5 Conclusion 65
PART 2 ADVANCED TOPICS IN GANs…67
5 Training and common challenges: GANing for success 69 5.1 Evaluation 71 Evaluation framework 72 ▪ Inception score 73 Fréchet inception distance 75 5.2 Training challenges 77 Adding network depth 78 ▪ Game setups 79 Min-Max GAN 79 ▪ Non-Saturating GAN 81 When to stop training 83 ▪ Wasserstein GAN 83 5.3 Summary of game setups 87 5.4 Training hacks 88 Normalizations of inputs 88 ▪ Batch normalization 89 Gradient penalties 89 ▪ Train the Discriminator more 90 Avoid sparse gradients 90 ▪ Soft and noisy labels 91
6 Progressing with GANs 92 6.1 Latent space interpolation 94 6.2 They grow up so fast 94 Progressive growing and smoothing of higher-resolution layers 95 Example implementation 97 ▪ Mini-batch standard deviation 98 ▪ Equalized learning rate 100 ▪ Pixel-wise feature normalization in the generator 101 6.3 Summary of key innovations 104 6.4 TensorFlow Hub and hands-on 105 6.5 Practical applications 106
7 Semi-Supervised GAN 110 7.1 Introducing the Semi-Supervised GAN 112 What is a Semi-Supervised GAN? 113 ▪ Architecture 114 Training process 115 ▪ Training objective 115 7.2 Tutorial: Implementing a Semi-Supervised GAN 116 Architecture diagram 116 ▪ Implementation 117 Setup 117 ▪ The dataset 118 ▪ The Generator 119 The Discriminator 120 ▪ Building the model 122 Training 123 7.3 Comparison to a fully supervised classifier 125 7.4 Conclusion 126
8 Conditional GAN 127 8.1 Motivation 127 8.2 What is Conditional GAN? 128 CGAN Generator 129 ▪ CGAN Discriminator 129 Summary table 130 ▪ Architecture diagram 130 8.3 Tutorial: Implementing a Conditional GAN 131 Implementation 131 ▪ Setup 132 ▪ CGAN Generator 133 CGAN Discriminator 134 ▪ Building the model 137 Training 138 ▪ Outputting sample images 139 ▪ Training the model 141 ▪ Inspecting the output: Targeted data generation 141 8.4 Conclusion 142
9 CycleGAN 143 9.1 Image-to-image translation 144 9.2 Cycle-consistency loss: There and back aGAN 145 9.3 Adversarial loss 146 9.4 Identity loss 146 9.5 Architecture 148 CycleGAN architecture: building the network 149 ▪ Generator architecture 151 ▪ Discriminator architecture 152 9.6 Object-oriented design of GANs 153 9.7 Tutorial: CycleGAN 153 Building the network 154 ▪ Building the Generator 156 Building the Discriminator 157 ▪ Training the CycleGAN 158 Running CycleGAN 160 9.8 Expansions, augmentations, and applications 160 Augmented CycleGAN 161 ▪ Applications 161
PART 3 WHERE TO GO FROM HERE ………………………………163
10 Adversarial examples 165 10.1 Context of adversarial examples 167 10.2 Lies, damned lies, and distributions 167 10.3 Use and abuse of training 168 10.4 Signal and the noise 174 10.5 Not all hope is lost 177
10.6 Adversaries to GANs 178 10.7 Conclusion 180
11 Practical applications of GANs 181 11.1 GANs in medicine 182 Using GANs to improve diagnostic accuracy 182 Methodology 184 • Results 186 11.2 GANs in fashion 187 Using GANs to design fashion 187 • Methodology 188 Creating new items matching individual preferences 189 Adjusting existing items to better match individual preferences 191 11.3 Conclusion 195
12 Looking ahead 196 12.1 Ethics 197 12.2 GAN innovations 199 Relativistic GAN 199 • Self-Attention GAN 201 BigGAN 203 12.3 Further reading 204 12.4 Looking back and closing thoughts 206
index 209