1 of 102

Generative Adversarial Networks (GAN)

2 of 102

Supervised Learning

  • Discriminative model

2

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

3 of 102

Unsupervised Learning

  • Generative model

3

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

= Latent space

4 of 102

Model Distribution vs. Data Distribution

4

5 of 102

Probability Distribution

5

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

6 of 102

Probability Distribution

6

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

7 of 102

Probability Distribution

7

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

8 of 102

Probability Density Estimation Problem

  •  

8

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

9 of 102

Generative Models from Lower Dimension

  •  

9

Latent space =

Source: Prof. Roger Grosse at U of Toronto

10 of 102

Deterministic Transformation (by Network)

  • 1-dimensional example:

  • Remember
    • Network does not generate distribution, but
    • It maps known distribution to target distribution

10

Source: Prof. Roger Grosse at U of Toronto

11 of 102

Deterministic Transformation (by Network)

  • High dimensional example:

11

Source: Prof. Roger Grosse at U of Toronto

12 of 102

Prob. Density Function by Deep Learning

  • Generative model of image

12

Source: Prof. Roger Grosse at U of Toronto

13 of 102

Generative Adversarial Networks (GANs)

  • In generative modeling, we'd like to train a network that models a distribution, such as a distribution over images.
  • GANs do not work with any explicit density function !
    • Instead, take game-theoretic approach

13

14 of 102

Turing Test

  • One way to judge the quality of the model is to sample from it.
  • GANs are based on a very different idea:
    • Model to produce samples which are indistinguishable from the real data, as judged by a discriminator network whose job is to tell real from fake

14

15 of 102

Generative Adversarial Networks (GAN)

  • The idea behind Generative Adversarial Networks (GANs): train two different networks
    • Generator network: try to produce realistic-looking samples
    • Discriminator network: try to distinguish between real and fake data

  • The generator network tries to fool the discriminator network

15

16 of 102

Autoencoder

  • Dimension reduction
  • Recover the input data
    • Learns an encoding of the inputs so as to recover the original input from the encodings as well as possible

16

17 of 102

Generative Adversarial Networks (GAN)

  • Analogous to Turing Test

17

Generated

Generator

Data Generator

18 of 102

Generative Adversarial Networks (GAN)

  • Analogous to Turing Test

18

Generated

Real

Real

Fake

Generator

Discriminator

19 of 102

Intuition for GAN

19

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

20 of 102

Discriminator Perspective (1/2)

20

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

21 of 102

Discriminator Perspective (2/2)

21

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

22 of 102

Generator Perspective

22

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

23 of 102

Loss Function of Discriminator

23

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

24 of 102

Loss Function of Generator

24

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

25 of 102

Non-Saturating Game

25

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

26 of 102

Non-Saturating Game

26

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

27 of 102

Solving a MinMax Problem

27

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

28 of 102

GAN Implementation in TensorFlow

28

29 of 102

TensorFlow Implementation

29

784

784

256

256

100

1

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

30 of 102

Generator

30

784

784

256

256

100

1

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

31 of 102

Discriminator

31

784

784

256

256

100

1

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

32 of 102

Combined

32

784

784

256

256

100

1

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

33 of 102

Training: Discriminator

33

784

784

256

256

100

1

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

34 of 102

Training: Generator

34

784

784

256

256

100

1

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

35 of 102

After Training

  • After training, use generator network to generate new data

35

https://www.slideshare.net/NaverEngineering/1-gangenerative-adversarial-network

36 of 102

Generated Images

36

37 of 102

DCGAN

37

38 of 102

DCGAN (Deep Convolutional GAN)

  • A DCGAN is a direct extension of the GAN, except that it explicitly uses convolutional and convolutional-transpose layers in the discriminator and generator, respectively
  • (For example) simplified architecture

38

Alec Radford, et al., "Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks," ICLR 2016

39 of 102

CycleGAN

39

40 of 102

Image-to-Image Translation

  • Change the style of image to another style
    • Monet to photos
    • Zebras to horses
    • Summer to winter

40

41 of 102

Paired vs. Unpaired Datasets

  • Limitation of paired datasets
    • Impossible to collect paired datasets in most of the cases.

41

42 of 102

Paired vs. Unpaired Datasets

  • Limitation of paired datasets
    • Impossible to collect paired datasets in most of the cases.

42

Change the styles of images

using only unpaired datasets

Cycle-consistent Generative

Adversarial Networks

(CycleGAN)

43 of 102

Start from GAN

  •  

43

Horse

Zebra

 

 

Adversarial Loss

(real or fake)

44 of 102

Start from GAN

  •  

44

Horse

Zebra

 

 

Adversarial Loss

(real or fake)

45 of 102

Discriminator

  •  

45

 

 

 

 

 

 

46 of 102

CycleGAN

  •  

46

 

 

 

 

 

 

Adversarial Loss

(real or fake)

Cycle-consistency loss

 

47 of 102

CycleGAN

47

48 of 102

Example of CycleGAN

48

49 of 102

Grain Boundary

  • Background
    • Grain boundaries play an important role in governing mechanical and physical properties of polycrystalline materials

  • Research objective
    • Propose an unsupervised learning-based grain boundary detection
    • Only requires virtual micrographs

49

Input

Deep Learning-based Grain Boundary Detection

Output

J. Na+, J. Lee+, et al., Label-free Grain Segmentation for Optical Microscopy Images via Unsupervised Image-to-Image Translation, Materials Characterization

50 of 102

Methodology

  • The appearance of real and virtual micrographs differs, but their underlying grain structure is semantically equivalent

  • How can we transfer appearance information from the virtual domain to the real domain?
    • Image-to-image translation

50

Virtual microstructure

Real microstructure

Not paired

51 of 102

CycleGAN

  • The target appearance is enforced by an adversarial loss, while the grain structure is preserved by a reconstruction loss

51

Real-to-Virtual Microstructure Translation

Real microstructure

 

 

 

Adversarial loss

Reconstruction loss

Virtual microstructure

52 of 102

Results: Low Carbon Steel

52

Input

Ground Truth

CycleGAN

53 of 102

Homework Assignment

  • To change the white-colored digit in a black background image to the black-colored digit in a white background image

  • Assume data is not paired

53

54 of 102

Conditional GAN

54

55 of 102

Conditional GAN

  • In an unconditioned generative model, there is no control on modes of the data being generated.

  • In the Conditional GAN (CGAN), the generator learns to generate a fake sample with a specific condition or characteristics (such as a label associated with an image or more detailed tag) rather than a generic sample from unknown noise distribution.

55

56 of 102

Conditional GAN

  • MNIST digits generated conditioned on their class label

56

57 of 102

Conditional GAN

  • Simple modification to the original GAN framework that conditions the model on additional information for better multi-modal learning

  • Many practical applications of GANs when we have explicit supervision available

57

58 of 102

Normal Distribution of MNIST

  • A standard normal distribution
  • This is how we would like points corresponding to MNIST digit images to be distributed in the latent space

58

59 of 102

Generator at GAN

59

Generator

Generator

60 of 102

Generator at Conditional GAN

  • Feed a random point in latent space and desired number.
  • Even if the same latent point is used for two different numbers, the process will work correctly since the latent space only encodes features such as stroke width or angle

60

Generator

Generator

61 of 102

Generator

61

62 of 102

Discriminator

62

63 of 102

Combined

63

64 of 102

CGAN Implementation

64

65 of 102

Fake MNIST Images Generated by CGAN

65

66 of 102

InfoGAN

66

67 of 102

InfoGAN

  • In a standard generative model, there is no control on the features of the data being generated.

  • In the Information Maximizing GAN (InfoGAN), the generator learns to generate a fake sample with latent codes (such as values in the range of -1 to 1) that has interpretable information of the data rather than a generic sample from unknown noise distribution.

  • The latent code in InfoGAN learns interpretable information from the data using unsupervised learning.

67

68 of 102

InfoGAN

  • MNIST digits generated by latent code variation per noise

68

Continuous latent code 1

 

 

69 of 102

InfoGAN

  • MNIST digits generated by latent code variation per noise

69

Continuous latent code 2

 

 

70 of 102

InfoGAN

  •  

70

71 of 102

Generator at Conditional GAN

  • Feed a random point in latent space and desired number.
  • Even if the same latent point is used for two different numbers, the process will work correctly since the latent space only encodes features such as stroke width or angle

71

Generator

Generator

72 of 102

Generator at InfoGAN

  • Feed a random point in latent space and latent code.
  • Even if the same latent point is used, the process will work correctly by controlling the interpretable information in the data through latent code.

72

Generator

Generator

 

 

 

 

 

 

73 of 102

Structure of InfoGAN

73

1024

7×7×128

62+2

(7, 7, 128)

(14, 14, 64)

(28, 28, 1)

(28, 28, 1)

(14, 14, 64)

(7, 7, 128)

1024

128

2

1

74 of 102

Generator

74

75 of 102

Discriminator

75

76 of 102

Discriminator

76

77 of 102

Q Net

77

78 of 102

Combined

78

79 of 102

Combined

79

80 of 102

Fake MNIST Images Generated by InfoGAN

80

Nose 1

Nose 2

Nose 3

Nose 4

Nose 5

Nose 6

Nose 7

Nose 8

Latent code 2

 

 

Nose 1

Nose 2

Nose 3

Nose 4

Nose 5

Nose 6

Nose 7

Nose 8

Latent code 1

 

 

81 of 102

Example of InfoGAN

81

82 of 102

Generate FFT Spectrum Data

  • Background
    • The FFT spectrum provides important information for diagnosing equipment health
    • The generated data features should be controllable to improve the utility of the generative model

  • Research objective
    • Propose a method of deep learning-based vibration signal generation
    • Extract information from FFT spectra with unsupervised learning

82

83 of 102

Methodology

  • Let the latent code learn the information about where the peak with the highest diversity occurs in the FFT spectrum.

83

Generator

Low

High

Noise

Low value case

High value case

High information

Low information

84 of 102

Fake Vibration Signals Generated by InfoGAN

84

Normal

Abnormal

85 of 102

Adversarial Autoencoder

85

86 of 102

Limitation of Autoencoder

  •  

86

87 of 102

Generate Data from Controlled Latent Space

87

  • Encode data into a controllable latent space
  • Generate new data from the controlled space

 

 

88 of 102

Adversarial Autoencoder

88

Encoder

89 of 102

Adversarial Autoencoder

89

Encoder

Decoder

90 of 102

Adversarial Autoencoder

90

Encoder

Decoder

Generator

91 of 102

Adversarial Autoencoder

91

Encoder

Decoder

Generator

Discriminator

92 of 102

Prior Distribution and Latent Representation

92

 

 

93 of 102

Prior Distribution and Latent Representation

93

 

 

94 of 102

Prior Distribution and Latent Representation

94

 

Latent representations of�MNIST dataset

 

Latent representations of�MNIST dataset

95 of 102

Incorporating Label Information

95

Label Information

96 of 102

Disentangled Latent Representation

96

97 of 102

Disentangled Latent Representation

97

98 of 102

Disentangled Latent Representation

98

99 of 102

Disentangled Latent Representation

99

100 of 102

Disentangled Latent Representation

100

101 of 102

Disentangled Latent Representation

101

102 of 102

Disentangled Latent Representation

102