1
EC 500 A1: �From Image Processing to �Convolutional Neural Networks (CNN)
Recap: Convolution and Fourier Transform
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Approximated Laplacian filter
Image pyramid : Gaussian pyramid
Down-sample
Down-sample
Down-sample
Residual image
Down-sample
Up-
sample
-
=
Gaussian pyramid
6
Laplacian pyramid
7
Image reconstruction
Up-sample
+
=
Up-sample
+
=
Up-sample
……
Today
9
Image processing by frequency filtering
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Example
Can we have filters for specific frequencies?
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Fourier domain
Recap: Binomial filters
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Gaussian filters
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Frequency [u]
u
Can we have filters for specific frequencies?
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Fourier domain
Rethinking frequency modulation (FM)
Music-1
Music-2
Music-3
time
frequency
Can we have filters for specific frequencies?
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Fourier domain
Spatial domain
Gabor filters
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Gabor filters
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Modulation: move Gaussian to different frequencies
Examples
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Examples
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
What is this? How do you tell?
22
23
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
Today
24
How to perform classification?
[Figure credit: A. Torralba, P. Isola, and W. T. Freeman, Foundations of Computer Vision.]
How to perform classification?
26
Dog
Bird
Neural Network
(encoder)
Feature vector
……
Has four legs
Has wing
……
1
0
……
0
1
Deep neural networks (DNN)
Convolution
A special computation between layers
28
Convolution
29
0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 1 |
0 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 1 | 1 |
1 | 1 | 1 | 1 | 1 |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
0 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
Feature map (nodes) at layer t
Feature map at layer t+1
“Filter” weights
(3-by-3)
Inner product
Element-wise multiplication and sum
1
Convolution
30
0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 1 |
0 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 1 | 1 |
1 | 1 | 1 | 1 | 1 |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
0 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
“Filter” weights
(3-by-3)
Inner product
6
Feature map (nodes) at layer t
Feature map at layer t+1
Convolution
31
0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 1 |
0 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 1 | 1 |
1 | 1 | 1 | 1 | 1 |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
0 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
“Filter” weights
(3-by-3)
Inner product
1
Zero-padding: Set the missing values to be 0
Feature map (nodes) at layer t
Feature map at layer t+1
Convolution example
32
0 | 0 | 0 |
1 | 1 | 1 |
0 | 0 | 0 |
1 | 1 | 1 |
0 | 0 | 0 |
1 | 1 | 1 |
Convolution
33
“Filter” weights
(3-by-3)
“Filter” weights
(3-by-3-by-“2”)
| | |
| | |
| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 1 |
0 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 1 | 1 |
1 | 1 | 1 | 1 | 1 |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
0 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
Inner product
Feature map (nodes) at layer t
Feature map at layer t+1
Convolution
34
“Filter” weights
(3-by-3-by-“2”)
| | |
| | |
| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
0 | 0 | 0 | 0 | 1 |
0 | 0 | 0 | 1 | 1 |
0 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 1 | 1 |
1 | 1 | 1 | 1 | 1 |
0 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
Inner product
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | |
| | |
| | |
1 | 1 | 1 |
0 | 0 | 0 |
1 | 1 | 1 |
Feature map (nodes) at layer t
Feature map at layer t+1
One filter for one output “channel” to capture a different “pattern” (e.g., edges, circles, eyes, etc.)
Convolution: properties
35
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
Top-left, Top right: has ears
Middle: has eyes
36
Questions?
Convolutional neural networks (CNN)
37
Shared weights
Vectorization + FC layers
Max pooling + down-sampling
Recognition example
Recognition example
Image
Recognition example
Image
Convolution
Recognition example
Image
Convolution
Feature map
Recognition example
Image
Convolution
Feature map
Recognition example
Image
Convolution
Feature map
Convolution
Recognition example
Image
Convolution
Feature map
Convolution
……
Recognition example
Image
Convolution
Feature map
Convolution
……
Recognition example
Image
Convolution
Feature map
Feature map
Convolution
……
Recognition example
Image
Convolution
Feature map
Convolution
……
Recognition example
Image
Convolution
|
|
|
|
|
|
Feature map
Convolution
……
Recognition example
Convolution
|
|
|
|
|
|
Feature map
Recognition example
Convolution
|
|
|
|
|
|
Feature map
Recognition example
Convolution
|
|
|
|
|
|
Feature map
Convolution
……
Recognition example
Convolution
|
|
|
|
|
|
Feature map
Convolution
……
Recognition example
Convolution
|
|
|
|
|
|
Feature map
Convolution
……
54
Questions?
Convolutional neural networks (CNN)
55
Shared weights
Vectorization + FC layers
Max pooling + down-sampling
Translation-tolerant (in pattern combinations)
Convolution
Translation-tolerant (in pattern combinations)
Convolution
Convolution
Translation-tolerant (in pattern combinations)
Convolution
Convolution
Receptive field
59
Linear receptive field
Exponential receptive field
(with pooling + down-sampling)
Layers of feature maps (representations)
60
What does a large response at each layer/channel mean?
61
Questions?
Convolutional neural networks (CNN)
62
Shared weights
Vectorization + FC layers
Max pooling + down-sampling
Representative CNN networks
[Krizhevsky et al., 2012]
[Simonyan et al., 2015]
63
Representative CNN networks
Representative CNN networks
[He et al, 2016]
[Huang et al, 2017]
65
Advantages:
Representative CNN networks
A general architecture involves
66
Representative CNN networks
A general architecture involves
67
68
Questions?
Convolutional neural networks (CNN)
69
Shared weights
Vectorization + FC layers
Max pooling + down-sampling
Stride (down-sampled) convolution
70
Stride (down-sampled) convolution
71
Dilated convolution: without down-sampling
72
73
Questions?
Convolution with [?] filters
74
75
Questions?
Convolutional neural networks (CNN)
76
Vectorization + FC layers
A simple CNN classifier (assuming gray images)
77
A simple CNN classifier (assuming gray images)
78
A simple CNN classifier (assuming gray images)
79
A simple CNN classifier (assuming gray images)
80
A simple CNN classifier (assuming gray images)
81
A simple CNN classifier (assuming gray images)
82
A simple CNN classifier (assuming gray images)
83
84
Questions?
What if the image size changes?
85
Vectorization + FC layers
Revisit the bird image
86
How to apply?
Convolutional neural networks (CNN) for detection
87
Convolutional neural networks (CNN) for segmentation
88
Spatial output
89
A simple CNN classifier
90
Spatial output
91
92
Questions?
Popular CNN architectures
93
Popular CNN architectures
94
Popular CNN architectures
95
96
Questions?
Besides translation, CNNs need to tackle object scale
97
Feature pyramid networks
98
[Feature Pyramid Networks for Object Detection, CVPR 2017]