Global feature enhancement method, device and equipment and readable storage medium
By introducing the global feature enhancement module into the feature extraction network and using the self-attention layer and channel splicing layer for feature fusion, the problem of insufficient receptive fields in the deep network is solved, and the ability to extract global feature information and the recognition of edge objects in the image are improved. Effect.
Patent Information
- Application Number
- CN202410857297.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-28
AI Technical Summary
Existing feature extraction models have insufficient receptive fields in deep networks, resulting in insufficient extraction of global feature information. In particular, semantic segmentation models focus more on the center of the image and ignore edge objects.
By introducing the top path, middle path and bottom path in the global feature enhancement module, convolution, pooling and global average pooling operations are performed respectively, and the self-attention layer and channel splicing layer are used for data integration and feature fusion, gradually increasing Pooling window size and depth aggregation enhance the model’s receptive field and feature extraction capabilities.
Effectively obtain global feature information, improve the expression ability of the model and the adequacy of feature extraction, and enhance the ability to identify edge objects in the image.
Smart Images

Figure CN118537576A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a global feature enhancement method, device, equipment and readable storage medium. Background Art
[0002] In deep networks, the size of the receptive field roughly reflects the contextual information that the deep learning model can obtain. Although in theory the receptive field of existing feature extraction models is already larger than the image size, in practice the receptive field is much smaller. This results in many models being unable to fully incorporate contextual information, limiting the model's expressive power. In actual industrial inspection projects, it is found that semantic segmentation models focus more on objects in the center of the image and ignore objects at the edge of the image. This is because the model's receptive field fails to fully cover the entire image and cannot obtain more global feature information.
[0003] Therefore, the current feature extraction model suffers from the problem of insufficient extraction of global feature information. Summary of the invention
[0004] In view of this, an object of the present invention is to provide a global feature enhancement method, device, equipment and readable storage medium, which solve the technical problem of insufficient global feature information extraction in the prior art.
[0005] In order to solve the above technical problems, the present invention provides a global feature enhancement method, comprising:
[0006] Inputting the feature graph group output by the feature extraction network into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature graph group;
[0007] Inputting the feature map group output by the feature extraction network into the middle path and the bottom path of the global feature enhancement module for processing; wherein the middle path includes a plurality of paths for performing a pooling operation on the feature map group, the bottom path is used for performing a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path gradually increase;
[0008] After the pooling process of the middle path and the bottom path is completed, the upsampling layer is used to perform size transformation respectively to obtain data with the same size as the integrated data image;
[0009] The data in the middle path and the bottom path that have undergone size transformation are processed using a self-attention layer, and the integrated data and the data processed by the self-attention layer are integrated using a channel splicing layer and a convolution layer to obtain target global enhanced data.
[0010] Optionally, the window sizes of the multiple paths corresponding to the intermediate path are 2*(k+N)+1; wherein k is an even number, k>=2, and N increases gradually.
[0011] Optionally, the step of integrating the integrated data and the data processed by the self-attention layer using a channel splicing layer and a convolution layer to obtain target global enhanced data includes:
[0012] The channel splicing layer is used to integrate the integrated data and the data processed by the self-attention layer, and a 1*1 convolutional layer is used to perform cross-channel interaction and information integration to obtain the target global enhanced data.
[0013] Optionally, the processing of the size-transformed data in the middle path and the bottom path by using the self-attention layer includes:
[0014] The self-attention layer is used to perform top-down and bottom-up feature fusion processing on the data in the middle path and the bottom path that have undergone size transformation; wherein the top-down refers to the data from the initial path of the middle path to the bottom path, and the bottom-up refers to the data from the bottom path to the top path.
[0015] Optionally, there are three intermediate paths, the top path is taken as path 1, the paths corresponding to the intermediate paths are path 2, path 3 and path 4 respectively, and the bottom path is taken as path 5.
[0016] Optionally, the using the self-attention layer to perform top-down and bottom-up feature fusion processing on the data in the middle path and the bottom path after the size transformation includes:
[0017] After pooling and upsampling, the data of path 2 enters the self-attention layer 1 for global feature extraction, and the output data of self-attention layer 1 is sent to path 7 and path 8 respectively;
[0018] The data of path 8 and path 9 are feature fused, and the fused data is sent to the self-attention layer 2 for calculation. The output data of the self-attention layer 2 is sent to path 9 and path 10 respectively; path 24 is the data of path 3 after pooling and upsampling;
[0019] The data of path 10 and path 11 are feature fused, and the fused data is sent to the self-attention layer 3 for calculation. The output data of the self-attention layer 3 is sent to path 12 and path 13 respectively; path 11 is the data of path 4 after pooling and upsampling;
[0020] The data of path 13 and the data of path 14 are feature fused, and the fused data is sent to the self-attention layer 4 for calculation. The output data of the self-attention layer 4 is sent to the path 15 and the path 16 respectively, and the data of the path 15 is sent to the channel splicing layer; path 14 is the data of path 5 after pooling and upsampling;
[0021] The data of path 16 is fused with the data of path 12, and the fused result is sent to path 18 and path 17, and the result of path 17 is sent to the channel splicing layer;
[0022] The data of path 18 and the data of path 9 are fused, and the fused results are sent to paths 19 and 20, and the result of path 19 is sent to the channel splicing layer;
[0023] The data of path 20 is fused with the data of path 7, and the fused result is sent to path 21 and path 22, and the result of path 21 is sent to the channel splicing layer;
[0024] The data of path 22 is fused with the data of path 6, and the fused data of path 23 is sent to the channel concatenation layer; wherein, path 6 is the data obtained after the pooling operation of path 1.
[0025] Optionally, the convolution window size corresponding to the top path is 1*1.
[0026] The present application also provides a global feature enhancement device, comprising:
[0027] Using a top path processing module, the feature map group output by the feature extraction network is input into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature map group;
[0028] Using the middle path and bottom path processing modules, the feature map group output by the feature extraction network is input into the middle path and bottom path of the global feature enhancement module for processing; wherein the middle path includes a plurality of paths for performing a pooling operation on the feature map group, the bottom path is used for performing a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path are gradually increased;
[0029] An upsampling module is used to perform size transformation using an upsampling layer after the middle path and the bottom path are pooled to obtain data with the same size as the integrated data image;
[0030] A self-attention layer processing module is used to process the data in the middle path and the bottom path that have undergone size transformation using the self-attention layer, and to integrate the integrated data and the data processed by the self-attention layer using the channel splicing layer and the convolution layer to obtain target global enhanced data.
[0031] The present application also provides a global feature enhancement device, comprising:
[0032] Memory for storing computer programs;
[0033] A processor is used to implement the steps of the above-mentioned global feature enhancement method when executing the computer program.
[0034] The present application also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned global feature enhancement method are implemented.
[0035] It can be seen that the present invention obtains integrated data by inputting the feature map group output by the feature extraction network into the top path of the global feature enhancement module for processing; wherein the top path is used to perform a convolution operation on the feature map group; the feature map group output by the feature extraction network is input into the middle path and the bottom path of the global feature enhancement module for processing; wherein the middle path includes multiple paths for performing a pooling operation on the feature map group, and the bottom path is used to perform a global average pooling layer operation on the feature map group, and the pooling window size of the middle path and the bottom path gradually increases; after the middle path and the bottom path are pooled, they are resized using the upsampling layer to obtain data with the same size as the integrated data image; the self-attention layer is used to process the data in the resized middle path and the bottom path, and the channel splicing layer and the convolution layer are used to integrate the integrated data and the data processed by the self-attention layer to obtain the target global enhanced data. This application introduces a self-attention layer, which can better obtain global feature information through the long-distance dependency capture ability of self-attention, and strengthens this ability at each layer through deep aggregation (self-attention data is stacked layer by layer), thereby improving the adequacy of global feature information extraction.
[0036] In addition, the present invention also provides a global feature enhancement device, equipment and readable storage medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0038] Figure 1 A flowchart of a global feature enhancement method provided by an embodiment of the present invention;
[0039] Figure 2 A schematic diagram of the overall structure of a visual inspection task provided by an embodiment of the present invention;
[0040] Figure 3 A schematic diagram of the overall structure of a global feature enhancement method provided by an embodiment of the present invention;
[0041] Figure 4 A schematic diagram of the structure of a self-attention layer provided by an embodiment of the present invention;
[0042] Figure 5 A schematic diagram of the structure of a global feature enhancement device provided by an embodiment of the present invention;
[0043] Figure 6 A schematic diagram of the structure of a global feature enhancement device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not 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.
[0045] Some of the terms that appear in the description of the embodiments of the present application may be interpreted as follows:
[0046] Global features: Global features refer to the overall properties of an image. Common global features include color features, texture features, and shape features, such as intensity histograms. Since they are low-level visual features at the pixel level, global features have good invariance, simple calculations, and intuitive representations. However, their high feature dimensions and large amount of calculations are their fatal weaknesses. In addition, global feature descriptions are not suitable for image aliasing and occlusion. Local features are features extracted from local areas of an image, including edges, corners, lines, curves, and areas with special attributes. Common local features include two types of descriptions: corner point type and area type.
[0047] Self-attention: It mainly introduces weights based on the relationship between two objects. At the channel and space levels, it strengthens the connection between two objects by calculating the values between each unit channel and between pixels, thereby improving the accuracy of semantic segmentation.
[0048] Please refer to Figure 1 , Figure 1 This is a flowchart of a global feature enhancement method provided by an embodiment of the present invention. The method may include:
[0049] S101, inputting the feature map group output by the feature extraction network into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature map group.
[0050] The executor of this embodiment is an electronic device. The feature extraction network in this embodiment is a network layer for extracting features, which is a feature extraction network of the prior art. This application is mainly an improvement on all feature enhancement modules. The top path in this embodiment refers to inputting the feature map group into the top path for convolution operation. The integrated data of this embodiment refers to the data after the convolution operation through the top path. This embodiment does not limit the specific window size corresponding to the top path, as long as it is lower than the middle path and the bottom path.
[0051] It should be further explained that, in order to improve the efficiency of the top path processing, the convolution window size corresponding to the top path is 1*1. In this embodiment, the convolution window size corresponding to the top path is 1*1, so that only one interaction is required, thereby improving the efficiency of the top path processing.
[0052] It should be further explained that, in order to improve the efficiency of information integration, the above-mentioned use of the channel splicing layer and the convolution layer to integrate the integrated data and the data processed by the self-attention layer to obtain the target global enhanced data can include: using the channel splicing layer to integrate the integrated data and the data processed by the self-attention layer, and using the 1*1 convolution layer to perform cross-channel interaction and information integration to obtain the target global enhanced data. This embodiment uses a 1*1 convolution layer to perform cross-channel interaction and information integration to obtain the target global enhanced data. Since the 1*1 convolution layer indicates that the data only needs to be interacted once, the efficiency of information integration can be improved.
[0053] S102, input the feature map group output by the feature extraction network into the middle path and the bottom path of the global feature enhancement module for processing; wherein the middle path includes multiple paths for performing pooling operations on the feature map group, the bottom path is used to perform a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path gradually increase.
[0054] The intermediate path in this embodiment may include multiple paths. This embodiment does not limit the specific number of paths included in the intermediate path. For example, the intermediate path may include two paths; or the intermediate path in this embodiment may include three paths. The pooling window of the intermediate path in this embodiment gradually increases from small to large.
[0055] It should be further explained that in order to improve the receptive field of the model, the window size of the multiple paths corresponding to the above-mentioned intermediate path is 2*(k+N)+1; wherein k is an even number, k>=2, and N gradually increases. The window size of this embodiment refers to the pooling window size. This embodiment does not limit the specific window size of each path in the intermediate path. For example, the intermediate path of this embodiment can be 2*(k+1)+1, 2*(k+2)+1, and 2*(k+3)+1 from left to right; or the intermediate path of this embodiment can be 2*(k+1)+1, 2*(k+3)+1, and 2*(k+5)+1 from left to right. This embodiment gives the rule of increasing the pooling window to improve the receptive field of the model.
[0056] S103, after the middle path and the bottom path are pooled, they are resized using upsampling layers to obtain data with the same size as the integrated data image.
[0057] S104, using the self-attention layer to process the data in the middle path and the bottom path after the size transformation, and using the channel splicing layer and the convolution layer to integrate the integrated data and the data processed by the self-attention layer to obtain the target global enhanced data.
[0058] This embodiment uses a self-attention layer to process the data in the middle path and the bottom path after the size transformation. This embodiment does not limit the specific process of processing using the self-attention layer. For example, this embodiment can use the self-attention layer to perform top-down feature fusion processing on the data processed by the top path, the middle path and the bottom path; or this embodiment can also use the self-attention layer to perform bottom-up feature fusion processing on the data processed by the top path, the middle path and the bottom path; or this embodiment can also use the self-attention layer to perform top-down and bottom-up feature fusion processing on the data processed by the top path, the middle path and the bottom path.
[0059] It should be further explained that, in order to improve the accuracy of global feature extraction, the above-mentioned use of the self-attention layer to process the data in the middle path and the bottom path after the size transformation can include: using the self-attention layer to perform top-down and bottom-up feature fusion processing on the data in the middle path and the bottom path after the size transformation; wherein, top-down refers to the initial path from the middle path to the bottom path, and bottom-up refers to the bottom path to the top path. This embodiment performs data flow in a top-down and bottom-up manner, which can make full use of the data redundancy of the feature map group, mine potential feature information that is helpful for the current task, and provide information mining capabilities for the global feature enhancement module.
[0060] It should be further explained that, in order to improve the effect of the intermediate path processing, there are three intermediate paths, the top path is taken as path 1, the paths corresponding to the intermediate path are path 2, path 3 and path 4 respectively, and the bottom path is taken as path 5. It can be understood that, after experiments, when there are three intermediate paths, the global features can be fully mined, and it can have a higher efficiency, so the effect of the intermediate path processing can be improved.
[0061] It should be further explained that, in order to improve the accuracy of top-down and bottom-up feature fusion, the above-mentioned top-down and bottom-up feature fusion processing of the data in the middle path and the bottom path after size transformation using the self-attention layer can include: the data of path 2 is pooled and up-sampled and then enters the self-attention 1 layer for global feature extraction, and the output data of the self-attention layer 1 is sent to path 7 and path 8 respectively; the data of path 8 and the data of path 9 are feature fused, and the fused data is sent to the self-attention layer 2 for calculation, and the output data of the self-attention layer 2 is sent to path 9 and path 10 respectively; path 24 is the data of path 3 after pooling and up-sampling; the data of path 10 and the data of path 11 are feature fused, and the fused data is sent to the self-attention layer 3 for calculation, and the output data of the self-attention layer 3 is sent to path 12 and path 13 respectively; path 11 is the data of path 4 after pooling and up-sampling; path 13 The data of path 16 and the data of path 12 are feature fused, and the fused data is sent to the self-attention layer 4 for calculation. The output data of self-attention 4 is sent to path 15 and path 16 respectively, and the data of path 15 is sent to the channel splicing layer; path 14 is the data of path 5 after pooling and upsampling; the data of path 16 is fused with the data of path 12, and the fused result is sent to path 18 and path 17, and the result of path 17 is sent to the channel splicing layer; the data of path 18 is fused with the data of path 9, and the fused result is sent to path 19 and path 20, and the result of path 19 is sent to the channel splicing layer; the data of path 20 is fused with the data of path 7, and the fused result is sent to path 21 and path 22, and the result of path 21 is sent to the channel splicing layer; the data of path 22 is fused with path 6, and the fused data of path 23 is sent to the channel splicing layer; wherein, path 6 is the data obtained after the pooling operation of path 1. This embodiment improves the accuracy of top-down and bottom-up feature fusion by providing specific top-down and bottom-up feature fusion methods.
[0062] A global feature enhancement method provided by an embodiment of the present invention may include: S101, inputting a feature map group output by a feature extraction network into a top path of a global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature map group; S102, inputting a feature map group output by a feature extraction network into a middle path and a bottom path of a global feature enhancement module for processing; wherein the middle path includes a plurality of paths for performing a pooling operation on the feature map group, the bottom path is used to perform a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path gradually increase; S103, after completing the pooling processing on the middle path and the bottom path, respectively performing size transformation using an upsampling layer to obtain data of the same size as the integrated data image; S104, using a self-attention layer to process the data in the middle path and the bottom path that have undergone size transformation, and using a channel splicing layer and a convolution layer to integrate the integrated data and the data processed by the self-attention layer to obtain target global enhanced data. Since the present application introduces the self-attention layer, the long-distance dependency capture capability of the self-attention can better obtain the global feature information, and through the deep aggregation method (self-attention data stacking layer by layer), the capability is strengthened at each layer, thereby improving the adequacy of the global feature information extraction. Moreover, the convolution window size corresponding to the top path in this embodiment is 1*1, so that only one interaction is required, so the efficiency of the top path processing can be improved; and, the embodiment gives the rule of increasing the pooling window, and improves the effect of the middle path on the data processing of the feature map group; and, the embodiment gives the rule of increasing the pooling window, and improves the effect of the middle path on the data processing of the feature map group; and, the embodiment performs data flow in a top-down and bottom-up manner, and can make full use of the data redundancy of the feature map group, and mine potential feature information that is helpful for the current task, and provides the information mining capability of the global feature enhancement module; and, by setting the middle path to 3, the global features can be fully mined, and can have a higher efficiency, so the effect of the middle path processing can be improved; and, by providing a specific feature fusion method from top to bottom and from bottom to top, the accuracy of the top-down and bottom-up feature fusion is improved.
[0063] In order to make the present invention easier to understand, please refer to Figure 2 , Figure 2The overall structure diagram of a visual detection task provided by an embodiment of the present invention may specifically include four parts: input, feature extraction network, global feature enhancement module and output. The global feature enhancement method is only a component of the entire visual task (such as target detection, semantic segmentation), which is mainly connected to the feature extraction network (such as ResNet deep residual network, DenseNet dense connection network and VGGNet ultra-deep convolutional network for large model recognition, etc.). The input of this module is the feature map group obtained by the feature extraction network. In particular, the present invention is for Figure 1 The global feature enhancement module operates without involving input, feature extraction network and output.
[0064] The overall structure of the global feature enhancement module of the present invention is as follows: Figure 3 As shown, Figure 3 The overall structure diagram of a global feature enhancement method provided by an embodiment of the present invention is an improvement on the SPPNet (target detection) spatial pyramid pooling method, which introduces a self-attention mechanism and a top-up and top-down data flow method. It mainly includes the following steps:
[0065] Step 1, obtain the feature map group output by the feature extraction network;
[0066] Step 2: Copy the feature map group into 5 copies, and enter path 1, path 2, path 3, path 4 and path 5 respectively for global feature extraction; among them, path 1 is used to perform convolution operation on the data to achieve cross-channel interaction and information integration, the pooling window size from path 2 to path 4 is gradually increased, and path 5 is used to perform global average pooling (GAP) operation on the data to obtain global channel information;
[0067] Step 3: The data in path 1 is first sent to a convolution layer with a convolution window size of 1*1 for calculation, and the convolution result is sent to path 6;
[0068] The data in path 1 in this embodiment is first sent to a convolution layer (1*1, conv) with a convolution window size of 1*1.
[0069] In step 4, the data of path 2, path 3 and path 4 are respectively sent to the pooling layers with pooling window sizes of 2*k+1, 2*(k+1)+1 and 2*(k+2)+1 for calculation, and various corresponding pooling results are obtained. They are respectively sent to an upsampling layer for size transformation and upsampled to the same size as the image size of path 6; k is an even number, k>=2;
[0070] The upsampling method in this embodiment may be a bilinear interpolation method with good speed and effect, or may be a nearest neighbor or cubic interpolation method.
[0071] Step 5: The data of path 5 will enter a global average pooling layer to obtain global channel information;
[0072] Step 6: After pooling and upsampling, path 2 enters the corresponding self-attention layer for global feature extraction. The output data of self-attention layer 1 will be sent to path 7 and path 8 respectively;
[0073] In this embodiment, the data of path 2 will enter the self-attention layer 1 for global feature extraction after pooling and upsampling. The self-attention layer has a better effect on global feature extraction than the traditional convolution layer. The structure of the self-attention layer is as follows Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of a self-attention layer provided by an embodiment of the present invention, taking the data of path 2 as an example. The input is the data processed by path 2, and then the input is divided into three parts, which enter three fully connected layers with an output dimension of d (fully connected layer_1, fully connected layer_2, and fully connected layer_3) for data calculation, and obtain feature matrices Q, K, and V respectively, and then these three feature matrices are calculated according to the formula:
[0074] ;
[0075] in Represents the self-attention calculation result, Representative query, represents a key, Representative values, corresponding to Figure 3 Q, K and V in is the weight calculation function, represents the output dimension of the fully connected layer. In the present invention, d is set to 64. Represents the matrix transpose operation. The output after self-attention calculation is data with global information. The output data of self-attention layer 1 will be sent to path 7 and path 8 respectively.
[0076] Step 7: The data of path 8 will be fused with the data of path 24 by adding them point by point. The fused data will be sent to the self-attention layer 2 for calculation. The output data of the self-attention layer 2 will be sent to path 9 and path 10 respectively.
[0077] This embodiment does not limit the specific feature fusion method. For example, the feature fusion method in this embodiment can be point-by-point addition, or the feature fusion method in this embodiment can also be channel splicing.
[0078] Step 8: The data of path 10 will be fused with the data of path 11 by adding them point by point. The fused data will be sent to the self-attention layer 3 for calculation. The output data of the self-attention layer 3 will be sent to path 12 and path 13 respectively.
[0079] Step 9: The data of path 13 will be fused with the data of path 14 by adding them point by point. The fused data will be sent to the self-attention layer 4 for calculation. The output data of self-attention 4 will be sent to path 15 and path 16 respectively.
[0080] Step 10: The data of path 15 will be sent to the channel splicing layer;
[0081] In this embodiment, the above data flows in a top-down manner, which is used to transfer high-level information downward to interact with low-level information.
[0082] Step 11: The data of path 16 will be fused with the data of path 12 by adding them point by point. The fused results will be sent to paths 18 and 17. The result of path 17 will be sent to the channel splicing layer.
[0083] Step 12: The data of path 18 will be fused with the data of path 9, and the fused result will be sent to path 19 and path 20. The result of path 19 will be sent to the channel splicing layer;
[0084] Step 13: The data of path 20 will be fused with the data of path 7, and the fused result will be sent to path 21 and path 22. The result of path 21 will be sent to the channel splicing layer;
[0085] Step 14: The data of path 22 will be fused with path 6, and the fused data of path 23 will be sent to the channel splicing layer;
[0086] In this embodiment, the above data flow is bottom-up, which is used to interact the bottom-level data with the high-level data information. By performing data flow in a top-down and bottom-up manner, the data redundancy of the feature map group can be fully utilized to mine potential feature information that is helpful for the current task.
[0087] Step 15: Use the channel concatenation layer to fuse the data processed from path 1 to path 5. After the fusion is completed, send the result to a 1*1 convolution layer for cross-channel interaction and information integration, and finally obtain the result after global feature enhancement.
[0088] The embodiment of the present invention provides an effective global feature enhancement method, which has the following advantages:
[0089] 1. Stronger global information acquisition capability and better computational efficiency. Due to the introduction of the self-attention layer, the long-distance dependency capture capability of self-attention can better acquire global feature information, and this capability is enhanced at each layer through deep aggregation (self-attention data is stacked layer by layer). In addition, thanks to the parallel computing method of self-attention, the computational efficiency of the method of the present invention is also improved.
[0090] 2. Stronger information mining capabilities. Through top-down and bottom-up data flow, the data redundancy of the feature map group can be fully utilized to mine potential feature information that is helpful for the current task.
[0091] The global feature enhancement device provided in an embodiment of the present invention is introduced below. The global feature enhancement device described below and the global feature enhancement method described above can be referenced to each other.
[0092] Please refer to Figure 5 , Figure 5 A schematic diagram of the structure of a global feature enhancement device provided by an embodiment of the present invention may include:
[0093] The top path processing module 100 is used to input the feature graph group output by the feature extraction network into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature graph group;
[0094] Using the middle path and bottom path processing module 200, the feature map group output by the feature extraction network is input into the middle path and bottom path of the global feature enhancement module for processing; wherein the middle path includes a plurality of paths for performing a pooling operation on the feature map group, the bottom path is used for performing a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path are gradually increased;
[0095] An upsampling module 300 is used to perform size transformation on the middle path and the bottom path respectively using an upsampling layer after the pooling process is completed, so as to obtain data with the same size as the integrated data image;
[0096] The self-attention layer processing module 400 is used to process the data in the middle path and the bottom path that have undergone size transformation using the self-attention layer, and to integrate the integrated data and the data processed by the self-attention layer using the channel splicing layer and the convolution layer to obtain the target global enhanced data.
[0097] Further, based on the above embodiment, the window sizes of the multiple paths corresponding to the intermediate path are 2*(k+N)+1; wherein k is an even number, k>=2, and N increases gradually.
[0098] Further, based on any of the above embodiments, the self-attention layer processing module 400 may include:
[0099] The information units are integrated using a convolutional layer, and the channel splicing layer is used to integrate the integrated data and the data processed by the self-attention layer, and a 1*1 convolutional layer is used to perform cross-channel interaction and information integration to obtain the target global enhanced data.
[0100] Further, based on any of the above embodiments, the self-attention layer processing module 400 may include:
[0101] The top-down and bottom-up feature fusion unit is used to use the self-attention layer to perform top-down and bottom-up feature fusion processing on the data in the middle path and the bottom path that have undergone size transformation; wherein the top-down refers to the initial path from the middle path to the bottom path, and the bottom-up refers to the bottom path to the top path.
[0102] Further, based on any of the above embodiments, there are three intermediate paths, the top path is taken as path 1, the paths corresponding to the intermediate path are path 2, path 3 and path 4 respectively, and the bottom path is taken as path 5.
[0103] Further, based on any of the above embodiments, the top-down and bottom-up feature fusion unit may include:
[0104] The global feature extraction subunit is used to pool and upsample the data of path 2 and then enter the self-attention layer 1 for global feature extraction. The output data of the self-attention layer 1 will be sent to path 7 and path 8 respectively;
[0105] The first feature fusion subunit is used to perform feature fusion on the data of path 8 and the data of path 9, and send the fused data to the self-attention layer 2 for calculation, and send the output data of the self-attention layer 2 to path 9 and path 10 respectively; path 24 is the data of path 3 after pooling and upsampling;
[0106] The second feature fusion subunit is used to perform feature fusion on the data of path 10 and the data of path 11, send the fused data to the self-attention layer 3 for calculation, and send the output data of the self-attention layer 3 to path 12 and path 13 respectively; path 11 is the data of path 4 after pooling and upsampling;
[0107] The third feature fusion subunit is used to perform feature fusion on the data of path 13 and the data of path 14, and send the fused data to the self-attention layer 4 for calculation. The output data of the self-attention layer 4 is sent to the path 15 and the path 16 respectively, and the data of the path 15 is sent to the channel splicing layer; path 14 is the data of path 5 after pooling and upsampling;
[0108] The fourth feature fusion subunit is used to fuse the data of path 16 with the data of path 12, send the fused result to path 18 and path 17, and send the result of path 17 to the channel splicing layer;
[0109] The fifth fusion subunit is used to fuse the data of path 18 and the data of path 9, send the fused results to path 19 and path 20, and send the result of path 19 to the channel splicing layer;
[0110] The sixth fusion subunit is used to fuse the data of path 20 and the data of path 7, send the fused results to path 21 and path 22, and send the result of path 21 to the channel splicing layer;
[0111] The seventh fusion subunit is used to fuse the data of path 22 and path 6, and send the fused data of path 23 to the channel splicing layer; wherein path 6 is the data obtained after the pooling operation of path 1.
[0112] Further, based on any of the above embodiments, the convolution window size corresponding to the top path is 1*1.
[0113] It should be noted that the order of the modules and units in the above-mentioned global feature enhancement device can be changed without affecting the logic.
[0114] The global feature enhancement device provided by the embodiment of the present invention may include: using a top path processing module 100 to input the feature map group output by the feature extraction network into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature map group; using an intermediate path and a bottom path processing module 200 to input the feature map group output by the feature extraction network into the intermediate path and the bottom path of the global feature enhancement module for processing; wherein the intermediate path includes a plurality of paths for performing a pooling operation on the feature map group, and the bottom path is used to perform a global pooling operation on the feature map group. The local average pooling layer operates, and the pooling window size of the middle path and the bottom path gradually increases; the upsampling module 300 is used to perform size transformation using the upsampling layer after the pooling processing of the middle path and the bottom path is completed, so as to obtain data consistent with the size of the integrated data image; the self-attention layer processing module 400 is used to process the data in the middle path and the bottom path after the size transformation using the self-attention layer, and integrate the integrated data and the data processed by the self-attention layer using the channel splicing layer and the convolution layer to obtain the target global enhanced data. Since the self-attention layer is introduced in this application, the long-distance dependency capture capability of the self-attention is used to better obtain the global feature information, and this capability is strengthened at each layer through the deep aggregation method (self-attention data is stacked layer by layer), thereby improving the adequacy of the global feature information extraction. Moreover, in this embodiment, the convolution window size corresponding to the top path is 1*1, so that only one interaction is required, so the efficiency of the top path processing can be improved; and, this embodiment gives the rule of increasing the pooling window, so as to improve the effect of the intermediate path on the data processing of the feature map group; and, this embodiment gives the rule of increasing the pooling window, so as to improve the effect of the intermediate path on the data processing of the feature map group; and, this embodiment performs data flow in a top-down and bottom-up manner, so as to make full use of the data redundancy of the feature map group, mine potential feature information that is helpful for the current task, and provide the information mining capability of the global feature enhancement module; and, by setting the intermediate path to 3, the global features can be comprehensively mined, and it can have higher efficiency, so the effect of the intermediate path processing can be improved; and, by giving the specific feature fusion methods from top to bottom and from bottom to top, this embodiment improves the accuracy of top-down and bottom-up feature fusion.
[0115] A global feature enhancement device provided in an embodiment of the present invention is introduced below. The global feature enhancement device described below and the global feature enhancement method described above can refer to each other.
[0116] Please refer to Figure 6 , Figure 6A schematic diagram of the structure of a global feature enhancement device provided by an embodiment of the present invention may include:
[0117] A memory 10, used for storing computer programs;
[0118] The processor 20 is used to execute a computer program to implement the above-mentioned global feature enhancement method.
[0119] The memory 10 , the processor 20 , and the communication interface 30 all communicate with each other via a communication bus 40 .
[0120] In the embodiment of the present invention, the memory 10 is used to store one or more programs, and the program may include program code, and the program code includes computer operation instructions. In the embodiment of the present invention, the memory 10 may store programs for implementing the following functions:
[0121] The feature map group output by the feature extraction network is input into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature map group;
[0122] Inputting the feature map group output by the feature extraction network into the middle path and the bottom path of the global feature enhancement module for processing; wherein the middle path includes a plurality of paths for performing a pooling operation on the feature map group, the bottom path is used for performing a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path gradually increase;
[0123] After the pooling process of the middle path and the bottom path is completed, the upsampling layer is used to perform size transformation to obtain data with the same size as the integrated data image;
[0124] The self-attention layer is used to process the data in the middle path and the bottom path after size transformation, and the channel splicing layer and the convolution layer are used to integrate the integrated data and the data processed by the self-attention layer to obtain the target global enhanced data.
[0125] In a possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.
[0126] In addition, the memory 10 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include an NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and processing hardware-based tasks.
[0127] The processor 20 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic device, a microprocessor or any conventional processor, etc. The processor 20 may call a program stored in the memory 10 .
[0128] The communication interface 30 may be an interface of a communication module, and is used to connect to other devices or systems.
[0129] Of course, it should be noted that Figure 6 The structure shown does not constitute a limitation on the global feature enhancement device in the embodiment of the present invention. In actual applications, the global feature enhancement device may include Figure 6 More or fewer components than shown, or combinations of certain components.
[0130] The following is an introduction to a readable storage medium provided in an embodiment of the present invention. The readable storage medium described below and the global feature enhancement method described above can be referenced to each other.
[0131] The present invention also provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned global feature enhancement method are implemented.
[0132] The readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0133] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0134] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0135] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0136] The global feature enhancement method, device, equipment and readable storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A global feature enhancement method, characterized in that: include: Inputting the feature map group output by the feature extraction network into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature map group; Inputting the feature map group output by the feature extraction network into the middle path and the bottom path of the global feature enhancement module for processing; wherein the middle path includes a plurality of paths for performing a pooling operation on the feature map group, the bottom path is used for performing a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path gradually increase; After the pooling process of the middle path and the bottom path is completed, the upsampling layer is used to perform size transformation respectively to obtain data with the same size as the integrated data image; The data in the middle path and the bottom path that have undergone size transformation are processed using a self-attention layer, and the integrated data and the data processed by the self-attention layer are integrated using a channel splicing layer and a convolution layer to obtain target global enhanced data.
2. The global feature enhancement method according to claim 1, characterized in that: The window sizes of the multiple paths corresponding to the intermediate path are 2*(k+N)+1; wherein k is an even number, k>=2, and N increases gradually.
3. The global feature enhancement method according to claim 1, characterized in that: The method of integrating the integrated data and the data processed by the self-attention layer by using the channel splicing layer and the convolution layer to obtain target global enhanced data includes: The channel splicing layer is used to integrate the integrated data and the data processed by the self-attention layer, and a 1*1 convolutional layer is used to perform cross-channel interaction and information integration to obtain the target global enhanced data.
4. The global feature enhancement method according to any one of claims 1 to 3, characterized in that: The processing of the data in the middle path and the bottom path after the size transformation by using the self-attention layer includes: The self-attention layer is used to perform top-down and bottom-up feature fusion processing on the data in the middle path and the bottom path that have undergone size transformation; wherein the top-down refers to the data from the initial path of the middle path to the bottom path, and the bottom-up refers to the data from the bottom path to the top path.
5. The global feature enhancement method according to claim 4, characterized in that: There are three intermediate paths, the top path is taken as path 1, the paths corresponding to the intermediate paths are path 2, path 3 and path 4 respectively, and the bottom path is taken as path 5.
6. The global feature enhancement method according to claim 5, characterized in that: The using the self-attention layer to perform top-down and bottom-up feature fusion processing on the data in the middle path and the bottom path after the size transformation includes: After pooling and upsampling, the data of path 2 enters the self-attention layer 1 for global feature extraction, and the output data of self-attention layer 1 is sent to path 7 and path 8 respectively; The data of path 8 and the data of path 24 are feature fused, and the fused data is sent to the self-attention layer 2 for calculation. The output data of the self-attention layer 2 is sent to path 9 and path 10 respectively; path 24 is the data of path 3 after pooling and upsampling; The data of path 10 and path 11 are feature fused, and the fused data is sent to the self-attention layer 3 for calculation. The output data of the self-attention layer 3 is sent to path 12 and path 13 respectively; path 11 is the data of path 4 after pooling and upsampling; The data of path 13 and the data of path 14 are feature fused, and the fused data is sent to the self-attention layer 4 for calculation. The output data of the self-attention layer 4 is sent to the path 15 and the path 16 respectively, and the data of the path 15 is sent to the channel splicing layer; path 14 is the data of path 5 after pooling and upsampling; The data of path 16 is fused with the data of path 12, and the fused result is sent to path 18 and path 17, and the result of path 17 is sent to the channel splicing layer; The data of path 18 and the data of path 9 are fused, and the fused results are sent to paths 19 and 20, and the result of path 19 is sent to the channel splicing layer; The data of path 20 is fused with the data of path 7, and the fused result is sent to path 21 and path 22, and the result of path 21 is sent to the channel splicing layer; The data of path 22 is fused with the data of path 6, and the fused data of path 23 is sent to the channel concatenation layer; wherein, path 6 is the data obtained after the pooling operation of path 1.
7. The global feature enhancement method according to claim 1, characterized in that: The convolution window size corresponding to the top path is 1*1.
8. A global feature enhancement device, characterized in that: include: Using a top path processing module, the feature map group output by the feature extraction network is input into the top path of the global feature enhancement module for processing to obtain integrated data; wherein the top path is used to perform a convolution operation on the feature map group; Using the middle path and bottom path processing modules, the feature map group output by the feature extraction network is input into the middle path and bottom path of the global feature enhancement module for processing; wherein the middle path includes a plurality of paths for performing a pooling operation on the feature map group, the bottom path is used for performing a global average pooling layer operation on the feature map group, and the pooling window sizes of the middle path and the bottom path are gradually increased; An upsampling module is used to perform size transformation using an upsampling layer after the middle path and the bottom path are pooled to obtain data with the same size as the integrated data image; A self-attention layer processing module is used to process the data in the middle path and the bottom path that have undergone size transformation using the self-attention layer, and to integrate the integrated data and the data processed by the self-attention layer using the channel splicing layer and the convolution layer to obtain target global enhanced data.
9. A global feature enhancement device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the global feature enhancement method as described in any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the global feature enhancement method according to any one of claims 1 to 7 are implemented.
