【问题标题】:Tensorflow Convolution with Different Filter Sizes具有不同滤波器大小的 TensorFlow 卷积
【发布时间】:2017-07-13 00:55:20
【问题描述】:

我想用不同大小的过滤器对我的数据馈送进行卷积处理,并且想知道如何使用 Tensorflow 实现以下设置

换句话说,我希望有两个并行卷积并将它们连接到展平层中,就在馈入全连接层之前,但不确定连接。

任何代码 sn-p 或方法的来源都会有很大帮助!

【问题讨论】:

    标签: python tensorflow conv-neural-network convolution


    【解决方案1】:

    假设批量大小为 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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-22
      • 2020-03-16
      • 2017-06-23
      • 2017-09-08
      • 1970-01-01
      • 1970-01-01
      • 2019-11-24
      相关资源
      最近更新 更多