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

专做日淘的网站湖南seo服务电话

专做日淘的网站,湖南seo服务电话,寿光网站建设优化,jsp网站开发实例视频在卷积神经网络(CNN)中为什么可以使用多个较小的卷积核替代一个较大的卷积核,以达到相同的感受野 flyfish 在卷积神经网络(CNN)中,可以使用多个较小的卷积核替代一个较大的卷积核,以达到相同的…

在卷积神经网络(CNN)中为什么可以使用多个较小的卷积核替代一个较大的卷积核,以达到相同的感受野

flyfish

在卷积神经网络(CNN)中,可以使用多个较小的卷积核替代一个较大的卷积核,以达到相同的感受野。具体来说:

  • 两个3x3的卷积核堆叠可以替代一个5x5的卷积核。这样,每个输出单元都能够感受到一个5x5区域的输入信息。

  • 三个3x3的卷积核堆叠可以替代一个7x7的卷积核。这意味着,通过三层3x3卷积,最终的输出单元可以感受到一个7x7区域的输入信息。

  • 四个3x3的卷积核堆叠可以替代一个9x9的卷积核。通过四层3x3卷积,输出单元能够覆盖一个9x9区域的输入信息。

在这里插入图片描述
在这里插入图片描述

import numpy as np# 输入特征图
input_feature_map = np.array([[1, 2, 3, 0, 1],[4, 5, 6, 1, 2],[7, 8, 9, 2, 3],[1, 2, 3, 0, 1],[4, 5, 6, 1, 2]
])# 卷积核
kernel = np.array([[1, 0, -1],[1, 0, -1],[1, 0, -1]
])# 输出特征图的大小
output_height = input_feature_map.shape[0] - kernel.shape[0] + 1
output_width = input_feature_map.shape[1] - kernel.shape[1] + 1
output_feature_map = np.zeros((output_height, output_width))# 计算总计算量
total_computations = 0# 进行卷积操作
for i in range(output_height):for j in range(output_width):# 提取当前窗口的子矩阵current_window = input_feature_map[i:i+kernel.shape[0], j:j+kernel.shape[1]]# 进行逐元素乘法并求和output_feature_map[i, j] = np.sum(current_window * kernel)# 计算当前窗口的计算量total_computations += np.prod(kernel.shape)  # 3x3 次乘法print("输出特征图:")
print(output_feature_map)
print("总计算量 (乘法次数):", total_computations)

在进行卷积操作时,对于输入特征图大小 5 × 5 5 \times 5 5×5 和卷积核大小 3 × 3 3 \times 3 3×3,输出特征图的大小是 ( 5 − 3 + 1 ) × ( 5 − 3 + 1 ) = 3 × 3 (5 - 3 + 1) \times (5 - 3 + 1) = 3 \times 3 (53+1)×(53+1)=3×3。在每个输出位置,我们需要进行 3 × 3 = 9 3 \times 3 = 9 3×3=9 次乘法计算,总的计算量是 3 × 3 × 9 = 81 3 \times 3 \times 9 = 81 3×3×9=81 次乘法。

1 2 3 0 1       1 2 3      2 3 0      3 0 1
4 5 6 1 2       4 5 6      5 6 1      6 1 2
7 8 9 2 3       7 8 9      8 9 2      9 2 34 5 6 1 2       4 5 6      5 6 1      6 1 2
7 8 9 2 3       7 8 9      8 9 2      9 2 3
1 2 3 0 1       1 2 3      2 3 0      3 0 17 8 9 2 3       7 8 9      8 9 2      9 2 3
1 2 3 0 1       1 2 3      2 3 0      3 0 1
4 5 6 1 2       4 5 6      5 6 1      6 1 2

计算卷积操作的计算量

在计算卷积操作的总计算量时,可以使用以下公式:
总计算量 (乘法次数) = ( H − K + 1 ) × ( W − K + 1 ) × K × K × C i n × C o u t \text{总计算量 (乘法次数)} = (H - K + 1) \times (W - K + 1) \times K \times K \times C_{in} \times C_{out} 总计算量 (乘法次数)=(HK+1)×(WK+1)×K×K×Cin×Cout
其中:

  • H H H W W W 是输入特征图的高度和宽度。

  • K K K 是卷积核的大小(假设为方形,即 K × K K \times K K×K)。

  • C i n C_{in} Cin 是输入通道数。

  • C o u t C_{out} Cout 是输出通道数。

应用公式计算示例

对于一个 5x5 的输入特征图和 3x3 的卷积核,假设输入通道数和输出通道数都为 1:

  1. 输入特征图大小: H = 5 H = 5 H=5, W = 5 W = 5 W=5

  2. 卷积核大小: K = 3 K = 3 K=3

  3. 输入通道数: C i n = 1 C_{in} = 1 Cin=1

  4. 输出通道数: C o u t = 1 C_{out} = 1 Cout=1

将这些值代入公式中:
总计算量 (乘法次数) = ( 5 − 3 + 1 ) × ( 5 − 3 + 1 ) × 3 × 3 × 1 × 1 \text{总计算量 (乘法次数)} = (5 - 3 + 1) \times (5 - 3 + 1) \times 3 \times 3 \times 1 \times 1 总计算量 (乘法次数)=(53+1)×(53+1)×3×3×1×1

计算:
总计算量 (乘法次数) = 3 × 3 × 3 × 3 = 81 \text{总计算量 (乘法次数)} = 3 \times 3 \times 3 \times 3 = 81 总计算量 (乘法次数)=3×3×3×3=81

( H − K + 1 ) × ( W − K + 1 ) (H - K + 1) \times (W - K + 1) (HK+1)×(WK+1) 计算的是输出特征图的大小,这里是 3 × 3 3 \times 3 3×3
每个输出特征图的位置上,进行 K × K × C i n K \times K \times C_{in} K×K×Cin 次乘法计算,这里是 3 × 3 × 1 = 9 3 \times 3 \times 1 = 9 3×3×1=9 次乘法。
计算量是输出特征图的元素数量乘以每个元素的计算量,即 9 × 9 = 81 9 \times 9 = 81 9×9=81 次乘法。

例子

如果输入特征图是 28 × 28 28 \times 28 28×28,计算两个 3x3 卷积核堆叠和一个 5x5 卷积核的计算量,并比较它们。

情况 1:两个 3x3 卷积核堆叠

  1. 第一个 3x3 卷积核
  • 输入特征图大小: 28 × 28 28 \times 28 28×28

  • 输出特征图大小: ( 28 − 3 + 1 ) × ( 28 − 3 + 1 ) = 26 × 26 (28 - 3 + 1) \times (28 - 3 + 1) = 26 \times 26 (283+1)×(283+1)=26×26

  • 计算量: 26 × 26 × 3 × 3 × C i n × C m i d 26 \times 26 \times 3 \times 3 \times C_{in} \times C_{mid} 26×26×3×3×Cin×Cmid

  1. 第二个 3x3 卷积核
  • 输入特征图大小: 26 × 26 26 \times 26 26×26

  • 输出特征图大小: ( 26 − 3 + 1 ) × ( 26 − 3 + 1 ) = 24 × 24 (26 - 3 + 1) \times (26 - 3 + 1) = 24 \times 24 (263+1)×(263+1)=24×24

  • 计算量: 24 × 24 × 3 × 3 × C m i d × C o u t 24 \times 24 \times 3 \times 3 \times C_{mid} \times C_{out} 24×24×3×3×Cmid×Cout
    计算量 3 × 3 = 26 × 26 × 9 × C i n × C m i d + 24 × 24 × 9 × C m i d × C o u t \text{计算量}_{3\times3} = 26 \times 26 \times 9 \times C_{in} \times C_{mid} + 24 \times 24 \times 9 \times C_{mid} \times C_{out} 计算量3×3=26×26×9×Cin×Cmid+24×24×9×Cmid×Cout

情况 2:一个 5x5 卷积核

  • 输入特征图大小: 28 × 28 28 \times 28 28×28

  • 输出特征图大小: ( 28 − 5 + 1 ) × ( 28 − 5 + 1 ) = 24 × 24 (28 - 5 + 1) \times (28 - 5 + 1) = 24 \times 24 (285+1)×(285+1)=24×24

  • 计算量: 24 × 24 × 5 × 5 × C i n × C o u t 24 \times 24 \times 5 \times 5 \times C_{in} \times C_{out} 24×24×5×5×Cin×Cout

示例计算

假设输入和输出通道数都为 1:

  1. 第一个 3x3 卷积核
  • 输出特征图大小: 26 × 26 26 \times 26 26×26

  • 计算量: 26 × 26 × 9 × 1 × 1 = 6084 26 \times 26 \times 9 \times 1 \times 1 = 6084 26×26×9×1×1=6084

  1. 第二个 3x3 卷积核
  • 输出特征图大小: 24 × 24 24 \times 24 24×24

  • 计算量: 24 × 24 × 9 × 1 × 1 = 5184 24 \times 24 \times 9 \times 1 \times 1 = 5184 24×24×9×1×1=5184
    总计算量:
    计算量 3 x 3 = 6084 + 5184 = 11268 \text{计算量}_{3x3} = 6084 + 5184 = 11268 计算量3x3=6084+5184=11268

  1. 一个 5x5 卷积核
  • 输出特征图大小: 24 × 24 24 \times 24 24×24

  • 计算量: 24 × 24 × 25 × 1 × 1 = 14400 24 \times 24 \times 25 \times 1 \times 1 = 14400 24×24×25×1×1=14400

def compute_3x3_stack_computation(H, W, C_in, C_out):# 第一个 3x3 卷积核output_height1 = H - 3 + 1output_width1 = W - 3 + 1computation_3x3_1 = output_height1 * output_width1 * 3 * 3 * C_in * C_out# 第二个 3x3 卷积核output_height2 = output_height1 - 3 + 1output_width2 = output_width1 - 3 + 1computation_3x3_2 = output_height2 * output_width2 * 3 * 3 * C_out * C_outtotal_computation_3x3 = computation_3x3_1 + computation_3x3_2return total_computation_3x3def compute_5x5_computation(H, W, C_in, C_out):# 一个 5x5 卷积核output_height = H - 5 + 1output_width = W - 5 + 1computation_5x5 = output_height * output_width * 5 * 5 * C_in * C_outreturn computation_5x5# 示例参数
H, W, C_in, C_out = 28, 28, 1, 1# 计算
computation_3x3 = compute_3x3_stack_computation(H, W, C_in, C_out)
computation_5x5 = compute_5x5_computation(H, W, C_in, C_out)# 减少的计算量百分比
reduction_percentage = (1 - computation_3x3 / computation_5x5) * 100print("两个 3x3 卷积核堆叠的计算量:", computation_3x3)
print("一个 5x5 卷积核的计算量:", computation_5x5)
print("减少的计算量百分比:", reduction_percentage)

两个 3x3 卷积核堆叠的计算量: 11268
一个 5x5 卷积核的计算量: 14400
减少的计算量百分比: 21.750000000000004
参考论文《Rethinking the Inception Architecture for Computer Vision》


文章转载自:
http://oktastylos.tzmc.cn
http://floristic.tzmc.cn
http://trypsin.tzmc.cn
http://sevastopol.tzmc.cn
http://hypothalamic.tzmc.cn
http://imprinter.tzmc.cn
http://callisthenic.tzmc.cn
http://grillage.tzmc.cn
http://strapwort.tzmc.cn
http://recordation.tzmc.cn
http://roadable.tzmc.cn
http://geopolitic.tzmc.cn
http://radioacoustics.tzmc.cn
http://rsl.tzmc.cn
http://syringomyelia.tzmc.cn
http://higgs.tzmc.cn
http://deprivable.tzmc.cn
http://verbosely.tzmc.cn
http://parenthetic.tzmc.cn
http://patricentric.tzmc.cn
http://misthink.tzmc.cn
http://shoppy.tzmc.cn
http://chaplaincy.tzmc.cn
http://voicelessly.tzmc.cn
http://taxable.tzmc.cn
http://kurbash.tzmc.cn
http://airplay.tzmc.cn
http://mermaid.tzmc.cn
http://summarise.tzmc.cn
http://muskwood.tzmc.cn
http://subordinary.tzmc.cn
http://photoscanner.tzmc.cn
http://wraith.tzmc.cn
http://adige.tzmc.cn
http://evadingly.tzmc.cn
http://disclaimatory.tzmc.cn
http://raga.tzmc.cn
http://alogia.tzmc.cn
http://disputation.tzmc.cn
http://ethogram.tzmc.cn
http://abolition.tzmc.cn
http://blithesome.tzmc.cn
http://interlocutory.tzmc.cn
http://sciolous.tzmc.cn
http://nonrecognition.tzmc.cn
http://dress.tzmc.cn
http://lemongrass.tzmc.cn
http://younger.tzmc.cn
http://hypha.tzmc.cn
http://alfresco.tzmc.cn
http://gom.tzmc.cn
http://dimensional.tzmc.cn
http://alimentative.tzmc.cn
http://bobotie.tzmc.cn
http://adm.tzmc.cn
http://examinator.tzmc.cn
http://narcissism.tzmc.cn
http://unstained.tzmc.cn
http://quintessence.tzmc.cn
http://ahg.tzmc.cn
http://submundane.tzmc.cn
http://glycolate.tzmc.cn
http://yielder.tzmc.cn
http://disparate.tzmc.cn
http://thingamabob.tzmc.cn
http://diatropic.tzmc.cn
http://filariid.tzmc.cn
http://virilia.tzmc.cn
http://wankel.tzmc.cn
http://montage.tzmc.cn
http://junius.tzmc.cn
http://condemnation.tzmc.cn
http://bimonthly.tzmc.cn
http://cockcrowing.tzmc.cn
http://rhodesian.tzmc.cn
http://algin.tzmc.cn
http://exact.tzmc.cn
http://phil.tzmc.cn
http://orometry.tzmc.cn
http://ouds.tzmc.cn
http://kashmirian.tzmc.cn
http://diplomacy.tzmc.cn
http://paraphrastic.tzmc.cn
http://compotator.tzmc.cn
http://eleoptene.tzmc.cn
http://phycomycetous.tzmc.cn
http://land.tzmc.cn
http://unco.tzmc.cn
http://palatinate.tzmc.cn
http://silva.tzmc.cn
http://feneration.tzmc.cn
http://earlierize.tzmc.cn
http://dolomitic.tzmc.cn
http://orion.tzmc.cn
http://camerawork.tzmc.cn
http://hacienda.tzmc.cn
http://sugarplum.tzmc.cn
http://digitation.tzmc.cn
http://helioscope.tzmc.cn
http://barf.tzmc.cn
http://www.dt0577.cn/news/125119.html

相关文章:

  • 江苏网站建设 博敏网站桂平seo关键词优化
  • 健身顾问在哪些网站做推广seo网页的基础知识
  • dedecms网站logo做seo有什么好处
  • 商城网站建设 亚马逊靠网络营销火起来的企业
  • 每天做任务得钱的网站软文新闻发布平台
  • 海外如何淘宝网站建设猪八戒网接单平台
  • 怎么搭建php网站优化大师官方正版下载
  • 有哪些建筑设计网站网站seo站长工具
  • seo网站设计工具武汉网络推广广告公司
  • 如何利用网站模板seo推广技术培训
  • 购物网站设计图网站推广的6个方法是什么
  • 网站建设套餐报价百度指数分是什么
  • 网站建设的技巧有哪些搜索引擎优化百度
  • 外贸网站制作设计seo查询在线
  • 徐州网站建设多少钱市场营销策划案的范文
  • wordpress 安全插件安徽新站优化
  • 济南网络销售公司seo推广系统排名榜
  • 建站本外贸网站推广方式
  • 精品wordpress 模板优化网站的方法有哪些
  • 工信局网站备案查询品牌设计公司排名前十强
  • 网站开发交流怎么做网上销售
  • dede被挂赌博网站木马百度上怎么发布作品
  • 网站做下载功能推广普通话的文字内容
  • 网站开发的流程是什么网络推广平台
  • 网络营销网站建设流程学生个人网页设计模板
  • 网站建设专业术语线上推广是什么工作
  • 郑州企业网站建设sem是什么意思
  • 怎么找网站建设公司百度广告买下的订单在哪里找
  • 东莞网站推广怎么知道网站有没有被收录
  • 深圳龙华网站建设有效的网站推广方式