Padding
Output Dimension
n+2p−f+1 n + 2 p − f + 1
Padding Types
Valid:
p=0
p
=
0
Same:
n+2p−f+1=n⇒p=f−12
n
+
2
p
−
f
+
1
=
n
⇒
p
=
f
−
1
2
Stride
Output Dimension
⌊n+2p−fs⌋+1 ⌊ n + 2 p − f s ⌋ + 1
Convolutions Over Volume
n×n×ncprev,f×f×ncprev⇒(⌊n+2p−fs⌋+1)×(⌊n+2p−fs⌋+1)×nc n × n × n c p r e v , f × f × n c p r e v ⇒ ( ⌊ n + 2 p − f s ⌋ + 1 ) × ( ⌊ n + 2 p − f s ⌋ + 1 ) × n c
Pooling
Output Dimension
⌊n−fs⌋+1 ⌊ n − f s ⌋ + 1
One Layer of a Convolution Network
Size Symbol | Meaning |
---|---|
f[l] f [ l ] | Filter Size |
p[l] p [ l ] | Padding |
s[l] s [ l ] | Stride |
n[l−1]h×n[l−1]w×n[l−1]c n h [ l − 1 ] × n w [ l − 1 ] × n c [ l − 1 ] | Input |
n[l]h×n[l]w×n[l]c n h [ l ] × n w [ l ] × n c [ l ] | Output |
n[l]c n c [ l ] | Number of filters |
f[l]×f[l]×n[l−1]c f [ l ] × f [ l ] × n c [ l − 1 ] | Each filter size |
a[l]→n[l]h×n[l]w×n[l]c
a
[
l
]
→
n
h
[
l
]
×
n
w
[
l
]
×
n
c
[
l
]
A[l]→m×n[l]h×n[l]w×n[l]c A [ l ] → m × n h [ l ] × n w [ l ] × n c [ l ] | Activations |
f[l]×f[l]×n[l−1]c×n[l]c f [ l ] × f [ l ] × n c [ l − 1 ] × n c [ l ] | Weights |
n[l]c n c [ l ] | Bias |
n[l]h=⌊n[l−1]h+2p[l]−f[l]s[l]⌋+1
n
h
[
l
]
=
⌊
n
h
[
l
−
1
]
+
2
p
[
l
]
−
f
[
l
]
s
[
l
]
⌋
+
1
n[l]w=⌊n[l−1]w+2p[l]−f[l]s[l]⌋+1
n
w
[
l
]
=
⌊
n
w
[
l
−
1
]
+
2
p
[
l
]
−
f
[
l
]
s
[
l
]
⌋
+
1
Types of Layers in a Convolutional Network
Type | Abbr. |
---|---|
Convolution | CONV |
Pooling | POOL |
Fully Connected | FC |
Why Convolutions?
- Parameter Sharing: A feature detector that’s useful in one part of the image is probably useful in aother part of the image.
- Sparsity of Connections: In each layer, each output value depends only on a small number of inputs.