回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我正在尝试arxiv最近的一项工作,名为“<a href="http://128.84.21.199/abs/1608.04337" rel="noreferrer">Factorized CNN</a>”</p>
<p>主要讨论了空间分离卷积(深度卷积)和信道线性投影(1x1conv)相结合的卷积运算速度。在</p>
<p><a href="http://i.stack.imgur.com/qaSdE.png" rel="noreferrer">this is the figure for their conv layer architecture</a></p>
<p>我发现我可以用tf.nn.depthwise_conv2d和1x1卷积,或可分离变压器一</p>
<p>以下是我的实现:</p>
<p/><div^{cl1}$
<div^{cl2}$
<pre class="snippet-code-html lang-html prettyprint-override"><code>#conv filter for depthwise convolution
depthwise_filter = tf.get_variable("depth_conv_w", [3,3,64,1], initializer=tf.random_normal_initializer(stddev=np.sqrt(2.0/9/32)))
#conv filter for linear channel projection
pointwise_filter = tf.get_variable("point_conv_w", [1,1,64,64], initializer=tf.random_normal_initializer(stddev=np.sqrt(2.0/1/64)))
conv_b = tf.get_variable("conv_b", [64], initializer=tf.constant_initializer(0))
#depthwise convolution, with multiplier 1
conv_tensor = tf.nn.relu(tf.nn.depthwise_conv2d(tensor, depthwise_filter, [1,1,1,1], padding='SAME'))
#linear channel projection with 1x1 convolution
conv_tensor = tf.nn.bias_add(tf.nn.conv2d(conv_tensor, pointwise_filter, [1,1,1,1], padding='VALID'), conv_b)
#residual
tensor = tf.add(tensor, conv_tensor)</code></pre>
</div>
</div>
<p>这应该比原来的3x3x64->;64通道卷积快9倍左右。在</p>
<p>但是,我无法体验到任何绩效改进。在</p>
<p>我必须假设我做得不对,或者tensorflow的实现有问题。在</p>
<p>因为很少有使用depthwise_conv2d的例子,我把这个问题留在这里。在</p>
<p>这种慢速正常吗?还是有什么错误?在</p>