tensorflow学习: 卷积函数
来源:互联网 发布:mysql string length 编辑:程序博客网 时间:2024/04/27 23:29
今天学习了tensorflow的卷积函数,做笔记如下:
1
tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None)
参数:
input:
四维张量,
[batch, in_height, in_width, in_channels]
filter:
[filter_height, filter_width, in_channels, out_channels]
strides:
[1,h_stride,v_stride,1],只需要修改中间两项水平垂直移动
padding:
"VALID"和"SAME"两种模式
use_cudnn_on_gpu
:一个可选布尔值,默认情况下是
True
name
: (可选)为这个操作取一个名字
输出:[batch, out_height, out_width, out_channels]
作用:
对一个四维的输入数据
input
和四维的卷积核filter
进行操作,然后对输入数据进行一个二维的卷积操作,最后得到卷积之后的结果。个人理解就是把通道看成一个整体进行卷积。
个人理解:假设输入的彩色图像长度为100,宽度为100,则尺寸为100x100x3。卷积核大小为5×5,输出特征映射(特征图)数为10。
在tf.nn.conv2d中,卷积核形状定义为[width,height,in_channels,out_channels]即 [5, 5 , 3,10]。图像上的卷积核的形状为5x5x3,并且在整个图像上卷积10次,以产生10个不同的特征图。
2
tf.nn.depthwise_conv2d(input, filter, strides, padding, name=None)
参数:
input
:
[batch, in_height, in_width, in_channels]
。
filter
: [filter_height, filter_width, in_channels, channel_multiplier]
。
strides
:[1,h_stride,v_stride,1]
padding
:一个字符串,取值为SAME
或者 VALID
use_cudnn_on_gpu
: 一个可选布尔值,默认情况下是True
name
:(可选)为这个操作取一个名字
输出:
[batch, out_height, out_width,
in_channels * channel_multiplier
]
作用:
depthwise_conv2d
函数将不同的卷积核独立的应用在in_channels
的每个通道上(从通道1
到通道 channel_multiplier
),然后把所以的结果进行汇总。最后输出通道的总数是in_channels * channel_multiplier。个人理解就是把输入通道分开,分别进行卷积,最后合并。
个人理解:
在tf.nn.depthwise_conv2d中,卷积核形状为[width,height,in_channels,channel_multiplier]即[5,5,3,10]。现在输出的方式不同了,卷积形状为5x5x1,对输入图像的3个通道(特征图)分别卷积,则输入图像的每一个通道(特征图)会生成10特征图,最后合并,得到总共30个特征图。channel_multiplier会告诉你每个维度需要应用多少个不同的过滤器。假设输入的彩色图像长度为100,宽度为100,则尺寸为100x100x3。卷积核大小为5×5。
3
tf.nn.separable_conv2d(input, depthwise_filter, pointwise_filter, strides, padding, name=None)
参数:
input
:
[batch, in_height, in_width, in_channels]
depthwise_filter
:[filter_height,filter_width,in_channels,channel_multiplier]
其中,in_channels
的卷积 深度是 1。
pointwise_filter
:[1, 1, channel_multiplier * in_channels, out_channels]
。其中,pointwise_filter
是在depthwise_filter
卷积之后的混合卷积。
strides:
[1,h_stride,v_stride,1], 只需要修改中间两项水平垂直移动
padding:
"VALID"和"SAME", 两种模式
name
:(可选)为这个操作取一个名字
作用:tf.nn.separable_conv2d是利用几个分离的卷积核去做卷积。首先用depthwise_filter做卷积,效果与depthwise_conv2d相同,然后用1x1的卷积核pointwise_filter去做卷积。
参考文章:http://blog.csdn.net/u012436149/article/details/52890859?locationNum=8&fps=1
- tensorflow学习: 卷积函数
- 4.1 Tensorflow:卷积函数
- 学习Tensorflow,反卷积
- tensorflow学习之卷积
- [TensorFlow 学习笔记-04]卷积函数之tf.nn.conv2d
- Tensorflow中卷积函数汇总
- 学习TensorFlow,多层卷积神经网络
- TensorFlow学习--卷积神经网络CNN
- tensorflow学习笔记一之tensorflow实现卷积部分常用函数
- tensorflow学习笔记-卷积,反卷积,空洞卷积
- tensorflow:卷积函数----tf.nn.conv2d
- Tensorflow实战学习(十四)【卷积层、激活函数、池化层、归一化层、高级层】
- Tensorflow实战学习(十三)【卷积、跨度、边界填充、卷积核】
- TensorFlow 深度学习笔记 卷积神经网络
- TensorFlow学习(九):卷积网络CNN
- tensorflow学习笔记(三十二):conv2d_transpose ("解卷积")
- tensorflow卷积神经网络例子学习笔记
- Tensorflow基础:卷积神经网络迁移学习
- android 保存bitmap到本地
- IO流(4)—字符流
- 把数组排成最小的数
- 解决“此实现不是 Windows 平台 FIPS 验证的加密算法的一部分”
- LINQ
- tensorflow学习: 卷积函数
- (BFS)Rescue--HDOJ
- centos 下安装memcached
- 线性筛
- leetcode--Partition List
- 彻底搞清计算结构体大小和数据对齐原则
- 小技巧和学习方向
- UVA
- 互不侵犯king