I want to use dilated convolution in Keras. I found AtrousConv2D
but could not find any definition for it in the Keras docs and when I use
acov=AtrousConv2D((3,3))(image)
it produces this error
init() missing 1 required positional argument: 'kernel_size'
I need dilation convolution but I do not know how can I use this layer or how can I produce this layer myself.
Dilated Convolution: It is a technique that expands the kernel (input) by inserting holes between its consecutive elements. In simpler terms, it is the same as convolution but it involves pixel skipping, so as to cover a larger area of the input.
Dilated convolutions introduce another parameter to convolutional layers called the dilation rate. This defines a spacing between the values in a kernel. A 3x3 kernel with a dilation rate of 2 will have the same field of view as a 5x5 kernel, while only using 9 parameters.
A Dilated Causal Convolution is a causal convolution where the filter is applied over an area larger than its length by skipping input values with a certain step. A dilated causal convolution effectively allows the network to have very large receptive fields with just a few layers.
it preserves the resolution/dimensions of data at the output layer. This is because the layers are dilated instead of pooling, hence the name dilated causal convolutions. it maintains the ordering of data.
The standard keras Conv2D layer supports dilation, you just need to set the dilation_rate
to a value bigger than one. For example:
out = Conv2D(10, (3, 3), dilation_rate=2)(input_tensor)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With