Deep Learning Basics Lecture 6: Convolutional NN Princeton University COS 495 Instructor: Yingyu Liang
Review: convolutional layers
Convolution: two dimensional case Input Kernel/filter a b c d w x e f g h y z i j k l wa + bx + bw + cx + ey + fz fy + gz Feature map
Convolutional layers the same weight shared for all output nodes π output nodes π kernel size π input nodes Figure from Deep Learning, by Goodfellow, Bengio, and Courville
Terminology Figure from Deep Learning, by Goodfellow, Bengio, and Courville
Case study: LeNet-5
LeNet-5 β’ Proposed in β Gradient-based learning applied to document recognition β , by Yann LeCun, Leon Bottou, Yoshua Bengio and Patrick Haffner, in Proceedings of the IEEE, 1998
LeNet-5 β’ Proposed in β Gradient-based learning applied to document recognition β , by Yann LeCun, Leon Bottou, Yoshua Bengio and Patrick Haffner, in Proceedings of the IEEE, 1998 β’ Apply convolution on 2D images (MNIST) and use backpropagation
LeNet-5 β’ Proposed in β Gradient-based learning applied to document recognition β , by Yann LeCun, Leon Bottou, Yoshua Bengio and Patrick Haffner, in Proceedings of the IEEE, 1998 β’ Apply convolution on 2D images (MNIST) and use backpropagation β’ Structure: 2 convolutional layers (with pooling) + 3 fully connected layers β’ Input size: 32x32x1 β’ Convolution kernel size: 5x5 β’ Pooling: 2x2
LeNet-5 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
LeNet-5 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
LeNet-5 Filter: 5x5, stride: 1x1, #filters: 6 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
LeNet-5 Pooling: 2x2, stride: 2 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
LeNet-5 Filter: 5x5x6, stride: 1x1, #filters: 16 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
LeNet-5 Pooling: 2x2, stride: 2 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
LeNet-5 Weight matrix: 400x120 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
Weight matrix: 84x10 LeNet-5 Weight matrix: 120x84 Figure from Gradient-based learning applied to document recognition, by Y. LeCun, L. Bottou, Y. Bengio and P. Haffner
Software platforms for CNN Updated in April 2016; checked more recent ones online
Platform: Marvin (marvin.is)
Platform: Marvin by
LeNet in Marvin: convolutional layer
LeNet in Marvin: pooling layer
LeNet in Marvin: fully connected layer
Platform: Caffe (caffe.berkeleyvision.org)
LeNet in Caffe
Platform: Tensorflow (tensorflow.org)
Platform: Tensorflow (tensorflow.org)
Platform: Tensorflow (tensorflow.org)
Others β’ Theano β CPU/GPU symbolic expression compiler in python (from MILA lab at University of Montreal) β’ Torch β provides a Matlab-like environment for state-of-the-art machine learning algorithms in lua β’ Lasagne - Lasagne is a lightweight library to build and train neural networks in Theano β’ See: http://deeplearning.net/software_links/
Optimization: momentum
Basic algorithms β’ Minimize the (regularized) empirical loss 1 ΰ· π π Ο π’=1 π π π = π(π, π¦ π’ , π§ π’ ) + π(π) where the hypothesis is parametrized by π β’ Gradient descent π π’+1 = π π’ β π π’ πΌΰ· π π π π’
Mini-batch stochastic gradient descent β’ Instead of one data point, work with a small batch of π points (π¦ π’π+1, π§ π’π+1 ) ,β¦, (π¦ π’π+π, π§ π’π+π ) β’ Update rule 1 π π’+1 = π π’ β π π’ πΌ π ΰ· π π π’ , π¦ π’π+π , π§ π’π+π + π(π π’ ) 1β€πβ€π
Momentum β’ Drawback of SGD: can be slow when gradient is small β’ Observation: when the gradient is consistent across consecutive steps, can take larger steps β’ Metaphor: rolling marble ball on gentle slope
Momentum Contour: loss function Path: SGD with momentum Arrow: stochastic gradient Figure from Deep Learning, by Goodfellow, Bengio, and Courville
Momentum β’ work with a small batch of π points (π¦ π’π+1, π§ π’π+1 ) ,β¦, (π¦ π’π+π, π§ π’π+π ) β’ Keep a momentum variable π€ π’ , and set a decay rate π½ β’ Update rule 1 π€ π’ = π½π€ π’β1 β π π’ πΌ π ΰ· π π π’ , π¦ π’π+π , π§ π’π+π + π(π π’ ) 1β€πβ€π π π’+1 = π π’ + π€ π’
Momentum β’ Keep a momentum variable π€ π’ , and set a decay rate π½ β’ Update rule 1 π€ π’ = π½π€ π’β1 β π π’ πΌ π ΰ· π π π’ , π¦ π’π+π , π§ π’π+π + π(π π’ ) 1β€πβ€π π π’+1 = π π’ + π€ π’ β’ Practical guide: π½ is set to 0.5 until the initial learning stabilizes and then is increased to 0.9 or higher.
Recommend
More recommend