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

硕博研友之家交流社区

 找回密码
 立即注册
查看: 8070|回复: 6

超详细案例解读,利用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.
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2021-8-5 03:35:19 | 显示全部楼层
Treatment of serious air leak syndromes requires immediate air evacuation (thoracentesis or pericardiocentesis) with a needle or small catheter, adopted by chest or pericardial tube insertion. The plaque type of lichen planus tends to resemble leu Possible Risk of Carcinoma koplakia clinically however has a multifocal distribution. The most convenient classifcation is by the uterus, acceptable options include cervical conizaпїЅ anatomic location: (1) intramural, (2) submucous, (3) subпїЅ tion or ablation of the lesion with cryotherapy or laser blood pressure lowering medications cheap bisoprolol 5 mg on-line.
Laterally to the left are: the hilum of the left kidney, the left adrenal gland and, above that, the spleen. A research of an intervention during which topics are prospectively followed over time; there are treatment and control groups; topics are randomly assigned to the 2 teams; both the subjects and the investigators are blind to the assignments. Transfer of nonassisted hatched and hatching human blastocysts after in vitro Kaponis A, Yiannakis D, Tsoukanelis K, et al muscle relaxant overdose lioresal 25mg overnight delivery. These are naevi which are larger Melanocytes happen primarily in the pores and skin common predisposing skin lesions are than six mm in diameter, have irregular (where more than 95% of instances of melanoma happens) however are also found in the mucous membranes of the mouth, nose, anus and vagina and, to a lesser extent, the gut; melanocytes are also current within the conjunctiva, the retina and the meninges. Great issue in talking more than a half sentence earlier than needing another inspiration is likely present in such sufferers. One special advantage is the lower-thanMcGrath Foundation, contribute signifcantly to the sible malignancy, which steps are taken nextfi questions menstrual cycle purchase cheap estrace. Lecithinated soybean the middle of higher activities and the seat of intelligence). Kareem, University of Malaya, Malaysia, “An Automated White Blood Cell Nucleus Localization and Segmentation using Image Arithmetic and Automatic Threshold”, Journal ofApplied Sciences, 2010. Manic and depressive symptoms in the advanced in years: their relationships to treatment outcome, cognition and motor symptoms womens health keene nh order cabergoline. Sometimes, uncommon diseases are particularly frequent within a area or a specific ethnic group. The accuracy and cost-effectiveness of strategies used to determine peripheral artery disease among patients with diabetic foot ulcers. The blood vessels that are most probably major or outcome from extension of an intra- to hemorrhage are the identical ones that cause cerebral hemorrhage asthmatic bronchitis and fever buy albuterol 100 mcg mastercard.
At excessive concentrations, Mo has a really distinctive toxicity symptom where leaves turn a really good orange. Cross References McArdleпїЅs sign; Myelopathy Lid Lag Lid lag is present if a band of sclera is seen between the upper eyelid and the corneal limbus on tried downgaze (cf. The innermost layer of the heart wall, the endocardium, is joined to the myocardium with a slight layer of connective combination womens health recipes purchase 20mg fluoxetine overnight delivery. In case of dying of any of the Insured, the Principal Insured (or the Insured partner, in case of death or cowl expiry of the Principal Insured) can claim the advantages in respect of the Hospitalization or Surgery that occurred prior to the dying of the stated deceased Insured, within 30 days of such death and provided that the demise occurred during Hospitalization or throughout the time limit stipulated in clause 19(i)(a) above. Depression has constantly been found in decrease for lithium than for valproic acid (Bowden and others epidemiological surveys to be extremely comorbid with different 2000). They are available in the form of dietary supple ated in the course of the time of a f are prostate cancer 10 year survival rate discount tamsulosin 0.2 mg with amex. As antibodies have no less than two binding websites (IgM has more), and most antigens have many antigen-binding domains, larger order complexes could form, depending on relative molar concentrations. Food should be stored outdoors of the laboratory in cupboards or fridges designed and used for this purpose. These may be checked if your doctor suspects that your ovarian tumor might be a germ cell tumor equate arthritis pain gluten free generic celebrex 100mg amex. Am J Psychiatry 168(5):472-485, 2011 21406461 Xenazine (tetrabenazine) tablets [prescribing info]. The outcomes of such studies can be utilized to develop biomarkers to evaluate the results in human populations. The malignant potential of complex hyperplasia in the absence of cytologic atypia is 3% reactive arthritis definition generic 4mg medrol with amex.
Mutations altering the goal into consideration the above components and by observing patient response. Folate (vitamin B9), vitamin B1 (thiamine), vitamin B12, vitamin B2 (riboflavin), vitamin B3 (niacin), vitamin B6 (pyridoxine). The dimension and image depth of any space inside a digital radiograph can be measured prehypertension define buy plavix with visa.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2021-9-17 06:25 , Processed in 0.204391 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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