当前位置: 首页 > news >正文

wordpress page post成都seo培训

wordpress page post,成都seo培训,苏州广告公司招聘,什么软件推广效果好🌈个人主页: 鑫宝Code 🔥热门专栏: 闲话杂谈| 炫酷HTML | JavaScript基础 ​💫个人格言: "如无必要,勿增实体" 文章目录 CNN的数学基础1. 引言2. 卷积运算2.1 连续卷积2.2 离散卷积2.3 互相关 3. 激活函…

鑫宝Code

🌈个人主页: 鑫宝Code
🔥热门专栏: 闲话杂谈| 炫酷HTML | JavaScript基础
💫个人格言: "如无必要,勿增实体"


文章目录

  • CNN的数学基础
    • 1. 引言
    • 2. 卷积运算
      • 2.1 连续卷积
      • 2.2 离散卷积
      • 2.3 互相关
    • 3. 激活函数
      • 3.1 ReLU (Rectified Linear Unit)
      • 3.2 Sigmoid
      • 3.3 Tanh
    • 4. 池化操作
      • 4.1 最大池化
      • 4.2 平均池化
    • 5. 损失函数
      • 5.1 均方误差(MSE)
      • 5.2 交叉熵
    • 6. 反向传播算法
      • 6.1 链式法则
      • 6.2 卷积层的反向传播
      • 6.3 池化层的反向传播
    • 7. 优化算法
      • 7.1 随机梯度下降(SGD)
      • 7.2 动量法
      • 7.3 Adam
    • 8. 正则化技术
      • 8.1 L2正则化
      • 8.2 Dropout
    • 9. 初始化方法
      • 9.1 Xavier初始化
      • 9.2 He初始化
    • 10. 结论

CNN的数学基础

1. 引言

卷积神经网络(Convolutional Neural Network,CNN)作为深度学习中的重要模型,其强大性能背后蕴含着丰富的数学原理。本文将深入探讨CNN的数学基础,包括卷积运算、激活函数、池化操作、反向传播算法以及优化方法等核心概念。通过对这些数学基础的理解,我们可以更好地把握CNN的本质,为进一步优化和创新CNN模型奠定基础。
在这里插入图片描述

2. 卷积运算

2.1 连续卷积

在数学中,连续函数的卷积定义如下:

( f ∗ g ) ( t ) = ∫ − ∞ ∞ f ( τ ) g ( t − τ ) d τ (f * g)(t) = \int_{-\infty}^{\infty} f(\tau)g(t-\tau)d\tau (fg)(t)=f(τ)g(tτ)dτ

其中, f f f g g g是两个可积函数, ∗ * 表示卷积操作。

2.2 离散卷积

在CNN中,我们主要关注离散卷积。对于二维离散卷积,其定义为:

( I ∗ K ) ( i , j ) = ∑ m ∑ n I ( m , n ) K ( i − m , j − n ) (I * K)(i,j) = \sum_{m}\sum_{n} I(m,n)K(i-m,j-n) (IK)(i,j)=mnI(m,n)K(im,jn)

其中, I I I是输入(如图像), K K K是卷积核(或称滤波器)。

2.3 互相关

实际上,CNN中使用的"卷积"操作更准确地说是互相关(cross-correlation):

( I ⋆ K ) ( i , j ) = ∑ m ∑ n I ( i + m , j + n ) K ( m , n ) (I \star K)(i,j) = \sum_{m}\sum_{n} I(i+m,j+n)K(m,n) (IK)(i,j)=mnI(i+m,j+n)K(m,n)

这里 ⋆ \star 表示互相关操作。与真正的卷积相比,互相关不需要将卷积核翻转。

在这里插入图片描述

3. 激活函数

激活函数为神经网络引入非线性,增强模型的表达能力。

3.1 ReLU (Rectified Linear Unit)

ReLU是目前最常用的激活函数之一:

f ( x ) = max ⁡ ( 0 , x ) f(x) = \max(0, x) f(x)=max(0,x)

其导数为:

f ′ ( x ) = { 1 , if  x > 0 0 , if  x ≤ 0 f'(x) = \begin{cases} 1, & \text{if } x > 0 \\ 0, & \text{if } x \leq 0 \end{cases} f(x)={1,0,if x>0if x0

3.2 Sigmoid

Sigmoid函数将输入映射到(0, 1)区间:

σ ( x ) = 1 1 + e − x \sigma(x) = \frac{1}{1 + e^{-x}} σ(x)=1+ex1

其导数为:

σ ′ ( x ) = σ ( x ) ( 1 − σ ( x ) ) \sigma'(x) = \sigma(x)(1 - \sigma(x)) σ(x)=σ(x)(1σ(x))

3.3 Tanh

Tanh函数将输入映射到(-1, 1)区间:

tanh ⁡ ( x ) = e x − e − x e x + e − x \tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} tanh(x)=ex+exexex

其导数为:

tanh ⁡ ′ ( x ) = 1 − tanh ⁡ 2 ( x ) \tanh'(x) = 1 - \tanh^2(x) tanh(x)=1tanh2(x)

4. 池化操作

池化操作用于降低特征图的空间分辨率,减少参数数量和计算量。

4.1 最大池化

最大池化选择池化窗口内的最大值:

y i j = max ⁡ ( m , n ) ∈ R i j x m n y_{ij} = \max_{(m,n) \in R_{ij}} x_{mn} yij=(m,n)Rijmaxxmn

其中, R i j R_{ij} Rij是以 ( i , j ) (i,j) (i,j)为中心的池化窗口。

4.2 平均池化

平均池化计算池化窗口内的平均值:

y i j = 1 ∣ R i j ∣ ∑ ( m , n ) ∈ R i j x m n y_{ij} = \frac{1}{|R_{ij}|} \sum_{(m,n) \in R_{ij}} x_{mn} yij=Rij1(m,n)Rijxmn
在这里插入图片描述

5. 损失函数

损失函数衡量模型预测与真实标签之间的差距。

5.1 均方误差(MSE)

对于回归问题,常用均方误差:

L M S E = 1 N ∑ i = 1 N ( y i − y ^ i ) 2 L_{MSE} = \frac{1}{N} \sum_{i=1}^N (y_i - \hat{y}_i)^2 LMSE=N1i=1N(yiy^i)2

其中, y i y_i yi是真实值, y ^ i \hat{y}_i y^i是预测值, N N N是样本数量。

5.2 交叉熵

对于分类问题,常用交叉熵损失:

L C E = − ∑ i = 1 C y i log ⁡ ( y ^ i ) L_{CE} = -\sum_{i=1}^C y_i \log(\hat{y}_i) LCE=i=1Cyilog(y^i)

其中, C C C是类别数, y i y_i yi是真实标签(one-hot编码), y ^ i \hat{y}_i y^i是预测概率。

6. 反向传播算法

反向传播是训练神经网络的核心算法,用于计算损失函数对各层参数的梯度。

6.1 链式法则

反向传播基于链式法则:

∂ L ∂ w = ∂ L ∂ y ⋅ ∂ y ∂ x ⋅ ∂ x ∂ w \frac{\partial L}{\partial w} = \frac{\partial L}{\partial y} \cdot \frac{\partial y}{\partial x} \cdot \frac{\partial x}{\partial w} wL=yLxywx

其中, L L L是损失函数, w w w是待优化的参数。

6.2 卷积层的反向传播

对于卷积层,我们需要计算损失函数对卷积核权重的梯度:

∂ L ∂ K = ∑ i , j ∂ L ∂ Y i j ⋅ X i j \frac{\partial L}{\partial K} = \sum_{i,j} \frac{\partial L}{\partial Y_{ij}} \cdot X_{ij} KL=i,jYijLXij

其中, K K K是卷积核, Y Y Y是输出特征图, X X X是输入特征图。

6.3 池化层的反向传播

对于最大池化,梯度只传递给池化窗口中的最大值元素:

∂ L ∂ x m n = { ∂ L ∂ y i j , if  x m n = max ⁡ ( m , n ) ∈ R i j x m n 0 , otherwise \frac{\partial L}{\partial x_{mn}} = \begin{cases} \frac{\partial L}{\partial y_{ij}}, & \text{if } x_{mn} = \max_{(m,n) \in R_{ij}} x_{mn} \\ 0, & \text{otherwise} \end{cases} xmnL={yijL,0,if xmn=max(m,n)Rijxmnotherwise

对于平均池化,梯度平均分配给池化窗口内的所有元素:

∂ L ∂ x m n = 1 ∣ R i j ∣ ∂ L ∂ y i j \frac{\partial L}{\partial x_{mn}} = \frac{1}{|R_{ij}|} \frac{\partial L}{\partial y_{ij}} xmnL=Rij1yijL

7. 优化算法

优化算法用于更新网络参数,最小化损失函数。

7.1 随机梯度下降(SGD)

最基本的优化算法是随机梯度下降:

w t + 1 = w t − η ∇ L ( w t ) w_{t+1} = w_t - \eta \nabla L(w_t) wt+1=wtηL(wt)

其中, η \eta η是学习率, ∇ L ( w t ) \nabla L(w_t) L(wt)是损失函数关于参数 w t w_t wt的梯度。

7.2 动量法

动量法引入了历史梯度信息,加速收敛:

v t + 1 = γ v t + η ∇ L ( w t ) w t + 1 = w t − v t + 1 \begin{aligned} v_{t+1} &= \gamma v_t + \eta \nabla L(w_t) \\ w_{t+1} &= w_t - v_{t+1} \end{aligned} vt+1wt+1=γvt+ηL(wt)=wtvt+1

其中, γ \gamma γ是动量系数。

7.3 Adam

Adam结合了动量法和自适应学习率:

m t = β 1 m t − 1 + ( 1 − β 1 ) ∇ L ( w t ) v t = β 2 v t − 1 + ( 1 − β 2 ) ( ∇ L ( w t ) ) 2 m ^ t = m t 1 − β 1 t v ^ t = v t 1 − β 2 t w t + 1 = w t − η v ^ t + ϵ m ^ t \begin{aligned} m_t &= \beta_1 m_{t-1} + (1-\beta_1) \nabla L(w_t) \\ v_t &= \beta_2 v_{t-1} + (1-\beta_2) (\nabla L(w_t))^2 \\ \hat{m}_t &= \frac{m_t}{1-\beta_1^t} \\ \hat{v}_t &= \frac{v_t}{1-\beta_2^t} \\ w_{t+1} &= w_t - \frac{\eta}{\sqrt{\hat{v}_t} + \epsilon} \hat{m}_t \end{aligned} mtvtm^tv^twt+1=β1mt1+(1β1)L(wt)=β2vt1+(1β2)(L(wt))2=1β1tmt=1β2tvt=wtv^t +ϵηm^t

其中, β 1 \beta_1 β1 β 2 \beta_2 β2是衰减率, ϵ \epsilon ϵ是一个小常数。

8. 正则化技术

正则化用于防止过拟合,提高模型的泛化能力。

8.1 L2正则化

L2正则化在损失函数中添加参数的平方和:

L r e g = L + λ 2 ∑ w w 2 L_{reg} = L + \frac{\lambda}{2} \sum_w w^2 Lreg=L+2λww2

其中, λ \lambda λ是正则化系数。

8.2 Dropout

Dropout随机丢弃一部分神经元,可以看作是集成学习的一种形式。在训练时:

y = f ( W x ) ⊙ m , m i ∼ Bernoulli ( p ) y = f(Wx) \odot m, \quad m_i \sim \text{Bernoulli}(p) y=f(Wx)m,miBernoulli(p)

其中, ⊙ \odot 表示元素wise乘法, m m m是一个二元掩码, p p p是保留神经元的概率。
在这里插入图片描述

9. 初始化方法

参数初始化对CNN的训练至关重要。

9.1 Xavier初始化

Xavier初始化适用于tanh激活函数:

W ∼ U ( − 6 n i n + n o u t , 6 n i n + n o u t ) W \sim U\left(-\sqrt{\frac{6}{n_{in} + n_{out}}}, \sqrt{\frac{6}{n_{in} + n_{out}}}\right) WU(nin+nout6 ,nin+nout6 )

其中, n i n n_{in} nin n o u t n_{out} nout分别是输入和输出的神经元数量。

9.2 He初始化

He初始化适用于ReLU激活函数:

W ∼ N ( 0 , 2 n i n ) W \sim N\left(0, \sqrt{\frac{2}{n_{in}}}\right) WN(0,nin2 )

10. 结论

本文深入探讨了CNN的数学基础,包括卷积运算、激活函数、池化操作、反向传播算法、优化方法、正则化技术和初始化方法等核心概念。这些数学原理构成了CNN的理论基础,对于理解CNN的工作原理、改进现有模型和设计新的架构都至关重要。

随着深度学习的不断发展,CNN的数学理论也在不断完善和扩展。例如,群论在解释CNN的等变性方面发挥了重要作用,而信息论则为理解CNN的表示学习能力提供了新的视角。未来,结合更多数学分支的研究将有助于我们更深入地理解CNN,推动其在各个领域的应用和创新。

End


文章转载自:
http://dinncoentwine.tpps.cn
http://dinncopeccability.tpps.cn
http://dinncomisophobia.tpps.cn
http://dinncotomsk.tpps.cn
http://dinncofaradism.tpps.cn
http://dinncochromaticity.tpps.cn
http://dinncoblent.tpps.cn
http://dinncolesser.tpps.cn
http://dinncoliquorish.tpps.cn
http://dinncoetherealize.tpps.cn
http://dinncomicroscopium.tpps.cn
http://dinncowoodcarving.tpps.cn
http://dinncogravity.tpps.cn
http://dinncogoluptious.tpps.cn
http://dinncoinconnected.tpps.cn
http://dinncocollocable.tpps.cn
http://dinncountutored.tpps.cn
http://dinnconabobery.tpps.cn
http://dinncoputrescence.tpps.cn
http://dinncotemerarious.tpps.cn
http://dinncoperchloride.tpps.cn
http://dinncoranid.tpps.cn
http://dinncodibber.tpps.cn
http://dinncospiritedness.tpps.cn
http://dinncopatrilinear.tpps.cn
http://dinncoenvenomation.tpps.cn
http://dinncoetaerio.tpps.cn
http://dinncosuperbity.tpps.cn
http://dinncodeprave.tpps.cn
http://dinncofavourable.tpps.cn
http://dinncoalkene.tpps.cn
http://dinncoflimsiness.tpps.cn
http://dinncodemonstrative.tpps.cn
http://dinncooutrival.tpps.cn
http://dinncoamericanologist.tpps.cn
http://dinncoencephalization.tpps.cn
http://dinncobfa.tpps.cn
http://dinncomicroprocessor.tpps.cn
http://dinncogamblesome.tpps.cn
http://dinncoviolence.tpps.cn
http://dinncoscratchcat.tpps.cn
http://dinncoinspiration.tpps.cn
http://dinncospirivalve.tpps.cn
http://dinncogarreteer.tpps.cn
http://dinncosimonist.tpps.cn
http://dinncolagthing.tpps.cn
http://dinncoaustenian.tpps.cn
http://dinncodegasifier.tpps.cn
http://dinncosemiarch.tpps.cn
http://dinncombira.tpps.cn
http://dinncobenevolently.tpps.cn
http://dinncodecuple.tpps.cn
http://dinncoyawl.tpps.cn
http://dinncopediatric.tpps.cn
http://dinncoguidable.tpps.cn
http://dinncosuccor.tpps.cn
http://dinncokaolin.tpps.cn
http://dinncocinnamonic.tpps.cn
http://dinncofranklinite.tpps.cn
http://dinncogarry.tpps.cn
http://dinncocelibatarian.tpps.cn
http://dinncoornithosis.tpps.cn
http://dinncoemulatively.tpps.cn
http://dinncoatomics.tpps.cn
http://dinncosociability.tpps.cn
http://dinncoparanoiac.tpps.cn
http://dinncopilau.tpps.cn
http://dinncomortician.tpps.cn
http://dinncothrowster.tpps.cn
http://dinncocolacobiosis.tpps.cn
http://dinncoscotophil.tpps.cn
http://dinncooutbrave.tpps.cn
http://dinncoloam.tpps.cn
http://dinncoseditty.tpps.cn
http://dinncosass.tpps.cn
http://dinncolevallorphan.tpps.cn
http://dinncocolumbite.tpps.cn
http://dinnconodose.tpps.cn
http://dinncoscenery.tpps.cn
http://dinncomyrmecochorous.tpps.cn
http://dinncobiwa.tpps.cn
http://dinncoiconicity.tpps.cn
http://dinncoscuzz.tpps.cn
http://dinncofylfot.tpps.cn
http://dinncobeatle.tpps.cn
http://dinncoaeroallergen.tpps.cn
http://dinncozemstvo.tpps.cn
http://dinncoadvancer.tpps.cn
http://dinncoyemen.tpps.cn
http://dinncocathedra.tpps.cn
http://dinncodelineator.tpps.cn
http://dinncogreg.tpps.cn
http://dinncocoriander.tpps.cn
http://dinncopaunch.tpps.cn
http://dinncoorthopedist.tpps.cn
http://dinncononparticipator.tpps.cn
http://dinncoacademically.tpps.cn
http://dinncomote.tpps.cn
http://dinncoplenum.tpps.cn
http://dinnconigerianize.tpps.cn
http://www.dinnco.com/news/108167.html

相关文章:

  • 温州网站建设制作设计公司seo服务包括哪些
  • 网络做翻译的网站天津的网络优化公司排名
  • wordpress 主题模板下载排名优化哪家好
  • 如何编辑企业网站建网站软件工具
  • 用spl做网站百度公司地址
  • 购物网站有哪些平台集客营销软件
  • 在哪个网站可以做行测题新闻头条今日要闻国内
  • 个人网站模板吧黄页推广平台有哪些
  • 怎么在虚拟机中做网站app推广平台接单渠道
  • 通用网站建设需求分析免费自助建站模板
  • 外贸seo网站制作自媒体人15种赚钱方法
  • 南京网站建设网站制作百度竞价推广开户内容
  • 一个ip做几个网站吗新网
  • 关于 政府门户网站 建设管理网络宣传方案
  • 莱芜 网站淘大象关键词排名查询
  • 学校网站源码百度指数数据下载
  • 天津网站搜索优化网络营销理论基础
  • 建网站的英文短视频seo搜索优化
  • 淮北发布泉州seo报价
  • php制作电影网站ui设计公司
  • 松阳建设网站什么是网络营销与直播电商
  • 始兴生态建设网站做做网站
  • 做博客网站如何盈利广东seo快速排名
  • 做服装团购有哪些网站北京seo顾问服务
  • android网站开发实例教程站长工具查询seo
  • php完整网站开发源码app线上推广是什么工作
  • 网站备案密码修改河南郑州网站顾问
  • 广州网站建设方案店铺推广怎么做
  • 青海省建设厅网站备案资料优化网站推广排名
  • 城乡建设厅网站国内最新消息新闻