An image processing method and system based on hardware acceleration of convolution operation

Through the output matrix division and branch combination of the convolution operation in the GPU, the problem of too long post-processing split operation in target detection is solved, and real-time and high-speed target detection performance is improved.

CN112507900BActive Publication Date: 2024-10-18PANJI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011470432.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-14
Publication Date
2024-10-18
Estimated Expiration
2040-12-14

AI Technical Summary

Technical Problem

During the target detection process, the multi-dimensional output matrix splitting operation of the post-processing part is run on the CPU, which causes the calculation to take too long and cannot meet the needs of real-time and high-speed recognition.

Method used

A hardware acceleration method based on convolution operations is used to divide and branch the output matrix in the GPU. Through index value filtering and splicing, the merged output results are directly obtained, replacing the traditional matrix splitting operation running on the CPU.

Benefits of technology

It significantly reduces the time-consuming post-processing operations, improves the performance of target detection, improves data filtering and computing efficiency through GPU acceleration, and achieves real-time, high-speed target detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112507900B_ABST
    Figure CN112507900B_ABST
Patent Text Reader

Abstract

An image processing method based on hardware acceleration of convolution operation includes the following steps: step 1, modifying the output layer of the original network, performing a new convolution calculation on the output matrix, and dividing the original output matrix into several branches; step 2, respectively combining the types of branches, and obtaining all the corresponding related parameters for calculation through index values; step 3, obtaining the index values ​​of the top N boxes with the highest confidence, extracting the corresponding branches through the index values, obtaining the corresponding coordinates by mapping back to the original image, filtering the coordinates of the representative boxes through non-maximum suppression, and returning the results. When the present invention deploys the model on any platform, when encountering operations such as data splitting and combination, it can improve the speed of end-to-end model operation by changing the original data splitting work that runs slower on part of the CPU to use convolution processing on the GPU.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and in particular relates to an image processing method and system based on hardware acceleration of convolution operation. Background Art

[0002] Deep learning technology has been widely used in the field of target detection, especially in face recognition, autonomous driving, medical testing and other industries. A typical target detection network model reasoning process is as follows: a picture is sent to the network, the picture data is calculated by layers of data networks, and finally the model will infer a result for the input picture. From this process, it can be seen that the model is the core of target detection technology decision-making.

[0003] In the actual production process, the model needs to be deployed on the device. Generally, the prediction of image data is completed by three parts: data pre-processing, model reasoning and post-processing (analysis of reasoning results). For example, in the deployment of the target detection model of the tensorflow framework, the data needs to be pre-processed and normalized first, and the data type of the image needs to be converted into the data type that circulates in the network model. This part is generally deployed on the CPU. The processed data will be sent to the network model for reasoning. For the target detection task, the center point coordinates of each box and its corresponding width and height, the foreground confidence of the target in the box, and the probability value of each category are generally returned. This part is generally run in the GPU and the speed is relatively fast. The result returned is an output matrix multi-dimensional output matrix that stacks together information such as target type, target confidence, target position, etc., which needs to be split, transformed, and mapped. Post-processing operations such as mapping are required to extract the final detection result.

[0004] In post-processing, the first thing is the splitting operation. This part of the calculation needs to be run on the GPU to split the results of the combined multi-dimensional output matrix for subsequent processing, such as splitting the center point, width and height of the box and the confidence of the foreground. The center point and width and height are mapped to the original image by calculating their scaling ratio according to the size of the corresponding multi-dimensional output matrix. The foreground confidence is used to filter out unimportant boxes. It can be seen that the splitting operation of the post-processing part is indispensable and very important. However, the amount of data in the returned multi-dimensional output matrix is ​​huge and the splitting is not sequential. At the same time, this part of the operation runs on the CPU, so the operation is very time-consuming. The whole set of detection takes too long to complete and cannot meet the real-time and high-speed recognition requirements. Summary of the invention

[0005] The object of the present invention is to provide an image processing method and system based on hardware acceleration of convolution operation to solve the above problems.

[0006] To achieve the above object, the present invention adopts the following technical solutions:

[0007] An image processing method based on hardware acceleration of convolution operation comprises the following steps:

[0008] Step 1, performing convolution calculation on the first output matrix of the neural network, extracting the same category output results in different channels into a second output matrix, the second output matrix comprising no less than 2 branches, each branch comprising the same category output results;

[0009] Step 2: Filter the content of the output result of the first branch in the second output matrix and obtain an index value, obtain the output results of one or more other branches in the second output matrix through the index value, and splice them with the output result of the first branch to form a merged output result.

[0010] The above two steps are run on the GPU.

[0011] Furthermore, in step 2, the output results of the multiple branches are spliced ​​to obtain a final combined output result, and the selection of which branches to splice is pre-configured by the system or input by the system in real time.

[0012] Furthermore, in step 1, a 1x1 convolution operation is performed on the first matrix.

[0013] Furthermore, in step 2, the content of the output result of the first branch is screened by using the size of the parameter, the sum of the parameters, and the variance of the parameters, and finally obtaining an index value, which can extract the corresponding output results in other branches;

[0014] Furthermore, in step 2, all branches other than the above branches are deformed to be the same shape as the first branch, and the first branch is horizontally spliced ​​with the remaining branches. The output results of one or more other branches in the second output matrix are obtained through the index value, and the acquisition method is to combine the channel elements in the first branch so that all elements have index attributes, and use the key factor element as the index to complete the screening of all data in other branches at one time;

[0015] Furthermore, a system for running the image processing method based on hardware acceleration of convolution operations includes an output matrix partitioning module, a branch combination module and a mapping screening module; the output matrix partitioning module, the branch combination module and the mapping screening module are connected in sequence; the system is used to run all operations of step 1 and step 2.

[0016] Compared with the prior art, the present invention has the following technical effects:

[0017] When the model is deployed on any platform, the present invention can be used to accelerate operations such as data splitting and combination.

[0018] 1. Reduce post-processing operations and improve speed. In the end-side target detection, the time-consuming data splitting work in the post-processing is replaced by using the convolution operation to directly obtain the original split data, reducing the time consumption of the entire reasoning process. Therefore, the present invention significantly improves the performance of the entire end-to-end target detection algorithm.

[0019] 2. Screen data in advance to reduce the amount of data for subsequent calculations and achieve reasoning acceleration. The present invention directly outputs the final result by means of convolution, so the screening operation can be performed directly, and a small amount of data is left after the screening to participate in the subsequent calculations.

[0020] 3. GPU acceleration: Using convolution operations running on the GPU to replace the matrix splitting operations originally running on the CPU improves computing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is the principle diagram of the present invention; DETAILED DESCRIPTION

[0022] The present invention is further described below in conjunction with the accompanying drawings:

[0023] See also Figure 1 , an image processing method and system based on hardware acceleration of convolution operation:

[0024] 1. Modify the output layer of the original network, perform new convolution calculations on the output matrix, focus on only one type of results for learning each time, make the learning content purer, divide the original output matrix into several branches (the number of branches depends on the number of types of output data that need to be extracted, for example, it can be divided into three categories: target type, target confidence and target position), connect them through convolution, and set the number of channels according to specific calculation requirements. The three branches are target foreground and background type, target confidence and target position, where the target position is the center point and width and height of each point prediction in the output matrix, the target foreground and background type is the confidence of the predicted foreground of each point, and the target confidence is the probability value of each category of the target prediction in the box of each center point in the output matrix. The higher the probability, the closer the target is to a certain category. Such a last layer directly generates the data needed for subsequent calculations, avoiding the split structure of the original network. At the same time, the way of focusing on only one learning content for the output matrix each time is purer than the original network.

[0025] 2. Combine the foreground and background types, target confidence and target position of the three layers respectively. Because it is necessary to select the frame with the highest confidence from all the candidate frames of the three layers for prediction, the frames of all layers must be merged and sorted first, and the first n frames are taken out for subsequent processing; the size and proportion of the three output matrices are transformed to the dimensions corresponding to the target position and then combined, so that all the relevant parameters for calculation can be obtained through the index value. By extracting the first N frames for subsequent operations, we can help screen out 95% of the frames, which is better than the behavior of the original network in the final screening of frames. At the same time, it greatly reduces the amount of data involved in subsequent operations and speeds up the operation.

[0026] 3. Get the index values ​​of the top N boxes with the highest confidence, and extract the corresponding target foreground and background types, target confidence, target position, and corresponding scaling ratio through the index values. Map the target position and scaling ratio back to the original image to obtain its corresponding coordinates, and then filter the coordinates representing each box through non-maximum suppression (NMS), and finally return the result.

[0027] 4. The invention provides a way of thinking. When a model is deployed on any platform and operations such as data splitting and combination are encountered, the speed of end-to-end model operation can be improved by changing part of the original data splitting work that runs slowly on the CPU into convolution processing on the GPU.

[0028] A system for running the image processing method based on hardware acceleration of convolution operation includes an output matrix division module, a branch combination module and a mapping screening module; the output matrix division module, the branch combination module and the mapping screening module are connected in sequence.

[0029] Example: Taking a Huawei hardware platform as an example, the overall speed can be increased by 200%, and the post-processing speed can be increased by 500%, ultimately achieving real-time, high-speed target detection and promoting the implementation of target detection algorithms in high-frame-rate target detection terminal devices.

Claims

1. An image processing method based on hardware acceleration of convolution operation, characterized in that: The following steps are involved: Step 1, performing convolution calculation on the first output matrix of the neural network, extracting the same category output results in different channels into a second output matrix, the second output matrix comprising no less than 2 branches, each branch comprising the same category output results; Step 2, screening the content of the output result of the first branch in the second output matrix and obtaining an index value, obtaining the output results of one or more other branches in the second output matrix through the index value, and splicing them with the output result of the first branch to form a combined output result; The above step 2 is run in the GPU; In step 2, the output results of the multiple branches are spliced ​​to obtain a final combined output result, and the selection of which branches to splice is pre-configured by the system or input by the system in real time.

2. The image processing method based on hardware acceleration of convolution operation according to claim 1, characterized in that: In step 1, a 1x1 convolution operation is performed on the first matrix.

3. The image processing method based on hardware acceleration of convolution operation according to claim 1, characterized in that: In step 2, the content of the output result of the first branch is screened using the size of the parameter, the sum of the parameters, and the variance of the parameters, and finally an index value is obtained, which can extract the corresponding output results in other branches.

4. The image processing method based on hardware acceleration of convolution operation according to claim 1, characterized in that: In step 2, all branches other than the first branch are deformed to have the same shape as the first branch, and the first branch is horizontally spliced ​​with the remaining branches; the output results of one or more other branches in the second output matrix are obtained through the index value, and the acquisition method is through the combination of all channel elements in the first branch, so that all elements have index attributes, and the key factor element is used as the index to complete the screening of all data in other branches at one time.

5. A system for running the image processing method based on hardware acceleration of convolution operation according to any one of claims 1 to 4, characterized in that: It includes an output matrix division module, a branch combination module and a mapping screening module; the output matrix division module, the branch combination module and the mapping screening module are connected in sequence; the system is used to run all operations of step 1 and step 2.

Citation Information

Patent Citations

  • Method for accelerating convolution neutral network hardware and AXI bus IP core thereof

    CN104915322A

  • An image prediction method and apparatus

    CN107578055A