tensorflow: overparametrized convolution error in tf.nn.separable_conv2d

I’m trying to build a network of layers with channel-wise separable convolution. (Just like the paper Factorized CNN)

I’ve found that separable_conv2d and depthwise_conv2d is the two options, and I’m trying out these two.

What I am trying to build is as below

depthwise_filter = tf.get_variable("depth_conv_w", [3,3,64,3], initialize=tf.random_normal_initializer(stddev=np.sqrt(2.0/9/32)))
pointwise_filter = tf.get_variable("point_conv_w", [1,1,192,64], initializer=tf.random_normal_initializer(stddev=np.sqrt(2.0/9/128)))
conv_tensor = tf.nn.depthwise_conv2d(tensor, depthwise_filter, [1,1,1,1], padding='SAME')
conv_tensor = tf.nn.conv2d(conv_tensor, pointwise_filter, [1,1,1,1], padding='VALID')

and it works fine.

However, if I switch the last 2 lines with

conv_tensor=tf.nn.separable_conv2d(tensor,depthwise_filter,pointwise_filter,[1,1,1,1],padding='SAME')

then tensorflow gives me ‘overparamatrized convolution error’ as specified in here

I think channel_multiplier * in_channel is usually larger than or equal to the out_channel. So I believe this is an error.

PS) I can get the same result as the separable_conv2d with depthwise_conv2d and 1x1 convolution. Is there any advantage of using separable_conv2d?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you! Using depthwise convolution followed by pointwise convolution is very slow. Like it takes almost double the time.