You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HERE the default upsample kernel size is 3, which is fine when num_res_units is not 0, however when num_res_units is 0 (which is the default) I believe a better default for up_kernel_size is 4 (at least in the 2-D case)
An up_kernel_size value of 4 isn't currently compatible with how we calculate the needed padding value for convolutions. This will in UNet cause output volumes to be 1 too small in every spatial dimension. Is there a specific reasoning behind kernel size 4 for transposed convolutions?
In my experience, when each resolution in the upsampling half of the U-Net consists of only a concatenation and a stride 2 kernel size 3 convolution, artifacts often arise in the image because some pixels don't depend on enough pixels in the previous layer. Specifically, 1/9 of each pixel in each layer only depends on a single pixel in the previous layer. Because each of these pixels has another pixel that depends only on it, a pixel in the final layer that depends only on a 1 pixel wide 'column' that extends all the way up to the 1x1 layer, 4 pixels that each come from a pixel in the 2x2 layer, etc. These of course also depend on the information coming over from the downsampling half through the skip connections, but it hurts performance that they cannot model interactions in the upsampling half.
The issue with even kernel sizes is that it's much harder to produce an output of the expected size because of the need for asymmetric padding of the input volume. Currently with odd kernels for transpose convolutions we automatically choose a padding such that the output dimensions are the input dimensions multiplied by the stride. For regular convolutions the output dimensions are the input dimensions divided by the stride and rounded. This produces regular behaviour in the UNet which lets us define it programmatically. If we use even sized kernels, to do this we need to produce an oversized output and crop it as needed, so the Convolution class would now appear as such:
What we're doing differently here is choosing a clip value self.clip_dims then cropping the the output volume to the expected size. Does this seem like a good idea or does cropping the output have negative consequences?
Activity
ericspod commentedon Mar 6, 2020
An
up_kernel_sizevalue of 4 isn't currently compatible with how we calculate the needed padding value for convolutions. This will in UNet cause output volumes to be 1 too small in every spatial dimension. Is there a specific reasoning behind kernel size 4 for transposed convolutions?The following will induce this error:
HastingsGreer commentedon Mar 7, 2020
In my experience, when each resolution in the upsampling half of the U-Net consists of only a concatenation and a stride 2 kernel size 3 convolution, artifacts often arise in the image because some pixels don't depend on enough pixels in the previous layer. Specifically, 1/9 of each pixel in each layer only depends on a single pixel in the previous layer. Because each of these pixels has another pixel that depends only on it, a pixel in the final layer that depends only on a 1 pixel wide 'column' that extends all the way up to the 1x1 layer, 4 pixels that each come from a pixel in the 2x2 layer, etc. These of course also depend on the information coming over from the downsampling half through the skip connections, but it hurts performance that they cannot model interactions in the upsampling half.
ericspod commentedon Mar 25, 2020
The issue with even kernel sizes is that it's much harder to produce an output of the expected size because of the need for asymmetric padding of the input volume. Currently with odd kernels for transpose convolutions we automatically choose a padding such that the output dimensions are the input dimensions multiplied by the stride. For regular convolutions the output dimensions are the input dimensions divided by the stride and rounded. This produces regular behaviour in the UNet which lets us define it programmatically. If we use even sized kernels, to do this we need to produce an oversized output and crop it as needed, so the
Convolutionclass would now appear as such:What we're doing differently here is choosing a clip value
self.clip_dimsthen cropping the the output volume to the expected size. Does this seem like a good idea or does cropping the output have negative consequences?