Image processing method, device and electronic device

By pruning the feature map nodes and convolution kernel convolution channel weights of the convolution operation topology map, the problems of low efficiency and waste of memory resources in image processing are solved, and a faster and more efficient image processing process is achieved.

CN114882247BActive Publication Date: 2024-08-23NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210555119.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2024-08-23
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

Existing image processing methods have low efficiency, complicated processes and serious waste of memory resources due to the huge calculation amount of convolutional neural networks.

Method used

By obtaining the convolution operation topology map, judging the significance, similarity and importance of the feature map nodes and convolution channel weights of the convolution kernel, structural and numerical pruning is performed to obtain the convolutional neural network after pruning training. , used for image processing.

Benefits of technology

It improves the speed of image processing, reduces the processing flow, saves memory resources, ensures the accuracy of the convolutional neural network after pruning training, and minimizes the amount of calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114882247B
    Figure CN114882247B
Patent Text Reader

Abstract

The present invention provides an image processing method, device and electronic device. In the image processing method, the feature map nodes and the edges with convolution kernel convolution channel weights in the convolution operation topology map are first pruned and trained based on the convolution operation topology map, and then the convolution neural network after pruning training is used to process the image to be processed. In this way, the speed of subsequent image processing can be greatly improved, the processing flow is reduced, and memory resources are saved. In addition, in the above-mentioned pruning training process of the present invention, the convolution operation topology map is used as the basis, which not only realizes the numerical pruning of feature map nodes (removing some feature map nodes), but also considers the structured pruning of the edges with convolution kernel convolution channel weights (removing some edges), which is more scientific. On the premise of ensuring the accuracy of the convolution neural network after pruning training, it can achieve maximum pruning and reduce the calculation amount of the network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image processing method, device and electronic equipment. Background Art

[0002] In recent years, deep learning neural network technology has been developing continuously, and more and more image processing problems (image denoising, image super-resolution, etc.) have achieved results that surpass traditional algorithms through convolutional neural networks. At present, when using convolutional neural networks to process images, due to the huge amount of computation of the convolutional neural network itself, the image processing efficiency is low, the process is complicated and wastes memory resources.

[0003] In summary, existing image processing methods have technical problems such as low efficiency, complicated processes, and serious waste of memory resources. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide an image processing method, device and electronic device to alleviate the technical problems of low efficiency, complicated procedures and serious waste of memory resources in existing image processing methods.

[0005] In a first aspect, an embodiment of the present invention provides an image processing method, comprising:

[0006] Obtaining a convolution operation topology map corresponding to when the convolution neural network performs a convolution operation on the image sample, wherein the convolution operation topology map includes: a feature map node and a directional edge with a convolution kernel convolution channel weight between the feature map nodes;

[0007] Performing significance judgment on the feature graph nodes and convolution kernel convolution channel weights in the convolution operation topology graph respectively, and removing the first target feature graph node and target edge in the convolution operation topology graph according to the significance judgment result, so as to obtain the convolution operation topology graph after the first pruning training;

[0008] Performing similarity judgment on feature map nodes obtained from the same convolution layer in the convolution operation topology map after the first pruning training, and removing the second target feature map node in the convolution operation topology map after the first pruning training according to the similarity judgment result, to obtain the convolution operation topology map after the second pruning training;

[0009] Performing importance judgment on each feature map node in the convolution operation topology map after the second pruning training, and removing the third target feature map node in the convolution operation topology map after the second pruning training according to the importance judgment result, to obtain the convolution operation topology map after the target pruning training, and then to obtain the convolution neural network after pruning training;

[0010] The convolutional neural network trained by pruning is used to perform image processing on the image to be processed to obtain an image processing result.

[0011] In an embodiment of the present invention, a method for processing an image is provided, comprising: obtaining a convolution operation topology map corresponding to a convolution operation performed by a convolutional neural network on an image sample, wherein the convolution operation topology map comprises: feature map nodes and directional edges between feature map nodes with convolution kernel convolution channel weights; performing significance judgment on the feature map nodes and convolution kernel convolution channel weights in the convolution operation topology map respectively, and removing the first target feature map node and target edge in the convolution operation topology map according to the significance judgment result, to obtain a convolution operation topology map after a first pruning training; obtaining a convolution operation topology map after the first pruning training for the same convolution layer in the convolution operation topology map after the first pruning training; A similarity judgment is performed between the feature map nodes obtained, and the second target feature map node in the convolution operation topology map after the first pruning training is removed according to the similarity judgment result to obtain the convolution operation topology map after the second pruning training; an importance judgment is performed on each feature map node in the convolution operation topology map after the second pruning training, and the third target feature map node in the convolution operation topology map after the second pruning training is removed according to the importance judgment result to obtain the convolution operation topology map after the target pruning training, and then the convolution neural network after pruning training is obtained; the convolution neural network after pruning training is used to perform image processing on the image to be processed to obtain an image processing result. From the above description, it can be seen that in the image processing method of the present invention, the feature map nodes and the edges with convolution kernel convolution channel weights in the convolution operation topology map are first pruned and trained based on the convolution operation topology map, and then the convolution neural network after pruning training is used to process the image to be processed. In this way, the speed of subsequent image processing can be greatly improved, the processing flow is reduced, and memory resources are saved. In addition, in the above-mentioned pruning training process of the present invention, the convolution operation topology map is used as the basis, which not only realizes the numerical pruning of feature map nodes (removing some feature map nodes), but also considers the structured pruning of edges with convolution kernel convolution channel weights (removing some edges), which is more scientific. On the premise of ensuring the accuracy of the convolution neural network after pruning training, it can achieve maximum pruning, reduce the computational complexity of the network, and alleviate the problems of low efficiency, complicated process and serious waste of memory resources in the existing image processing method when processing the image to be processed. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0013] Figure 1 A flowchart of an image processing method provided by an embodiment of the present invention;

[0014] Figure 2 A schematic diagram of a matrix representation of a convolution operation provided by an embodiment of the present invention;

[0015] Figure 3 A schematic diagram of a convolution operation topology diagram provided by an embodiment of the present invention;

[0016] Figure 4 A flowchart of performing significance judgment on feature graph nodes in a convolution operation topology graph provided by an embodiment of the present invention;

[0017] Figure 5 A schematic diagram of a visualized feature graph node provided by an embodiment of the present invention;

[0018] Figure 6 A flowchart for determining the significance of convolution kernel convolution channel weights in a convolution operation topology diagram provided by an embodiment of the present invention;

[0019] Figure 7 A schematic diagram of a convolution operation topology graph after saliency judgment pruning provided in an embodiment of the present invention;

[0020] Figure 8 A flowchart for performing similarity judgment between feature graph nodes obtained from the same convolution layer in a convolution operation topology graph after the first pruning training provided by an embodiment of the present invention;

[0021] Fig. 9 A flowchart for determining the importance of each feature map node in the convolution operation topology map after the second pruning training provided by an embodiment of the present invention;

[0022] Fig.10 A schematic diagram of an image processing device provided by an embodiment of the present invention;

[0023] Fig.11 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] At present, when a convolutional neural network is used to process an image, the image processing efficiency is low, the process is complicated, and memory resources are wasted due to the huge amount of computation required by the convolutional neural network itself.

[0026] Based on this, in the image processing method of the present invention, the feature map nodes and the edges with convolution kernel convolution channel weights in the convolution operation topology map are first pruned and trained based on the convolution operation topology map, and then the convolution neural network after pruning training is used to perform image processing on the image to be processed. In this way, the speed of subsequent image processing can be greatly improved, the processing flow is reduced, and memory resources are saved. In addition, the above-mentioned pruning training process of the present invention is based on the convolution operation topology map, which not only realizes the numerical pruning of feature map nodes (removing some feature map nodes), but also considers the structured pruning of edges with convolution kernel convolution channel weights (removing some edges), which is more scientific. On the premise of ensuring the accuracy of the convolution neural network after pruning training, it can achieve maximum pruning and reduce the computational complexity of the network.

[0027] To facilitate understanding of this embodiment, a method for processing an image disclosed in an embodiment of the present invention is first introduced in detail.

[0028] Embodiment 1:

[0029] According to an embodiment of the present invention, an embodiment of a method for processing an image is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0030] Figure 1 is a flow chart of an image processing method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0031] Step S102, obtaining a convolution operation topology map corresponding to the convolution operation performed by the convolution neural network on the image sample, wherein the convolution operation topology map includes: directional edges with convolution kernel convolution channel weights between feature map nodes and feature map nodes;

[0032] In the embodiment of the present invention, based on the theoretical basis of convolutional neural network (CNN), for the convolution operation, the input matrix I=(x i,j ) g×h , convolution kernel K = (w e,f ) l×l is an l-order square matrix. According to the convolution calculation formula: Among them, s is the convolution step size, p is the number of padding, then there is a u×v order output matrix O=(y a,b ) u×v , expand the rows of the input matrix I and the output matrix O by rs(·) (or expand the columns by cs(·)), then: rs(O) = C×rs(I).

[0033] The above input matrix I=(x i,j ) g×h is an image sample. If it is a black and white image sample, it is essentially a two-dimensional matrix. If it is a color image sample, it is essentially a two-dimensional matrix of RGB three channels (3 two-dimensional matrices). Among them, g×h represents the size of the image sample (length×width), x i,j Represents the pixel value of the pixel in the i-th row and j-th column in the image sample. The above convolution kernel represents a convolution channel of a convolution kernel in the convolution layer, where l×l represents the size of the convolution kernel and w e,f Represents the position of the parameters in the convolution kernel. The above output matrix O = (y a,b ) u×v is the feature map output by a convolution kernel (one convolution kernel corresponds to one feature map), where u×v represents the size of the feature map, and y a,b Represents the pixel value of the pixel in the a-th row and b-th column in the feature map.

[0034] like Figure 2 As shown, the size of the input image sample is 5*5, which can be represented as a 5*5 two-dimensional matrix, which contains a 00 to a 44 There are 25 elements in total, a 00 Represents the pixel value of the pixel in the first row and first column of the image sample. The size of the convolution kernel is 3*3 (showing one convolution channel of the convolution kernel), which is located at the upper left corner of the image sample, and contains w 00 to w 22 There are 9 weight parameters in total. The size of the output feature map is 3*3 (s=1, p=0), which can be expressed as a 3*3 two-dimensional matrix, which contains b 00 to b 22 There are 9 elements in total, among which b 00 =a 00 *w 00 +a 01 *w01 +a 02 *w 02 +a 03 *0+a 04 *0+a 05 *0, that is Figure 2 The products of the corresponding elements in the dark color image below the upper middle image are added together to get Figure 2 For the elements in the dark color image above the middle upper image, the 3*3 convolution kernel moves to the right with a step size of 1, so that b is obtained 01 、b 02 The above convolution operation process can be expressed as: Figure 2 The product of the transition matrix in the lower middle part and the result of the row expansion of the input matrix is ​​equal to the result of the row expansion of the output matrix, that is, Figure 2 The lower part shows C×rs(I)=rs(O), where C represents the transition matrix:

[0035]

[0036] in,

[0037] The above process introduces the process of a black and white image sample passing through a convolution operation of a convolution kernel and a convolution channel. The above process can be represented by a convolution operation topology diagram (the above process can be represented as Figure 3 middle Through the transition matrix After the convolution operation, the feature map node is obtained part of the process, that is, only represented as one path), refer to Figure 3 , which shows a schematic diagram of the convolution operation topology. The squares in the first column can represent image samples of the R channel, image samples of the G channel, and image samples of the B channel, respectively. express, Represents the feature map node corresponding to the first convolution kernel of the l-2th convolution layer (the meanings of other parameters are similar, l = 2). Feature map nodes go through the transition matrix After the convolution operation of (representing the weight of the first convolution channel of the first convolution kernel of the l-1th convolution layer, that is, the convolution kernel convolution channel weight in the present invention), the result of the first product sum is obtained, and at the same time Feature map nodes go through the transition matrix After the convolution operation of (representing the weight of the second convolution channel of the first convolution kernel of the l-1th convolution layer, that is, the convolution kernel convolution channel weight in the present invention), the second product sum result is obtained, and at the same time Feature map nodes go through the transition matrix After the convolution operation of (representing the weight of the third convolution channel of the first convolution kernel of the l-1th convolution layer, that is, the convolution kernel convolution channel weight in the present invention), the third product sum result is obtained, and the above three product sum results are added to obtain the feature map node After the image samples of the R channel, the image samples of the G channel, and the image samples of the B channel are convolved by the corresponding convolution channels of the first convolution kernel of the l-1th convolution layer, we get Feature map nodes (it can be seen that the l-1th convolution layer has s convolution kernels, and s feature map nodes are obtained, one convolution kernel corresponds to one feature map node), so we get Feature graph nodes, Feature graph nodes and Feature graph nodes and The convolution operation topology diagram between feature map nodes and the directional edges with convolution kernel and convolution channel weights between other feature map nodes are similar to this and will not be repeated here.

[0038] Step S104, respectively performing significance judgment on the feature graph nodes and the convolution kernel convolution channel weights in the convolution operation topology graph, and removing the first target feature graph node and the target edge in the convolution operation topology graph according to the significance judgment result, to obtain the convolution operation topology graph after the first pruning training;

[0039] The inventors took into account that in order to process complex image information, existing convolutional neural networks usually have a large number of model parameters, and require relatively large computing resources and storage space. Many models that can run well on server platforms are difficult to directly port to embedded platforms, such as autonomous driving platforms. The main reason is that the computing power and storage capacity of embedded platforms are relatively limited, and real-time performance is an indispensable requirement in embedded platforms such as autonomous driving platforms. Therefore, in order to ensure that the convolutional neural network can run in real time and accurately on the embedded platform, it is necessary to compress the existing convolutional neural network to ensure that the model's running speed is guaranteed while ensuring that the model's accuracy is reduced within an acceptable range, or even on par with the original model.

[0040] The compression processing method can be pruning of the convolutional neural network, which specifically refers to selecting unimportant connections (i.e., target edges) and parameters (i.e., target feature map nodes) in the convolutional neural network and removing them to achieve the purpose of reducing the model volume. The key issue in pruning is to find unimportant connections and parameters in the model, so it is particularly important to choose a suitable evaluation method. Pruning can be divided into structured pruning and unstructured pruning according to granularity. Unstructured pruning mainly sets unimportant parameters on the convolution kernel to zero, while structured pruning can be divided into shape-wise and filter-wise. Shape-wise is to remove a row or column of the convolution kernel, and filter-wise is to remove the entire convolution kernel. After considering the advantages and disadvantages of the above-mentioned various pruning methods, the inventor designed the technical solution of the present invention. In the solution of the present invention, the fusion of structured pruning and unstructured pruning is achieved.

[0041] The above-mentioned removal of the first target feature map node in the convolution operation topology graph refers to removing a convolution kernel (because a feature map node corresponds to a convolution kernel, that is, structured pruning), and the above-mentioned removal of the target edge refers to setting all the weight parameters of a convolution channel of the convolution kernel to 0 (that is, unstructured pruning).

[0042] Step S106, performing similarity judgment between feature map nodes obtained by the same convolution layer in the convolution operation topology map after the first pruning training, and removing the second target feature map node in the convolution operation topology map after the first pruning training according to the similarity judgment result, to obtain the convolution operation topology map after the second pruning training;

[0043] The above-mentioned removal of the second target feature map node in the convolution operation topology map after the first pruning training according to the similarity judgment result specifically refers to removing the second target feature map node in the feature map nodes obtained by the same convolution layer in the convolution operation topology map after the first pruning training.

[0044] The process is described in detail below and will not be repeated here.

[0045] Step S108, performing importance judgment on each feature map node in the convolution operation topology map after the second pruning training, and removing the third target feature map node in the convolution operation topology map after the second pruning training according to the importance judgment result, to obtain the convolution operation topology map after the target pruning training, and then to obtain the convolution neural network after pruning training;

[0046] The convolution operation topology map after the target pruning training obtained above is the topology map representation of the convolutional neural network after pruning training, that is, the convolution operation topology map after the target pruning training obtained above is the convolutional neural network after pruning training.

[0047] Step S110, performing image processing on the image to be processed using the convolutional neural network after pruning training to obtain an image processing result.

[0048] Specifically, if the convolutional neural network after pruning training is a vehicle recognition network, then the convolutional neural network after pruning training is used to perform image processing on the image to be processed, that is, the vehicle recognition network after pruning training is used to perform vehicle recognition processing on the image to be processed, and then the vehicle in the image to be processed is identified.

[0049] If the pruned convolutional neural network is a network for identifying people, then using the pruned convolutional neural network to process the image to be processed is to use the pruned convolutional neural network to identify people in the image to be processed, thereby obtaining information about the people in the image to be processed.

[0050] That is to say, in this embodiment, the image processing process can be determined according to the functions that can be realized by the convolutional neural network, and the image processing process can be to identify vehicles from the image to be processed, or to identify people in the image to be processed, etc. The embodiment of the present invention does not specifically limit the specific functions of the convolutional neural network, and can also be a face feature point detection network, a living body detection network, etc., and any convolutional neural network that can perform image processing on the image to be processed is within the protection scope of this application.

[0051] In an embodiment of the present invention, a method for processing an image is provided, comprising: obtaining a convolution operation topology map corresponding to a convolution operation performed by a convolutional neural network on an image sample, wherein the convolution operation topology map comprises: feature map nodes and directional edges between feature map nodes with convolution kernel convolution channel weights; performing significance judgment on the feature map nodes and convolution kernel convolution channel weights in the convolution operation topology map respectively, and removing the first target feature map node and target edge in the convolution operation topology map according to the significance judgment result, to obtain a convolution operation topology map after a first pruning training; obtaining a convolution operation topology map after the first pruning training for the same convolution layer in the convolution operation topology map after the first pruning training; A similarity judgment is performed between the feature map nodes obtained, and the second target feature map node in the convolution operation topology map after the first pruning training is removed according to the similarity judgment result to obtain the convolution operation topology map after the second pruning training; an importance judgment is performed on each feature map node in the convolution operation topology map after the second pruning training, and the third target feature map node in the convolution operation topology map after the second pruning training is removed according to the importance judgment result to obtain the convolution operation topology map after the target pruning training, and then the convolution neural network after pruning training is obtained; the convolution neural network after pruning training is used to perform image processing on the image to be processed to obtain an image processing result. From the above description, it can be seen that in the image processing method of the present invention, the feature map nodes and the edges with convolution kernel convolution channel weights in the convolution operation topology map are first pruned and trained based on the convolution operation topology map, and then the convolution neural network after pruning training is used to process the image to be processed. In this way, the speed of subsequent image processing can be greatly improved, the processing flow is reduced, and memory resources are saved. In addition, in the above-mentioned pruning training process of the present invention, the convolution operation topology map is used as the basis, which not only realizes the numerical pruning of feature map nodes (removing some feature map nodes), but also considers the structured pruning of edges with convolution kernel convolution channel weights (removing some edges), which is more scientific. On the premise of ensuring the accuracy of the convolution neural network after pruning training, it can achieve maximum pruning, reduce the computational complexity of the network, and alleviate the problems of low efficiency, complicated process and serious waste of memory resources in the existing image processing method when processing the image to be processed.

[0052] The above content briefly introduces the image processing method of the present invention, and the specific contents involved therein are described in detail below.

[0053] In an alternative embodiment of the present invention, reference Figure 4 The above step S104, performing significance judgment on the feature graph nodes in the convolution operation topology graph, specifically includes the following steps:

[0054] Step S401, calculate the formula based on the node significance of the feature graph Calculate the significance of each feature map node obtained by each convolutional layer, where Represents the feature map node corresponding to the i-th convolution kernel of the l-th convolution layer The significance of Represents a feature map node The feature map node under the jth image sample, Represents a feature map node The F-norm of Represents a feature map node The variance of , b represents the batch size;

[0055] The inventors considered that if all elements in a feature map node (essentially a two-dimensional matrix) are not close to 0 and the variance is larger, the feature map node is more significant; conversely, if the elements in a feature map node are closer to 0 and the variance is smaller, the feature map node is more redundant.

[0056] like Figure 5 As shown, a schematic diagram of the feature map node after visualization is shown. Among feature_map_3, feature_map_7 and feature_map_8, the pixel value of most pixels is 0, that is, black, and the effective information contained therein is less, so these feature map nodes are redundant, and the relationship between the pixel value and 0 can be characterized by the Frobenius norm of each feature map node. However, it is not the case that the larger the F-norm, the more significant the corresponding feature map node. For example, a feature map node displayed in all white, in which the pixel value of each pixel is 255, the F-norm is very large, but it is obvious that there is no effective feature information in the feature map node displayed in all white. Therefore, in addition to considering the relationship between the pixel value and 0 in the feature map node, the variance of the pixel value must also be considered. The larger the variance, the more effective information will be. Based on this, the inventor designed the above-mentioned feature map node significance calculation formula.

[0057] Specifically, the above Figure 5 The picture of a cat in is an image sample. If there is also a picture of a dog, it is another image sample. The above batch size can be understood as the number of image samples input at one time.

[0058] Step S402, calculating a first mean, a first median, and a first mode of the significance of each feature map node obtained by each convolutional layer;

[0059] by Figure 3 The middle column in is used as an example to illustrate the calculation feature map node The saliency and feature graph nodes The significance of The significance of the data is then calculated, and the first mean, first median, and first mode of these significances are then calculated.

[0060] Step S403, based on the first mean, the first median and the first mode, determine the first target feature map node in each feature map node obtained by each convolution layer, and then obtain the first target feature map node in the convolution operation topology map.

[0061] The specific steps include:

[0062] (1) When the first mean is greater than the first median, and the first median is greater than the first mode, among the feature map nodes obtained in each convolutional layer, the feature map node corresponding to the first target saliency that is not less than the first mean among the saliency of each feature map node is taken as the first target feature map node;

[0063] The above first mean is greater than the first median, and the first median is greater than the first mode, indicating that the significance is consistent with the positively skewed distribution.

[0064] Continue with Figure 3 Take the middle column in as an example to illustrate, if the first mean, the first median and the first mode obtained in the above step S402 meet this situation, then the feature graph node The significance of is compared with the first mean. If the feature map node If the significance of is greater than the first mean, the feature map node As the first target feature map node, it is removed.

[0065] (2) When the first mean is less than the first median, and the first median is less than the first mode, among the feature map nodes obtained in each convolutional layer, the feature map node corresponding to the second target significance that is not greater than the first mean among the significance of each feature map node is taken as the first target feature map node;

[0066] The first mean is smaller than the first median, and the first median is smaller than the first mode, indicating that the significance is consistent with the negatively skewed distribution.

[0067] (3) When the first mean is equal to the first median, and the first median is equal to the first mode, among the feature map nodes obtained in each convolutional layer, the feature map node corresponding to the third target significance whose absolute value of the difference between the significance of each feature map node and the first mean is greater than a first preset value is taken as the first target feature map node, wherein the first preset value is the variance of the significance of each feature map node.

[0068] The first mean is equal to the first median, and the first median is equal to the first mode, indicating that the significance is in line with the normal distribution.

[0069] The purpose of using the above three methods is that the network will be continuously adjusted during the pruning process. At the beginning of pruning, the feature map nodes that account for the majority are retained, and a small number of feature map nodes are removed, which can ensure that the algorithm has a certain fault tolerance space.

[0070] In an alternative embodiment of the present invention, reference Figure 6 The above step S104, performing significance judgment on the convolution kernel convolution channel weights in the convolution operation topology graph, specifically includes the following steps:

[0071] Step S601, calculating the F-norm of each convolution kernel convolution channel weight of each convolution layer, and taking the F-norm of each convolution kernel convolution channel weight as the significance of the corresponding convolution kernel convolution channel weight;

[0072] The following is an explanation of the rationality of using the F-norm of each convolution kernel convolution channel weight as the significance of the corresponding convolution kernel convolution channel weight:

[0073] When judging the significance of the convolution kernel convolution channel weight, it can be seen from the definition of matrix norm that for any matrix norm: And for any matrix, ‖rs(A)‖2=‖A‖ F Therefore, when data is transferred between convolutional layers, the F-norm of a convolution kernel determines the upper limit of the significance of the feature map node obtained by the convolution kernel.

[0074] Let's assume that the i-th convolution kernel of the l-th convolution layer is Among them, m is the number of convolution kernel channels, is the transition matrix, that is, the convolution kernel convolution channel weight, and the feature map of the l-1th convolution layer is The i-th feature map of the l-th convolutional layer is defined by convolution have: Among them, z is the total number of convolution kernels in the lth convolution layer.

[0075] Obviously, for the set If there is a convolution channel And there exists a set of numbers k1, k2, ..., k that are not all zero n , so that A=k1B1+k2B2+…+k n B n , then the convolution channel A is redundant, that is, the feature map node obtained by the convolution kernel containing the convolution channel A can be linearly represented by other feature map nodes. However, in practical application, this method is very difficult, and there is even no B1, B2, ..., B1 that meets the conditions. n , under certain allowable error conditions, for any There exists a set of non-zero numbers k1, k2, ..., km ≠0, so when When it approaches 0 matrix, It is a redundant convolution channel. Therefore, the F-norm can still be used to evaluate the significance of the convolution channel. The significance index of the convolution channel of the lth convolution layer is Since the matrix It is composed of the elements in the convolution kernel. In order to speed up the calculation, the Frobenius norm can be directly calculated for each convolution channel in the convolution kernel, which is similar to There is only a difference in the numerical value, but they are equivalent in mathematical principle. Therefore, the F-norm of the convolution channel weights of each convolution kernel of each convolution layer is calculated and used as the significance of the convolution channel weights of the corresponding convolution kernel.

[0076] Step S602, calculating the second mean, the second median and the second mode of the significance of each convolution kernel convolution channel weight in each convolution layer;

[0077] by Figure 3 The middle column in is used as an example to illustrate the calculation of the convolution kernel convolution channel weight. F-norm, convolution kernel convolution channel weight F-norm, convolution kernel convolution channel weight F-norm, convolution kernel convolution channel weight The F-norm of the convolution kernel is calculated until the convolution channel weight is calculated. The F-norm of the convolution kernel convolution channel weight is obtained. The significance of convolution kernel and convolution channel weights The significance of convolution kernel and convolution channel weights The significance of convolution kernel and convolution channel weights The significance of the convolution kernel is calculated until the convolution channel weight is calculated. The significance of the results is then calculated for the second mean, second median, and second mode of these significances.

[0078] Step S603, based on the second mean, the second median and the second mode, determine the target convolution kernel convolution channel weight in the convolution channel weights of each convolution layer, and use the edge corresponding to the target convolution kernel convolution channel weight as the target edge, thereby obtaining the target edge in the convolution operation topology graph.

[0079] The specific steps include:

[0080] 1) When the second mean is greater than the second median, and the second median is greater than the second mode, among the convolution kernel convolution channel weights of each convolution layer, the convolution kernel convolution channel weight corresponding to the fourth target significance that is not less than the second mean among the significance of each convolution kernel convolution channel weight is used as the target convolution kernel convolution channel weight;

[0081] The above second mean is greater than the second median, and the second median is greater than the second mode, indicating that the significance is consistent with the positively skewed distribution.

[0082] Continue with Figure 3 Taking the middle column in as an example, if the second mean, the second median and the second mode obtained in the above step S602 meet this situation, the convolution kernel convolution channel weight The significance is compared with the second mean. If the convolution kernel convolution channel weight The significance of is greater than the second mean, then the convolution kernel convolution channel weight As the convolution channel weight of the target convolution kernel, the corresponding edge is the target edge.

[0083] 2) When the second mean is less than the second median, and the second median is less than the second mode, among the convolution kernel convolution channel weights of each convolution layer, the convolution kernel convolution channel weight corresponding to the fifth target significance that is not greater than the second mean among the significance of each convolution kernel convolution channel weight is used as the target convolution kernel convolution channel weight;

[0084] The second mean is smaller than the second median, and the second median is smaller than the second mode, indicating that the significance is consistent with the negatively skewed distribution.

[0085] 3) When the second mean is equal to the second median, and the second median is equal to the second mode, among the convolution kernel convolution channel weights of each convolution layer, the convolution kernel convolution channel weight corresponding to the sixth target significance whose absolute value of the difference between the significance of each convolution kernel convolution channel weight and the second mean is greater than the second preset value is taken as the target convolution kernel convolution channel weight, where the second preset value is the variance of the significance of each convolution kernel convolution channel weight.

[0086] The above second mean is equal to the second median, and the second median is equal to the second mode, which means that the significance is in line with the normal distribution.

[0087] The purpose of using the above three methods is that the network will be continuously adjusted during the pruning process. At the beginning of pruning, the convolution kernel and convolution channel weights that account for the majority are retained, and a small part of the convolution kernel and convolution channel weights are removed, which can ensure that the algorithm has a certain fault tolerance space.

[0088] It can be seen that the above pruning for significance judgment of feature graph nodes is to remove nodes in the graph, and the pruning for significance judgment of convolution kernel channel weights is to remove edges in the graph. Figure 7 The topology of the convolution operation after saliency judgment pruning is shown in Figure .

[0089] When judging the similarity of feature graph nodes of the same convolutional layer, the similarity of the numerical matrix of the feature graph nodes and the similarity of the nodes in the graph are considered simultaneously. In an optional embodiment of the present invention, reference is made to Figure 8 The above step S106, performing similarity judgment between feature graph nodes obtained by the same convolution layer in the convolution operation topology graph after the first pruning training, specifically includes:

[0090] Step S801, performing singular value decomposition on each feature map node obtained by the target convolutional layer to obtain a singular value vector of each feature map node, wherein the target convolutional layer is any convolutional layer in the convolutional neural network;

[0091] Since the feature map nodes (essentially matrices) obtained in convolutional neural networks are not necessarily square matrices, they cannot be directly obtained through P -1 The definition of matrix similarity of AP=B is used to calculate matrix similarity, and the singular value decomposition (SVD) method is used to calculate the singular values ​​of the feature graph nodes. That is: Among them, the square It is composed of square The matrix composed of the eigenvectors of It is composed of square The matrix composed of the eigenvectors of is a singular matrix. The principle of using singular values ​​is that singular values ​​can represent the degree of transformation of the image under different transformations. Convolution operation is a transformation of the image. The singular values ​​are arranged from small to large to form a singular value vector, then each feature map node Corresponding to a singular value vector (The singular values ​​of the feature graph nodes are calculated using the singular value decomposition (SVD) method, and the obtained singular values ​​are arranged in order from small to large).

[0092] Step S802, calculating a numerical similarity matrix between the first feature map node and the second feature map node according to the singular value vector of the first feature map node and the singular value vector of the second feature map node, wherein the first feature map node is any feature map node in each feature map node obtained by the target convolutional layer, and the second feature map node is any feature map node in each feature map node obtained by the target convolutional layer;

[0093] Specifically, the numerical similarity matrix between the first feature map node and the second feature map node can be calculated using cosine similarity, such as: in, Represents the first feature graph node With the second feature graph node The numerical similarity matrix of Represents the first feature graph node The corresponding singular value vector, Represents the second feature graph node The corresponding singular value vector, express The 2-norm of express The 2-norm of .

[0094] It should be noted that, in addition to using cosine similarity to calculate the numerical similarity matrix, other similarity calculation methods may also be used, and the embodiment of the present invention does not specifically limit the above cosine similarity calculation method.

[0095] Step S803, obtaining the n-th order neighbor feature graph node of the first feature graph node and the n-th order neighbor feature graph node of the second feature graph node;

[0096] like Figure 7 As shown in the figure on the right, the first feature map node The first-order neighbor feature map node has feature map node Feature map nodes Feature map nodes Feature map nodes Feature map nodes Second feature map node The first-order neighbor feature map node has feature map node Feature map nodes Feature map nodes Feature map nodes Feature map nodes

[0097] The so-called n-th order refers to the feature map nodes obtained by the convolution layers of the n layers before the feature map node and the feature map nodes obtained by the convolution layers of the n layers after the feature map node. The so-called neighbor feature map nodes refer to the feature map nodes that have direct edges with the feature map node (when the order is 1) and the feature map nodes that have indirect edges with the feature map node (when the order is greater than 1).

[0098] Step S804, calculating a node similarity matrix between the first feature graph node and the second feature graph node according to the n-th order neighbor feature graph node of the first feature graph node and the n-th order neighbor feature graph node of the second feature graph node;

[0099] Let’s set a collection is a feature graph node The set of 1st-order neighbor feature graph nodes, the set is a feature graph node The set of first-order neighbor feature map nodes.

[0100] Specifically, the node similarity matrix of the first feature graph node and the second feature graph node is calculated according to the Jaccard similarity calculation formula, which is specifically: in, Represents the first feature graph node With the second feature graph node The node similarity matrix of Represents the first feature graph node The first-order neighbor feature map node and the second feature map node The same neighbor feature map node of the first-order neighbor feature map node, Represents the first feature graph node The first-order neighbor feature map node and the second feature map node The union of the first-order neighbor feature graph nodes of , |·| represents the cardinality of the set. In a broad sense, the set and They can be feature map nodes and The set of all feature graph nodes of the n-th order neighbor, that is, the set is a feature map node The set of n-order neighbor feature graph nodes, the set It is a feature map node The set of n-order neighbor feature graph nodes. Generally, n=3 is often used.

[0101] Step S805, determining a similarity matrix between the first feature graph node and the second feature graph node according to the numerical similarity matrix and the node similarity matrix;

[0102] Specifically, the similarity matrix between the first feature graph node and the second feature graph node is obtained by combining the numerical similarity matrix and the node similarity matrix, which is specifically: in, Represents the first feature graph node With the second feature graph node The similarity matrix of Represents the first feature graph node With the second feature graph node The numerical similarity matrix of Represents the first feature graph node With the second feature graph node The node similarity matrix of .

[0103] Define the similarity matrix S(l) have:

[0104]

[0105] Step S806, calculating the variance of the elements in each row of the similarity matrix, and calculating the variance mean, variance median and variance mode according to the variance of the elements in each row;

[0106] Specifically, we need to (l) Transform, obviously, if a feature map node The similarity with other feature map nodes is relatively high, so the similarity matrix S (l) The variance of the elements in the i-th row (or column, the embodiment of the present invention is described using rows as an example, it can also be columns) is smaller.

[0107] Set in, Represents the similarity matrix S (l) Calculate the variance of the i-th row elements of the above variances, and calculate the variance mean, variance median, and variance mode.

[0108] Step S807, based on the variance mean, the variance median and the variance mode, determine the second target feature map node in the feature map nodes obtained by the target convolution layer, and then obtain the second target feature map node in the convolution operation topology map.

[0109] The specific steps include:

[0110] i) When the mean variance is not less than the median variance, and the median variance is not less than the mode variance, in the feature map node obtained by the target convolutional layer, the feature map node represented by the first target row corresponding to the first target variance whose variance of the elements in each row is not greater than the mean variance is used as the second target feature map node;

[0111] The above variance mean is not less than the variance median, and the variance median is not less than the variance mode, which means that the variance conforms to the positive skewed distribution or normal distribution.

[0112] For example, is not greater than the variance mean, that is, it is the first target variance, and the corresponding first target behavior similarity matrix S (l) The i-th row of the feature graph node represented by

[0113] ii) When the mean variance is less than the median variance, and the median variance is less than the mode variance, in the feature map node obtained by the target convolutional layer, the feature map node represented by the second target row corresponding to the second target variance in which the variance of the elements in each row is not greater than the mode variance is taken as the second target feature map node.

[0114] The above variance mean is less than the variance median, and the variance median is less than the variance mode, indicating that the variance is in accordance with the negatively skewed distribution.

[0115] The purpose of using the above two methods is to remove some nodes and edges for saliency judgment. At this time, the nodes that meet the similarity evaluation criteria can be retained, that is, the above two methods meet the similarity evaluation criteria.

[0116] In an alternative embodiment of the present invention, reference Fig. 9 The above step S108, performing importance judgment on each feature map node in the convolution operation topology map after the second pruning training, specifically includes the following steps:

[0117] Step S901, determining the degree value of each feature graph node;

[0118] Specifically, the importance judgment introduces the importance judgment of the feature map nodes in the global convolutional neural network, retains the important feature map nodes, and removes the unimportant feature map nodes. The present invention adopts the gravity model in the complex network to mine the importance of the nodes in the topological graph.

[0119] The above degree value includes the sum of out-degree and in-degree.

[0120] Step S902, using the Floyd algorithm to calculate the distance between any two feature graph nodes;

[0121] Step S903, calculating the importance of each feature graph node according to the degree value and the distance;

[0122] The process specifically includes the following steps:

[0123] Calculate the importance of feature graph nodes according to the formula Compute feature map nodes The importance of, where I(i) represents the feature map node corresponding to the i-th convolution kernel of the l-th convolution layer The importance of i Represents the feature map node corresponding to the i-th convolution kernel of the l-th convolution layer The degree value, d j Represents the feature map node M corresponding to the jth convolution kernel j The degree value, Represents a feature map node With feature map node M j The distance between them. n represents the number of feature map nodes in the convolution operation topology graph after the second pruning training.

[0124] Step S904: determine a third target feature graph node based on the importance of each feature graph node.

[0125] Specifically, each feature map node can be first arranged in ascending order of the importance of the feature map node, and then a preset number of feature map nodes at the front can be removed, or a preset percentage of feature map nodes at the front can be removed, that is, the preset number of feature map nodes or the preset percentage of feature map nodes to be removed are the third target feature map nodes.

[0126] In the above-mentioned pruning training process, in the specific implementation, the accuracy of the convolutional neural network after pruning training can be set, and the above-mentioned significance judgment, similarity judgment and importance judgment processes can be executed according to the accuracy to perform pruning training; the pruning ratio of each convolutional layer can also be set (the so-called pruning ratio is the parameter of the convolution kernel without the pruning ratio), and pruning is performed according to the set pruning ratio. The size of the pruning ratio can be determined according to the operating space of the embedded platform. If the operating space of the embedded platform is relatively large, a smaller pruning ratio can be set to ensure the accuracy of the convolutional neural network after pruning training. If the operating space of the embedded platform is very small, in order to ensure high-speed operation in the operating space of the embedded platform, a larger pruning ratio can be set.

[0127] It should be noted that if the pruning ratio of each convolutional layer is set, when pruning training is performed, after completing the pruning for significance judgment, first determine whether the pruning ratio of each convolutional layer has been met. If so, no subsequent pruning training will be performed. If not, subsequent similarity judgment pruning will be performed. Similarly, after completing the similarity judgment pruning, it is also necessary to determine whether the pruning ratio of each convolutional layer has been met. If so, no subsequent pruning training will be performed. If not, subsequent importance judgment pruning will be performed (this process will definitely enable the convolutional neural network after pruning training to reach the above pruning ratio, because the order is based on the importance of the global feature map nodes. Therefore, how much more pruning is needed, and the feature map nodes can be removed according to the sorted results), so that the final convolutional neural network after pruning training meets the above pruning ratio.

[0128] The inventors used the method of the present invention and the method of the prior art to test the VGG network and the ResNet network in combination with the Cifar-10 data set. During the test, the pruning training was performed while ensuring that the accuracy of the convolutional neural network after pruning training remained basically unchanged. The test results are shown in the following table:

[0129] VGG-16 Cifar-10 Experimental Results

[0130]

[0131] ResNet-18 Cifar-10 Experimental Results

[0132]

[0133]

[0134] The above experimental results show that, while ensuring that the accuracy of the convolutional neural network after pruning training remains basically unchanged, the pruning ratio of the method of the present invention (Our) is relatively larger, and greater pruning can be achieved.

[0135] The method of the present invention integrates structured pruning and unstructured pruning. Under the premise of ensuring the accuracy of the convolutional neural network after pruning training, it can achieve maximum pruning, reduce costs, enable a single embedded platform to run more deep learning models, and save hardware resources.

[0136] Embodiment 2:

[0137] The embodiment of the present invention further provides an image processing device, which is mainly used to execute the image processing method provided in the first embodiment of the present invention. The image processing device provided in the embodiment of the present invention is specifically introduced below.

[0138] Fig.10 is a schematic diagram of an image processing device according to an embodiment of the present invention, such as Fig.10 As shown, the device mainly includes: an acquisition unit 10, a saliency judgment unit 20, a similarity judgment unit 30, an importance judgment unit 40 and an image processing unit 50, wherein:

[0139] An acquisition unit, used to acquire a convolution operation topology map corresponding to the convolution operation performed by the convolution neural network on the image sample, wherein the convolution operation topology map includes: directional edges with convolution kernel convolution channel weights between feature map nodes and feature map nodes;

[0140] A saliency judgment unit is used to perform saliency judgment on the feature map nodes and convolution kernel convolution channel weights in the convolution operation topology map, and remove the first target feature map node and target edge in the convolution operation topology map according to the saliency judgment result to obtain the convolution operation topology map after the first pruning training;

[0141] A similarity judgment unit is used to perform similarity judgment between feature map nodes obtained by the same convolution layer in the convolution operation topology map after the first pruning training, and remove the second target feature map node in the convolution operation topology map after the first pruning training according to the similarity judgment result to obtain the convolution operation topology map after the second pruning training;

[0142] An importance judgment unit is used to judge the importance of each feature map node in the convolution operation topology map after the second pruning training, and remove the third target feature map node in the convolution operation topology map after the second pruning training according to the importance judgment result, so as to obtain the convolution operation topology map after the target pruning training, and then obtain the convolution neural network after pruning training;

[0143] The image processing unit is used to perform image processing on the image to be processed by using the convolutional neural network after pruning training to obtain an image processing result.

[0144] In an embodiment of the present invention, an image processing device is provided, comprising: obtaining a convolution operation topology map corresponding to when a convolution neural network performs a convolution operation on an image sample, wherein the convolution operation topology map comprises: feature map nodes and directional edges between feature map nodes with convolution kernel convolution channel weights; performing significance judgment on the feature map nodes and convolution kernel convolution channel weights in the convolution operation topology map respectively, and removing the first target feature map node and target edge in the convolution operation topology map according to the significance judgment result, to obtain a convolution operation topology map after a first pruning training; obtaining a convolution operation topology map after the first pruning training for the same convolution layer in the convolution operation topology map after the first pruning training; A similarity judgment is performed between the feature map nodes obtained, and the second target feature map node in the convolution operation topology map after the first pruning training is removed according to the similarity judgment result to obtain the convolution operation topology map after the second pruning training; an importance judgment is performed on each feature map node in the convolution operation topology map after the second pruning training, and the third target feature map node in the convolution operation topology map after the second pruning training is removed according to the importance judgment result to obtain the convolution operation topology map after the target pruning training, and then the convolution neural network after pruning training is obtained; the convolution neural network after pruning training is used to perform image processing on the image to be processed to obtain an image processing result. From the above description, it can be seen that in the image processing device of the present invention, the feature map nodes and the edges with convolution kernel convolution channel weights in the convolution operation topology map are first pruned and trained based on the convolution operation topology map, and then the convolution neural network after pruning training is used to process the image to be processed. In this way, the speed of subsequent image processing can be greatly improved, the processing flow is reduced, and memory resources are saved. In addition, in the above-mentioned pruning training process of the present invention, the convolution operation topology map is used as the basis, which not only realizes the numerical pruning of feature map nodes (removing some feature map nodes), but also considers the structured pruning of edges with convolution kernel convolution channel weights (removing some edges), which is more scientific. On the premise of ensuring the accuracy of the convolution neural network after pruning training, it can achieve maximum pruning, reduce the computational complexity of the network, and alleviate the problems of low efficiency, complicated process and serious waste of memory resources in the existing image processing method when processing the image to be processed.

[0145] Optionally, the significance judgment unit is further used to: calculate the significance of the feature graph node according to the formula Calculate the significance of each feature map node obtained by each convolutional layer, where Represents the feature map node corresponding to the i-th convolution kernel of the l-th convolution layer The significance of Represents a feature map node The feature map node under the jth image sample, Represents a feature map node The F-norm of Represents a feature map node The variance of b represents the batch size; in the significance of each feature map node obtained in each convolutional layer, the first mean, the first median and the first mode of the significance of each feature map node are calculated; based on the first mean, the first median and the first mode, the first target feature map node is determined in each feature map node obtained in each convolutional layer, and then the first target feature map node in the convolution operation topology graph is obtained.

[0146] Optionally, the significance judgment unit is also used for: when the first mean is greater than the first median, and the first median is greater than the first mode, in each feature map node obtained by each convolution layer, the feature map node corresponding to the first target significance of each feature map node that is not less than the first mean is taken as the first target feature map node; when the first mean is less than the first median, and the first median is less than the first mode, in each feature map node obtained by each convolution layer, the feature map node corresponding to the second target significance of each feature map node that is not greater than the first mean is taken as the first target feature map node; when the first mean is equal to the first median, and the first median is equal to the first mode, in each feature map node obtained by each convolution layer, the feature map node corresponding to the third target significance of the significance of each feature map node whose absolute value of the difference with the first mean is greater than a first preset value is taken as the first target feature map node, wherein the first preset value is the variance of the significance of each feature map node.

[0147] Optionally, the significance judgment unit is also used to: calculate the F-norm of each convolution kernel convolution channel weight of each convolution layer, and use the F-norm of each convolution kernel convolution channel weight as the significance of the corresponding convolution kernel convolution channel weight; calculate the second mean, second median and second mode of the significance of each convolution kernel convolution channel weight in the significance of each convolution kernel convolution channel weight of each convolution layer; based on the second mean, second median and second mode, determine the target convolution kernel convolution channel weight in the convolution channel weights of each convolution layer, and use the edge corresponding to the target convolution kernel convolution channel weight as the target edge, thereby obtaining the target edge in the convolution operation topology graph.

[0148] Optionally, the significance judgment unit is further used to: when the second mean is greater than the second median, and the second median is greater than the second mode, in each convolutional kernel convolution channel weight of each convolutional layer, the convolution channel weight corresponding to the fourth target significance that is not less than the second mean in the significance of each convolutional kernel convolution channel weight is used as the target convolution channel weight; when the second mean is less than the second median, and the second median is less than the second mode, in each convolutional kernel convolution channel weight of each convolutional layer, the convolution channel weight corresponding to the fourth target significance that is not less than the second mean in the significance of each convolutional kernel convolution channel weight is used as the target convolution channel weight; The convolution kernel convolution channel weight corresponding to the fifth target significance which is not greater than the second mean is taken as the target convolution kernel convolution channel weight; when the second mean is equal to the second median, and the second median is equal to the second mode, among the convolution kernel convolution channel weights of each convolution layer, the convolution kernel convolution channel weight corresponding to the sixth target significance whose absolute value of the difference between the significance of each convolution kernel convolution channel weight and the second mean is greater than the second preset value is taken as the target convolution kernel convolution channel weight, wherein the second preset value is the variance of the significance of each convolution kernel convolution channel weight.

[0149] Optionally, the similarity judgment unit is also used to: perform singular value decomposition on each feature map node obtained by the target convolution layer to obtain a singular value vector of each feature map node, wherein the target convolution layer is any convolution layer in the convolutional neural network; calculate the numerical similarity matrix of the first feature map node and the second feature map node according to the singular value vector of the first feature map node and the singular value vector of the second feature map node, wherein the first feature map node is any feature map node in each feature map node obtained by the target convolution layer, and the second feature map node is any feature map node in each feature map node obtained by the target convolution layer; obtain the n-th order neighbor feature map node of the first feature map node and the second feature map node n-order neighbor feature map nodes; calculate the node similarity matrix of the first feature map node and the second feature map node according to the n-order neighbor feature map nodes of the first feature map node and the n-order neighbor feature map nodes of the second feature map node; determine the similarity matrix of the first feature map node and the second feature map node according to the numerical similarity matrix and the node similarity matrix; calculate the variance of the elements of each row in the similarity matrix, and calculate the variance mean, variance median and variance mode according to the variance of the elements of each row; based on the variance mean, variance median and variance mode, determine the second target feature map node in the feature map nodes obtained by the target convolution layer, and then obtain the second target feature map node in the convolution operation topology graph.

[0150] Optionally, the similarity judgment unit is also used to: when the variance mean is not less than the variance median, and the variance median is not less than the variance mode, in the feature map nodes obtained by the target convolution layer, the feature map node represented by the first target row corresponding to the first target variance in the variance of the elements in each row that is not greater than the variance mean is used as the second target feature map node; when the variance mean is less than the variance median, and the variance median is less than the variance mode, in the feature map nodes obtained by the target convolution layer, the feature map node represented by the second target row corresponding to the second target variance in the variance of the elements in each row that is not greater than the variance mode is used as the second target feature map node.

[0151] Optionally, the importance judgment unit is also used to: determine the degree value of each feature graph node; use the Floyd algorithm to calculate the distance between any two feature graph nodes; calculate the importance of each feature graph node based on the degree value and the distance; and determine a third target feature graph node based on the importance of each feature graph node.

[0152] Optionally, importance judgment is also used to: calculate the importance of feature graph nodes according to the formula Compute feature map nodes The importance of, where I(i) represents the feature map node corresponding to the i-th convolution kernel of the l-th convolution layer The importance of iRepresents the feature map node corresponding to the i-th convolution kernel of the l-th convolution layer The degree value, d j Represents the feature map node M corresponding to the jth convolution kernel j The degree value, Represents a feature map node With feature map node M j The distance between.

[0153] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0154] like Fig.11 As shown, an electronic device 600 provided in an embodiment of the present application includes: a processor 601, a memory 602 and a bus, wherein the memory 602 stores machine-readable instructions executable by the processor 601. When the electronic device is running, the processor 601 communicates with the memory 602 through the bus, and the processor 601 executes the machine-readable instructions to perform the steps of the method for determining the image processing as described above.

[0155] Specifically, the memory 602 and the processor 601 can be general-purpose memories and processors, which are not specifically limited here. When the processor 601 runs the computer program stored in the memory 602, the image processing determination method can be executed.

[0156] The processor 601 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 601. The above processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and completes the steps of the above method in combination with its hardware.

[0157] Corresponding to the above-mentioned method for determining the processing of the image, an embodiment of the present application also provides a computer-readable storage medium, which stores machine-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the steps of the above-mentioned method for determining the processing of the image.

[0158] The image processing determination device provided in the embodiment of the present application can be specific hardware on the device or software or firmware installed on the device. The device provided in the embodiment of the present application has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brief description, the parts not mentioned in the device embodiment can refer to the corresponding contents in the aforementioned method embodiment. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.

[0159] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0160] For another example, the flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0161] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0162] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0163] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or partly contribute to the prior art or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions for an electronic device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the vehicle marking method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0164] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0165] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solution of the present application, rather than to limit it. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the aforementioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solution recorded in the aforementioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiment of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for processing an image, characterized in that: include: Obtaining a convolution operation topology map corresponding to when the convolution neural network performs a convolution operation on the image sample, wherein the convolution operation topology map includes: a feature map node and a directional edge with a convolution kernel convolution channel weight between the feature map nodes; Performing significance judgment on the feature graph nodes and convolution kernel convolution channel weights in the convolution operation topology graph respectively, and removing the first target feature graph node and target edge in the convolution operation topology graph according to the significance judgment result, so as to obtain the convolution operation topology graph after the first pruning training; Performing similarity judgment on feature map nodes obtained from the same convolution layer in the convolution operation topology map after the first pruning training, and removing the second target feature map node in the convolution operation topology map after the first pruning training according to the similarity judgment result, to obtain the convolution operation topology map after the second pruning training; Performing importance judgment on each feature map node in the convolution operation topology map after the second pruning training, and removing the third target feature map node in the convolution operation topology map after the second pruning training according to the importance judgment result, to obtain the convolution operation topology map after the target pruning training, and then to obtain the convolution neural network after pruning training; Using the pruned convolutional neural network trained by the method to perform image processing on the image to be processed, to obtain an image processing result; The step of performing significance judgment on the feature graph nodes in the convolution operation topology graph includes: Calculate the saliency of feature graph nodes according to the formula Calculate the significance of each feature map node obtained by each convolutional layer, where Indicates Convolutional layer The feature map nodes corresponding to the convolution kernels The significance of Represents a feature map node In the feature map nodes under image samples, Represents a feature map node The F-norm of Represents a feature map node The variance of Indicates the batch size; Among the significances of each feature map node obtained by each convolutional layer, a first mean, a first median and a first mode of the significances of each feature map node are calculated; Based on the first mean, the first median, and the first mode, determining the first target feature map node from each feature map node obtained in each convolution layer, and then obtaining the first target feature map node in the convolution operation topology map; The significance judgment of the convolution kernel convolution channel weights in the convolution operation topology graph includes: Calculate the F-norm of each convolution kernel convolution channel weight of each convolution layer, and use the F-norm of each convolution kernel convolution channel weight as the significance of the corresponding convolution kernel convolution channel weight; Among the significances of the convolution kernel convolution channel weights of each convolution layer, calculating the second mean, the second median and the second mode of the significances of the convolution kernel convolution channel weights; Based on the second mean, the second median and the second mode, a target convolution kernel convolution channel weight is determined in the convolution kernel convolution channel weights of each convolution layer, and the edge corresponding to the target convolution kernel convolution channel weight is used as the target edge, thereby obtaining the target edge in the convolution operation topology graph.

2. The method according to claim 1, characterized in that Determining the first target feature map node from each feature map node obtained in each convolutional layer based on the first mean, the first median, and the first mode includes: When the first mean is greater than the first median, and the first median is greater than the first mode, among the feature map nodes obtained in each convolutional layer, a feature map node corresponding to a first target significance that is not less than the first mean among the significances of the feature map nodes is used as the first target feature map node; When the first mean is less than the first median, and the first median is less than the first mode, among the feature map nodes obtained in each convolutional layer, a feature map node corresponding to a second target significance that is not greater than the first mean among the significances of the feature map nodes is used as the first target feature map node; When the first mean is equal to the first median, and the first median is equal to the first mode, among the feature map nodes obtained in each convolutional layer, the feature map node corresponding to the third target significance whose absolute value of the difference between the significance of each feature map node and the first mean is greater than a first preset value is taken as the first target feature map node, wherein the first preset value is the variance of the significance of each feature map node.

3. The method according to claim 1, characterized in that Based on the second mean, the second median and the second mode, determining a target convolution kernel convolution channel weight in each convolution kernel convolution channel weight of each convolution layer includes: When the second mean is greater than the second median, and the second median is greater than the second mode, among the convolution kernel convolution channel weights of each convolution layer, a convolution kernel convolution channel weight corresponding to a fourth target significance that is not less than the second mean among the significances of the convolution kernel convolution channel weights is used as the target convolution kernel convolution channel weight; When the second mean is less than the second median, and the second median is less than the second mode, among the convolution kernel convolution channel weights of each convolution layer, the convolution kernel convolution channel weight corresponding to the fifth target significance that is not greater than the second mean among the significances of the convolution kernel convolution channel weights is used as the target convolution kernel convolution channel weight; When the second mean is equal to the second median, and the second median is equal to the second mode, among the convolution kernel convolution channel weights of each convolution layer, the convolution kernel convolution channel weight corresponding to the sixth target significance whose absolute value of the difference between the significance of each convolution kernel convolution channel weight and the second mean is greater than a second preset value is used as the target convolution kernel convolution channel weight, wherein the second preset value is the variance of the significance of each convolution kernel convolution channel weight.

4. The method according to claim 1, characterized in that: Performing similarity judgment between feature graph nodes obtained from the same convolution layer in the convolution operation topology graph after the first pruning training includes: Performing singular value decomposition on each feature map node obtained by the target convolutional layer to obtain a singular value vector of each feature map node, wherein the target convolutional layer is any convolutional layer in the convolutional neural network; Calculate a numerical similarity matrix of the first feature map node and the second feature map node according to a singular value vector of the first feature map node and a singular value vector of the second feature map node, wherein the first feature map node is any one of each feature map node obtained by the target convolution layer, and the second feature map node is any one of each feature map node obtained by the target convolution layer; Get the first feature graph node The first-order neighbor feature map node and the second feature map node order neighbor feature map node; According to the first feature graph node The first-order neighbor feature map node and the second feature map node The first-order neighbor feature map node calculates a node similarity matrix between the first feature map node and the second feature map node; Determine a similarity matrix between the first feature graph node and the second feature graph node according to the numerical similarity matrix and the node similarity matrix; Calculating the variance of the elements in each row of the similarity matrix, and calculating the variance mean, variance median and variance mode according to the variance of the elements in each row; Based on the variance mean, the variance median and the variance mode, the second target feature map node is determined in the feature map nodes obtained by the target convolution layer, so as to obtain the second target feature map node in the convolution operation topology map.

5. The method according to claim 4, characterized in that Determining the second target feature map node from the feature map nodes obtained by the target convolution layer based on the variance mean, the variance median, and the variance mode, includes: When the variance mean is not less than the variance median, and the variance median is not less than the variance mode, in the feature graph nodes obtained by the target convolution layer, the feature graph node represented by the first target row corresponding to the first target variance that is not greater than the variance mean in the variance of the elements of each row is used as the second target feature graph node; When the variance mean is less than the variance median, and the variance median is less than the variance mode, in the feature map node obtained by the target convolutional layer, the feature map node represented by the second target row corresponding to the second target variance in the variance of the elements of each row that is not greater than the variance mode is used as the second target feature map node.

6. The method according to claim 1, characterized in that The importance of each feature map node in the convolution operation topology map after the second pruning training is judged, including: Determine the degree value of each feature graph node; The Floyd algorithm is used to calculate the distance between any two feature graph nodes; Calculate the importance of each feature graph node according to the degree value and the distance; The third target feature map node is determined based on the importance of each feature map node.

7. The method according to claim 6, characterized in that Calculating the importance of each feature graph node according to the degree value and the distance includes: Calculate the importance of feature graph nodes according to the formula Compute feature map nodes of importance, among which Indicates Convolutional layer The feature map nodes corresponding to the convolution kernels The importance of Indicates Convolutional layer The feature map nodes corresponding to the convolution kernels The degree value, Indicates The feature map nodes corresponding to the convolution kernels The degree value, Represents a feature map node With feature map nodes The distance between.

8. An image processing device, characterized in that: include: An acquisition unit, used to acquire a convolution operation topology map corresponding to when the convolution neural network performs a convolution operation on the image sample, wherein the convolution operation topology map includes: a feature map node and a directional edge with a convolution kernel convolution channel weight between the feature map nodes; A saliency judgment unit is used to perform saliency judgment on the feature map nodes and convolution kernel convolution channel weights in the convolution operation topology map, and remove the first target feature map node and target edge in the convolution operation topology map according to the saliency judgment result to obtain the convolution operation topology map after the first pruning training; A similarity judgment unit, configured to perform similarity judgment on feature map nodes obtained by the same convolution layer in the convolution operation topology map after the first pruning training, and remove the second target feature map node in the convolution operation topology map after the first pruning training according to the similarity judgment result to obtain the convolution operation topology map after the second pruning training; An importance judgment unit is used to perform importance judgment on each feature map node in the convolution operation topology map after the second pruning training, and remove the third target feature map node in the convolution operation topology map after the second pruning training according to the importance judgment result, so as to obtain the convolution operation topology map after the target pruning training, and then obtain the convolution neural network after pruning training; An image processing unit, used to perform image processing on the image to be processed by using the convolutional neural network after the pruning training to obtain an image processing result; The significance judgment unit is further used to: calculate the significance of the feature graph node according to the formula Calculate the significance of each feature map node obtained by each convolutional layer, where Indicates Convolutional layer The feature map nodes corresponding to the convolution kernels The significance of Represents a feature map node In the feature map nodes under image samples, Represents a feature map node The F-norm of Represents a feature map node The variance of represents a batch size; among the significances of each feature map node obtained in each convolutional layer, calculating a first mean, a first median, and a first mode of the significance of each feature map node; based on the first mean, the first median, and the first mode, determining the first target feature map node among the feature map nodes obtained in each convolutional layer, thereby obtaining the first target feature map node in the convolution operation topology graph; Among them, the significance judgment unit is also used to: calculate the F-norm of the convolution channel weights of each convolution kernel of each convolution layer, and use the F-norm of the convolution channel weights of each convolution kernel as the significance of the corresponding convolution channel weight; in the significance of the convolution channel weights of each convolution kernel of each convolution layer, calculate the second mean, second median and second mode of the significance of each convolution channel weight; based on the second mean, the second median and the second mode, determine the target convolution channel weight in the convolution channel weights of each convolution layer, and use the edge corresponding to the target convolution channel weight as the target edge, thereby obtaining the target edge in the convolution operation topology graph.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to execute the method according to any one of claims 1 to 7.