CS 4501 Introduction to Computer Vision Neural Networks

  • Slides: 34
Download presentation
CS 4501: Introduction to Computer Vision Neural Networks + Backpropagation

CS 4501: Introduction to Computer Vision Neural Networks + Backpropagation

Last Class • Softmax Classifier • Generalization / Overfitting • Pytorch

Last Class • Softmax Classifier • Generalization / Overfitting • Pytorch

Today’s Class • Global Features • The perceptron model • Neural Networks – multilayer

Today’s Class • Global Features • The perceptron model • Neural Networks – multilayer perceptron model (MLP) • Backpropagation

Supervised Machine Learning Steps Training Labels Training Images Image Features Training Learned model Testing

Supervised Machine Learning Steps Training Labels Training Images Image Features Training Learned model Testing Image Features Test Image Prediction Slide credit: D. Hoiem

Supervised Learning –Softmax Classifier Extract features Run features through classifier Get predictions 5

Supervised Learning –Softmax Classifier Extract features Run features through classifier Get predictions 5

Last Class: (mini-batch) Stochastic Gradient Descent (SGD) Initialize w and b randomly for e

Last Class: (mini-batch) Stochastic Gradient Descent (SGD) Initialize w and b randomly for e = 0, num_epochs do for b = 0, num_batches do Compute: Update w: Update b: Print: end and B is a small set of training examples. // Useful to see if this is becoming smaller or not. 6

Generalization • Generalization refers to the ability to correctly classify never before seen examples

Generalization • Generalization refers to the ability to correctly classify never before seen examples • Can be controlled by turning “knobs” that affect the complexity of the model Training set (labels known) Test set (labels unknown)

Overfitting Underfitting High Bias Overfitting High Variance

Overfitting Underfitting High Bias Overfitting High Variance

Pytorch: Project Assignment 4 • http: //vicenteordonez. com/vision/

Pytorch: Project Assignment 4 • http: //vicenteordonez. com/vision/

Image Features • In your Project 4: Nearest Neighbors + Softmax Classifier features are:

Image Features • In your Project 4: Nearest Neighbors + Softmax Classifier features are: Image: 3 x 32 Feature: 3072 -dim vector

Image Features: Color Photo by: marielito slide by Tamara L. Berg

Image Features: Color Photo by: marielito slide by Tamara L. Berg

Image Features: Color

Image Features: Color

Image Features: Color However, these are all images of people but the colors in

Image Features: Color However, these are all images of people but the colors in each image are very different.

Image Features: Ho. G Paper by Navneet Dalal & Bill Triggs presented at CVPR

Image Features: Ho. G Paper by Navneet Dalal & Bill Triggs presented at CVPR 2005 for detecting people. Scikit-image implementation

Image Features: Ho. G + Block Normalization Paper by Navneet Dalal & Bill Triggs

Image Features: Ho. G + Block Normalization Paper by Navneet Dalal & Bill Triggs presented at CVPR 2005 for detecting people. Figure from Zhuolin Jiang, Zhe Lin, Larry S. Davis, ICCV 2009 for human action recognition.

Image Features: GIST The “gist” of a scene: Oliva & Torralba, 2001

Image Features: GIST The “gist” of a scene: Oliva & Torralba, 2001

Image Features: GIST Oriented edge response at multiple scales (5 spatial scales, 6 edge

Image Features: GIST Oriented edge response at multiple scales (5 spatial scales, 6 edge orientations) Hays and Efros, SIGGRAPH 2007

Image Features: GIST Aggregated edge responses over 4 x 4 windows Hays and Efros,

Image Features: GIST Aggregated edge responses over 4 x 4 windows Hays and Efros, SIGGRAPH 2007

Image Features: Bag of (Visual) Words Representation slide by Fei-fei Li

Image Features: Bag of (Visual) Words Representation slide by Fei-fei Li

slide by Fei-fei Li

slide by Fei-fei Li

Summary: Image Features • Largely replaced by Neural networks • Still useful to study

Summary: Image Features • Largely replaced by Neural networks • Still useful to study for inspiration in designing neural networks that compute features. • Many other features proposed • LBP: Local Binary Patterns: Useful for recognizing faces. • Dense SIFT: SIFT features computed on a grid similar to the HOG features. • etc.

Perceptron Model Frank Rosenblatt (1957) - Cornell University Activation function More: https: //en. wikipedia.

Perceptron Model Frank Rosenblatt (1957) - Cornell University Activation function More: https: //en. wikipedia. org/wiki/Perceptron

Perceptron Model Frank Rosenblatt (1957) - Cornell University !? More: https: //en. wikipedia. org/wiki/Perceptron

Perceptron Model Frank Rosenblatt (1957) - Cornell University !? More: https: //en. wikipedia. org/wiki/Perceptron

Perceptron Model Frank Rosenblatt (1957) - Cornell University Activation function More: https: //en. wikipedia.

Perceptron Model Frank Rosenblatt (1957) - Cornell University Activation function More: https: //en. wikipedia. org/wiki/Perceptron

Activation Functions Step(x) Tanh(x) Sigmoid(x) Re. LU(x) = max(0, x)

Activation Functions Step(x) Tanh(x) Sigmoid(x) Re. LU(x) = max(0, x)

Pytorch - Perceptron

Pytorch - Perceptron

Two-layer Multi-layer Perceptron (MLP) ”hidden" layer Loss / Criterion

Two-layer Multi-layer Perceptron (MLP) ”hidden" layer Loss / Criterion

Forward pass

Forward pass

Backward pass Grad. Inputs Grad. Params

Backward pass Grad. Inputs Grad. Params

Pytorch – Two-layer MLP + Regression

Pytorch – Two-layer MLP + Regression

Pytorch – Two-layer MLP + Log. Softmax # of Hidden Units

Pytorch – Two-layer MLP + Log. Softmax # of Hidden Units

Pytorch – Two-layer MLP + Log. Softmax + Negative Likelihood Loss

Pytorch – Two-layer MLP + Log. Softmax + Negative Likelihood Loss

Bookmark Opportunity!

Bookmark Opportunity!

Questions? 34

Questions? 34