elec 576: understanding and visualizing convnets ......elec 576: understanding and visualizing...

76
ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of Medicine (Neuroscience Dept.) Rice University (ECE Dept.) 10-11-2017

Upload: others

Post on 21-May-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks

Ankit B. PatelBaylor College of Medicine (Neuroscience Dept.)

Rice University (ECE Dept.) 10-11-2017

Page 2: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Understand & Visualizing Convnets

Page 3: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Deconvolutional Net

[Zeiler and Fergus]

Page 4: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Feature Visualization

[Zeiler and Fergus]

Page 5: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Activity Maximization

[Simonyan et al.]

Page 6: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Deep Dream Visualization• To produce human viewable images, need to

• Activity maximization (gradient ascent)

• L2 regularization

• Gaussian blur

• Clipping

• Different scales

Page 7: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Image Example

[Günther Noack]

Page 8: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Dumbbell Deep Dream

AlexNet VGGNet GoogleNet

Page 9: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Deep Dream Video

Class: goldfish, Carassius auratus

Page 10: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Texture Synthesis

[Leon Gatys, Alexander Ecker, Matthias Bethge]

Page 11: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Generated Textures

[Leon Gatys, Alexander Ecker, Matthias Bethge]

Page 12: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Deep Style

[Leon Gatys, Alexander Ecker, Matthias Bethge]

Page 13: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Deep Style

[Leon Gatys, Alexander Ecker, Matthias Bethge]

Page 14: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Introduction to Recurrent Neural Networks

Page 15: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

What Are Recurrent Neural Networks?

• Recurrent Neural Networks (RNNs) are networks that have feedback

• Output is feed back to the input

• Sequence processing

• Ideal for time-series data or sequential data

Page 16: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

History of RNNs

Page 17: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Important RNN Architectures• Hopfield Network

• Jordan and Elman Networks

• Echo State Networks

• Long Short Term Memory (LSTM)

• Bi-Directional RNN

• Gated Recurrent Unit (GRU)

• Neural Turing Machine

Page 18: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Hopfield Network

[Wikipedia]

Page 19: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Elman Networks

[John McCullock]

Page 20: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Echo State Networks

[Herbert Jaeger]

Page 21: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Definition of RNNs

Page 22: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

RNN Diagram

[Richard Socher]

Page 23: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

RNN Formulation

[Richard Socher]

Page 24: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

RNN Example

[Andrej Karpathy]

Page 25: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Different Kinds of Inference Tasks

[Kevin Murphy]

Page 26: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Different Structures for Filtering/Prediction Tasks

[Andrej Karpathy]

Object Recognition

Machine Translation

Action Recognition

Object Tracking

Image Captioning

Page 27: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Universal Expressive Power Results

[John Bullinaria]

Page 28: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Training RNNs

Page 29: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Training an RNN• Use back propagation through time (BPTT)

[Denny Britz]

Page 30: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Back Propagation through Time

[Denny Britz]

Page 31: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

RNN Training Issues• Exploding/Vanishing gradients

• Exploding/Vanishing activations

Page 32: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Exploding Gradients

[Richard Socher]

Solution: Gradient Clipping

http://www.jmlr.org/proceedings/papers/v28/pascanu13.pdf

Page 33: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Vanishing Gradient

[Hochreiter, Schmidhuber]

Page 34: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Why Training is Unstable

[Xu, Huang, Li]

Variance of activations/gradients grows multiplicatively

Page 35: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Interesting Question• Are there modifications to an RNN such that it can

combat these gradient problems?

Page 36: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

RNNs with Longer Term Memory

Page 37: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Motivation • The need to remember certain events for arbitrarily

long periods of time (Non-Markovian)

• The need to forget certain events

Page 38: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Long Short Term Memory

• 3 gates

• Input

• Forget

• Output

[Zygmunt Z.]

Page 39: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

LSTM Formulation

[Alex Graves, Navdeep Jaitly]

Page 40: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Preserving Gradients

[Hochreiter, Schmidhuber]

Page 41: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Gated Recurrent Unit• 2 gates

• Reset

• Combine new input with previous memory

• Update

• How long the previous memory should stay

[Zygmunt Z.]

Page 42: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

GRU Formulation

[Danny Britz]

Page 43: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

LSTM & GRU Benefits• Remember for longer temporal durations

• RNN has issues for remembering longer durations

• Able to have feedback flow at different strengths depending on inputs

Page 44: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Differences between LSTM & GRU

• GRU has two gates, while LSTM has three gates

• GRU does not have internal memory

• GRU does not use a second nonlinearity for computing the output

Page 45: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Visual Difference of LSTM & GRU

[Chris Olah]

LSTM GRU

Page 46: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

LSTM vs GRU Results

[Chung, Gulcehre, Cho, Bengio]

Page 47: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Other Methods for Stabilizing RNN Training

Page 48: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Why Training is Unstable

[Xu, Huang, Li]

Variance of activations/gradients grows multiplicatively

Page 49: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Stabilizing Activations & Gradients

[Xu, Huang, Li]

We want

Page 50: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Taylor Expansions of Different Activation Functions

[Xu, Huang, Li]

Page 51: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Layer Normalization• Similar to batch normalization

• Apply it to RNNs to stabilize the hidden state dynamics

[Ba, Kiros, Hinton]

Page 52: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Layer Normalization Results

[Ba, Kiros, Hinton]

Page 53: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Variants of RNNs

Page 54: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Bidirectional RNNs• The output at time t does not depend on previous

time steps but also the future

• Two RNNs stacked on top of each other

[Danny Britz]

Page 55: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Deep RNNs• Stack them on top of each other

• The output of the previous RNN is the input to the next one

[Danny Britz]

Page 56: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

The Power of RNNs: Understanding and

Visualizing

Page 57: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

The Effectiveness of an RNN

[Andrej Karpathy]

Page 58: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

The Effectiveness of an RNN

[Andrej Karpathy]

Page 59: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

The Effectiveness of an RNN

[Andrej Karpathy]

Page 60: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

The Effectiveness of an RNN

[Andrej Karpathy]

Trained on War & Peace

Iteration: 100

Iteration: 300

Iteration: 2000

Page 61: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Visualize the Neurons of an RNN

[Andrej Karpathy]

Page 62: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Visualize the Neurons of an RNN

[Andrej Karpathy]

Page 63: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Applications

Page 64: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

RNN Applications• Speech Recognition

• Natural Language Processing

• Action Recognition

• Machine Translation

• Many more to come

Page 65: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Speech Recognition• Deep Bidirectional LSTM

[Alex Graves, Navdeep Jaitly, Abdel-rahman Mohamed]

Page 66: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Conversational Speech Recognition

• Achieving human parity

[Xiong et al.]

Page 67: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Natural Language Processing

[Soumith Chantala]

Page 68: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Contextual LSTM for NLP Tasks

[Ghost et al.]

Page 69: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Action Recognition• Long-term Recurrent Convnet

[Donahue et al.]

Page 70: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Google’s Neural Machine Translation System

[Yonghui Wu et al.]

Page 71: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Image Captioning Pt 1

[Vinyals, Toshev, Bengio, Erhan]

Page 72: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Image Captioning Pt 2

[Vinyals, Toshev, Bengio, Erhan]

Page 73: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Object Tracking

[Ning, Zhang, Huang, He, Wang]

Page 74: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

Neural Turing Machines

[Chris Olah]

Page 75: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

WaveNet

[van den Oord et al.]

Page 76: ELEC 576: Understanding and Visualizing Convnets ......ELEC 576: Understanding and Visualizing Convnets & Introduction to Recurrent Neural Networks Ankit B. Patel Baylor College of

DoomBot• Doom Competition

• Facebook won 1st place (F1)

• https://www.youtube.com/watch?v=94EPSjQH38Y