Do not be afraid, "convolution" is actually very simple (on)

 

CSDN articles from my blog of the same name, welcome attention ~ the end the scan code

 

Foreword

 

I believe that many times, when we see the "convolution", always forced to look ignorant state, not only because it is more difficult to understand the concept itself, but also because it plays out in the vagaries of different applications the role of people also often confused.

But in fact, these applications are essentially the same thing, to understand the origin of convolution, you can learn by analogy. In fact, I personally convolution understanding, very long time in a state of half-comprehended, as some tricky points of the Fourier transform, not just mistakes in the application, without understanding. But if you really want to do research on machine learning, I think the real theoretical basis of learning before, the essence of the concept must be clear.

Therefore, this article is for students to engineering, science and other fields interested and finishing, in addition to their own understanding, and thank know almost answer other answer on the main watercress (authorized), popular content simple, easy understanding.

 

What is the convolution

Convolution, most of the time we are in various engineering fields, signal fields have seen common nouns, such as system

 

Easy to understand, is that

* = Input Output System

While it might seem just a simple mathematical formula, but it has important physical significance, because such systems are ubiquitous in nature, the best way to calculate the output of a system is the use of convolution. More generally, we have many other application areas:

Statistics, the moving average is a weighted convolution.

Probability theory, statistics two independent variables X and Y and the probability density function is the convolution of the probability density function of X and Y.

Acoustics, echo sound source can be reflected with a reflection effect of the various functions represented by convolution.

Electronic Engineering and signal processing, any of a linear system can be output by the input signal and the system function (impulse response of the system) convolve obtained.

Physics, any of a linear system (in line with the principle of superposition) are present convolution.

Computer science, a convolutional neural network (CNN) is a deep learning algorithms, in recent years, is widely used in pattern recognition, image processing and other fields.

 

这6个领域中,卷积起到了至关重要的作用。在面对一些复杂情况时,作为一种强有力的处理方法,卷积给出了简单却有效的输出。对于机器学习领域,尤其是深度学习,最著名的CNN卷积神经网络(Convolutional Neural Network, CNN),在图像领域取得了非常好的实际效果,始一出现便横扫各类算法。关于CNN的具体内容和理解,将在之后的文章中解释,这里先留一个悬念。

那么,到底什么是卷积呢?

 

小故事

 

首先给大家讲一个关于卷积的小故事:

小明是杭州某互联网大厂的员工,每天996十分辛苦,但小明最近爱上了打台球,经常不在工位。

 

这天,小明的主管让小明改一个需求,小明却到楼下找产品部小丽打台球去了,被主管发现,他非常气愤,扇了小明一巴掌(注意,这就是输入信号,脉冲)。

于是小明脸上会渐渐地(贱贱地)鼓起来一个包,小明的脸就是一个系统,而鼓起来的包就是小明的脸对巴掌的响应。好,这样就和信号系统建立起来意义对应的联系。

下面还需要一些假设来保证论证的严谨:假定小明的脸是线性时不变系统,也就是说,无论什么时候主管打一巴掌,打在小明脸的同一位置(这似乎要求小明的脸足够光滑,如果小明长了很多青春痘,甚至整个脸皮处处连续处处不可导,那难度太大了,我就无话可说了)

小明的脸上总是会在相同的时间间隔内鼓起来一个相同高度的包来,并且假定以鼓起来的包的大小作为系统输出。

 

好了,那么,下面可以进入核心内容——卷积了!

如果小明每天都到公司楼下去打台球,那么主管每天都要扇小明一巴掌,不过当主管打小明一巴掌后,小明5分钟就消肿了,所以时间长了,他甚至就适应这种生活了……如果有一天,主管忍无可忍,叫上公司的251个保安,站成一个圈围住小明,以0.5秒的间隔开始不间断的扇小明的过程。

这样问题就来了,第一次扇小明鼓起来的包还没消肿,第二个巴掌就来了,小明脸上的包就可能鼓起来两倍高,大家不断扇小明,脉冲不断作用在小明脸上,效果不断叠加了,这样这些效果就可以求和了,结果就是小明脸上的包的高度随时间变化的一个函数了(注意理解)

 

如果主管再狠一点,频率越来越高,以至于小明都辨别不清时间间隔了,那么,求和就变成积分了。可以这样理解,在这个过程中的某一固定的时刻,小明的脸上的包的鼓起程度和什么有关呢?

和之前每次打小明都有关!但是各次的贡献是不一样的,越早打的巴掌,贡献越小,所以这就是说,某一时刻的输出是之前很多次输入乘以各自的衰减系数之后的叠加而形成某一点的输出,然后再把不同时刻的输出点放在一起,形成一个函数,这就是卷积,卷积之后的函数就是小明脸上的包的大小随时间变化的函数。

本来小明的包几分钟就可以消肿,可是如果连续打,几个小时也消不了肿了,这难道不是一种平滑过程么?反映到剑桥大学的公式上,f(a)就是第a个巴掌,g(x-a)就是第a个巴掌在x时刻的作用程度,乘起来再叠加就ok了。

又比如,小明因为被主管虐待,所以一怒之下还手,结果被保安驾出了公司,还没有拿到N+1赔偿。他只好通过理财的方式来达到财务自由,希望出任CEO赢取白富美走上人生巅峰,于是他把所有存款100元钱存入了XXP2P理财,年利率是5%,按复利计算(即将每一年所获利息加入本金,以计算下一年的利息),那么在五年之后他能拿到的钱数是

 

如下表所示

 

将这笔钱存入银行的一年之后,小明又往银行中存入了100元钱,年利率仍为5%,那么这笔钱按复利计算,到了第五年,将收回的钱数是,

 

我们将这一结果作为新的一行加入上面的表格中:

 

以此类推,如果小明每年都往银行中存入新的100元钱,那么这个收益表格将是这样的

 

可见,最终小明拿到的钱将等于他各年存入的钱分别计算复利之后得到的钱数的总和,即:

 

用求和符号来简化这个公式,可以得到:

 

在上式中f(i)为小明的存钱函数,g(i)为存入银行的每一笔钱的复利计算函数。在这里,小明最终得到的钱就是他的存钱函数和复利计算函数的卷积。

为了更清晰地看到这一点,我们将这个公式推广到连续的情况,也就是说,小明在从0到t的这一段时间内,每时每刻都往银行里存钱,他的存钱函数为

 

而银行也对他存入的每一笔钱按复利公式计算收益:

 

则小明到时间t将得到的总钱数为:

 

这也就是卷积的表达式了,上式可以记为

 
 

补充

 

相信通过上面这个例子,大家应该能够很清晰地记住卷积公式了。下面我们再展开说两句:

如果我们将小明的存款函数视为一个信号发生(也就是激励)的过程,而将复利函数

 

视为一个系统对信号的响应函数(也就是响应),那么二者的卷积

 

就可以看做是在t时刻对系统进行观察,得到的观察结果(也就是输出)将是过去产生的所有信号经过系统的「处理/响应」后得到的结果的叠加,这也就是卷积的物理意义了。

讲到这里,小伙伴们是不是已经对卷积有了一个清晰而深刻的认识呢?在下一篇文章中,我将会用更加规范化的例子来讲解卷积的意义,同时进行一些理论形式的推导,最后会给出卷积在计算机视觉上的应用方法~

 

 

 

 
 

Guess you like

Origin www.cnblogs.com/y1ran/p/12119019.html