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)可以采用全连接的方式(即输入层和隐含层直接 ...
随机推荐
- 深入理解JavaScript系列+ 深入理解javascript之执行上下文
http://www.cnblogs.com/TomXu/archive/2011/12/15/2288411.html http://blog.csdn.net/hi_kevin/article/d ...
- FAQ系列 | 解读EXPLAIN执行计划中的key_len
http://imysql.com/2015/10/20/mysql-faq-key-len-in-explain.shtml
- base查找方法的实现JAVA
import java.util.List; import java.util.ArrayList; import java.util.Scanner; /*在一个有序数组中查找一个数的过程,模拟二分 ...
- 如何运用管理员身份运行cmd窗口?
所有程序 → 附件 → 命令行提示符 → 鼠标右键“以管理员身份运行”.
- Magento的布局(Layout),块(Block)和模板(Template)
public function indexAction() { //remove our previous echo //echo 'Hello Index!'; $this->loadLayo ...
- Win10 10586 更新
最近发现,电脑c盘突然少了许多,发现c盘多了个windowsBT文件夹,大概6个G,恩,win10 又推出更新了,版本10586. 不知道为啥,更新时win10 把原来的下载的删除了,大概出了什么错误 ...
- Conversion to Dalvik format failed:Unable toexecute dex: method ID not in [0, 0xffff]: 65536
关于方法数超限,Google官方给出的方案是这样的:https://developer.android.com/intl/zh-cn/tools/building/multidex.html 我也写过 ...
- groupBy
public List groupBy(List list,String flag,String... sortName) throws Exception{ Map<String,List&l ...
- 获取API返回值
//$return=getApiResult($url); // if ($return==200){ // //..... // } function getApiResult($url){ if( ...
- c#安全性、稳定性、高性能需要注重的点
1.弱事件 2.类型安全(包括类型转换时可能的异常) 3.线程安全 5.装箱和拆箱 6.闭包传递局部变量时可能遇到的问题. 7.用于dictionary的键,要同时实现GetHashCode和Equa ...