Presentation is loading. Please wait.

Presentation is loading. Please wait.

Upsampling through Transposed Convolution and Max Unpooling

Similar presentations


Presentation on theme: "Upsampling through Transposed Convolution and Max Unpooling"โ€” Presentation transcript:

1 Upsampling through Transposed Convolution and Max Unpooling

2 Convolution Overview

3 Convolution examples No Padding ๐‘– = 4, ๐‘˜ = 3, ๐‘  = 1 ๐‘Ž๐‘›๐‘‘ ๐‘ = 0
๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก = (๐‘– โˆ’ ๐‘˜) + 1 In this example: Output size = 2 Add information about the figure + output formula

4 Convolution examples Half Padding No Padding
๐‘– =5, ๐‘˜ = 3, ๐‘  = 1 ๐‘Ž๐‘›๐‘‘ ๐‘ =1 ๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก = ๐‘– โˆ’ ๐‘˜ +2๐‘ + 1 In this example: Output size = ๐‘–=5 It is also called Same Padding Add information about the figure + output formula

5 Convolution examples Full Padding No Padding Half Padding
๐‘– =5, ๐‘˜ = 3, ๐‘  = 1 ๐‘Ž๐‘›๐‘‘ ๐‘ =2 ๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก = ๐‘– โˆ’ ๐‘˜ +2๐‘ + 1 In this example: Output size = 7 Add information about the figure + output formula

6 Convolution as a matrix operation
Convolution can be expressed as a matrix operation The convolution matrix โ€œCโ€ is inferred from the kernel The output is obtained by multiplying the โ€œCโ€ with the flattened input column vector and then reshaped

7 Flattening Input

8 Obtaining โ€œCโ€ kernel Slide it over the input ๐‘ค 0,0 ๐‘ค 0,1 ๐‘ค 0,2 ๐‘ค 1,0
๐‘ค 1,1 ๐‘ค 1,2 ๐‘ค 2,0 ๐‘ค 2,1 ๐‘ค 2,2 Slide it over the input

9 Convolution as matrix multiplication
๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก=๐ถ. ๐‘– ๐‘‡ Where ๐‘– is the flattened input feature map. From the previous two slides: Assume the convolution on ๐‘–=4 ๐‘ค๐‘–๐‘กโ„Ž ๐‘˜=3, ๐‘ =1 : We get the output as 4x1 vector Reshape the output

10 Reshaping output 1 2 3 4 1 2 3 4

11 Pooling

12 Pooling Pooling is a down-sampling operation
Summarizes subregions (looses information that is not invertible). Most common functions of pooling are max-pooling and average-pooling

13 Pooling Examples Max-Pooling
Add information about the figure + output formula

14 Pooling Examples Average-Pooling Max-Pooling
Add information about the figure + output formula

15 Transposed Convolution

16 Transposed Convolution
It is the process of going in the opposite direction of convolution It is also called deconvolution or fractionally strided convolutions Expressed mathematically as the transpose of the convolution matrix โ€œ ๐‘ช ๐‘ป โ€ Note that transposed convolution does NOT guarantee to recover the original image. But returns a feature map that has the same dimensions as the original

17 Reshape it to the shape of input
Example Consider the Convolution matrix โ€œCโ€ on slide 7 Consider the flattened output of convolution on slide 9 Output = ๐ถ ๐‘‡ ๐‘–โ€ฒ ๐ถ ๐‘‡ is 16x4 matrix ๐‘–โ€ฒ is 4x1 column vector Output = 16x1 vector Reshape it to the shape of input

18 It is always possible to emulate transposed convolution with direct convolution using the same kernel, given the padding of the input, kernel size, and number of strides of the convolution. For this, we need to manipulate the output of the convolution (it is also the input for transposed convolution) This emulation is for the understanding of the transposed deconvolution as it is inefficient to implement due to the sparsity of the convolution matrix. It is rather implemented in practice using the backpropagation of the original convolution.

19 Transpose convolution as direct convolution

20 No padding, ๐‘ =1, transposed
A convolution described by ๐‘  = 1, ๐‘ = 0 and ๐‘˜ has an associated transposed convolution described by ๐‘˜ โ€ฒ = ๐‘˜, ๐‘  โ€ฒ =๐‘  ๐‘Ž๐‘›๐‘‘ ๐‘ โ€ฒ = ๐‘˜ โˆ’ 1 and its output size is ๐‘œโ€ฒ = ๐‘–โ€ฒ + (๐‘˜ โˆ’ 1)

21 Transposed Convolution can be expressed as
Example Transposed Convolution can be expressed as

22 Zero padding, ๐‘ =1, transposed
A convolution described by ๐‘  = 1, ๐‘ and ๐‘˜ has an associated transposed convolution described by ๐‘˜ โ€ฒ = ๐‘˜, ๐‘  โ€ฒ =๐‘  ๐‘Ž๐‘›๐‘‘ ๐‘ โ€ฒ = ๐‘˜ โˆ’๐‘โˆ’ 1 and its output size is ๐‘œ โ€ฒ = ๐‘– โ€ฒ + ๐‘˜ โˆ’ 1 โˆ’2๐‘

23 Example: Half padding, transposed
Transposed Convolution can be expressed as

24 Example: Full padding, transposed
Transposed Convolution can be expressed as

25 Padded input, non-unit strides, transposed
A convolution described by ๐‘  , ๐‘ and ๐‘˜ And whose input size โ€œ๐’Šโ€ is ๐‘–+2๐‘โˆ’๐‘˜ is a multiple of ๐‘  has an associated transposed convolution described by ๐‘– โ€ฒ , ๐‘˜ โ€ฒ = ๐‘˜, ๐‘  โ€ฒ =๐‘  ๐‘Ž๐‘›๐‘‘ ๐‘ โ€ฒ = ๐‘˜ โˆ’๐‘โˆ’ 1 Where ๐‘–โ€ฒ is the stretched input obtained by adding ๐‘ โˆ’1 zeros between each input unit and its output size is ๐‘œ โ€ฒ = ๐‘ (๐‘– โ€ฒ โˆ’1)+๐‘˜โˆ’2๐‘

26 Example: Padded input with non-unit strides
Transposed Convolution can be expressed as

27 Max-unpooling

28 Max-Unpooling Max-unpooling is an upsampling procedure
Max-Pooling is an non-invertible operation, instead we obtain an approximation. I order to retrieve an approximation, the locations of the maximum values obtained during the max-pooling operation are stored. The approximation is retrieved by placing each input value of the max- unpooling back to its location, and the neighboring values are set to 0.

29 Max-unpooling example

30 Additional Materials

31 Padded input, non-unit strides(odd), transposed
A convolution described by ๐‘  , ๐‘ and ๐‘˜ And whose input size โ€œ๐’Šโ€ is ๐‘–+2๐‘โˆ’๐‘˜ ๐‘š๐‘œ๐‘‘ ๐‘  has an associated transposed convolution described by ๐‘Ž, ๐‘– โ€ฒ , ๐‘˜ โ€ฒ = ๐‘˜, ๐‘  โ€ฒ =1 ๐‘Ž๐‘›๐‘‘ ๐‘ โ€ฒ = ๐‘˜ โˆ’๐‘โˆ’ 1 Where ๐‘–โ€ฒ is the stretched input obtained by adding ๐‘ โˆ’1 zeros between each input unit, and ๐‘Ž=๐‘–+2๐‘โˆ’๐‘˜ where โ€œaโ€ is the no. of zeros added to the bottom and right sides and its output size is ๐‘œ โ€ฒ = ๐‘ (๐‘– โ€ฒ โˆ’1)+๐‘Ž+๐‘˜โˆ’2๐‘

32 Example: Padded input with non-unit strides(odd)
Transposed Convolution can be expressed as

33 Dilated Convolution Inflating the kernel with spaces โ€œ๐‘‘โ€
โ€œ๐‘‘โ€ is a hyper-parameter, which is the number of spaces inserted between kernel elements ๐‘‘=1 corresponds to the normal convolution Used to cheaply increase the receptive field without increasing the kernel size

34 Example of Dialated convolution


Download ppt "Upsampling through Transposed Convolution and Max Unpooling"

Similar presentations


Ads by Google