tensorflow详解-tf.nn.conv2d(),tf.nn.max_pool()

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Miss_yan/article/details/78123248

 tf.nn.conv2d() 函数来计算卷积,weights 作为滤波器,[1, 2, 2, 1] 作为 strides。TensorFlow 对每一个 input 维度使用一个单独的 stride 参数,[batch, input_height, input_width, input_channels]。我们通常把 batch  input_channels strides 序列中的第一个第四个)的 stride 设为 1


tf.nn.max_pool() 函数实现最大池化时, ksize参数是滤波器大小,strides参数是步长。2x2 的滤波器配合 2x2 的步长是常用设定。

ksize 和 strides 参数也被构建为四个元素的列表,每个元素对应 input tensor 的一个维度 ([batch, height, width, channels]),对 ksize 和 strides 来说,batch 和 channel 通常都设置成 1


池化层并不是很受青睐。部分原因是:

  • 现在的数据集又大又复杂,我们更关心欠拟合问题。
  • Dropout 是一个更好的正则化方法。
  • 池化导致信息损失。想想最大池化的例子,n 个数字中我们只保留最大的,把余下的 n-1 完全舍弃了。


猜你喜欢

转载自blog.csdn.net/Miss_yan/article/details/78123248