请选择 进入手机版 | 继续访问电脑版

硕博研友之家交流社区

 找回密码
 立即注册
查看: 7482|回复: 5

超详细案例解读,利用FPGA加速深度神经网络运算

[复制链接]

1825

主题

1825

帖子

6439

积分

论坛元老

Rank: 8Rank: 8

积分
6439
发表于 2020-4-3 15:01:49 | 显示全部楼层 |阅读模式
  全联接神经网络是一种计算量比较大的机器学习模型,在训练和推断过程中需要对所有神经元进行矩阵计算。为了加快计算速度,各公司的大佬们采取了不同手段进行数据的抽象和综合。

  通常来说,我们采用卷积操作,将数据进行抽象和综合,然后送入到全连接神经网络进行最后的计算,实质上就是矩阵运算等数学计算的一系列综合操作。

  熟悉矩阵运算的朋友都知道,矩阵当中的每个元素和其他元素是没有关联的,这种特性天然就适合使用并行计算的方式来加快其计算速度。

  重点来了!并行计算正是 FPGA 等芯片的强项,利用FPGA将有效实现深度学习神经网络的加速计算(推理),下面是具体的操作展示。

  1.深度学习神经网络的环境搭建

  2.安装 OpenCL的开发环境,使Intel? Arria? 10 FPGA作为OpenCL的设备,注意安Intel对应的SDK

  3.利用 Tensorflow 作为框架,实现一个简单的全连接神经网络

  (提供一个算法描述示例,使用 Mnist 数据集作为训练和测试)

  1)Mnist 数据集每张图片为 28×28 像素,将每张图片的像素点作为输入

  2)第一个隐藏层设置 500 个神经元,与输入图像的 784 个像素点做计算(矩阵乘法)

  3)将得到的结果使用 relu 函数进行结果,只保留数值 >0 的结果,其他的设置为 0

  4)第二个隐藏层设置 10 个神经元,与第一个隐藏层的输出进行计算(矩阵乘法),最终得到 10 个结果作为输出

  从上述的算法描述当中,我们可以看到实际上就是几次矩阵的计算过程:一个 [1,784] 和 [784, 500] 的矩阵乘法,得到一个 [1,500] 的中间矩阵;然后这个 [1,500] 的中间矩阵与 [500, 10] 的矩阵进行计算,最终得到一个 [1,10] 的矩阵,这个就是我们的最终结果。

  4.对搭建完成的神经网络进行训练,训练之后得到模型文件

  5.通过一定的操作方式,提取这些模型文件中的模型参数

  6.把模型参数当作输入的参数,送入到FPGA当中进行加速计算,实现推理过程

  上述神经网络算法的OpenCL实现,大致如下:

  

  7.最后使用C/C++编写CPU程序,与 FPGA 进行交互,来验证 OpenCL 算法实现的正确性。

  以下是 CPU 程序的部分代码。

  

  通过以上步骤,我们就成功的使用OpenCL在Intel FPGA上实现了一个简单的神经网络的推理加速。

回复

使用道具 举报

0

主题

3

帖子

12

积分

新手上路

Rank: 1

积分
12
发表于 2020-4-6 16:01:20 | 显示全部楼层
谢LZ,已学习
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2020-4-6 16:21:40 | 显示全部楼层
顶一下,辛苦楼主,对OpenCL不太熟,基于OpenCL的算法实现方便详细展示一下吗?
回复

使用道具 举报

0

主题

1

帖子

12

积分

新手上路

Rank: 1

积分
12
发表于 2020-4-6 18:38:36 | 显示全部楼层
回楼上,英特尔FPGA中国创新中心官网有相关的线上培训课,有讲OpenCL,可以关注一下
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2020-4-6 19:31:00 | 显示全部楼层
楼主整理得很好,继续学习。
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2021-7-22 06:44:54 | 显示全部楼层
Se la patologia e stabile sara suff Livello di evidenza B ciente un esame all’anno. The state of Washington has carried out a free publish-traumatic stress dysfunction program, which creates community-based avenues to counseling companies which are much less formal in nature than many psychological health providers. If the upper restrict of the particle contamination burden is understood, then it should be potential for the designer to specify a filtration system that may handle the utmost particle burden and be sure that water turbidity does not increase above an allowable or fascinating level medicine 657 order procyclidine 5 mg overnight delivery.
Electrolytes11 aspart 20min11 9hrs11 needed11 milky11 Administer inside 15 protamine minutes before or after a meal. Here we suggest a apply Low-Rank plus Sparse (L+S) matrix decomposition to reliably detect voxelwise group differences within the Orientation Distribution Function which are strong in opposition to the consequences of noise and outliers. For further information on the points included in this type, see Reporting Life Sciences Research erectile dysfunction self test kamagra 100mg amex. Moodley, Medical management of uterine fibroids with medroxyprogesterone acetate (Depo Provera): a pilot examine. J Neurol Neurosurg Psychiatry hypertrophic olivary degeneration after pontine hemorrhage. Therefore, therapy of these illnesses requires the use of broad-spectrum anti-inflammatory drugs, corresponding to steroids gastritis english buy cheap maxolon on-line. Since 1994, voluntary enrollees may qualify for a reduced premium if they have 30 39 quarters of coated employment. Having children isn t crucial thing and a bloke is not going to run off screaming when you tell him but then you definitely at all times have this concern that it will happen Teenage feminine thirteen:19 Some of those dealing with untimely menopause talked about the way in which that such conversations with associates now prompted them to think about the truth that the clock could also be ticking faster for them. Regarding the current, it was claimed that within the workplace “a mentor who took a particular interest” had a positive effect in shaping the career paths of some members gastritis symptoms forum buy motilium with visa. Adaptive Biotechnol eligible for enrollment, a affected person ogies retains the proper to change should meet all of the following the program in entire or half at standards: any time in the train of its sole • Be a U. CulReuse of open containers might contamitures of the trays were taken instantly after nate solutions from drops contacting unsterthey were opened and every half-hour during ile areas and then running again over conthe exposure interval. For every, the denition, Note: the article sent by Armin Wendel to Soyinfo software, and results are given: 1   generic 50 mg glyset fast delivery.
Without providing particular details, the manufacturer said that instances of hypospadias had been observed in male infants exposed in utero to the drug, with or with out different anticonvulsants. Resolution expressing the sense of the Congress that a National Dysphagia Awareness Month should be established. Therapy for Duchenne muscular dystrophy: renewed optimism from genetic approaches muscle relaxants quizlet 30 mg nimodipine. Uma zona de intersecao entre eles sempre existira, quando considerados varios aspectos do exercicio, como 2. It doesnt have a pump like the guts, so pores and skin brushing is one of the finest ways to move that lymph around the physique. Ann Intern Med 2015;163:437451 loss interventions in main care: a scientific 31 muscle relaxant flexeril 10 mg purchase generic zanaflex on-line. Haemosiderin, which is fashioned by aggregates of ferritin and is identifiable by gentle microscopy as golden-yellow to brown, granular pigment, especially throughout the mononuclear phagocytes of the bone marrow, spleen and liver the place break-down of senescent red cells takes place. Among patients handled for hereditary retinoblastoma, the risk of creating a second most cancers in the 50 years after the initial Thyroid Cancer diagnosis was as high as fifty one% (Wong and others 1997b). Alveolar bone screws positioned mesial to the primary molars have been used initially as direct skeletal anchorage, with NiTi coil springs connected to the screws delivering 200 gm as the source of drive blood pressure medication good for pregnancy generic 40mg benicar with amex. Primary care providers are often characterized by terms similar to ease of access, continuity of the patient-supplier relationship, and integration of basic care and specialty administration and consultations, both outpatient and inpatient. Quantitative immunohistological standards based on percentages of IgA- and IgG-containing plasma cells are, nevertheless, more sensitive and particular for the diagnosis of Sjögren syndrome (Bodeutsch et al. Thus a traditional healthy adult will appear to have a constructive fluid steadiness of about 1 1 gastritis lettuce doxazosin 4mg lowest price.
The continuum of Darwinian and Lamarckian mechanisms of evolution In the preceding sections, we mentioned a considerable number of pheptg nomena. To achieve the objective of excessive sensitivity, the rule of thumb recommends utilizing the upper limit of normal for the peculiar assay because the criterion for a optimistic check [forty four]. A ccelerates disintegration ofirreversibly injured m yocytes (causes contractionband necrosis) 2 impotence law chennai generic tadacip 20 mg with visa.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|硕博研友之家交流社区

GMT+8, 2021-8-2 16:04 , Processed in 0.205260 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表