Compressed YOLOv4-Tiny network accelerator based on ZYNQ

By designing configurable convolution and sampling calculation modules, parallel processing and multi-level caching technology on the ZYNQ platform, the problem of limited detection accuracy and speed performance of the YOLOv4-Tiny network on resource-constrained platforms has been solved, and efficient Target detection.

CN118839737APending Publication Date: 2024-10-25NANJING UNIV OF AERONAUTICS & ASTRONAUTICS +1
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202410843199.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-25

AI Technical Summary

Technical Problem

When the YOLOv4-Tiny network is deployed on an embedded platform with limited resources, the amount of parameters and calculations are large, resulting in limited detection accuracy and speed performance, and data quantification has an impact on accuracy, and it is necessary to speed up forwarding under limited resources. Reasoning speed.

Method used

Design a compressed YOLOv4-Tiny network accelerator based on ZYNQ. The convolution and sampling are designed as configurable computing modules. The convolution activation module and sampling computing module are used for parallel processing, combined with batch normalization layer fusion, activation function optimization and Fixed-point quantization, data communication through the AXI bus, realizes parallel and pipeline calculation of convolution and sampling operations, and uses multi-level cache and ping-pong cache to reduce data transmission delay.

Benefits of technology

It achieves efficient target detection under limited resources, reduces data calculation delay and transmission delay, improves the forward inference speed and performance of the YOLOv4-Tiny network, and forms a highly energy-efficient target detection system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118839737A_ABST
    Figure CN118839737A_ABST
Patent Text Reader

Abstract

The invention discloses a compressed YOLOv4-Tiny network accelerator based on ZYNQ, and relates to the field of hardware acceleration of a target detection convolutional neural network, and the accelerator comprises a PS end, a PL end, and an AXI bus responsible for communication between the PS end and the PL end. The PS end comprises a parameter configuration and operation control module, a Concat layer calculation module, a DDR (Double Data Rate) and an SD (Secure Digital) card data interaction module; the PL end comprises a convolution activation module, a sampling calculation module and a convolution and sampling input and output cache module. The convolution activation module is mainly used for realizing convolution operation and activation function calculation, and the calculation efficiency is improved by means of BN layer fusion, convolution parallelism, activation function optimization, fixed-point quantization and the like; the sampling calculation module adopts an assembly line structure to improve the sampling calculation speed; the convolution and sampling input and output cache module is used for storing convolution and sampling input feature map data, weight data and output feature map data. In addition, the forward reasoning time of the model can be further shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of hardware acceleration of target detection convolutional neural networks, and in particular to a ZYNQ-based compressed YOLOv4-Tiny network accelerator. Background Art

[0002] In the field of target detection, with the continuous development of artificial intelligence technology, target detection algorithms based on convolutional neural networks (CNN) can solve visual tasks such as image segmentation, target tracking, and scene understanding, and have become the mainstream of current research in the field of target detection. The YOLO series is a representative algorithm for target detection in CNN. Among them, the YOLOv4-Tiny network combines the advantages of the previous versions of the YOLO network and makes a lot of simplifications on their basis, and has good performance in detection accuracy and speed. However, the YOLOv4-Tiny network still has a certain amount of parameters and computation, which hinders its deployment on resource-constrained embedded platforms.

[0003] ZYNQ is an embedded platform released by Xilinx that combines FPGA (PL side) and ARM (PS side). The ARM processor has the advantages of low power consumption and low cost, and has obvious advantages in data processing and signal control, which is suitable for data transmission and signal control in YOLOv4-Tiny; the FPGA part, as a programmable hardware chip, has the advantages of programmability, high parallelism and low power consumption, and can be used to improve the computational efficiency of complex multiplication and addition operations in the YOLOv4-Tiny network. Therefore, the ZYNQ platform is suitable for hardware deployment of target detection networks.

[0004] The deployment of target detection network using ZYNQ mainly focuses on data quantization, hardware acceleration unit design, and data transmission design. Data quantization will reduce FPGA resource consumption, but it will have a certain impact on data accuracy. Therefore, how to balance resource consumption and accuracy is an important issue. Since the compressed YOLOv4-Tiny has its own unique model structure, it is necessary to design the parallelism of the hardware acceleration unit of the compressed model to give full play to the advantages of parallel computing and overlap the computing and data access delays as much as possible. Summary of the invention

[0005] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide a compressed YOLOv4-Tiny network accelerator based on ZYNQ, in which convolution and sampling are designed as configurable computing modules to adapt to different convolution and sampling calculations in the YOLOv4-Tiny network; at the same time, the convolution module and the sampling module are designed respectively by adopting relevant optimization means, so as to accelerate the forward reasoning speed of the YOLOv4-Tiny network and improve the performance of the accelerator under the condition of limited resources.

[0006] The present invention adopts the following technical solutions to solve the above technical problems:

[0007] A ZYNQ-based compressed YOLOv4-Tiny network accelerator proposed in the present invention includes a processing system PS end and a programmable logic PL end for data communication therewith, wherein the PL end includes a convolution activation module, a sampling calculation module, a convolution input and output cache module, and a sampling input and output cache module; wherein,

[0008] The PS side is used to store the input feature map data and weight data read from the outside, and send the start signal and configuration information of the accelerator IP core to the PL side;

[0009] After receiving the start signal and configuration information of the accelerator IP core, the PL side reads the weight data and input feature map data in the PS side and performs convolution sampling operations;

[0010] The convolution input and output cache module is used to store the input feature map data and weight data required for the convolution layer operation in the network model, as well as the output feature map data obtained by the convolution layer operation;

[0011] The convolution activation module is used to read the input feature map data and weight data required for the current operation from the convolution input and output cache module, and implement the convolution operation and activation function calculation in parallel by using batch normalization BN layer fusion, convolution parallelism, activation function optimization and fixed-point quantization acceleration methods, and save the calculation results to the convolution input and output cache module;

[0012] The sampling input and output cache module is used to store the input feature map data required for the sampling layer calculation in the network model, as well as the output feature map data calculated by the sampling layer;

[0013] The sampling calculation module reads the input feature map data required for the current operation from the sampling input and output cache module, uses a pipeline structure to perform sampling calculations, and saves the calculation results to the sampling input and output cache module.

[0014] As a further optimization scheme of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, the calculation result of the convolution activation module is saved to the output feature map cache unit in the convolution input and output cache module; the calculation result of the sampling calculation module is saved to the output feature map cache unit in the sampling input and output cache module; the PS end and the PL end communicate data through the AXI bus.

[0015] As a further optimization solution of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, the accelerator is for the forward reasoning calculation of the YOLOv4-Tiny network model after pruning and compression. Before the forward reasoning calculation, the YOLOv4-Tiny model is pre-compressed and the YOLOv4-Tiny model is compressed by the pruning method.

[0016] As a further optimization scheme of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, the convolution kernel size, whether to use the activation function, the convolution step size, the number of input channels, the number of output channels, the number of input feature map pixels and the padding type of the convolution activation module are all configurable parameters, and the configurable parameters are used to adapt to the calculation of different convolutional layers in the YOLOv4-Tiny network;

[0017] The sampling mode, number of input channels, and number of input feature map pixels of the sampling calculation module are configurable parameters used to adapt to different sampling calculations in the YOLOv4-Tiny network. The sampling mode refers to up / down sampling.

[0018] As a further optimization scheme of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, the batch normalization BN layer is preprocessed, and the calculation of the BN layer and the convolution layer is merged by using the BN layer fusion method; the convolution activation module includes multiple convolution activation calculation modules, each convolution activation calculation module includes a PE unit and an activation module, and the multiple PE units process the convolution calculation in parallel, and the feature map and weight in the input feature map cache unit in the convolution input and output cache module are expanded in the input and output dimensions, each PE unit is responsible for the parallel calculation of multiple input channels, and the calculation results of the multiple PE units are written into the output feature map cache unit in the convolution input and output cache module; the activation module uses the activation function optimization method to reduce the number of multiplication operations; the input and output feature maps, weights and bias parameters of each convolution and sampling layer of the network model are quantized by fixed-point quantization.

[0019] As a further optimization scheme of a compressed YOLOv4-Tiny network accelerator based on ZYNQ described in the present invention, a sampling input and output cache module includes a sampling input feature map cache unit and a sampling output feature map cache unit, wherein the sampling calculation module reads data from the sampling input feature map cache unit, and selects upsampling or downsampling operation according to the sampling mode signal transmitted from the PS end; after reading data from the sampling input feature map cache unit, for the downsampling operation, the feature map data of multiple input channels are compared using a two-stage comparator, and the maximum value is written into the sampling output feature map cache unit; for the upsampling operation, it is achieved by copying one input feature map data into four output feature map pixels and storing them in the sampling output feature map cache unit.

[0020] As a further optimization scheme of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, for the convolution input and output cache module and the sampling input and output cache module, an array partitioning method is adopted to improve the reading and writing speed of data from off-chip to on-chip and from on-chip to off-chip; a ping-pong cache method is adopted to reduce the data waiting time of the PE unit in the convolution activation module; wherein,

[0021] The delay of loading data from the external DDR to the convolution input and output cache module through ping-pong cache is overlapped with the two delays of the convolution activation module calculation; the delay of writing the calculation result of the convolution activation module back to the external DDR by the output feature map cache unit in the convolution input and output cache module is further overlapped with the delay of the ping-pong cache to hide the delay of writing data back to the external DDR.

[0022] As a further optimization solution of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, the PS end includes a parameter configuration and operation control module, a Concat layer calculation module, and a data interaction module for interacting with external DDR and SD card data; wherein,

[0023] The parameter configuration and operation control module is used to control, call and configure the convolution activation module and sampling calculation module in the PL side. According to the network structure of YOLOv4-Tiny, the convolution activation module and sampling calculation module in the PL side are called and configured to complete the calculation process of the entire network.

[0024] The Concat layer calculation module is used to complete the splicing operation of the output channels of different convolutional layers through the storage space pre-opened in the memory;

[0025] The data interaction module is used to write the input feature map data and weight data from the external SD card to the DDR, and to write the final convolution activation and sampling calculation results from the DDR back to the SD card.

[0026] As a further optimization solution of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, the PS end and the PL end complete the transmission of data and signals through the AXI4 bus and the AXI4-Lite bus, and the PS end uses the AXI4-Lite bus to send the start signal and configuration signal of the PL end convolution activation module and sampling calculation module to the PL end; after receiving the configuration signal, the PL end completes the reading of off-chip input data and writing the results back to the chip through the AXI4 bus.

[0027] As a further optimization solution of the ZYNQ-based compressed YOLOv4-Tiny network accelerator described in the present invention, the accelerator workflow is as follows:

[0028] Step 1: After the PS initializes the external SD card, the input image data and weight data pre-stored in the SD card are written to the external DDR, so that the two calculation modules of convolution activation and sampling calculation on the PL side can access the image data and weight data;

[0029] Step 2: The parameter configuration and operation control module on the PS side obtains the type and execution order of each network layer through the pre-defined network structure, calls the convolution activation module and sampling calculation module on the PL side according to the type of the network layer, and sends the corresponding status judgment signal through the AXI bus to specifically configure the network layer;

[0030] Step 3. The convolution activation module and sampling calculation module on the PL side initiate access requests to the input feature map data and weight data in the DDR, and use the AXI bus as the data bus to write the data in the DDR into the input feature map cache unit and weight cache unit in the convolution input and output cache module; after the convolution activation module and the sampling calculation module perform convolution, activation and sampling calculations, they store the final output feature map data in the output feature map cache unit of the sampling input and output cache module, and then write it back to the DDR through the AXI bus.

[0031] Step 4: After the PS completes the calculation process of the entire network according to the execution order of each network layer of YOLOv4-Tiny, it can decode and display the contents in the SD card on the PC to obtain graphical detection and recognition results.

[0032] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:

[0033] The present invention performs hardware acceleration on the forward reasoning calculation of the pruned and compressed YOLOv4-Tiny network model, thereby realizing a highly energy-efficient target detection system; the present invention designs a configurable computing unit for different convolution sampling operations in the YOLOv4-Tiny model, thereby realizing various types of convolution and sampling operations; the most computationally intensive convolution operations in the network model are performed by multiple PE parallelism, pipelined calculation and other methods to reduce data calculation delay; the convolution is processed by BN layer fusion, activation function optimization and other processes to reduce the number of multiplication operations; multi-level cache, output feature map multiplexing and other methods are used to reduce the number of off-chip accesses and reduce transmission delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a diagram of the YOLOv4-Tiny accelerator architecture of the present invention.

[0035] Figure 2 This is the YOLOv4-Tiny network structure diagram.

[0036] Figure 3 This is the hardware architecture diagram of the accelerator convolution calculation.

[0037] Figure 4 This is the hardware architecture diagram of the accelerator downsampling parallel computing unit.

[0038] Figure 5 This is a schematic diagram of the accelerator's multi-level cache.

[0039] Figure 6 It is a schematic diagram of the communication between the accelerator PS and PL. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0041] like Figure 1 As shown in the figure, a YOLOv4-Tiny accelerator based on ZYNQ includes two parts, PS and PL, and the communication between the two is completed through the AXI bus. The PS part includes parameter setting and operation control module, Concat layer calculation, parameter configuration and operation control, DDR, SD card data interaction; the PL part includes convolution activation module, sampling calculation unit, convolution input and output cache module, sampling input and output cache module.

[0042] like Figure 2As shown in the figure, the YOLOv4-Tiny network model consists of 21 convolutional layers, 3 downsampling layers, 1 upsampling layer, and 7 Concat layers. Among them, the convolutional layers are divided into 3×3 convolutional layers and 1×1 convolutional layers, and each 3×3 convolution is followed by a BN layer and a Leaky-ReLU activation function; the upsampling layer is implemented through the nearest neighbor interpolation, and the value of each pixel in the target image is filled with the nearest pixel in the original image to achieve the amplification of the input feature map; the Concat layer achieves the purpose of improving the network feature extraction capability by splicing the output channels of the two network layers.

[0043] The improved bee colony algorithm is used to prune YOLOv4-Tiny. Pruning includes the following steps:

[0044] Step 1: Build the YOLOv4-Tiny model and train it on the corresponding dataset to obtain the pre-trained weight data for each channel.

[0045] Step 2: Hired bees generate candidate pruning structures based on the independence of the output channels of each convolutional layer of the network model, compare the fitness of the candidate pruning structures with the initial pruning structures, and retain the structures with large fitness.

[0046] Step 3: After the employed bees have completed a round of exploration of all initial nectar sources, the observer bees continue to generate candidate pruning structures based on the initial pruning structure with a certain probability, compare the fitness of the candidate pruning structure with the initial pruning structure, and retain the structure with a large fitness.

[0047] Step 4: If the initial pruning structure is not updated in multiple rounds of exploration by employed bees and observer bees, the scout bees regenerate the initial pruning structure, and the employed bees and observer bees conduct new exploration on the structure.

[0048] Step 5: The pruning structure with the highest fitness is selected as the optimal pruning structure, and the structure is fine-tuned for multiple rounds to maximize the accuracy loss.

[0049] The convolution activation module integrates BN, convolution operation, and Leaky-ReLU activation function, and adopts BN layer fusion, convolution parallelism, activation function optimization, fixed-point quantization and other means to improve the efficiency of convolution calculation.

[0050] Specifically, the BN layer fusion is to integrate the BN layer operation into the convolution operation to obtain new weight and bias parameters of the convolution operation. The convolution operation can be expressed as Out = w*x + b, where x is the input, w is the weight, and b is the bias. The BN layer operation can be expressed as Among them, μ is the mean, is the standard deviation, ε is a small constant, and γ and β are scaling factors. Substituting the output of the convolution layer into the calculation formula of the BN layer, we can get the new convolution calculation formula: The weight is changed to The bias is changed to

[0051] Specifically, the convolution parallelism is designed by loop partitioning, loop expansion, loop pipelining, and output feature map multiplexing. Loop partitioning is used to solve the problem of insufficient on-chip resources and the inability to load all the input feature maps and weight data required for a layer of convolution at one time. By dividing the feature map and weight into multiple sub-blocks, only the input feature map and weight of one sub-block are loaded each time for calculation. A certain size of buffer is allocated to the input feature map, weight, and output feature map. The buffer sizes of the three are represented as In Buf =T n ×TR in ×TC in ×dataweight, W Buf =T m ×T n ×K×K×dataweight、Out Buf =T m ×T r ×T c ×dataweight, where In Buf , W Buf 、Out Buf are the input feature map cache, weight cache, and output feature map cache sizes, respectively. n , T m are the parallelism of the input channel and the output channel, TR in ,TC in are the width and height of the input feature map sub-block, T r , T c They are the width and height of the output feature map sub-block, K×K represents the size of the convolution kernel, and dataweight represents the bit width of the data.

[0052] Specifically, Figure 3 As shown, the loop expansion selects two dimensions, input channel and output channel, and sets the parallelism of the two dimensions to T n , T m , the convolution is done by T m PE units, In[x] represents the pixel of the x-th input feature map, W[n][m] represents the weight data of the n-th input channel and the m-th output channel. After expansion, the hardware architecture is composed of T n ×T m multipliers and a depth of log2T n T m In each clock cycle, the convolution module selects T nInput feature map reads T n feature map pixels at the same position, and read the corresponding T from the weight cache at the same time n ×T m weights, through T n ×T m multipliers and T m The addition tree calculates the input feature map and obtains T m The intermediate calculation result of the pixel corresponding to the output feature map is in For a convolutional layer with multiple input channels, these multiplication and addition units are reused (CH in / T n )×K×K times, we can get T m The final calculation result of each pixel.

[0053] Specifically, the circular pipeline is used to further reduce the computing delay and improve the throughput. The length or width of the output feature map is used as the inner loop, so that the output feature map pixels accumulated in two adjacent calculations are different data, which can realize the pipeline calculation between multiple groups of PEs inside, and set the pipeline instruction interval in the width direction of the output feature map to 1, thereby improving the computing efficiency of the accelerator.

[0054] Specifically, based on the block division method used, the output feature map reuse method is adopted to reduce the number of times the output feature map is written back to the chip. The reuse method is divided into three stages: In the first stage, the size of T n ×TR in ×TC in The input feature map sub-block is loaded into the input feature map cache, and T m ×T m ×K×K weights are loaded into the weight cache; in the second stage, the input feature map sub-block is convolved with the weight sub-block to obtain T m ×T r ×T c The intermediate results of size are stored in the output feature map cache, the input feature map and weight cache are updated in the input channel direction, the next convolution calculation is performed and the result is accumulated with the first calculation result; in the third stage, the first and second steps are repeated so that the partial sum in the output feature map cache is reused all the time. By adopting the output feature map reuse method, to obtain a complete output feature map layer, the number of input feature map accesses in the path from off-chip storage to on-chip cache is times, the output feature map is accessed once, and the weight map is accessed Second-rate.

[0055] Specifically, for the setting of block parameters, the resources and computing performance of the Zynq platform must be considered comprehensively. n , T mThe larger the parameter setting, the more tasks each PE can calculate in parallel. The more parallel PEs there are, the better the acceleration effect, but the higher the resource consumption. Taking the Zynq-7000 series platform as an example, for the YOLOv4-Tiny model, the maximum parallelism can be set to T without exceeding the available on-chip resource limit. n =4, T m =32. At the same time, it has been verified experimentally that for T r , T c Parameters, in T r =13, T c When =13, the model's forward inference time is the shortest.

[0056] Specifically, the activation function is optimized, YOLOv4-Tiny uses Leaky-ReLU as the activation function. When the input of this activation function is less than 0, the input will be multiplied by a coefficient of 0.1. The coefficient is changed to 0.125, and one multiplication operation in the FPGA is changed to three right shift operations, which greatly saves DSP resources.

[0057] Specifically, the quantization is 16-bit fixed-point quantization, and the calculation process is: Among them, s is the sign bit, B i is the i-th decimal place, BW is the bit width after fixed-point quantization, and FL is the number of decimal places in the fixed-point number. The weights and feature map data of the model are quantized according to the weight distribution range of YOLOv4-Tiny. The absolute values ​​of most parameters of YOLOv4-Tiny are in the range of [-2, 2], and some weight absolute values ​​can reach 3, so the integer bit is quantized with 2 bits.

[0058] The down sampling mode of the sampling calculation unit is as follows: Figure 4 First, the data in the 2×2 window is sent to the first-level comparator for pairwise comparison, and the two larger data are taken out and sent to the second-level comparator to obtain the maximum result, which is sent to the output cache. The two-level comparator is processed in a pipeline manner to improve the calculation speed of the downsampling unit.

[0059] The parameter configuration and operation control tasks of the PS side, after the PS side loads the weights from the SD card to the DDR, define and schedule each layer in sequence. If the network layer is convolution or sampling, the PL side IP core is called by sending the start signal and configuration signal to complete the current layer task. If the network layer is a Concat layer, it is implemented on the PS side until all network layers are executed in sequence.

[0060] The PS-side Concat layer calculation module is to splice the output channels of different network layers to form the input feature map of the next layer of network. Before the design, the output feature maps of each layer of the network were placed layer by layer in the memory in the order of the layers. However, there are 11 Concat layers in the YOLOv4-Tiny network. Taking the third Concat layer as an example, its input is the output feature map of the third and sixth layers of convolution. After splicing them, the output is sent to the seventh layer of convolution, which leads to the discontinuity of the reading address of the seventh layer of convolution. By setting the storage address of the output feature map data, the space 104×104×64×16bit required for the output feature map of the sixth layer of convolution is opened up after the third layer of memory space, and the output of the sixth layer of convolution is written into this space, so that the seventh layer of convolution can perform convolution operations by reading continuous addresses.

[0061] like Figure 5 , a multi-level cache solution is used to store these data. The cache unit is divided into three levels: off-chip DDR, on-chip OCM and PL cache module. The data originally stored in one BRAM is stored in multiple BRAMs by array segmentation to achieve parallel reading and writing of input and output data. Since the data transmission process in the accelerator is loaded from the off-chip DDR to the on-chip cache, then loaded from the on-chip cache to the internal cache of the computing unit, calculated by the parallel PE and the results are written to the output cache, and finally written back to the DDR, these three processes are independent of each other, and the design can be made by overlapping the delays of these parts. The delay of loading data from DDR to the input cache and weight cache is overlapped with the two delays of PE unit calculation by ping-pong cache. The delay of writing the calculation result from the output cache back to DDR is further overlapped with the delay of ping-pong cache to hide the delay of writing data back to DDR.

[0062] like Figure 6, PS and PL use AXI4 to communicate. The IP core of the accelerator on the PL side is connected to the PS side through the AXI Interconnect module. The PS and PL realize data communication and transmission of related control signals through the AXI4 bus and the AXI4-Lite bus. First, the PS side opens up a certain storage space to store the input feature map data and weight data read from the SD card. The PS side uses the AXI-Lite bus to send the start signal and related configuration information of the accelerator IP core to the PL side via the S_AXI_GP interface. Secondly, after receiving the relevant signal, the PL side sends a read DDR request to the PS side through the AXI4 bus, communicates with the DDR controller on the PS side through the S_AXI_HP interface, reads the weight data and input feature map data in the DDR memory, and performs related convolution sampling operations. Finally, after the convolution activation and sampling calculation IP core calculates the final output result, the PL side writes the result back to the DDR on the PS side through the AXI4 bus.

[0063] The above description is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a technician familiar with the technical field within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention.

Claims

1. A ZYNQ-based compressed YOLOv4-Tiny network accelerator, characterized in that: It includes a processing system PS end and a programmable logic PL end communicating with the PS end, wherein the PL end includes a convolution activation module, a sampling calculation module, a convolution input and output buffer module, and a sampling input and output buffer module; wherein, The PS side is used to store the input feature map data and weight data read from the outside, and send the start signal and configuration information of the accelerator IP core to the PL side; After receiving the start signal and configuration information of the accelerator IP core, the PL side reads the weight data and input feature map data in the PS side and performs convolution sampling operations; The convolution input and output cache module is used to store the input feature map data and weight data required for the convolution layer operation in the network model, as well as the output feature map data obtained by the convolution layer operation; The convolution activation module is used to read the input feature map data and weight data required for the current operation from the convolution input and output cache module, and implement the convolution operation and activation function calculation in parallel by using batch normalization BN layer fusion, convolution parallelism, activation function optimization and fixed-point quantization acceleration methods, and save the calculation results to the convolution input and output cache module; The sampling input and output cache module is used to store the input feature map data required for the sampling layer calculation in the network model, as well as the output feature map data calculated by the sampling layer; The sampling calculation module reads the input feature map data required for the current operation from the sampling input and output cache module, uses a pipeline structure to perform sampling calculations, and saves the calculation results to the sampling input and output cache module.

2. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 1, characterized in that: The calculation results of the convolution activation module are saved in the output feature map cache unit in the convolution input and output cache module; the calculation results of the sampling calculation module are saved in the output feature map cache unit in the sampling input and output cache module; the PS end and the PL end communicate data through the AXI bus.

3. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 1, characterized in that: The accelerator is for the forward reasoning calculation of the pruned and compressed YOLOv4-Tiny network model. Before the forward reasoning calculation, the YOLOv4-Tiny model is pre-compressed and the pruning method is used to compress the YOLOv4-Tiny model.

4. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 1, characterized in that: The convolution kernel size, whether to use activation function, convolution step size, number of input channels, number of output channels, number of input feature map pixels and padding type of the convolution activation module are all configurable parameters. The configurable parameters are used to adapt to the calculation of different convolution layers in the YOLOv4-Tiny network. The sampling mode, number of input channels, and number of input feature map pixels of the sampling calculation module are configurable parameters used to adapt to different sampling calculations in the YOLOv4-Tiny network. The sampling mode refers to up / down sampling.

5. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 2, characterized in that: The batch normalization BN layer is preprocessed, and the calculation of the BN layer and the convolution layer is merged by using the BN layer fusion method; the convolution activation module includes multiple convolution activation calculation modules, each of which includes a PE unit and an activation module. The multiple PE units process the convolution calculation in parallel, and expand the feature map and weight in the input feature map cache unit in the convolution input and output cache module in the input and output dimensions. Each PE unit is responsible for the parallel calculation of multiple input channels, and the calculation results of multiple PE units are written into the output feature map cache unit in the convolution input and output cache module; The activation module uses activation function optimization to reduce the number of multiplication operations; fixed-point quantization is used to quantize the input and output feature maps, weights and bias parameters of each convolution and sampling layer of the network model.

6. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 1, characterized in that: The sampling input and output cache module includes a sampling input feature map cache unit and a sampling output feature map cache unit, wherein the sampling calculation module reads data from the sampling input feature map cache unit, and selects upsampling or downsampling operation according to the sampling mode signal transmitted from the PS end; after reading data from the sampling input feature map cache unit, for the downsampling operation, the feature map data of multiple input channels are compared using a two-stage comparator, and the maximum value is written into the sampling output feature map cache unit; for the upsampling operation, it is achieved by copying one input feature map data into four output feature map pixels and storing them in the sampling output feature map cache unit.

7. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 1, characterized in that: For the convolution input and output cache module and the sampling input and output cache module, the array segmentation method is used to improve the reading and writing speed of data from off-chip to on-chip and from on-chip to off-chip; the ping-pong cache method is used to reduce the data waiting time of the PE unit in the convolution activation module; among them, The delay of loading data from the external DDR to the convolution input and output cache module through ping-pong cache is overlapped with the two delays of the convolution activation module calculation; the delay of writing the calculation result of the convolution activation module back to the external DDR by the output feature map cache unit in the convolution input and output cache module is further overlapped with the delay of the ping-pong cache to hide the delay of writing data back to the external DDR.

8. The ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 1, characterized in that: The PS end includes a parameter configuration and operation control module, a Concat layer calculation module, and a data interaction module for interacting with external DDR and SD card data; The parameter configuration and operation control module is used to control, call and configure the convolution activation module and sampling calculation module in the PL side. According to the network structure of YOLOv4-Tiny, the convolution activation module and sampling calculation module in the PL side are called and configured to complete the calculation process of the entire network. The Concat layer calculation module is used to complete the splicing operation of the output channels of different convolutional layers through the storage space pre-opened in the memory; The data interaction module is used to write the input feature map data and weight data from the external SD card to the DDR, and to write the final convolution activation and sampling calculation results from the DDR back to the SD card.

9. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 2, characterized in that: The PS and PL complete data and signal transmission through the AXI4 bus and AXI4-Lite bus. The PS uses the AXI4-Lite bus to send the start signal and configuration signal of the PL convolution activation module and sampling calculation module to the PL. After receiving the configuration signal, the PL side reads the off-chip input data and writes the results back to the chip through the AXI4 bus.

10. A ZYNQ-based compressed YOLOv4-Tiny network accelerator according to claim 1, characterized in that: The accelerator workflow is as follows: Step 1: After the PS initializes the external SD card, the input image data and weight data pre-stored in the SD card are written to the external DDR, so that the two calculation modules of convolution activation and sampling calculation on the PL side can access the image data and weight data; Step 2: The parameter configuration and operation control module on the PS side obtains the type and execution order of each network layer through the pre-defined network structure, calls the convolution activation module and sampling calculation module on the PL side according to the type of the network layer, and sends the corresponding status judgment signal through the AXI bus to specifically configure the network layer; Step 3. The convolution activation module and sampling calculation module on the PL side initiate access requests to the input feature map data and weight data in the DDR, and use the AXI bus as the data bus to write the data in the DDR into the input feature map cache unit and weight cache unit in the convolution input and output cache module; after the convolution activation module and the sampling calculation module perform convolution, activation and sampling calculations, they store the final output feature map data in the output feature map cache unit of the sampling input and output cache module, and then write it back to the DDR through the AXI bus. Step 4: After the PS completes the calculation process of the entire network according to the execution order of each network layer of YOLOv4-Tiny, it can decode and display the contents in the SD card on the PC to obtain graphical detection and recognition results.

Citation Information

Cited By

  • Lightweight FPGA-based tea bud detection method and system

    CN119478687A

  • ZYNQ-based universal CNN accelerator and use method thereof

    CN119721149A

  • A zynq-based general cnn accelerator and a method of using the same

    CN119721149B

  • Convolutional neural network image accelerator system based on ZYNQ and implementation method

    CN119810585A

  • Inference accelerator and inference method for YOLOv8m network

    CN121882138A