ece 6504: deep learning for perceptionf15ece6504/slides/l3... · image credit: andrej karpathy,...

26
ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: Neural Networks – Backprop Modular Design

Upload: others

Post on 25-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

ECE 6504: Deep Learning for Perception

Dhruv Batra Virginia Tech

Topics: –  Neural Networks

–  Backprop –  Modular Design

Page 2: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Administrativia •  Scholar

–  Anybody not have access? –  Please post questions on Scholar Forum. –  Please check scholar forums. You might not know you have

a doubt.

•  Sign up for Presentations –  https://docs.google.com/spreadsheets/d/

1m76E4mC0wfRjc4HRBWFdAlXKPIzlEwfw1-u7rBw9TJ8/edit#gid=2045905312

(C) Dhruv Batra 2

Page 3: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Plan for Today •  Notation + Setup •  Neural Networks •  Chain Rule + Backprop

(C) Dhruv Batra 3

Page 4: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Supervised Learning •  Input: x (images, text, emails…)

•  Output: y (spam or non-spam…)

•  (Unknown) Target Function –  f: X à Y (the “true” mapping / reality)

•  Data –  (x1,y1), (x2,y2), …, (xN,yN)

•  Model / Hypothesis Class –  g: X à Y –  y = g(x) = sign(wTx)

•  Learning = Search in hypothesis space –  Find best g in model class.

(C) Dhruv Batra 4

Page 5: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Basic Steps of Supervised Learning •  Set up a supervised learning problem

•  Data collection –  Start with training data for which we know the correct outcome provided by a teacher

or oracle.

•  Representation –  Choose how to represent the data.

•  Modeling –  Choose a hypothesis class: H = {g: X à Y}

•  Learning/Estimation –  Find best hypothesis you can in the chosen class.

•  Model Selection –  Try different models. Picks the best one. (More on this later)

•  If happy stop –  Else refine one or more of the above

(C) Dhruv Batra 5

Page 6: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Error Decomposition

(C) Dhruv Batra 6

Reality

model class

Page 7: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Error Decomposition

(C) Dhruv Batra 7

Reality

Page 8: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Error Decomposition

(C) Dhruv Batra 8

Reality model class

Higher-Order Potentials

Page 9: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Biological Neuron

(C) Dhruv Batra 9

Page 10: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Recall: The Neuron Metaphor •  Neurons

•  accept information from multiple inputs, •  transmit information to other neurons.

•  Artificial neuron •  Multiply inputs by weights along edges •  Apply some function to the set of inputs at each node

10 Image Credit: Andrej Karpathy, CS231n

Page 11: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Types of Neurons 1

Linear Neuron

1

Logistic Neuron

1

Perceptron

Potentially more. Require a convex

loss function for gradient descent training.

11 Slide Credit: HKUST

w0w1

w2

wd

f(~x, ~w)

w0w1

w2

wd

f(~x, ~w)

w0w1

w2

wd

f(~x, ~w)

Page 12: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Activation Functions •  sigmoid vs tanh

(C) Dhruv Batra 12

Page 13: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

A quick note

(C) Dhruv Batra 13 Image Credit: LeCun et al. ‘98

Page 14: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Rectified Linear Units (ReLU)

(C) Dhruv Batra 14

[Krizhevsky et al., NIPS12]

Page 15: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Limitation •  A single “neuron” is still a linear decision boundary

•  What to do?

•  Idea: Stack a bunch of them together!

(C) Dhruv Batra 15

Page 16: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Multilayer Networks •  Cascade Neurons together •  The output from one layer is the input to the next •  Each Layer has its own sets of weights

(C) Dhruv Batra 16 Image Credit: Andrej Karpathy, CS231n

Page 17: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Universal Function Approximators •  Theorem

–  3-layer network with linear outputs can uniformly approximate any continuous function to arbitrary accuracy, given enough hidden units [Funahashi ’89]

(C) Dhruv Batra 17

Page 18: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Neural Networks •  Demo

–  http://neuron.eng.wayne.edu/bpFunctionApprox/bpFunctionApprox.html

(C) Dhruv Batra 18

Page 19: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Key Computation: Forward-Prop

(C) Dhruv Batra 19 Slide Credit: Marc'Aurelio Ranzato, Yann LeCun

Page 20: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Key Computation: Back-Prop

(C) Dhruv Batra 20 Slide Credit: Marc'Aurelio Ranzato, Yann LeCun

Page 21: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

(C) Dhruv Batra 21

Page 22: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

(C) Dhruv Batra 22

Page 23: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Visualizing Loss Functions •  Sum of individual losses

(C) Dhruv Batra 23

Page 24: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Detour

(C) Dhruv Batra 24

Page 25: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Logistic Regression as a Cascade

(C) Dhruv Batra 25

w

|x

w

|x

w

|x

w

|x

Slide Credit: Marc'Aurelio Ranzato, Yann LeCun

Page 26: ECE 6504: Deep Learning for Perceptionf15ece6504/slides/L3... · Image Credit: Andrej Karpathy, CS231n 10 . 1 Types of Neurons Linear Neuron 1 Logistic Neuron 1 Perceptron Potentially

Forward Propagation •  On board

(C) Dhruv Batra 26