具有不同过滤器尺寸的 Tensorflow 卷积
Tensorflow Convolution with Different Filter Sizes
我想用不同大小的过滤器对我的数据提要进行卷积,并且想知道如何使用 Tensorflow 实现以下设置
换句话说,我想有两个并行卷积并在展平层中连接它们,就在馈入完全连接层之前,但不确定连接。
有关方法的任何代码片段或来源都将提供极大的帮助!
假设批量大小为 100,图像数据大小为 28x28x1。
import tensorflow as tf
inp = tf.placeholder(tf.float32, shape=[100, 28, 28, 1])
left_branch = tf.layers.conv2d(input=inp, filters=N, kernel_size=[L, M])
right_branch = tf.layers.conv2d(input=inp, filters=P, kernel_size=[R, S])
left_reshape = tf.reshape(left_branch, [100, num_outputs_in_left_branch])
right_reshape = tf.reshape(right_branch, [100, num_outputs_in_right_branch])
combined_branch = tf.concat([left_reshape, right_reshape], axis=1)
combined_branch = tf.layers.dense(combined_branch, num_units_in_dense)
我想用不同大小的过滤器对我的数据提要进行卷积,并且想知道如何使用 Tensorflow 实现以下设置
换句话说,我想有两个并行卷积并在展平层中连接它们,就在馈入完全连接层之前,但不确定连接。
有关方法的任何代码片段或来源都将提供极大的帮助!
假设批量大小为 100,图像数据大小为 28x28x1。
import tensorflow as tf
inp = tf.placeholder(tf.float32, shape=[100, 28, 28, 1])
left_branch = tf.layers.conv2d(input=inp, filters=N, kernel_size=[L, M])
right_branch = tf.layers.conv2d(input=inp, filters=P, kernel_size=[R, S])
left_reshape = tf.reshape(left_branch, [100, num_outputs_in_left_branch])
right_reshape = tf.reshape(right_branch, [100, num_outputs_in_right_branch])
combined_branch = tf.concat([left_reshape, right_reshape], axis=1)
combined_branch = tf.layers.dense(combined_branch, num_units_in_dense)