I want to use depthwise_conv2d from Tensorflow. As far as I understand it now, it performs regular 2D convolutions for every single channel, each with a depth_multiplier
number of features.
Then I should expect, if depth_multiplier = 1
, to have the number of input channels the same as the number of output channels. But why can I have 256 input channels and 512 output channels? Where do the extra channels come from?
The filters is of size[filter_height, filter_width, in_channels, channel_multiplier]
. If the channel_multiplier = 1
, then you get the same number of input channels as output. If its N
, then you get N*input_channels
as output channels
, with each input channe
l convolved with N
filters.
For example,
inputs = tf.Variable(tf.random_normal((20, 64,64,100)))
filters = tf.Variable(tf.random_normal((5,5,100,10)))
out = tf.nn.depthwise_conv2d(
inputs,
filters,
strides=[1,1,1,1],
padding='SAME')
you get out
of shape: shape=(20, 64, 64, 1000)
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