Object Detection
Semantic
segmentation with
U-Net
Object Detection vs. Semantic Segmentation
Input image
Object Detection
Semantic Segmentation
Motivation for U-Net
Chest X-Ray
Brain MRI
[Novikov et al., 2017, Fully Convolutional Architectures for Multi-Class Segmentation in Chest Radiographs]
[Dong et al., 2017, Automatic Brain Tumor Detection and Segmentation Using U-Net Based Fully Convolutional Networks ]
Per-pixel class labels
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000001111100000000000
001111111111111100000000
001111111111111111111110
001111111111111111111110
000011100000000000111000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
1. Car
0. Not Car
Per-pixel class labels
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
22 22 2 2 21 1 1 1 1 1 2 22 2 2 2 2 2 2 2 2
2 21 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2
2 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
2 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
333311133333333333111 333
333333333333333333333333
333333333333333333333333
333333333333333333333333
333333333333333333333333
1. Car
2. Building
3. Road
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
222222222222222222222222
2 2 2 2 2 2 21 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2
2 21 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2
2 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
2 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
333311133333333333111 333
333333333333333333333333
333333333333333333333333
333333333333333333333333
333333333333333333333333
Segmentation Map
Deep learning for semantic segmentation
๐ฆ!
๐ฆ
เทโเท
Object Detection
Transpose
convolutions
Transpose convolution
Normal Convolution
*
=
*
=
Transpose Convolution
Transpose convolution
1
2
2
1
3
2
0
2
2
2
2
0
2
2
2
2
1
1
1
Ignore the padding!
2
2
0×2
1×2
2×2
1×2
2
2×2
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
4×4
Transpose convolution
2
1
3
2
1
2
1
2
0
1
0
2
1
0
2
4
2
2×2
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
4×4
Transpose convolution
1
2
2
1
3
2
0
1
1
1
2
0
2
1
1
1
1
1
1
Ignore the padding!
1
1
0
1
4
2
0×1
1×1
2
2×1
1×1
+2×1
+0×1
2×2
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
4×4
Transpose convolution
2
1
3
2
1
2
1
2
0
1
0
2
1
0
4
0
1
4
2
2
1
2×2
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
4×4
Transpose convolution
1
2
2
1
3
2
0
3
3
3
2
0
2
3
3
3
1
1
1
3
3
0
4
0
1
4
2
2
1
0×3
1×3
2×3
1×3
3
+2×3 +1×3
2×2
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
4×4
Transpose convolution
2
1
3
2
1
2
1
2
0
1
0
2
1
2×2
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
0
4
0
1
10
5
2
1
0
3
6
3
4×4
Transpose convolution
1
2
2
1
3
2
0
2
2
2
2
0
2
2
2
2
1
1
1
2
2
0
4
0
1
10
5
2
1
3
0×2
1×2
3
2×2
1×2
2
0
2×2
6
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
+1×2 +2×2 +1×2
+2×2
+0×2
4×4
Transpose convolution
2
1
3
2
1
2
1
2
0
1
0
2
1
2×2
๐๐๐๐ก๐๐ ๐ = 3
๐๐๐๐๐๐๐ ๐ = 1
๐ ๐ก๐๐๐๐ ๐ = 2
https://asiltureli.github.io/Convolution-Layer-Calculator/
0
4
0
1
10
7
6
3
0
7
0
2
6
3
4
2
4×4
Transpose Convolution
Transpose Convolution: Kernel Size
Normal Convolution
torch.nn.ConvTranspose2d
Transpose Convolution
Transpose Convolution: Strides
Normal Convolution
torch.nn.ConvTranspose2d
Transpose Convolution
Transpose Convolution: Padding
Normal Convolution
torch.nn.ConvTranspose2d
Transpose Convolution
Details: https://medium.com/data-science/understand-transposed-convolutions-and-build-your-own-transposedconvolution-layer-from-scratch-4f5d97b2967
Object Detection
U-Net architecture
intuition
Deep learning for semantic segmentation
Skip connection
Object Detection
U-Net architecture
U-Net
hxwx3
h x w x # classes
Conv, RELU
Max Pool
Trans Conv
Skip Connection
Conv (1x1)
[Ronneberger et al., 2015, U-Net: Convolutional Networks for Biomedical Image Segmentation]
U-Net
Conv, RELU
Max Pool
Trans Conv
Skip Connection
Conv (1x1)
[Ronneberger et al., 2015, U-Net: Convolutional Networks for Biomedical Image Segmentation]
U-Net
U-Net
•Contracting path: aims to
decrease the spatial
dimensions of the image,
while also capturing
relevant information about
the image.
U-Net
•Expanding path: aims to
upsample the feature map
and produce a relevant
segmentation map using
the patterns learnt in the
contracting path.