ece 6504: deep learning for perception dhruv batra virginia tech topics: –toeplitz matrix –1x1...

20
ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: Toeplitz Matrix 1x1 Convolution AKA How to run a ConvNet on arbitrary sized images

Upload: flora-clark

Post on 04-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

ECE 6504: Deep Learningfor Perception

Dhruv Batra

Virginia Tech

Topics: – Toeplitz Matrix– 1x1 Convolution

– AKA How to run a ConvNet on arbitrary sized images

Page 2: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Plan for Today• Toeplitz Matrix

• 1x1 Convolution– AKA How to run a ConvNet on arbitrary sized images

(C) Dhruv Batra 2

Page 3: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Toeplitz Matrix• Diagonals are constants

• Aij = ai-j

(C) Dhruv Batra 3

Page 4: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Why do we care?• (Discrete) Convolution = Matrix Multiplication

– with Toeplitz Matrices

(C) Dhruv Batra 4

Page 5: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

(C) Dhruv Batra 5

"Convolution of box signal with itself2" by Convolution_of_box_signal_with_itself.gif: Brian Ambergderivative work: Tinos (talk) - Convolution_of_box_signal_with_itself.gif. Licensed under CC BY-SA 3.0 via Commons -

https://commons.wikimedia.org/wiki/File:Convolution_of_box_signal_with_itself2.gif#/media/File:Convolution_of_box_signal_with_itself2.gif

Page 6: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Why do we care?• Two way of writing the same thing

(C) Dhruv Batra 6

Page 7: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Plan for Today• Toeplitz Matrix

• 1x1 Convolution– AKA How to run a ConvNet on arbitrary sized images

(C) Dhruv Batra 7

Page 8: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Convolutional Netsa

(C) Dhruv Batra 8Image Credit: Yann LeCun, Kevin Murphy

Page 9: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Classical View

(C) Dhruv Batra 9Figure Credit: [Long, Shelhamer, Darrell CVPR15]

Page 10: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Classical View = Inefficient

(C) Dhruv Batra 10

Page 11: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Classical View

(C) Dhruv Batra 11Figure Credit: [Long, Shelhamer, Darrell CVPR15]

Page 12: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Re-interpretation• Just squint a little!

(C) Dhruv Batra 12Figure Credit: [Long, Shelhamer, Darrell CVPR15]

Page 13: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

“Fully Convolutional” Networks• Can run on an image of any size!

(C) Dhruv Batra 13Figure Credit: [Long, Shelhamer, Darrell CVPR15]

Page 14: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

“Fully Convolutional” Networks• Up-sample to get segmentation maps

(C) Dhruv Batra 14Figure Credit: [Long, Shelhamer, Darrell CVPR15]

Page 15: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Note: After several stages of convolution-pooling, the spatial resolution is greatly reduced (usually to about 5x5) and the number of feature maps is large (several hundreds depending on the application).

It would not make sense to convolve again (there is no translation invariance and support is too small). Everything is vectorized and fed into several fully connected layers.

If the input of the fully connected layers is of size Nx5x5, the first fully connected layer can be seen as a conv. layer with 5x5 kernels.The next fully connected layer can be seen as a conv. layer with 1x1 kernels.

Slide Credit: Marc'Aurelio Ranzato(C) Dhruv Batra 15

Page 16: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

NxMxM, M small

H hidden units / Hx1x1 feature maps

Fully conn. layer /Conv. layer (H kernels of size NxMxM)

Slide Credit: Marc'Aurelio Ranzato(C) Dhruv Batra 16

Page 17: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

NxMxM, M small

H hidden units / Hx1x1 feature maps

Fully conn. layer /Conv. layer (H kernels of size NxMxM)

K hidden units / Kx1x1 feature maps

Fully conn. layer /Conv. layer (K kernels of size Hx1x1)

Slide Credit: Marc'Aurelio Ranzato(C) Dhruv Batra 17

Page 18: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Viewing fully connected layers as convolutional layers enables efficient use of convnets on bigger images (no need to slide windows but unroll network over space as needed to re-use computation).

CNNInput

Image

CNNInput

Image

Input

Image

TRAINING TIME

TEST TIME

x

y

Slide Credit: Marc'Aurelio Ranzato(C) Dhruv Batra 18

Page 19: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

CNNInput

Image

CNNInput

Image

TRAINING TIME

TEST TIME

x

y

Unrolling is order of magnitudes more eficient than sliding windows!

CNNs work on any image size!

Viewing fully connected layers as convolutional layers enables efficient use of convnets on bigger images (no need to slide windows but unroll network over space as needed to re-use computation).

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

Page 20: ECE 6504: Deep Learning for Perception Dhruv Batra Virginia Tech Topics: –Toeplitz Matrix –1x1 Convolution –AKA How to run a ConvNet on arbitrary sized

Benefit of this thinking• Mathematically elegant

• Efficiency– Can run network on arbitrary image – Without multiple crops

• Dimensionality Reduction!– Can use 1x1 convolutions to reduce feature maps

(C) Dhruv Batra 20