2D image convolution
在学习cnn的过程中,对convolution的概念真的很是模糊,本来在学习图像处理的过程中,已对convolution有所了解,它与correlation是有不同的,因为convolution = correlation + filp over in both horizontal + vertical
但在CNN中,明明只是进行了correlation,但却称之为convolution,实在不解
下面, 将图像处理中的convolution重新整理记录
因为网络关于这部分的解释很多,这里直接借用其他 参考
“A convolution is done by multiplying a pixel's and its neighboring pixels color value by a matrix”, 这里的matrix就是convoluiton kernel (usually a small matrix of numbers)
这里假设图像是3*3,kernel也是3*3,实际计算中,有时为了使得卷积结果与原图像一致,会对原图像进行padding操作
原图像x:
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 2 | 3 | 0 |
| 0 | 4 | 5 | 6 | 0 |
| 0 | 7 | 8 | 9 | 0 |
| 0 | 0 | 0 | 0 | 0 |
| x(0,0) | x(0,1) | x(0,2) | x(0,3) | x(0,4) |
| x(1,0) | x(1,1) | x(1,2) | x(1,3) | x(1,4) |
| x(2,0) | x(2,1) | x(2,2) | x(2,3) | x(2,4) |
| x(3,0) | x(3,1) | x(3,2) | x(3,3) | x(3,4) |
| x(4,0) | x(4,1) | x(4,2) | x(4,3) | x(4,4) |
卷积核h:
| -1 | -2 | -1 |
| 0 | 0 | 0 |
| 1 | 2 | 1 |
| h(1,1) | h(1,2) | h(1,3) |
| h(2,1) | h(2,2) | h(2,3) |
| h(3,1) | h(3,2) | h(3,3) |
具体的过程为:
将h先上下翻转,再左右翻转,然后,与x进行correlation运算
| 1 | 2 | 1 |
| 0 | 0 | 0 |
| -1 | -2 | -1 |
| h(3,3) | h(3,2) | h(3,1) |
| h(2,3) | h(2,2) | h(2,1) |
| h(1,1) | h(1,2) | h(1,1) |
输出结果y:3*3
| x(0,0) | x(0,1) | x(0,2) | x(0,3) | x(0,4) |
| x(1,0) | x(1,1) | x(1,2) | x(1,3) | x(1,4) |
| x(2,0) | x(2,1) | x(2,2) | x(2,3) | x(2,4) |
| x(3,0) | x(3,1) | x(3,2) | x(3,3) | x(3,4) |
| x(4,0) | x(4,1) | x(4,2) | x(4,3) | x(4,4) |
依次覆盖,对应元素相乘
| h(3,3) | h(3,2) | h(3,1) |
| h(2,3) | h(2,2) | h(2,1) |
| h(1,1) | h(1,2) | h(1,1) |
y(1,1) = h(3,3) *x(0,0) + h(3,2) *x(0,1) + h(3,1) *x(0,2) +
h(2,3) *x(1,0) + h(2,2) *x(1,1) + h(2,1) *x(1,2) +
h(1,3) *x(2,0) + h(1,2) *x(2,1) + h(1,1) *x(2,2)
其他元素类似
注:In image processing, a kernel, convolution matrix, or mask is a small matrix useful for blurring, sharpening, embossing, edge-detection, and more. This is accomplished by means of convolution between a kernel and an image.
2D image convolution的更多相关文章
- Understanding Convolution in Deep Learning
Understanding Convolution in Deep Learning Convolution is probably the most important concept in dee ...
- 转置卷积Transposed Convolution
转置卷积Transposed Convolution 我们为卷积神经网络引入的层,包括卷积层和池层,通常会减小输入的宽度和高度,或者保持不变.然而,语义分割和生成对抗网络等应用程序需要预测每个像素的值 ...
- TensorflowTutorial_二维数据构造简单CNN
使用二维数据构造简单卷积神经网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 图像和一些时序数据集都可以用二维数据的形式表现,我们此次使用随机分布的二位数据构造一个简单的CNN-网络卷积- ...
- Intel DAAL AI加速——神经网络
# file: neural_net_dense_batch.py #================================================================= ...
- tensorflow: a Implementation of rotation ops (旋转的函数实现方法)
tensorflow 旋转矩阵的函数实现方法 关键字: rot90, tensorflow 1. 背景 在做数据增强的操作过程中, 很多情况需要对图像旋转和平移等操作, 针对一些特殊的卷积(garbo ...
- gdc skin
https://www.gdcvault.com/play/1024410/Achieving-High-Quality-Low-Cost 这篇是教美术怎么用做地形那种方法 复用贴图 做skin的 做 ...
- Winograd Convolution 推导 - 从1D到2D
Winograd Convolution 推导 - 从1D到2D 姚伟峰 http://www.cnblogs.com/Matrix_Yao/ Winograd Convolution 推导 - 从1 ...
- Deep Learning 10_深度学习UFLDL教程:Convolution and Pooling_exercise(斯坦福大学深度学习教程)
前言 理论知识:UFLDL教程和http://www.cnblogs.com/tornadomeet/archive/2013/04/09/3009830.html 实验环境:win7, matlab ...
- Deep Learning 学习随记(七)Convolution and Pooling --卷积和池化
图像大小与参数个数: 前面几章都是针对小图像块处理的,这一章则是针对大图像进行处理的.两者在这的区别还是很明显的,小图像(如8*8,MINIST的28*28)可以采用全连接的方式(即输入层和隐含层直接 ...
随机推荐
- Foundation: NSNotificationCenter
一个NSNotificationCenter对象(通知中心)提供了在程序中广播消息的机制,它实质上就是一个通知分发表.这个分发表负责维护为各个通知注册的观察者,并在通知到达时,去查找相应的观察者,将通 ...
- Const和readonly这间的区别和相同处
相同: const和readonly都是用来修饰常量的 不同: const 在申明之前就要对它初始化,readonly修饰的常量则可以到构造函数中初始化 const注重的是效率但是readonly注 ...
- css制作小三角
视觉稿中经常有些小三角,如下图.每次用图片做太不方便了,我们看看用css实现的效果(支持ie6,7哦) <style> /*border实现三角*/ /*箭头向上*/ .arrow-top ...
- nyoj349 poj1094 Sorting It All Out(拓扑排序)
nyoj349 http://acm.nyist.net/JudgeOnline/problem.php?pid=349poj1094 http://poj.org/problem?id=10 ...
- Ext.Net学习笔记10:Ext.Net ComboBox用法
ComboBox是最常用的控件之一,它与HTML中的Select控件很像,但可以进行多选.自定义显示格式.分页等. ComboBox用法 <ext:ComboBox runat="se ...
- pop动画大全 只能时代程序员更应该关心效果而不是冷冰冰的代码
下载地址 https://pan.baidu.com/s/1o8pQWau
- C语言链表全操作(增,删,改,查,逆序,递增排序,递减排序,链式队列,链式栈)
一,数据结构——链表全操作: 链表形式: 其中,每个节点(Node)是一个结构体,这个结构体包含数据域,指针域,数据域用来存放数据,指针域则用来指向下一个节点: 特别说明:对于单链表,每个节点(Nod ...
- 讲解最好的Python正则表达式
这篇文章转载自:http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html#!comments 这里非常感谢作者无私的贡献自己的成果. 请大 ...
- Poj 2115 C Looooops(exgcd变式)
C Looooops Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22704 Accepted: 6251 Descripti ...
- IniParse解析类
说明 iniParse这个类是一个解析ini文件的类,他的功能和Windows下GetPrivateProfileString的功能一样,可以很方便的保存读取配置. 当然他不是只有GetPrivate ...