Introduction to Convolutional Neural Networks (CNNs)

Similar documents
ECE G: Special Topics in Signal Processing: Sparsity, Structure, and Inference

Classification goals: Make 1 guess about the label (Top-1 error) Make 5 guesses about the label (Top-5 error) No Bounding Box

Lecture 35: Optimization and Neural Nets

Convolutional Neural Networks II. Slides from Dr. Vlad Morariu

SGD and Deep Learning

Introduction to Neural Networks

Jakub Hajic Artificial Intelligence Seminar I

CS 6501: Deep Learning for Computer Graphics. Basics of Neural Networks. Connelly Barnes

DEEP LEARNING AND NEURAL NETWORKS: BACKGROUND AND HISTORY

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels

Lecture 17: Neural Networks and Deep Learning

Neural networks and optimization

Neural Networks and Deep Learning

CS 1674: Intro to Computer Vision. Final Review. Prof. Adriana Kovashka University of Pittsburgh December 7, 2016

Training Neural Networks Practical Issues

Apprentissage, réseaux de neurones et modèles graphiques (RCP209) Neural Networks and Deep Learning

Topics in AI (CPSC 532L): Multimodal Learning with Vision, Language and Sound. Lecture 3: Introduction to Deep Learning (continued)

Neural Networks. Learning and Computer Vision Prof. Olga Veksler CS9840. Lecture 10

Understanding How ConvNets See

Machine Learning for Signal Processing Neural Networks Continue. Instructor: Bhiksha Raj Slides by Najim Dehak 1 Dec 2016

Reading Group on Deep Learning Session 1

Artificial Neural Networks. MGS Lecture 2

<Special Topics in VLSI> Learning for Deep Neural Networks (Back-propagation)

Machine Learning for Computer Vision 8. Neural Networks and Deep Learning. Vladimir Golkov Technical University of Munich Computer Vision Group

Lecture 7 Convolutional Neural Networks

Introduction to Convolutional Neural Networks 2018 / 02 / 23

Deep Feedforward Networks. Seung-Hoon Na Chonbuk National University

Based on the original slides of Hung-yi Lee

Neural Networks. Nicholas Ruozzi University of Texas at Dallas

Neural Networks Learning the network: Backprop , Fall 2018 Lecture 4

Neural Networks (Part 1) Goals for the lecture

Deep Learning (CNNs)

Neural Networks and Deep Learning.

Neural Networks. David Rosenberg. July 26, New York University. David Rosenberg (New York University) DS-GA 1003 July 26, / 35

Machine Learning for Large-Scale Data Analysis and Decision Making A. Neural Networks Week #6

Convolutional Neural Networks. Srikumar Ramalingam

Neural networks and support vector machines

EVERYTHING YOU NEED TO KNOW TO BUILD YOUR FIRST CONVOLUTIONAL NEURAL NETWORK (CNN)

1 What a Neural Network Computes

Maxout Networks. Hien Quoc Dang

Convolutional Neural Network Architecture

Neural Networks. Bishop PRML Ch. 5. Alireza Ghane. Feed-forward Networks Network Training Error Backpropagation Applications

Bayesian Networks (Part I)

Neural networks and optimization

Machine Learning. Neural Networks. (slides from Domingos, Pardo, others)

CSE446: Neural Networks Spring Many slides are adapted from Carlos Guestrin and Luke Zettlemoyer

Lecture 3 Feedforward Networks and Backpropagation

Lecture 3 Feedforward Networks and Backpropagation

Introduction to (Convolutional) Neural Networks

CSCI567 Machine Learning (Fall 2018)

Machine Learning. Neural Networks. (slides from Domingos, Pardo, others)

Artificial Neural Networks. Historical description

Neural Networks with Applications to Vision and Language. Feedforward Networks. Marco Kuhlmann

Introduction to Deep Neural Networks

Introduction to Machine Learning (67577)

Neural Networks. Single-layer neural network. CSE 446: Machine Learning Emily Fox University of Washington March 10, /9/17

Deep Neural Networks (1) Hidden layers; Back-propagation

Convolutional Neural Networks

Deep Feedforward Networks

Deep Learning Lab Course 2017 (Deep Learning Practical)

Statistical Machine Learning (BE4M33SSU) Lecture 5: Artificial Neural Networks

Lecture 2: Learning with neural networks

Machine Learning Lecture 14

Machine Learning and Data Mining. Multi-layer Perceptrons & Neural Networks: Basics. Prof. Alexander Ihler

arxiv: v1 [cs.cv] 11 May 2015 Abstract

Index. Santanu Pattanayak 2017 S. Pattanayak, Pro Deep Learning with TensorFlow,

A summary of Deep Learning without Poor Local Minima

How to do backpropagation in a brain

Demystifying deep learning. Artificial Intelligence Group Department of Computer Science and Technology, University of Cambridge, UK

NONLINEAR CLASSIFICATION AND REGRESSION. J. Elder CSE 4404/5327 Introduction to Machine Learning and Pattern Recognition

Backpropagation Introduction to Machine Learning. Matt Gormley Lecture 12 Feb 23, 2018

Comments. Assignment 3 code released. Thought questions 3 due this week. Mini-project: hopefully you have started. implement classification algorithms

Deep Feedforward Networks

Neural Networks 2. 2 Receptive fields and dealing with image inputs

Deep Learning Lecture 2

Introduction to Deep Learning

Machine learning comes from Bayesian decision theory in statistics. There we want to minimize the expected value of the loss function.

Artifical Neural Networks

ECE521 Lecture 7/8. Logistic Regression

CS60010: Deep Learning

Deep Neural Networks

Introduction Biologically Motivated Crude Model Backpropagation

(Feed-Forward) Neural Networks Dr. Hajira Jabeen, Prof. Jens Lehmann

1 Machine Learning Concepts (16 points)

Understanding Neural Networks : Part I


UNSUPERVISED LEARNING

Machine Learning. Neural Networks. (slides from Domingos, Pardo, others)

Feed-forward Networks Network Training Error Backpropagation Applications. Neural Networks. Oliver Schulte - CMPT 726. Bishop PRML Ch.

Handwritten Indic Character Recognition using Capsule Networks

DeepLearning on FPGAs

Neural Networks Lecturer: J. Matas Authors: J. Matas, B. Flach, O. Drbohlav

Machine Learning Lecture 12

Artificial Neural Networks D B M G. Data Base and Data Mining Group of Politecnico di Torino. Elena Baralis. Politecnico di Torino

Intro to Neural Networks and Deep Learning

Neural Networks. Lecture 2. Rob Fergus

Ch.6 Deep Feedforward Networks (2/3)

CS 343: Artificial Intelligence

Neural Networks, Computation Graphs. CMSC 470 Marine Carpuat

Transcription:

Introduction to Convolutional Neural Networks (CNNs) nojunk@snu.ac.kr http://mipal.snu.ac.kr Department of Transdisciplinary Studies Seoul National University, Korea Jan. 2016 Many slides are from Fei-Fei Li @Stanford, Raquel Urtasun @U. Toronto, and Marc Aurelio Ranzato @Facebook.

Traditional Pattern Recognition

Hierarchical Compositionality (DEEP)

Deep Learning What is deep learning? Nothing new! (Many) cascades of nonlinear transformations End-to-end learning (no human intervention / no fixed features)

Shallow(?) Learning Examples - Supervised

Deep Learning Examples - Supervised

Artificial Neural Networks (ANN) Biologically inspired models

Variants of ANNs

A Brief History of ANNs source of image: VUNO Inc.

A Brief History of ANNs First Generation: 1957 Perceptron: Rosenblatt, 1957 Adaline: Widrow and Hoff, 1960

A Brief History of ANNs First Generation: 1957 Perceptron: Rosenblatt, 1957 Adaline: Widrow and Hoff, 1960 Second Generation: 1986 MLP with BP: Rumelhart

A Brief History of ANNs Third Generation: 2006 RBM: Hinton and Salkhutdinov Reinvigorated research in Deep Learning

Classification problems Given inputs x, and outputs t { 1, 1} Find a hyperplane that divides the space into half (binary classification) y = sign(w T x + w 0 ) SVM tries to maximize the margin.

Classification problems Given inputs x, and outputs t { 1, 1} Find a hyperplane that divides the space into half (binary classification) y = sign(w T x + b) SVM tries to maximize the margin.

Nonlinear predictors How can we make our classifier more powerful?

Nonlinear predictors How can we make our classifier more powerful? Compute nonlinear functions of the input y = F(x, w)

Nonlinear predictors How can we make our classifier more powerful? Compute nonlinear functions of the input y = F(x, w) Two types of widely used approaches

Nonlinear predictors How can we make our classifier more powerful? Compute nonlinear functions of the input y = F(x, w) Two types of widely used approaches Kernel Trick: Fixed functions and optimize linear parameters on nonlinear mappings φ(x) y = sign(w T φ(x) + b)

Nonlinear predictors How can we make our classifier more powerful? Compute nonlinear functions of the input y = F(x, w) Two types of widely used approaches Kernel Trick: Fixed functions and optimize linear parameters on nonlinear mappings φ(x) y = sign(w T φ(x) + b) Deep Learning: Learn parametric nonlinear functions y = F(x, w) = (h 2 (w T 2 h 1 (w T 1 x + b 1 ) + b 2 ) h 1,2 : activation function at layer 1 or 2

Neural Networks Deep learning uses composite of simpler functions, e.g., ReLU, sigmoid, tanh, max Note: a composite of linear functions is linear! Example: 2 layer NNet (Convention: input and output layers are not taken as a layer)

Neural Networks Deep learning uses composite of simpler functions, e.g., ReLU, sigmoid, tanh, max Note: a composite of linear functions is linear! Example: 2 layer NNet (Convention: input and output layers are not taken as a layer) x is the input y is the output h i is the i-th hidden layer output W i is the set of parameters of the i-th layer

Nonlinearity - Activation function A singlue neuron can be used as a binary linear classifier Regularization has the interpretation of gradual forgetting Classical NNs used sigmoid or tanh function as an activation function. sigmoid: σ(x) = 1 1+e x tanh: tanh(x) = ex e x e x +e x

Sigmoid function Squashes numbers to range [0,1] Historically popular since they have nice interpretation as a saturating firing rate of a neuron

Sigmoid function Squashes numbers to range [0,1] Historically popular since they have nice interpretation as a saturating firing rate of a neuron 2 BIG problems: 1 Saturated neurons kill the gradients (cannot backprop further) Major bottleneck for the conventional NNs: not able to train more than 2 or 3 layers 2 Sigmoid outputs are not zero-centered Restriction on the gradient directions

ReLU: Rectified Linear Unit f (x) = max(0, x) Does not saturate Computationally very efficient Converges much faster than sigmoid/tanh in practice (e.g. 6x)

ReLU: Rectified Linear Unit f (x) = max(0, x) Does not saturate Computationally very efficient Converges much faster than sigmoid/tanh in practice (e.g. 6x) One annoying problem Dead neurons

ReLU: Rectified Linear Unit f (x) = max(0, x) Does not saturate Computationally very efficient Converges much faster than sigmoid/tanh in practice (e.g. 6x) One annoying problem Dead neurons Solution: leaky ReLU (small slope for negative input) Never dies. However, almost the same performance in practice.

Why ReLU? Piecewise linear tiling: mapping is locally linear Montufar et al. On the number of linear regions of DNNs, arxiv 2014

Forward Pass: Evaluating the function Forward propagation: compute the output y given the input x Fully connected layer Nonlinearity comes from ReLU Do it in a compositional way x h 1 h 2 y

Alternative graphical representation Slide from M. Ranzato

Why many layers? Hierarchically distributed representations Lee et al. Convolutional DBN s ICML 2009

Why many layers? Hierarchically distributed representations Lee et al. Convolutional DBN s ICML 2009

Training We want to estimate the parameters, biases and hyper-parameters (e.g., number of layers, number of neurons) for good predictions. Collect a training set of input-output pairs {x i, t i } N i=1. Encode the output with 1-K encoding t = [0,, 1,, 0].

Training We want to estimate the parameters, biases and hyper-parameters (e.g., number of layers, number of neurons) for good predictions. Collect a training set of input-output pairs {x i, t i } N i=1. Encode the output with 1-K encoding t = [0,, 1,, 0]. Define a loss per training example and minimize the empirical loss L(w) = 1 N l(w, x i, t i ) + R(w) N i=1 N : number of training examples R: regularizer w: set of all parameters

Loss functions L(w) = 1 N N l(w, x i, t i ) + R(w) i=1 Softmax (Probability of class k given input): p(c k = 1 x) = exp(y k ) Cj=1 exp(y j )

Loss functions L(w) = 1 N N l(w, x i, t i ) + R(w) i=1 Softmax (Probability of class k given input): p(c k = 1 x) = exp(y k ) Cj=1 exp(y j ) Cross entropy (most popular loss function for classification): l(w, x, t) = C t (k) log p(c k x) k=1

Loss functions L(w) = 1 N N l(w, x i, t i ) + R(w) i=1 Softmax (Probability of class k given input): p(c k = 1 x) = exp(y k ) Cj=1 exp(y j ) Cross entropy (most popular loss function for classification): l(w, x, t) = C t (k) log p(c k x) k=1 Gradient descent to train the network w = argmin L(w) w

Backpropagation Efficient way of computing gradient (Chain rule) Partial derivatives and gradients f (x, y) = xy f x = y df (x) f (x + h) f (x) = lim dx h 0 h f y = x df (x) f (x + h) = f (x) + h dx

Backpropagation Efficient way of computing gradient (Chain rule) Partial derivatives and gradients f (x, y) = xy f x = y df (x) f (x + h) f (x) = lim dx h 0 h f y = x Example: x = 4, y = 3 f (x, y) = 12 f x = 3 f x = 4 df (x) f (x + h) = f (x) + h dx [ f f = x, f ] y

Backpropagation Efficient way of computing gradient (Chain rule) Partial derivatives and gradients f (x, y) = xy f x = y df (x) f (x + h) f (x) = lim dx h 0 h f y = x Example: x = 4, y = 3 f (x, y) = 12 f x = 3 f x = 4 df (x) f (x + h) = f (x) + h dx [ f f = x, f ] y Question: If I increase x by h, how would the output f change?

Backpropagation Compound expressions with graphics (example from F.F. Li) q = x + y f = qz f q q x = 1, q x = 1 = z, f z = q Chain rule: f x = f q q x

Backpropagation: Another Example

Backpropagation: Another Example

Backpropagation: Another Example

Backpropagation: Another Example

Backpropagation: Another Example

Backpropagation: Another Example

Backpropagation: Another Example

Backpropagation: Key Idea

Backpropagation: Patterns in BP Add: gradient distributor Max: gradient router Mul: gradient switcher

Learning via Gradient Descent Gradient descent to train the network w = argmin w 1 N At each iteration, we need to compute N l(w, x i, t i ) + R(w) i=1 w n+1 = w n γ n L(w n ) Use the backward pass to compute L(w n ) efficiently Recall that the backward pass requires the forward pass first

Dealing with Big Data At each iteration, we need to compute w n+1 = w n γ n L(w n ) with L(w n ) = 1 N N l(w n, x i, t i ) + R(w n ) i=1 Too expensive when having millions of training examples

Dealing with Big Data At each iteration, we need to compute with L(w n ) = 1 N w n+1 = w n γ n L(w n ) N l(w n, x i, t i ) + R(w n ) i=1 Too expensive when having millions of training examples Instead, approximate the gradient with a mini-batch (subset of examples: 100 1,000) - called stochastic gradient descent 1 N N i=1 l(w n, x i, t i ) 1 S l(w n, x i, t i ) i S

SGD with momentum Stochastic Gradient Descent update with w n+1 = w n γ n L(w n ) L(w n ) = 1 S We can use momentum l(w n, x i, t i ) i S w w γ κ + L We can also decay learning rate γ as iterations goes on

Fully Connected Layer

Locally Connected Layer

Locally Connected Layer

Convolutional Neural Networks Idea: statistics are similar at different locations (Lecun 1998) Connect each hidden unit to a small input patch and share the weight across space This is called convolution layer and the network is a convolutional neural network

Convolutional Neural Networks Number of filters (neurons) is considered as a new dimension (depth) Volumetric representation

Convolutional Neural Networks Number of filters (neurons) is considered as a new dimension (depth) Volumetric representation

Convolutional Neural Networks CNNs are just neural nets BUT: 1. Local connectivity

Convolutional Neural Networks image: 32x32x3 volume CNNs are just neural nets BUT: 1. Local connectivity before: fully connected: 32x32x3 weights now: one neuron will connect to, e.g., 5x5x3 chunk (receptive field) and only have 5x5x3 weights connectivity is: local in space (5x5 instead of 32x32) but full in depth (all 3 depth channels)

Convolutional Neural Networks CNNs are just neural nets BUT: 1. Local connectivity

Convolutional Neural Networks CNNs are just neural nets BUT: 1. Local connectivity Multiple neurons all looking at the same region of the input volume, stacked along depth.

Convolutional Neural Networks CNNs are just neural nets BUT: 2. Weight sharing

Convolutional Neural Networks CNNs are just neural nets BUT: 2. Weight sharing Weights are shared across different locations Each depth slice is called one feature map

Convolutional Neural Networks

Convolutional Neural Networks

Convolutional Neural Networks

Convolutional Neural Networks

Convolutional Neural Networks

Convolutional Neural Networks

Convolutional Layer: Summary Input volume of size [W1 x H1 x D1] using K neurons with receptive fields F x F and applying them at strides of S gives Output volume: [W2, H2, D2] W2 = (W1-F)/S+1, H2 = (H1-F)/S+1, D2 = K

Feature (Filter) Visualization

Pooling In CNNs, Conv layers are often followed by Pool layers Pooling layer: makes the representations smaller and more manageable without losing too much information Increased receptive field Most common: MAX pooling Others: average, L2 pooling

Improving Generalization Weight sharing (Reduce the number of parameters) Data augmentation (e.g., jittering, noise injection, tranformations) Dropout [Hinton et al.]: randomly drop units (along with their connections) from the neural network during training. Use for the fully connected layers only Regularization: Weight decay (L2, L1) Sparsity in the hidden units Multi-task learning Transfer learning

Improving Generalization Dropout [Hinton et al.]: randomly drop units (along with their connections) from the neural network during training. Use for the fully connected layers only

Optimality Common knowledge: for non-convex problems, training does not work because we get stuck to local minima

Optimality Common knowledge: for non-convex problems, training does not work because we get stuck to local minima Not true!!! If the size of the network is large enough, local descent can reach a global minimizer from any initialization Haeffele, Vidal. Global Optimality in Tensor Factorization, Deep Learning and Beyond, arxiv 15

ConvNets Typical ConvNet: Image [Conv - ReLU] (Pool) [Conv - ReLU] (Pool) FC (fully-connected) Softmax

ConvNets - Flavours Lenet5 (Yann Lecun 1998) Alexnet (Alex Krizhevsky et. al., 2012)

ConvNets - Flavours ZFnet: Clarifai (Matt Zeiler and Rob Fergus, 2013) Googlenet (Google, 2014)

Complexity (Alexnet)

Recent Trend Human: 5.1% (Karpathy), Baidu cheating (2015.05) - 4.58%

Recent Trend

Recent Trend

Conclusions Deep Learning = learning hierarhical models. ConvNets are the most successful example. Leverage large labeled datasets. Optimization Don t we get stuck in local minima? No, they are all the same! In large scale applications, local minima are even less of an issue. Scaling GPUs Distributed framework (Google) Better optimization techniques Generalization on small datasets (curse of dimensionality): data augmentation weight decay dropout unsupervised learning multi-task learning