The invention provides a data call method based on the off-chip memory of the FPGA, which stores the data of the feature graph in FIFO row by row in order. Each read-write operation, the first M FIFO outputs the first data currently stored, and the latter M FIFO writes back the first data currently stored to the end of the data stored in FIFO corresponding to the number of L_M smaller than its number. At the same time, the L+1 line of the feature graph is stored. The first data is written to the end of the data stored in L_1 fifo, and the first data in line L+2 of the feature graph is written to the end of the data stored in L fifo, so that when FIFO continuously outputs the data out of the FIFO group in sequence, the remaining data of the feature graph is written to the FIFO group in order for reading until the data traversal of the whole feature graph is completed; therefore, the present invention does not directly debug the data. Using the data of the off-chip memory of the FPGA, the complex address jump is avoided, and the efficiency of calling the data of the off-chip memory of the FPGA is greatly improved.
【技术实现步骤摘要】
一种基于FPGA片外存储器的数据调用方法
本专利技术属于图像分类识别
,尤其涉及一种基于FPGA片外存储器的数据调用方法。
技术介绍
近五年来,卷积神经网络在图像特征提取、分类识别等领域取得了很好的效果。由于卷积神经网络架构灵活多变,现在的卷积神经网络主要通过CPU和GPU等软件平台实现。但是,现在的工程应用中,对于系统实时性、低功耗的需求越来越突出,因此利用硬件平台对卷积神经网络的计算进行加速并达到降低系统功耗的目的,日益成为卷积神经网络在工程应用中的研究热点问题。现场可编程门阵列(FPGA)就是其中一种很有前途的解决方案。但是,FPGA的片上存储资源很难满足卷积神经网络中图像数据、参数以及中间结果的存储,因此在利用FPGA加速卷积神经网络的计算时,需要调用FPGA片外的存储资源来满足系统的存储需求。因此,研究FPGA的片外存储的合理调用问题成为当前研究的重点。由于FPGA片外存储的合理调用,可以使得基于FPGA设计的卷积神经网络计算单元,充分发挥卷积神经网络算法中并行计算的特点,最大程度地加速卷积计算,提高系统的吞吐量。因此,FPGA片外存储的调用优化问题已成为未来卷积神经网络在FPGA上实现加速计算发展的重要研究方向之一。现有的关于FPGA片外存储调用的优化方法中,主要是基于FPGA片外存储器的结构进行存储的优化。FPGA的片外存储器中数据分Bank存储,当前的方法主要的思路是将卷积神经网络中不同的输入特征图数据尽量的存储在FPGA片外存储器不同的Bank中,但是这样的方法需要频繁地跳址访问片外存储器,读写效率低下,特别是在遇到大规模的卷积神经 ...
【技术保护点】
1.一种基于FPGA片外存储器的数据调用方法,应用于卷积神经网络,其特征在于,包括以下步骤:S1:在FPGA片内存储器中设置fifo组,其中,fifo组包括L个fifo,然后将各fifo依次编号为1至L,并确定需要同时向fifo组外输出数据的fifo的个数M,具体的:L=2×kernel+Stride×(N‑2)M=kernel+Stride×(N‑1)其中,kernel为预设的卷积核大小,Stride为卷积计算中所采用的滑窗的步长,N为需要同时生成的滑窗数据的组数,其中,N≥2;S2:将FPGA片外存储器中特征图中的前L行数据逐行存入fifo组中,其中,每一个fifo存储特征图的一行数据,且fifo的深度depth大于特征图的尺寸;S3:对fifo组中各fifo进行读写操作,其中所述读写操作具体为:对于从前面数的前M个fifo,每个fifo存储的第一个数据输出fifo组外作为卷积神经网络的滑窗数据,同时第二个数据成为第一个数据;对于倒数的后M个fifo,每个fifo存储的第一个数据写入比其编号小L‑M的编号对应的fifo存储的数据尾部,同时,将特征图第L+1行的第一个数据写入第L‑1 ...
【技术特征摘要】
1.一种基于FPGA片外存储器的数据调用方法,应用于卷积神经网络,其特征在于,包括以下步骤:S1:在FPGA片内存储器中设置fifo组,其中,fifo组包括L个fifo,然后将各fifo依次编号为1至L,并确定需要同时向fifo组外输出数据的fifo的个数M,具体的:L=2×kernel+Stride×(N-2)M=kernel+Stride×(N-1)其中,kernel为预设的卷积核大小,Stride为卷积计算中所采用的滑窗的步长,N为需要同时生成的滑窗数据的组数,其中,N≥2;S2:将FPGA片外存储器中特征图中的前L行数据逐行存入fifo组中,其中,每一个fifo存储特征图的一行数据,且fifo的深...
【专利技术属性】
技术研发人员:龙腾,魏鑫,陈禾,陈磊,陈亮,
申请(专利权)人:北京理工大学,
类型:发明
国别省市:北京,11
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。