Goal: to learn about what Fully Convolutional Networks (FCN) are and how they can be used for image segmentation. ๐ค
a simple way is to slide the window, creating a slow RNN?
another way is to build a Equal size Fully Convolutional Network (but receptive field is limited and hard to generalize to higher resolutions)
U-Net like architecture ๐
but how to UPSAMPLE the feature maps?
simple built-in function, targets at the average pooling
bed of nails
Nearest Neighbor
Bilinear Interpolation
Bicubic Interpolation also like this onw
Max Unpooling, targets at the max pooling
when max pooling is used, remember the position of the maximum value, and use it (those places) to upsample the feature map
Transpose Convolution , learnable weights
Ready for math? ๐
when 1D, size=3, stride=1, padding=1โฆ
x โ โ a โ = X a โ
\vec{x}*\vec{a} = X \vec{a}
x โ a = X a
[ x y z 0 0 0 0 x y z 0 0 0 0 x y z 0 0 0 0 x y z ] [ 0 a b c d 0 ] = [ a y + b z a x + b y + c z b x + c y + d z c x + d y ]
\begin{bmatrix}
x & y & z & 0 & 0 & 0 \\
0 & x & y & z & 0 & 0 \\
0 & 0 & x & y & z & 0 \\
0 & 0 & 0 & x & y & z \\
\end{bmatrix}
\begin{bmatrix}
0 \\
a \\
b \\
c \\
d \\
0 \\
\end{bmatrix} =
\begin{bmatrix}
ay+bz \\
ax+by+cz \\
bx+cy+dz \\
cx+dy \\
\end{bmatrix}
โฃ โก โ x 0 0 0 โ y x 0 0 โ z y x 0 โ 0 z y x โ 0 0 z y โ 0 0 0 z โ โฆ โค โ โฃ โก โ 0 a b c d 0 โ โฆ โค โ = โฃ โก โ a y + b z a x + b y + cz b x + cy + d z c x + d y โ โฆ โค โ
l e t โ T b e t r a n s p o s e c o n v o l u t i o n โ x โ โ T a โ = X T a โ
let \ *^T\ be \ transpose \ convolution \Rightarrow \vec{x}*^T \vec{a} = X^T \vec{a}
l e t โ T b e t r an s p ose co n v o l u t i o n โ x โ T a = X T a
[ x 0 0 0 y x 0 0 z y x 0 0 z y x 0 0 z y 0 0 0 z ] [ a b c d ] = [ a x a y + b x a z + b y + c x b z + c y + d x c z + d y d z ]
\begin{bmatrix}
x & 0 & 0 & 0 \\
y & x & 0 & 0 \\
z & y & x & 0 \\
0 & z & y & x \\
0 & 0 & z & y \\
0 & 0 & 0 & z \\
\end{bmatrix}
\begin{bmatrix}
a \\
b \\
c \\
d \\
\end{bmatrix} =
\begin{bmatrix}
ax \\
ay+bx\\
az+by+cx \\
bz+cy+dx \\
cz+dy \\
dz \\
\end{bmatrix}
โฃ โก โ x y z 0 0 0 โ 0 x y z 0 0 โ 0 0 x y z 0 โ 0 0 0 x y z โ โฆ โค โ โฃ โก โ a b c d โ โฆ โค โ = โฃ โก โ a x a y + b x a z + b y + c x b z + cy + d x cz + d y d z โ โฆ โค โ
HOWEVER, when the stride is greater than 1, transposed conv can not be expressed as normal conv
when 1D, size=3, stride=2 , padding=1โฆ
x โ โ a โ = X a โ
\vec{x}*\vec{a} = X \vec{a}
x โ a = X a
[ x y z 0 0 0 0 0 x y z 0 ] [ 0 a b c d 0 ] = [ a y + b z b x + c y + d z ]
\begin{bmatrix}
x & y & z & 0 & 0 & 0 \\
0 & 0 & x & y & z & 0 \\
\end{bmatrix}
\begin{bmatrix}
0 \\
a \\
b \\
c \\
d \\
0 \\
\end{bmatrix} =
\begin{bmatrix}
ay+bz \\
bx+cy+dz \\
\end{bmatrix}
[ x 0 โ y 0 โ z x โ 0 y โ 0 z โ 0 0 โ ] โฃ โก โ 0 a b c d 0 โ โฆ โค โ = [ a y + b z b x + cy + d z โ ]
l e t โ T b e t r a n s p o s e c o n v o l u t i o n โ x โ โ T a โ = X T a โ
let \ *^T\ be \ transpose \ convolution \Rightarrow \vec{x}*^T \vec{a} = X^T \vec{a}
l e t โ T b e t r an s p ose co n v o l u t i o n โ x โ T a = X T a
[ x 0 y 0 z x 0 y 0 z 0 0 ] [ a b ] = [ a x a y a z + b x b y b z 0 ]
\begin{bmatrix}
x & 0 \\
y & 0 \\
z & x \\
0 & y \\
0 & z \\
0 & 0 \\
\end{bmatrix}
\begin{bmatrix}
a \\
b \\
\end{bmatrix} =
\begin{bmatrix}
ax \\
ay \\
az+bx \\
by \\
bz \\
0 \\
\end{bmatrix}
โฃ โก โ x y z 0 0 0 โ 0 0 x y z 0 โ โฆ โค โ [ a b โ ] = โฃ โก โ a x a y a z + b x b y b z 0 โ โฆ โค โ
HHZZ: there is another way, which is upsampling the feature maps by a buit-in function, and then use a convolutional layer to learn the weights for the upsampling.
object detection + segmentation ๐
see Mask R-CNN paper
Panoptic Segmentation
end to end Instance Segmentation
key points segmentation & human pose estimation