A feature map processing method, terminal and storage medium based on high-order statistics
By calculating high-order statistics and using neural networks to obtain channel attention weights, the problem of limited statistical information captured by the channel attention mechanism in the existing technology is solved, and the representation ability and image processing quality of the neural network are improved.
Patent Information
- Application Number
- CN202011205903.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-02
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-11-02
AI Technical Summary
The statistical information captured by the channel attention mechanism in the existing technology is limited, resulting in inaccurate attention weights and affecting the feature representation ability of the neural network.
The feature map processing method based on high-order statistics is used to obtain the attention weight of the channel by calculating first-order, second-order, third-order and fourth-order statistics, combined with the pre-trained neural network, and improve the accuracy of the channel attention weight.
It improves the accuracy of channel attention weights, enhances the representation capabilities of neural networks, and enables higher-quality image processing.
Smart Images

Figure CN112434704B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a feature map processing method based on high-order statistics, a terminal and a storage medium. Background Art
[0002] Many existing deep learning-based image super-resolution algorithms intend to design deeper or wider network structures, while ignoring the characteristic correlation of the intermediate layers of the network, thus affecting the feature representation ability of the neural network. The channel attention mechanism can adaptively rescale the features of each channel by modeling the correlation between channels, so that the network can focus on more useful channels and improve the representation ability of the neural network. However, the channel attention mechanism in the existing technology captures very limited statistical information, and it is difficult to calculate the accurate attention weight.
[0003] Therefore, the prior art still needs to be improved and enhanced. Summary of the invention
[0004] In view of the above-mentioned defects of the prior art, the present invention provides a feature map processing method, a terminal and a storage medium based on high-order statistics, aiming to solve the problem in the prior art that the statistical information captured by the channel attention mechanism is limited and the obtained attention weights are inaccurate.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is as follows:
[0006] A first aspect of the present invention provides a feature map processing method based on high-order statistics, the method comprising:
[0007] Calculate the statistical value corresponding to each channel of the feature map to be processed respectively, wherein the statistical value includes at least one high-order statistic;
[0008] Inputting the feature graph to be processed into a pre-trained first neural network, and obtaining a first parameter set through the first neural network, wherein the first parameter set includes a plurality of first parameters, each of which is a correlation score between the feature graph to be processed and each of the statistics;
[0009] Obtaining the attention weight of each channel of the feature map to be processed according to each of the first parameters and the statistical value;
[0010] Each channel of the feature map to be processed is processed according to each of the attention weights to obtain a target feature map.
[0011] The feature map processing method based on high-order statistics, wherein the statistics include first-order statistics, second-order statistics, third-order statistics and fourth-order statistics.
[0012] The feature map processing method based on high-order statistics, wherein the statistical value corresponding to each channel is calculated separately, comprises:
[0013] Obtain the statistical value respectively according to the preset formula;
[0014] Wherein, the preset formula is:
[0015]
[0016]
[0017]
[0018]
[0019] Among them, z 1,c Represents the first-order statistic value of the c-th channel of the feature map U to be processed, z 2,c Represents the second-order statistic value of the c-th channel of the feature map U to be processed, z 3,c Represents the third-order statistic value of the c-th channel of the feature map U to be processed, z 4,c Represents the fourth-order statistic value of the c-th channel of the feature map U to be processed, u c (i, j) is the eigenvalue of the feature point with coordinates (i, j) in the cth channel of the feature map U, μ c is the mean of all eigenvalues in the cth channel of the feature map U, σ c is the mean standard deviation of all eigenvalues in the cth channel of the feature map U, and E is the mean operation.
[0020] The feature graph processing method based on high-order statistics, wherein the step of obtaining the first parameter set through the first neural network includes:
[0021] Inputting the feature graph to be processed into a first module in the first neural network, and obtaining a second parameter set output by the first module, wherein the second parameter set includes a plurality of second parameters;
[0022] Discrete variables are sampled for each of the second parameters to obtain each of the first parameters.
[0023] The feature map processing method based on high-order statistics, wherein the step of obtaining the attention weights of each channel of the feature map to be processed according to each of the first parameters and the statistical value respectively includes:
[0024] Performing weighted summation on the statistic values of each channel according to the first parameters respectively corresponding to the statistics, to obtain third parameters respectively corresponding to the channels;
[0025] Obtaining each of the attention weights according to each of the third parameters;
[0026] The value range of the attention weight is [0, 1].
[0027] The feature map processing method based on high-order statistics, wherein the step of obtaining each of the attention weights according to each of the third parameters comprises:
[0028] Input each of the third parameters into the second module of the first neural network to obtain the attention weight output by the second module.
[0029] The feature map processing method based on high-order statistics, wherein the processing of each channel of the feature map to be processed according to each of the attention weights includes:
[0030] Multiply the attention weight corresponding to the channel by the feature value of the channel.
[0031] In the feature map processing method based on high-order statistics, the first neural network is trained based on multiple groups of training data, and each group of training data includes a sample image and a sample target image corresponding to the sample image.
[0032] According to a second aspect of the present invention, a terminal is provided, comprising a processor and a storage medium communicatively connected to the processor, wherein the storage medium is suitable for storing a plurality of instructions, and the processor is suitable for calling the instructions in the storage medium to execute the steps of implementing any one of the above-mentioned feature map processing methods based on high-order statistics.
[0033] According to a third aspect of the present invention, a storage medium is provided, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any of the above-mentioned feature map processing methods based on high-order statistics.
[0034] Compared with the prior art, the present invention provides a feature map processing method, terminal and storage medium based on high-order statistics. In the method provided by the present invention, multiple statistical values of the characteristic values of each channel of the feature map are extracted, and the statistics include at least one high-order statistic. Then, a neural network is used to determine the correlation between each statistic and the feature map, and the attention weights of each channel of the feature map are obtained according to the corresponding correlation and statistical values. Multiple statistical values including high-order statistics can capture richer statistical information. The attention weights of each channel are determined based on the statistical values and the correlation of the statistics, thereby improving the accuracy of the channel attention weights, improving the representation ability of the neural network, and ultimately achieving higher quality image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A flowchart of an embodiment of a feature graph processing method based on high-order statistics provided by the present invention;
[0036] Figure 2 A schematic diagram of a neural network framework in an embodiment of a feature graph processing method based on high-order statistics provided by the present invention;
[0037] Figure 3 A schematic diagram of the principles of an embodiment of a terminal provided by the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0039] Embodiment 1
[0040] The feature map processing method based on high-order statistics provided by the present invention can be applied in a terminal, and the terminal can process the feature map by the feature map processing method based on high-order statistics provided by the present invention. The terminal can be, but is not limited to, various computers, mobile phones, tablet computers, vehicle-mounted computers, and portable wearable devices.
[0041] like Figure 1 As shown, in one embodiment of the feature map processing method based on high-order statistics, the steps include:
[0042] S100, respectively calculating the statistical value corresponding to each channel of the feature map to be processed, wherein the statistics include at least one high-order statistic.
[0043] The feature map to be processed is a feature map obtained after feature extraction of the image. Specifically, the feature map processing method based on high-order statistics provided in this embodiment can be used as a part of an image processing task. The image processing task includes but is not limited to various image processing tasks such as image super-resolution and image segmentation. When using a neural network to perform image processing tasks, it is necessary to process the feature map of the image to extract deeper and more important features, suppress unimportant features, generate a new feature map, and then perform further operations to obtain the final target image.
[0044] In this embodiment, after obtaining the feature map to be processed, the statistical values corresponding to each channel of the feature map to be processed are calculated respectively. For each channel of the feature map to be processed, the characteristic values in the channel are counted to obtain various statistical values. Specifically, the feature map to be processed includes multiple channels, and each feature point corresponds to an characteristic value (that is, the pixel value of the feature point) in each channel. The corresponding statistics are solved with each characteristic value on each channel of the feature map to be processed as the object to obtain the statistical value corresponding to the channel.
[0045] In this embodiment, the statistics include statistics of multiple different orders, including at least one high-order statistic, and the high-order statistic refers to a statistic with an order greater than the second order. In this embodiment, the values of multiple statistics including high-order statistics corresponding to each channel are obtained to determine the attention weight corresponding to the channel, which can capture more statistical information and make the obtained channel attention weight more accurate, thereby strengthening important features and suppressing unimportant features, thereby improving the image processing quality.
[0046] Specifically, in this embodiment, the statistics include first-order statistics, second-order statistics, third-order statistics and fourth-order statistics. Of course, it can be understood that other statistical combinations can also be selected, for example, first-order statistics, third-order statistics and fourth-order statistics or first-order statistics, second-order statistics, third-order statistics, fourth-order statistics and fifth-order statistics, etc.
[0047] The statistical values corresponding to each channel of the feature map to be processed can be calculated according to a preset formula. In this embodiment, the preset formula is:
[0048]
[0049]
[0050]
[0051]
[0052] Among them, z 1,c Represents the first-order statistic value of the c-th channel of the feature map U to be processed, z 2,c Represents the second-order statistic value of the c-th channel of the feature map U to be processed, z 3,c Represents the third-order statistic value of the c-th channel of the feature map U to be processed, z 4,c Represents the fourth-order statistic value of the c-th channel of the feature map U to be processed, u c (i, j) is the eigenvalue of the feature point with coordinates (i, j) in the cth channel of the feature map U, μ cis the mean of all eigenvalues in the cth channel of the feature map U, σ c is the mean standard deviation of all eigenvalues in the cth channel of the feature map U, and E is the mean operation.
[0053] Please refer again Figure 1 The feature map processing method based on high-order statistics provided in this embodiment further includes the steps of:
[0054] S200: Input the feature graph to be processed into a pre-trained first neural network, and obtain a first parameter set through the first neural network.
[0055] The first parameter set includes a plurality of first parameters, each of which is a correlation score between the feature graph to be processed and each of the statistics.
[0056] In this embodiment, the correlation between the feature map and each of the statistics is obtained through a pre-trained first neural network. Specifically, the first parameter set is obtained through the first neural network, including:
[0057] S210, inputting the feature graph to be processed into a first module in the first neural network, and obtaining a second parameter set output by the first module, wherein the second parameter set includes a plurality of second parameters;
[0058] S220: Sample discrete variables for each of the second parameters to obtain each of the first parameters.
[0059] Specifically, the schematic diagram of the architecture of the first neural network is as follows Figure 2As shown, the first neural network includes a first module, the first parameter set is output by the first module, the first module adopts a gating mechanism, after the feature map to be processed is input into the first module, the first module first estimates the correlation between the feature map to be processed and each of the statistics through a global average pooling layer and a fully connected layer, and outputs a second parameter set, the second parameters included in the second parameter set are respectively correlation parameters between each of the statistics and the feature map to be processed. Specifically, the parameters of the modules in the first neural network are determined during the training process of the first neural network, that is, the parameters of the first module, such as the parameters of the global average pooling layer and the fully connected layer included therein, are synchronously updated during the training process of the first neural network, and the parameters are determined when the training of the first neural network is completed. Specifically, the first neural network is a part of the image processing task neural network, and is trained as a whole with other neural network modules in the image processing task neural network. The image processing task neural network is trained by multiple sets of training data, each set of training data includes a sample image and a sample target image corresponding to the sample image. For example, when the image processing task is an image super-resolution task, the sample image is a low-resolution image, and the sample target image corresponding to the sample image is a high-resolution image corresponding to the low-resolution image. After the training is completed, the image processing task neural network can perform the corresponding image processing task to process the input image. The first neural network is synchronously trained as a part of the image processing task neural network, that is, the first neural network is trained according to multiple sets of training data, each set of training data includes a sample image and a sample target image corresponding to the sample image.
[0060] In a possible implementation, the second parameter set output by the first module can be directly obtained as the first parameter set. In this embodiment, randomness is introduced in the result output by the first module. After the second parameter set is obtained, discrete variables are sampled for each second parameter included in the second parameter set to obtain each first parameter. In this embodiment, randomness is introduced by adding Gumbel distribution noise. Specifically, the first parameter is a K-dimensional discrete random variable with a probability distribution of [α1, α2, ..., α K ], according to the Gumbel-Softmax technique, discrete variables can be sampled according to the following formula:
[0061] v = one_hot(softmax[(logα k +G k ) / τ])
[0062] Among them, τ is the temperature parameter of the softmax function, G1,G2,...G KIt is an independent and identically distributed Gumbel random variable, which can be generated by the inverse of the uniform distribution, that is, G = -log(-log(Z)), where Z is a sample that obeys the uniform distribution Unif[0,1].
[0063] The v obtained according to the above formula is the first parameter set, and v is a one hot vector of the form [0,0,1,0]. That is, only one of the statistics corresponds to the first parameter of 1, and the other statistics correspond to the first parameters of 0.
[0064] Please refer again Figure 1 The feature map processing method based on high-order statistics provided in this embodiment also includes the steps of:
[0065] S300, obtaining the attention weight of each channel of the feature map to be processed according to each of the first parameters and the statistical value.
[0066] After obtaining each of the first parameters and the statistical values, for the feature map to be processed, there are correlation scores of each of the statistics, and for each channel of the feature map to be processed, there are corresponding statistical values. According to each of the first parameters and the statistical values, the attention weights of each channel of the feature map to be processed are respectively obtained, specifically including:
[0067] S310 , performing weighted summation on the statistic values of each channel according to the first parameters respectively corresponding to each statistic, to obtain a third parameter respectively corresponding to each channel.
[0068] For each channel of the feature map to be processed, the first parameter corresponding to each statistic is used as a weight, and weighted summation is performed on the statistic values of each channel. The specific calculation method can be expressed by the following formula:
[0069]
[0070] Among them, y is the third parameter of the channel, v i is the first parameter of the ith statistic, v i is the i-th element in vector v, z i is the statistic value of the ith statistic of the channel, and K is the total number of statistics. For example, in this embodiment, the statistics include first-order statistics, second-order statistics, third-order statistics and fourth-order statistics, then K is 4.
[0071] Since the first parameter v is a one hot vector, for each channel, the first parameter v is used as a weight to perform weighted summation on the statistical values of each channel, which actually selects the statistical value of the statistic with the greatest correlation among the statistics of different orders as the corresponding third parameter. For example, Figure 2 FIG. 4 shows a case where the statistical value of the second-order statistic of a channel is selected as the third parameter of the channel.
[0072] S320. Obtain each of the attention weights according to each of the third parameters.
[0073] In a possible implementation, the third parameter can be directly used as the attention weight of the channel. In this embodiment, the value range of the attention weight is [0,1]. That is, after obtaining the third parameter, each third parameter is normalized and used as the attention weight of the corresponding channel.
[0074] Specifically, obtaining each of the attention weights according to each of the third parameters includes:
[0075] Input each of the third parameters into the second module of the first neural network to obtain the attention weight output by the second module.
[0076] Specifically, the second module includes a fully connected layer and an activation function, and the parameters of the second module are determined during the training process of the first neural network. For details, please refer to the previous description of the training of the first neural network.
[0077] Please refer again Figure 1 After obtaining the attention weights of each channel, the feature map processing method based on high-order statistics provided in this embodiment further includes the steps of:
[0078] S400, processing each channel of the feature map to be processed according to each of the attention weights to obtain a target feature map.
[0079] After obtaining the attention weights corresponding to each channel of the feature map to be processed, for each channel of the feature map to be processed, the attention weight corresponding to the channel is multiplied by the channel, that is, the attention weight corresponding to the channel is multiplied by the characteristic value of the channel. Specifically, the attention weight corresponding to the channel is multiplied by the characteristic value of the feature point of the feature map on the channel.
[0080] In summary, this embodiment provides a feature map processing method based on high-order statistics, by extracting multiple statistical values of the characteristic values of each channel of the feature map, the statistics include at least one high-order statistic, and then determining the correlation between each statistic and the feature map through a neural network, and obtaining the attention weights of each channel of the feature map according to the corresponding correlation and statistical values. Multiple statistical values including high-order statistics can capture richer statistical information, and the attention weights of each channel are determined based on the statistical values and the correlation of the statistics, thereby improving the accuracy of the channel attention weights, improving the representation ability of the neural network, and ultimately achieving higher quality image processing.
[0081] It should be understood that, although the various steps in the flowcharts given in the accompanying drawings of the present specification are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0082] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0083] Embodiment 2
[0084] Based on the above embodiments, the present invention also provides a terminal, such as Figure 3 As shown, the terminal includes a processor 10 and a memory 20. It can be understood that Figure 3 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0085] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a feature map processing program 30 based on high-order statistics is stored on the memory 20, and the feature map processing program 30 based on high-order statistics can be executed by the processor 10, thereby realizing the feature map processing method based on high-order statistics in the present invention.
[0086] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other chip, used to run the program code or process data stored in the memory 20, such as executing the feature map processing method based on high-order statistics described in Example 1.
[0087] Embodiment 3
[0088] The present invention also provides a storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the feature map processing method based on high-order statistics as described above.
[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A feature map processing method based on high-order statistics, characterized in that: The method comprises: Calculate the statistical value corresponding to each channel of the feature map to be processed respectively, wherein the statistics include first-order statistics, second-order statistics, third-order statistics and fourth-order statistics; The step of respectively calculating the statistical value corresponding to each channel of the feature graph to be processed includes: Obtain the statistical value respectively according to the preset formula; Wherein, the preset formula is: Among them, z 1,c Represents the first-order statistic value of the c-th channel of the feature map U to be processed, z 2,c Represents the second-order statistic value of the c-th channel of the feature map U to be processed, z 3,c Represents the third-order statistic value of the c-th channel of the feature map U to be processed, z 4,c Represents the fourth-order statistic value of the c-th channel of the feature map U to be processed, u c (i, j) is the eigenvalue of the feature point with coordinates (i, j) in the cth channel of the feature map U, μ c is the mean of all eigenvalues in the cth channel of the feature map U, σ c is the mean standard deviation of all eigenvalues in the cth channel of feature map U, and E is the mean operation; Inputting the feature graph to be processed into a pre-trained first neural network, and obtaining a first parameter set through the first neural network, wherein the first parameter set includes a plurality of first parameters, each of which is a correlation score between the feature graph to be processed and each of the statistics; Obtaining the attention weight of each channel of the feature map to be processed according to each of the first parameters and the statistical value; The step of respectively obtaining the attention weight of each channel of the feature map to be processed according to each of the first parameters and the statistical value includes: Performing weighted summation on the statistic values of each channel according to the first parameters respectively corresponding to the statistics, to obtain third parameters respectively corresponding to the channels; Obtaining each of the attention weights according to each of the third parameters; Wherein, the value range of the attention weight is [0,1]; Each channel of the feature map to be processed is processed according to each of the attention weights to obtain a target feature map.
2. The feature map processing method based on high-order statistics according to claim 1, characterized in that: The obtaining a first parameter set through the first neural network includes: Inputting the feature graph to be processed into a first module in the first neural network, and obtaining a second parameter set output by the first module, wherein the second parameter set includes a plurality of second parameters; Discrete variables are sampled for each of the second parameters to obtain each of the first parameters.
3. The feature map processing method based on high-order statistics according to claim 1, characterized in that: The obtaining each of the attention weights according to each of the third parameters comprises: Input each of the third parameters into the second module of the first neural network to obtain the attention weight output by the second module.
4. The feature map processing method based on high-order statistics according to claim 1, characterized in that: The processing of each channel of the feature map to be processed according to each of the attention weights includes: Multiply the attention weight corresponding to the channel by the feature value of the channel.
5. The feature map processing method based on high-order statistics according to any one of claims 1 to 4, characterized in that: The first neural network is trained based on multiple sets of training data, each set of training data includes a sample image and a sample target image corresponding to the sample image.
6. A terminal, characterized in that: The terminal includes: a processor, a storage medium communicatively connected to the processor, the storage medium being suitable for storing a plurality of instructions, and the processor being suitable for calling the instructions in the storage medium to execute the steps of the feature map processing method based on high-order statistics as described in any one of claims 1 to 5 above.
7. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the feature map processing method based on high-order statistics as described in any one of claims 1-5.
