×
COMP 3340
Convolutional Neural Network
for Image Classification
COMP3340 Applied Deep Learning
2.1 Notations and Outline
• CV: Computer Vision
• NN: Neural Networks
• ReLU: Rectified Linear Unit
• SGD: Stochastic Gradient Descend
• FP: Forward Propagation
• BP: Backward Propagation
• CNN: Convolutional Neural Networks
• BN: Batch Normalization
COMP3340 Applied Deep Learning [1] Reference
2
2.1 Notations and Outline
2.1 Notations and Outline
2.2 Introduction
2.3 Boarder Impact
2.4 Benchmark
2.5 Basic Knowledge for Deep Learning
2.6 CNN Operators
2.7 CNN Architectures
2.8 Reference
Three questions for quiz and final.
1. L1 and L2 Regularization analysis
2. Shuffle conv implementation
3. Flops/Parameters computation
COMP3340 Applied Deep Learning [1] Reference
3
Where is CNN?
COMP3340 Applied Deep Learning
60% Of Human Brain Is “Visual”
The visual data domain is the most important data domain.
COMP3340 Applied Deep Learning
5
2.2.2 Background
COMP3340 Applied Deep Learning [1] [Link]
6
2.2.2 Background
• Representing an image in a computer involves storing it as a grid of pixels, where each pixel represents the
smallest unit of the image.
• RGB (Red, Green, Blue) color model, where each color is represented by a combination of these three primary
colors.
• Channel: each value ranges from 0 to 255, (255, 0, 0) red, while (0, 255, 0) green, and (0, 0, 255) blue. A
combination of these, like (255, 255, 0), yellow.
COMP3340 Applied Deep Learning [1] [Link]
7
2.2.2 Background
COMP3340 Applied Deep Learning [1] [Link]
8
2.2.2 Background
COMP3340 Applied Deep Learning [1] [Link]
9
2.2.2 Background
A picture is worth a thousand words.
COMP3340 Applied Deep Learning [1] [Link]
10
2.2.2 Background
COMP3340 Applied Deep Learning [1] [Link]
11
2.2.2 Problem definition: ConvNet for Image Classification
COMP3340 Applied Deep Learning [1] [Link]
12
2.2.2 Problem definition
• In 2012, Google Brain took an
artificial neural network and
spread the computation across
16,000 of our CPU cores, and
trained models with more than 1
billion connections.
• While there’s no accepted way
to compare artificial neural
networks to biological brains, as
a very rough comparison an
adult human brain has around
100 trillion connections. So we
still have lots of room to grow.
COMP3340 Applied Deep Learning [1] [Link]
13
2.2.3 ImageNet benchmark
COMP3340 Applied Deep Learning [1] [Link]
14
2.2.3 ImageNet benchmark
COMP3340 Applied Deep Learning [1] [Link]
15
2.2.3 ImageNet benchmark
COMP3340 Applied Deep Learning [1] [Link]
16
2.2.3 ImageNet benchmark
COMP3340 Applied Deep Learning [1] [Link]
17
2.2.3 ImageNet benchmark
COMP3340 Applied Deep Learning [1] [Link]
18
Teach Computer to See
COMP3340 Applied Deep Learning [Link]
19
2.3 Boarder impact
• Basis of various modern CV applications
• Image classification
• Semantic Segmentation
• Object Detection
• Video Understanding
• Caption
• Relation Prediction
• Variants:
• Low-shot learning
• Continual learning
• Applications:
• Face recognition
• Robotics
COMP3340 Applied Deep Learning [1] Reference
20
2.3 Boarder Impact
Relation Prediction Caption
COMP3340 Applied Deep Learning [1] [Link]
21
2.4 Benchmark
• ImageNet (mentioned before)
• Cifar10. Cifar100
Process and visualize Cifar10 and Cifar100 dataset:
COMP3340 Applied Deep Learning [1] [Link]
22
23
PIL stands for Python Imaging Library, and it's the original library that
enabled Python to deal with images.
[-1,+1]
24
PIL stands for Python Imaging Library, and it's the original library that
enabled Python to deal with images.
25
26
27
2.5.1 Preliminaries for Image Classification
COMP3340 Applied Deep Learning [1] [Link]
28
[Link] K-Nearest Neighbor
COMP3340 Applied Deep Learning [1] [Link]
29
[Link] K-Nearest Neighbor
COMP3340 Applied Deep Learning [1] [Link]
30
…
31
…
32
33
34
…
Accuracy: 35.39%
35
[Link] K-Nearest Neighbor
COMP3340 Applied Deep Learning [1] [Link]
36
[Link] K-Nearest Neighbor
COMP3340 Applied Deep Learning [1] [Link]
37
[Link] K-Nearest Neighbor
Try it by yourself [demo]
COMP3340 Applied Deep Learning [1] [Link]
38
[Link] Cross-validation
COMP3340 Applied Deep Learning [1] Reference
39
[Link] Cross-validation
COMP3340 Applied Deep Learning [1] [Link]
40
[Link] Cross-validation
COMP3340 Applied Deep Learning [1] [Link]
41
[Link] Disadvantages of k-Nearest Neighbor
COMP3340 Applied Deep Learning [1] [Link]
42
[Link] Linear Classifier 10x3072
Weight matrix Bias vector
COMP3340 Applied Deep Learning [1] [Link]
43
[Link] Linear Classifier and Softmax
Wx+b
COMP3340 Applied Deep Learning [1] [Link]
44
[Link] Neural Network
1*0.55+2*0.54+0.45=2.08
W11
b1 = 0.45
1 W12
W21
W22
b2 = 0.89
b3 = 0.96
COMP3340 Applied Deep Learning [1] [Link]
45
[Link] Neural Network
COMP3340 Applied Deep Learning [1] [Link]
46
[Link] Neural Network
COMP3340 Applied Deep Learning [1] [Link]
47
[Link] Neural Network
COMP3340 Applied Deep Learning [1] [Link]
48
[Link] Neural Network
More Activation functions
COMP3340 Applied Deep Learning [1] [Link]
49
[Link] Neural Network
Forward Propagation
write the equations above more compactly as:
COMP3340 Applied Deep Learning [1] [Link]
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
[Link] Linear Classifier and Softmax
COMP3340 Applied Deep Learning [1] [Link]
78
[Link] Linear Classifier and Softmax
COMP3340 Applied Deep Learning [1] [Link]
79
Visualization
80
[Link] Linear Classifier and Softmax
COMP3340 Applied Deep Learning [1] [Link]
81
[Link] Linear Classifier and Softmax
COMP3340 Applied Deep Learning [1] [Link]
82
[Link] Linear Classifier and Softmax
COMP3340 Applied Deep Learning [1] [Link]
83
[Link] Regularization Regularization
COMP3340 Applied Deep Learning [1] [Link]
84
[Link] Regularization
COMP3340 Applied Deep Learning [1] [Link]
85
[Link] Regularization
COMP3340 Applied Deep Learning [1] [Link]
86
[Link] Neural Network
Backward Propagation
cost function with respect to that single example
cost function with respect to m examples
COMP3340 Applied Deep Learning [1] [Link]
87
[Link] Neural Network
Backward Propagation
gradient descent
where
COMP3340 Applied Deep Learning [1] [Link]
88
[Link] Neural Network (example)
COMP3340 Applied Deep Learning [1] [Link]
89
[Link] Neural Network
COMP3340 Applied Deep Learning [1] [Link]
90
[Link] Neural Network
COMP3340 Applied Deep Learning [1] [Link]
91
COMP3340 Applied Deep Learning [Link]
92
[Link] Neural Network
Backward Propagation
COMP3340 Applied Deep Learning [1] [Link]
93