【深度学习】CNN-卷积概念

1 定义

函数f和g的卷积(Convolution)的定义如下:

(f∗g)(t)=def ∫−∞∞f(τ)g(t−τ)dτ=∫−∞∞f(t−τ)g(τ)dτ.{\displaystyle {\begin{aligned}(f*g)(t)&\,{\stackrel {\mathrm {def} }{=}}\ \int _{-\infty }^{\infty }f(\tau )\,g(t-\tau )\,d\tau \\&=\int _{-\infty }^{\infty }f(t-\tau )\,g(\tau )\,d\tau .\end{aligned}}}【深度学习】CNN-卷积概念
上式中的t可用x替代。

f*g表示函数g经过翻转和平移与函数f的重叠部分的积分。随着 x 的不同取值,这个积分就定义了一个新函数h(x),称为函数f 与g 的卷积,记为h(x)=(f*g)(x)。


2 物理含义

  1. Express each function in terms of a dummy variable τ.{\displaystyle \tau .}【深度学习】CNN-卷积概念
  2. Reflect one of the functions: g(τ){\displaystyle g(\tau )}【深度学习】CNN-卷积概念g(−τ).{\displaystyle g(-\tau ).}【深度学习】CNN-卷积概念
  3. Add a time-offset, t, which allows g(t−τ){\displaystyle g(t-\tau )}【深度学习】CNN-卷积概念 to slide along the τ{\displaystyle \tau }【深度学习】CNN-卷积概念-axis.
  4. Start t at −∞ and slide it all the way to +∞. Wherever the two functions intersect, find the integral of their product. In other words, compute a sliding, weighted-sum of function f(τ){\displaystyle f(\tau )}【深度学习】CNN-卷积概念, where the weighting function is g(−τ).{\displaystyle g(-\tau ).}【深度学习】CNN-卷积概念
The resulting waveform (not shown here) is the convolution of functions f and g.

【深度学习】CNN-卷积概念

3 例子

两个向量卷积,说白了就是多项式乘法。下面用个矩阵例子说明其工作原理。

a =
     8     1     6
     3     5     7
     4     9     2

b =
     2     3     2
     1     6     1
     2     1     5


矩阵a和矩阵b的卷积就是,把矩阵b上下翻转得到矩阵b',然后让b'从矩阵a的顶部开始逐步往下平移,求取它们交集部分的积分(多项式乘积),作为卷积结果矩阵中的一行。多项式求解步骤如下。


【深度学习】CNN-卷积概念

所得卷积矩阵为:

a*b =

    16    26    31    20    12
    14    68    55    68    20
    27    63   132    82    41
    10    46    94    53    37
     8    22    33    47    10




转载自:http://blog.sciencenet.cn/blog-268138-383185.html