Image feature extraction method and system based on attention module
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN BOHR INTELLIGENT MFG TECH CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-08-04
AI Technical Summary
[0003]然而,目前主流注意力模块普遍采用标准二维卷积构建注意力图,随着卷积核尺寸增加,计算量呈显著增长趋势,整体计算开销较大,难以在资源受限的终端设备上高效部署
Smart Images

Figure CN122510587A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to an image feature extraction method and system based on an attention module. Background Technology
[0002] Attention mechanisms, as a key technology of convolutional neural networks, have been widely used in various visual tasks. By adaptively recalibrating feature weights, they effectively improve the feature representation capabilities of the network.
[0003] However, current mainstream attention modules generally use standard two-dimensional convolutions to construct attention maps. As the kernel size increases, the computational cost increases significantly, resulting in high overall computational overhead and making efficient deployment on resource-constrained devices difficult. Furthermore, traditional attention modules often generate attention weights based on local features, exhibiting weak ability to capture large-scale spatial dependencies in images and a limited receptive field. Therefore, current attention mechanisms generally suffer from high computational cost and limited receptive field, making it difficult to meet the practical application requirements for efficient image feature extraction. Summary of the Invention
[0004] In view of the shortcomings of the prior art, the purpose of this invention is to provide an image feature extraction method based on an attention module, which can solve the technical problems of large computational load and limited receptive field of the attention mechanism in the prior art.
[0005] A first aspect of this invention proposes an image feature extraction method based on an attention module, comprising:
[0006] Channel compression is performed on the input feature map to obtain a compressed feature map;
[0007] The compressed feature map is input into the first serial convolution group to obtain the first convolution output set;
[0008] The compressed feature map is input into the second serial convolution group to obtain the second convolution output set;
[0009] Attention is generated on the first convolutional output set and the second convolutional output set based on the attention module to obtain an attention map set;
[0010] The compressed feature map and the attention map set are fused to obtain a fused feature map.
[0011] Optionally, the step of channel compression of the input feature map to obtain a compressed feature map specifically includes:
[0012] The input feature map is compressed by a 1×1 convolutional layer to obtain an initial compressed feature map;
[0013] The initial compressed feature map is normalized by a normalization layer to obtain a normalized compressed feature map;
[0014] The normalized compressed feature map is processed by the SiLU activation function to obtain a compressed feature map.
[0015] Optionally, the first serial convolutional group includes multiple horizontal one-dimensional convolutional layers, and the second serial convolutional group includes multiple vertical one-dimensional convolutional layers, wherein the number of horizontal one-dimensional convolutional layers is the same as the number of vertical one-dimensional convolutional layers.
[0016] Optionally, the kernel size of the horizontal one-dimensional convolutional layer is (1, k), and the kernel size of the vertical one-dimensional convolutional layer is (k, 1); where k is an odd number greater than 1.
[0017] Optionally, the step of inputting the compressed feature map into the first serial convolutional group to obtain the first convolutional output set specifically includes:
[0018] Determine the i-th horizontal one-dimensional convolutional layer from the first serial convolutional group;
[0019] If i is 1, the compressed feature map is input into the i-th horizontal one-dimensional convolutional layer to obtain the i-th horizontal convolutional output; and the i-th horizontal convolutional output is added to the pre-constructed first convolutional output set.
[0020] If i is greater than 1, then obtain the horizontal convolution output of the (i-1)th layer and input the horizontal convolution output of the (i-1)th layer into the i-th horizontal one-dimensional convolutional layer to obtain the horizontal convolution output of the i-th layer; and add the horizontal convolution output of the i-th layer to the pre-constructed first convolution output set.
[0021] If i is equal to the total number of horizontal one-dimensional convolutional layers, then output the first convolutional output set;
[0022] If i is less than the total number of horizontal one-dimensional convolutional layers, then i is incremented by 1 and assigned to i, and the steps from obtaining the horizontal convolutional output of the (i-1)th layer to adding the horizontal convolutional output of the i-th layer to the pre-constructed first convolutional output set are executed.
[0023] Optionally, the step of inputting the compressed feature map into the second serial convolutional group to obtain the second convolutional output set specifically includes:
[0024] Determine the j-th vertical one-dimensional convolutional layer from the second serial convolutional group;
[0025] If j is 1, the compressed feature map is input into the j-th vertical one-dimensional convolutional layer to obtain the j-th vertical convolutional output; and the j-th vertical convolutional output is added to the pre-constructed second convolutional output set.
[0026] If j is greater than 1, then obtain the vertical convolution output of the (j-1)th layer and input the vertical convolution output of the (j-1)th layer into the j-th vertical one-dimensional convolutional layer to obtain the vertical convolution output of the j-th layer; and add the vertical convolution output of the j-th layer to the pre-constructed second convolution output set.
[0027] If j is equal to the total number of the vertical one-dimensional convolutional layers, then output the second convolutional output set;
[0028] If j is less than the total number of vertical one-dimensional convolutional layers, then j is incremented by 1 and assigned to j, and the steps from obtaining the vertical convolutional output of the (j-1)th layer to adding the vertical convolutional output of the jth layer to the pre-constructed second convolutional output set are executed.
[0029] Optionally, the step of generating attention maps by applying attention to the first convolutional output set and the second convolutional output set using the attention module to obtain an attention map set specifically includes:
[0030] Attention is generated for the horizontal and vertical convolutional outputs of the same number of layers in the first and second convolutional output sets based on the attention module, resulting in an attention map for each layer;
[0031] An attention map set is constructed based on the attention map of each layer; wherein the attention map set contains multiple layers of attention maps, the attention map of layer 0 is the compressed feature map, and the attention maps of layers 1 to n are the attention maps obtained from each layer.
[0032] Optionally, fusing the compressed feature map and the attention map set to obtain a fused feature map specifically includes:
[0033] The compressed feature map and the attention map of each layer are concatenated to obtain a concatenated feature map.
[0034] The stitched feature maps are fused by convolutional fusion using a 1×1 convolutional layer to obtain a fused feature map.
[0035] A second aspect of this invention provides an image feature extraction system based on an attention module, comprising: a processor and a memory;
[0036] The memory stores programs or instructions that can run on the processor, which, when executed by the processor, implement the steps of the attention module-based image feature extraction method as described in the first aspect.
[0037] A third aspect of the present invention provides a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the image feature extraction method based on an attention module as described in the first aspect.
[0038] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:
[0039] In this embodiment of the invention, channel compression is applied to the input feature map, and two sets of sequential convolutional groups are used to independently extract features from the horizontal and vertical directions, respectively. An attention map is then generated based on this, and finally, the compressed feature map is fused with the multi-layer attention map. This approach avoids the high computational overhead of using standard two-dimensional convolutions, effectively reducing the overall computational cost of the attention mechanism and making it easier to deploy on resource-constrained devices. Simultaneously, the sequentially stacked multi-layer convolutional structure can progressively expand the receptive field of each convolutional group, allowing the module to capture a wide range of spatial dependencies while maintaining a lightweight design. In summary, this invention reduces the computational cost of the attention mechanism while expanding the receptive field, meeting the practical application requirements for efficient image feature extraction. Attached Figure Description
[0040] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.
[0041] Figure 1 This is a flowchart illustrating an image feature extraction method based on an attention module provided in an embodiment of the present invention;
[0042] Figure 2 This is a schematic diagram of the structure of a Separated Progressive Attention (SPA) module provided in an embodiment of the present invention;
[0043] Figure 3 This is a schematic diagram of a separate convolution calculation process in the X and Y directions provided by an embodiment of the present invention;
[0044] Figure 4 This is a schematic diagram illustrating the change in receptive field of progressive convolution serial stacking provided by an embodiment of the present invention;
[0045] Figure 5 This is a schematic diagram of a multi-level feature collection and fusion method provided in an embodiment of the present invention;
[0046] Figure 6 This is a schematic diagram of the structure of an image feature extraction system based on an attention module provided in an embodiment of the present invention. Detailed Implementation
[0047] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0048] The image feature extraction method based on the attention module provided in this invention will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0049] Reference manual attached Figure 1 The diagram illustrates a flowchart of an image feature extraction method based on an attention module provided by an embodiment of the present invention.
[0050] Reference manual attached Figure 2 The diagram shows a structural schematic of a Separated Progressive Attention (SPA) module provided in an embodiment of the present invention.
[0051] Figure 2 This paper demonstrates an image feature extraction workflow based on segregated progressive attention. First, the input feature map is compressed into channels to reduce channel dimensionality and enhance feature expressiveness. Then, the compressed feature map is fed into sequential convolutional groups in the horizontal and vertical directions, extracting features layer by layer to expand the receptive field while maintaining computational efficiency. The horizontal and vertical features corresponding to each layer are processed by activation functions and then multiplied element-wise to generate an attention map, reflecting the complementarity and interaction of information from the two directions. Finally, the original compressed features and the attention maps from each layer are concatenated along the channel dimension and fused through convolution to achieve multi-level feature fusion. This structure reduces computational complexity while improving feature expressiveness and spatial dependency capture capabilities, making it suitable for efficient image processing tasks.
[0052] Reference manual attached Figure 3 The diagram illustrates a separate convolution calculation process in the X and Y directions provided by an embodiment of the present invention.
[0053] Figure 3 This paper compares the traditional 2D convolution method for generating attention maps with the proposed segregated progressive attention mechanism. The traditional method extracts features through 2D convolution and then generates the attention map using an activation function. In contrast, the segregated method decomposes the 2D convolution into horizontal and vertical convolution branches, extracting features in both directions simultaneously. These branches are then processed separately by activation functions and multiplied element-wise to generate the attention map. This method effectively reduces computational complexity through directional decomposition while preserving feature representation capabilities. It also effectively captures the spatial structural dependencies of the image, improving the expressiveness of the attention map. Furthermore, its simple structure makes it easy to integrate and suitable for high-performance visual tasks.
[0054] Reference manual attached Figure 4 The diagram illustrates a progressive convolutional serial stacking receptive field variation according to an embodiment of the present invention.
[0055] Figure 4 This paper demonstrates how split sequential convolution expands the receptive field through layer-by-layer stacking. Each convolutional layer extracts features independently in both the horizontal and vertical directions. By stacking multiple convolutional layers, the receptive field gradually expands, effectively capturing information from a larger region while maintaining low computational cost. Compared to traditional 2D convolution, this method effectively reduces computational complexity while ensuring the breadth and depth of feature extraction, making it suitable for efficient image feature representation and spatial dependency capture in resource-constrained environments.
[0056] Reference manual attached Figure 5 The diagram illustrates a multi-level feature collection and fusion method provided by an embodiment of the present invention.
[0057] Figure 5 This paper demonstrates the collection and fusion process of multi-layer attention features. First, the input feature map is compressed by channels to reduce dimensionality and improve feature expressiveness. Then, attention features at different depths are extracted using multi-layer attention modules. Next, the compressed features and the attention features from each layer are concatenated along the channel dimension to form a multi-level feature representation. Finally, convolutional fusion is used to generate the output features. This approach fully utilizes attention information at different depths, achieving multi-scale feature fusion, enhancing the network's expressive power, while maintaining a lightweight structure and high computational efficiency.
[0058] This invention provides an image feature extraction method based on an attention module, which may include the following steps:
[0059] S1: Perform channel compression on the input feature map to obtain a compressed feature map.
[0060] As an optional implementation, S1 performs channel compression on the input feature map, and the method for obtaining the compressed feature map may include:
[0061] The input feature map is compressed by a 1×1 convolutional layer to obtain an initial compressed feature map;
[0062] The initial compressed feature map is normalized by a normalization layer to obtain a normalized compressed feature map;
[0063] The normalized compressed feature map is processed by the SiLU activation function to obtain a compressed feature map.
[0064] This implementation method first reduces the number of channels using 1×1 convolutions, effectively decreasing the computational burden on subsequent modules. Furthermore, the normalization layer stabilizes the feature distribution, reducing jitter during training. Finally, the SiLU activation function is used instead of the traditional ReLU because SiLU preserves subtle information in negative regions, resulting in smoother and more flexible feature representation. The entire compression process is lightweight and effective, providing a clean and balanced input feature for subsequent attention generation, thus improving the stability and expressiveness of the overall feature extraction.
[0065] S2: Input the compressed feature map into the first serial convolution group to obtain the first convolution output set.
[0066] In this embodiment of the application, the first serial convolutional group includes multiple horizontal one-dimensional convolutional layers. The kernel size of the horizontal one-dimensional convolutional layer is (1, k); where k is an odd number greater than 1.
[0067] As an optional implementation, the method by which S2 inputs the compressed feature map into the first serial convolution group to obtain the first convolution output set may include:
[0068] Determine the i-th horizontal (X-direction) one-dimensional convolutional layer from the first serial convolutional group;
[0069] If i is 1, the compressed feature map is input into the i-th horizontal one-dimensional convolutional layer to obtain the i-th horizontal convolutional output; and the i-th horizontal convolutional output is added to the pre-constructed first convolutional output set.
[0070] If i is greater than 1, then obtain the horizontal convolution output of the (i-1)th layer and input the horizontal convolution output of the (i-1)th layer into the i-th horizontal one-dimensional convolutional layer to obtain the horizontal convolution output of the i-th layer; and add the horizontal convolution output of the i-th layer to the pre-constructed first convolution output set.
[0071] If i is equal to the total number of horizontal one-dimensional convolutional layers, then output the first convolutional output set;
[0072] If i is less than the total number of horizontal one-dimensional convolutional layers, then i is incremented by 1 and assigned to i, and the steps from obtaining the horizontal convolutional output of the (i-1)th layer to adding the horizontal convolutional output of the i-th layer to the pre-constructed first convolutional output set are executed.
[0073] This implementation method allows features to be progressively and systematically transferred layer by layer in the horizontal direction. The first layer is directly processed based on the compressed feature map, and each subsequent layer uses the output of the previous layer as input. This allows the receptive field to be steadily expanded layer by layer, rather than being stacked all at once. Simultaneously, the output of each layer is collected into a set in a timely manner, ensuring that subsequent attention generation has access to information from all layers and making the entire computation process clear and controllable. Overall, this sequential layer-by-layer approach is not only simple in structure and easy to implement, but also enables the progressive extraction of increasingly broader spatial features, laying a solid foundation for multi-level attention fusion.
[0074] S3: Input the compressed feature map into the second serial convolution group to obtain the second convolution output set.
[0075] In this embodiment, the second serial convolutional group includes multiple one-dimensional convolutional layers in the vertical direction (Y direction), and the number of one-dimensional convolutional layers in the horizontal direction is the same as the number of one-dimensional convolutional layers in the vertical direction. The kernel size of the one-dimensional convolutional layer in the vertical direction is (k, 1); where k is an odd number greater than 1.
[0076] In this embodiment, two one-dimensional convolution kernels (horizontal kernel and vertical kernel) are used instead of the standard two-dimensional convolution kernel:
[0077] The horizontal one-dimensional convolutional layer conv_x: kernel size (1,k), stride (1,1), padding (0,k / / 2);
[0078] Vertical one-dimensional convolutional layer conv_y: kernel size (k,1), stride (1,1), padding (k / / 2,0).
[0079] The X and Y directions are each independently subjected to n layers of sequential convolution. The input of each convolution layer is the output of the previous layer (the result after non-attention weighting), so that the receptive field grows linearly with the number of layers.
[0080] As an optional implementation, S3 may input the compressed feature map into the second serial convolution group to obtain the second convolution output set in the following ways:
[0081] Determine the j-th vertical one-dimensional convolutional layer from the second serial convolutional group;
[0082] If j is 1, the compressed feature map is input into the j-th vertical one-dimensional convolutional layer to obtain the j-th vertical convolutional output; and the j-th vertical convolutional output is added to the pre-constructed second convolutional output set.
[0083] If j is greater than 1, then obtain the vertical convolution output of the (j-1)th layer and input the vertical convolution output of the (j-1)th layer into the j-th vertical one-dimensional convolutional layer to obtain the vertical convolution output of the j-th layer; and add the vertical convolution output of the j-th layer to the pre-constructed second convolution output set.
[0084] If j is equal to the total number of the vertical one-dimensional convolutional layers, then output the second convolutional output set;
[0085] If j is less than the total number of vertical one-dimensional convolutional layers, then j is incremented by 1 and assigned to j, and the steps from obtaining the vertical convolutional output of the (j-1)th layer to adding the vertical convolutional output of the jth layer to the pre-constructed second convolutional output set are executed.
[0086] This implementation method allows vertical features to be progressively and independently transmitted layer by layer. The first layer directly processes the compressed feature map, and each subsequent layer relies on the results of the previous layer, thereby expanding the receptive field layer by layer in the vertical direction, allowing the model to see a wider vertical range. Simultaneously, the output of each layer is collected into a cascade in a timely manner, ensuring that complete vertical features are available for subsequent attention generation and making the entire computational process clear and controllable. Overall, this sequential stacking in the vertical direction complements the horizontal direction, jointly providing rich and progressive spatial features for the subsequent generation of high-quality attention maps.
[0087] S4: Based on the attention module, attention is generated on the first convolution output set and the second convolution output set to obtain an attention map set.
[0088] As an optional implementation, S4 generates attention on the first convolutional output set and the second convolutional output set based on the attention module, and the method for obtaining the attention map set may include:
[0089] Attention is generated for the horizontal and vertical convolutional outputs of the same number of layers in the first and second convolutional output sets based on the attention module, resulting in an attention map for each layer;
[0090] An attention map set is constructed based on the attention map of each layer; wherein the attention map set contains multiple layers of attention maps, the attention map of layer 0 is the compressed feature map, and the attention maps of layers 1 to n are the attention maps obtained from each layer.
[0091] This implementation method pairs the outputs of corresponding layers in the horizontal and vertical directions for attention generation. Instead of simply mixing the results from both directions, each layer fuses its own horizontal and vertical features. This preserves the independent spatial information of each layer while achieving a more accurate attention map through element-wise multiplication. Furthermore, each layer generates an independent attention map, which is then collected into a unified set to capture spatial dependencies at different scales. The entire process is clearly hierarchical and computationally controllable, providing rich and ordered attention weights for subsequent multi-level feature fusion.
[0092] S5: The compressed feature map and the attention map set are fused to obtain a fused feature map.
[0093] As an optional implementation, S5 fuses the compressed feature map and the attention map set to obtain the fused feature map in a manner that may include:
[0094] The compressed feature map and the attention map of each layer are concatenated to obtain a concatenated feature map.
[0095] The stitched feature maps are fused by convolutional fusion using a 1×1 convolutional layer to obtain a fused feature map.
[0096] This implementation first concatenates the initial compressed feature map with the attention maps generated at each layer, preserving both the original information and the attention weights at different depths, resulting in richer information. Then, a 1×1 convolution is used for fusion, rather than simple addition or multiplication. This allows the network to adaptively learn the importance of each part and flexibly adjust the output features. Simultaneously, the computational cost of a 1×1 convolution is minimal, not adding too much burden to the overall structure. Overall, this approach achieves full utilization of multi-level features while maintaining a lightweight structure, resulting in a more comprehensive and effective representation of the fused feature map.
[0097] In this embodiment of the application, the splicing feature map may include:
[0098] Layer 0: Compressed original features;
[0099] Layers 1 to n: Attention maps generated by each layer (sigmoid(x_out) × sigmoid(y_out));
[0100] The n+1 sets of feature maps are concatenated along the channel dimension and then fused and output through a 1×1 convolution.
[0101] Optional, please refer to the following as well. Figures 2-5 The technical solutions provided in the embodiments of the present invention can be implemented based on SPA. Figure 3 This is a schematic diagram of the structure of a separate progressive attention module provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of a separate convolution calculation process in the X and Y directions provided by an embodiment of the present invention; Figure 5 This is a schematic diagram illustrating the change in receptive field of progressive convolution serial stacking provided by an embodiment of the present invention; Figure 6 This is a schematic diagram of multi-level feature collection and fusion provided by an embodiment of the present invention.
[0102] Specifically, a SPA includes the following components:
[0103] Compression unit (i.e., compression layer): Compresses the input feature map through 1×1 convolution;
[0104] The first serial convolutional group (X-direction serial convolutional group): is composed of n horizontal 1D convolutional layers stacked in sequence;
[0105] The second serial convolutional group (Y-direction serial convolutional group): is composed of n vertical 1D convolutional layers stacked in sequence;
[0106] Attention generation unit: Multiplies the convolutional outputs of each layer in the X and Y directions after activating them with a Sigmoid function;
[0107] Feature collection and stitching unit: collects the output of the compression unit and the attention maps of each layer;
[0108] Fusion output unit: The collected multi-level features are spliced together and fused using 1×1 convolution.
[0109] In this embodiment, the forward propagation formula
[0110] Let the input features be ;
[0111] compression: , ;
[0112] initialization: ;
[0113] Progressive stacking :
[0114]
[0115]
[0116]
[0117] Collection and Integration: ;
[0118] Where σ is the Sigmoid function and ⊙ represents element-wise multiplication.
[0119] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:
[0120] In this embodiment of the invention, channel compression is applied to the input feature map, and two sets of sequential convolutional groups are used to independently extract features from the horizontal and vertical directions, respectively. An attention map is then generated based on this, and finally, the compressed feature map is fused with the multi-layer attention map. This approach avoids the high computational overhead of using standard two-dimensional convolutions, effectively reducing the overall computational cost of the attention mechanism and making it easier to deploy on resource-constrained devices. Simultaneously, the sequentially stacked multi-layer convolutional structure can progressively expand the receptive field of each convolutional group, allowing the module to capture a wide range of spatial dependencies while maintaining a lightweight design. In summary, this invention reduces the computational cost of the attention mechanism while expanding the receptive field, meeting the practical application requirements for efficient image feature extraction.
[0121] Compared with the prior art, the present invention has the following advantages:
[0122] Reduced computational complexity: XY-separated convolution reduces the computational complexity from O(k²) to O(2k). Reduced by 60% at the time;
[0123] Controllable receptive field: Serially stacking n layers can linearly expand the receptive field to (2n×k - n + 1);
[0124] Multi-scale feature fusion: collect n+1 layers of features to achieve dense connections of deep features;
[0125] Lightweight deployment: No full 2D convolution is required, making it suitable for mobile and embedded devices;
[0126] Plug and play: It can be embedded as a general module into various CNN architectures.
[0127] Reference manual attached Figure 6 The diagram shows a schematic of the structure of an image feature extraction system based on an attention module provided in an embodiment of the present invention.
[0128] This invention provides an image feature extraction system 20 based on an attention module, comprising: a processor 201 and a memory 202;
[0129] The memory 202 stores programs or instructions that can run on the processor 201. When the program or instructions are executed by the processor 201, they implement the steps of the above-described image feature extraction method based on the attention module and achieve the same technical effect. To avoid repetition, the present invention will not elaborate further.
[0130] It should be understood that the processor 201 in this embodiment of the invention may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0131] It should also be understood that the memory 202 in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DR RAM).
[0132] The above embodiments can be implemented, in whole or in part, by software, hardware (such as circuits), firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.
[0133] It should be understood that, in various embodiments of the present invention, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0134] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0135] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0136] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0137] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0138] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0139] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0140] This invention provides a readable storage medium comprising: storing a program or instructions on the readable storage medium, wherein when the program or instructions are executed by a processor, the program or instructions implement the steps of the above-described image feature extraction method based on an attention module, and can achieve the same technical effect. To avoid repetition, this invention will not elaborate further.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the protection scope of the present invention.
Claims
1. An image feature extraction method based on an attention module, characterized in that, The attention module-based image feature extraction method includes: Channel compression is performed on the input feature map to obtain a compressed feature map; The compressed feature map is input into the first serial convolution group to obtain the first convolution output set; The compressed feature map is input into the second serial convolution group to obtain the second convolution output set; Attention is generated on the first convolutional output set and the second convolutional output set based on the attention module to obtain an attention map set; The compressed feature map and the attention map set are fused to obtain a fused feature map.
2. The image feature extraction method based on an attention module according to claim 1, characterized in that, The process of channel compression of the input feature map to obtain a compressed feature map specifically includes: The input feature map is compressed by a 1×1 convolutional layer to obtain an initial compressed feature map; The initial compressed feature map is normalized by a normalization layer to obtain a normalized compressed feature map; The normalized compressed feature map is processed by the SiLU activation function to obtain a compressed feature map.
3. The image feature extraction method based on an attention module according to claim 1, characterized in that, The first serial convolutional group contains multiple horizontal one-dimensional convolutional layers, and the second serial convolutional group contains multiple vertical one-dimensional convolutional layers, wherein the number of horizontal one-dimensional convolutional layers is the same as the number of vertical one-dimensional convolutional layers.
4. The image feature extraction method based on an attention module according to claim 3, characterized in that, The kernel size of the horizontal one-dimensional convolutional layer is (1, k), and the kernel size of the vertical one-dimensional convolutional layer is (k, 1); where k is an odd number greater than 1.
5. The image feature extraction method based on an attention module according to claim 4, characterized in that, The step of inputting the compressed feature map into the first serial convolution group to obtain the first convolution output set specifically includes: Determine the i-th horizontal one-dimensional convolutional layer from the first serial convolutional group; If i is 1, the compressed feature map is input into the i-th horizontal one-dimensional convolutional layer to obtain the i-th horizontal convolutional output; and the i-th horizontal convolutional output is added to the pre-constructed first convolutional output set. If i is greater than 1, then obtain the horizontal convolution output of the (i-1)th layer and input the horizontal convolution output of the (i-1)th layer into the i-th horizontal one-dimensional convolutional layer to obtain the horizontal convolution output of the i-th layer; and add the horizontal convolution output of the i-th layer to the pre-constructed first convolution output set. If i is equal to the total number of horizontal one-dimensional convolutional layers, then output the first convolutional output set; If i is less than the total number of horizontal one-dimensional convolutional layers, then i is incremented by 1 and assigned to i, and the steps from obtaining the horizontal convolutional output of the (i-1)th layer to adding the horizontal convolutional output of the i-th layer to the pre-constructed first convolutional output set are executed.
6. The image feature extraction method based on an attention module according to claim 5, characterized in that, The step of inputting the compressed feature map into the second serial convolution group to obtain the second convolution output set specifically includes: Determine the j-th vertical one-dimensional convolutional layer from the second serial convolutional group; If j is 1, the compressed feature map is input into the j-th vertical one-dimensional convolutional layer to obtain the j-th vertical convolutional output; and the j-th vertical convolutional output is added to the pre-constructed second convolutional output set. If j is greater than 1, then obtain the vertical convolution output of the (j-1)th layer and input the vertical convolution output of the (j-1)th layer into the j-th vertical one-dimensional convolutional layer to obtain the vertical convolution output of the j-th layer; and add the vertical convolution output of the j-th layer to the pre-constructed second convolution output set. If j is equal to the total number of the vertical one-dimensional convolutional layers, then output the second convolutional output set; If j is less than the total number of vertical one-dimensional convolutional layers, then j is incremented by 1 and assigned to j, and the steps from obtaining the vertical convolutional output of the (j-1)th layer to adding the vertical convolutional output of the jth layer to the pre-constructed second convolutional output set are executed.
7. The image feature extraction method based on an attention module according to claim 6, characterized in that, The step of generating attention maps by applying an attention module to the first convolutional output set and the second convolutional output set to obtain an attention map set specifically includes: Attention is generated for the horizontal and vertical convolutional outputs of the same number of layers in the first and second convolutional output sets based on the attention module, resulting in an attention map for each layer; An attention map set is constructed based on the attention map of each layer; wherein the attention map set contains multiple layers of attention maps, the attention map of layer 0 is the compressed feature map, and the attention maps of layers 1 to n are the attention maps obtained from each layer.
8. The image feature extraction method based on an attention module according to claim 7, characterized in that, The process of fusing the compressed feature map and the attention map set to obtain a fused feature map specifically includes: The compressed feature map and the attention map of each layer are concatenated to obtain a concatenated feature map. The stitched feature maps are fused by convolutional fusion using a 1×1 convolutional layer to obtain a fused feature map.
9. An image feature extraction system based on an attention module, characterized in that, include: Processor and memory; The memory stores programs or instructions that can run on the processor, which, when executed by the processor, implement the steps of the attention module-based image feature extraction method as described in any one of claims 1 to 8.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the image feature extraction method based on an attention module as described in any one of claims 1 to 8.