Small target detection method, device, equipment and medium using multi-scale Gaussian attention
Through the multi-scale Gaussian attention mechanism, the problems of receptive field in traditional methods are solved, and more efficient small-object detection is achieved, which improves detection performance and robustness.
Patent Information
- Application Number
- CN202411432331.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-10-14
AI Technical Summary
Traditional object detection methods have problems such as receptive field insufficiency, information confusion and noise interference in small object detection, resulting in poor detection performance.
The multi-scale Gaussian attention mechanism is adopted to extract different scale features through parallel global average pooling, and combine one-dimensional and two-dimensional Gaussian distribution modeling channels and spatial attention weights to reduce information confusion and enhance robustness.
It improves the accuracy and robustness of small target detection, enhances the adaptability and discrimination ability to targets at different scales, and significantly improves the ability to capture small targets.
Smart Images

Figure CN119006797B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of target detection technology, and in particular to a small target detection method, device, equipment and medium using multi-scale Gaussian attention. Background Art
[0002] With the rapid development of computer vision, especially the widespread application of deep learning and the introduction of residual networks, the performance of object detection has made considerable progress in both speed and accuracy. For example, the newly released YOLOv10 achieves millisecond-level detection with excellent accuracy and only 2.3M parameters. In daily life, applications based on object detection technology are becoming an indispensable part, such as medical health, smart transportation, environmental protection and other fields. In recent years, many researchers have been committed to improving the performance of object detectors. Inspired by the way humans observe things, attention mechanisms have become one of the most popular research areas. Although there are many studies on the attention mechanism of conventional object detection, methods designed specifically for small object detection are still lacking.
[0003] After analysis, it was found that there are some incomplete considerations in the traditional attention mechanism used for regular target and small target detection. First, in the process of calculating channel attention and spatial attention, only one size of convolution kernel is usually used for convolution operation, which makes the receptive field of only one scale considered in the convolution operation. It is well known that the size of target objects in small target detection datasets also varies significantly. For example, in the same image of the VisDrone2019 dataset, there are both very small target objects and very large target objects. Therefore, a fixed receptive field may not be suitable for some application scenarios with target objects of varying scales. Some improved methods use convolution kernels of different scales in the calculation process, but simply add them up without considering the fact that different receptive fields may have different weights; second, most traditional methods only consider one of channel attention and spatial attention, which makes the model not fully utilize channel information and spatial information. Although some methods consider channel attention and spatial attention at the same time, they use cascade structures or simply multiply the two types of attention features, which may cause information confusion and thus affect detection performance; third, most existing channel attention and spatial attention mechanisms rely on a series of convolutional layers or fully connected layers, which will bring some additional parameters to the network. In addition, considering that most small target objects in an image may always be concentrated in a specific area, most of the existing methods for calculating attention features do not take this into account, which may cause the attention vector to be disturbed by surrounding noise, resulting in the model being unable to better focus on important channels or areas. Summary of the invention
[0004] Based on this, it is necessary to provide a small target detection method, device, equipment and medium of multi-scale Gaussian attention that considers the weight characteristics of different receptive fields, avoids information confusion, reduces noise interference, improves detection performance, and enhances robustness to address the above technical problems.
[0005] A small target detection method using multi-scale Gaussian attention, the method comprising:
[0006] Acquire an image to be detected; perform convolution processing on the image to be detected to obtain a first feature map;
[0007] Performing feature extraction on the first feature map through a plurality of parallel global average pooling operations, and outputting corresponding second feature maps at different scales;
[0008] Performing global average pooling and global maximum pooling processing on each of the second feature maps to obtain channel attention weights; modeling the channel attention weights through a one-dimensional Gaussian distribution to obtain modeled channel attention weights; multiplying the modeled channel attention weights by the corresponding channels of the second feature map to obtain a channel attention feature map;
[0009] Performing mean processing and maximization processing on each of the second feature maps to obtain a spatial attention weight; modeling the spatial attention weight through a two-dimensional Gaussian distribution to obtain a modeled spatial attention weight; multiplying the modeled spatial attention weight by a corresponding channel of the second feature map to obtain a spatial attention feature map;
[0010] Adding the channel attention feature map and the spatial attention feature map to obtain a corresponding third feature map at each scale;
[0011] Performing weight calculation based on each of the third characteristic graphs and the first characteristic graph to obtain an occupation weight of each third characteristic graph;
[0012] Calculate according to the first feature map, the third feature map and the occupation weight of each third feature map to obtain an image containing a small target detection result;
[0013] Performing convolution processing on the image to be detected to obtain a first feature map, including:
[0014] After performing several layers of convolution processing on the image to be detected, a convolution feature map is output; the convolution feature map is added to the image to be detected to obtain a first feature map.
[0015] A small target detection device of multi-scale Gaussian attention, the device comprising:
[0016] The basic module is used to obtain an image to be detected; perform convolution processing on the image to be detected to obtain a first feature map;
[0017] A multi-scale feature extraction module, used to extract features from the first feature map through a plurality of parallel global average pooling operations, and output corresponding second feature maps at different scales;
[0018] A Gaussian attention module is used to perform global average pooling and global maximum pooling on each of the second feature maps to obtain a channel attention weight; model the channel attention weight through a one-dimensional Gaussian distribution to obtain a modeled channel attention weight; multiply the modeled channel attention weight by the corresponding channel of the second feature map to obtain a channel attention feature map; perform mean processing and maximization processing on each of the second feature maps to obtain a spatial attention weight; model the spatial attention weight through a two-dimensional Gaussian distribution to obtain a modeled spatial attention weight; multiply the modeled spatial attention weight by the corresponding channel of the second feature map to obtain a spatial attention feature map; add the channel attention feature map and the spatial attention feature map to obtain a corresponding third feature map at each scale;
[0019] A dynamic weight module is used to perform weight calculation based on each of the third feature maps and the first feature map to obtain the occupancy weight of each third feature map; and to perform calculation based on the occupancy weights of the first feature map, the third feature map and each third feature map to obtain an image containing small target detection results.
[0020] The above-mentioned multi-scale Gaussian attention small target detection method, device, equipment and medium first obtain an image to be detected; perform convolution processing on the image to be detected to obtain a first feature map; extract features from the first feature map through several parallel global average pooling operations, and output corresponding second feature maps at different scales; perform global average pooling and global maximum pooling processing on each second feature map to obtain channel attention weights; model the channel attention weights through one-dimensional Gaussian distribution to obtain modeled channel attention weights; multiply the modeled channel attention weights by the corresponding channels of the second feature map to obtain a channel attention feature map; The image is processed by averaging and maximizing to obtain the spatial attention weight; the spatial attention weight is modeled by two-dimensional Gaussian distribution to obtain the modeled spatial attention weight; the modeled spatial attention weight is multiplied by the corresponding channel of the second feature map to obtain the spatial attention feature map; the channel attention feature map is added to the spatial attention feature map to obtain the corresponding third feature map at each scale; the weight is calculated according to each third feature map and the first feature map to obtain the occupancy weight of each third feature map; the occupancy weight of the first feature map, the third feature map and each third feature map is calculated to obtain an image containing the small target detection result.
[0021] The present invention firstly extracts features from the first feature map with different receptive fields through parallel global average pooling, thereby obtaining a second feature map considering different receptive fields; then the channel attention weight and the spatial attention weight of the second feature map are calculated, and the channel attention weight is Gaussian modeled through one-dimensional Gaussian distribution, and the spatial attention weight is Gaussian modeled through two-dimensional Gaussian distribution, thereby obtaining a third feature map after Gaussian modeling, which can make the attention mechanism smoother and more focused, avoid information confusion, and reduce noise interference; finally, considering that the importance of feature maps at different scales to the same scene is different, weight calculation is performed by each third feature map and the first feature map, and a suitable weight is set for each feature map, thereby enhancing the feature discrimination ability, enhancing the adaptability and robustness to different scenes, enabling it to more flexibly handle targets of different sizes, and improving the ability to capture small targets. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0023] Figure 1 A schematic diagram of the overall structural framework of a backbone network in one embodiment;
[0024] Figure 2 In one embodiment, Schematic diagram of the structural framework of the stage;
[0025] Figure 3 Schematic diagram of the process of a small target detection method using multi-scale Gaussian attention in one embodiment;
[0026] Figure 4 A schematic diagram of a multi-scale feature extraction module structure framework in one embodiment;
[0027] Figure 5 A schematic diagram of the Gaussian attention module structure framework in one embodiment;
[0028] Figure 6 A schematic diagram of a dynamic weight module structure framework in one embodiment;
[0029] Figure 7 This is a schematic diagram of the comparison of the first group of detection effects in an embodiment, wherein: Figure 7 (a) is a schematic diagram of the detection results obtained using the basic detector. Figure 7(b) is a schematic diagram of the detection results obtained using the MGAM module proposed in the present invention;
[0030] Figure 8 : is a schematic diagram for comparing the detection effects of the second group in one embodiment, wherein: Figure 8 (a) is a schematic diagram of the detection results obtained using the basic detector. Figure 8 (b) is a schematic diagram of the detection results obtained using the MGAM module proposed in the present invention;
[0031] Fig. 9 is a structural block diagram of a small target detection device of multi-scale Gaussian attention in one embodiment;
[0032] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment.
[0033] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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.
[0035] It should be noted that in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0036] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0037] The following will describe the implementation of the present invention in detail with reference to the accompanying drawings in the embodiment diagram of the present invention.
[0038] Example 1
[0039] refer to Figure 1, is a schematic diagram of the overall structure of the backbone network proposed in the present invention, including multiple stages of data processing, each stage has a similar structure, and the data processing method is also similar. Through this multi-stage data processing, on the one hand, the features of different levels of the image can be extracted layer by layer, so that the network can capture more subtle features related to small targets in the shallow layer, and retain these features in the deep layer, thereby improving the detection ability of small targets. On the other hand, by utilizing contextual information, features of different scales can be combined to improve the recognition of small targets and reduce the missed detection rate. In short, by gradually extracting and compressing features through this multi-stage processing, the interference of noise on the features of small targets can be reduced, helping the network to form a more stable and robust target representation, making the entire network more adaptable, and better handling scale changes in images, thereby effectively detecting large targets and small targets.
[0040] When performing specific data processing, the output of the previous stage is used as the input of the next stage. The main processing stages shown in this embodiment are 4, namely stage 1 to stage 4. The number of stages is set according to needs. This embodiment only gives one example. The initial stage before stage 1 is the preprocessing stage of the neural network, which consists of some convolutional layers and pooling layers. It is the feature map after preprocessing in the initial stage.
[0041] refer to Figure 2 , which is a schematic diagram of the structural framework of one stage, including the basic module and the multi-scale Gaussian attention mechanism module (MGAM). The basic module includes more than two convolutional layers, which are used to detect the input image. After processing, the convolution feature map is output; an identity connection layer is also set, which connects the input image to be detected Add directly to the convolution feature map to get the first feature map It is worth noting that the convolution kernel size of each convolution layer in the basic module can be set according to requirements; It means in The number of times the basic module is repeated in the stage can also be set according to needs.
[0042] The first feature map generated by the basic module Output to the MGAM module, which includes a multi-scale feature extraction module (MFEM), a Gaussian attention module (GAM) and a dynamic weight module (DWM). The MGAM module processes the data in sequence through the multi-scale feature extraction module (MFEM), the Gaussian attention module (GAM) and the dynamic weight module (DWM), and outputs an image containing the small target detection results at this stage. Specifically, first, the MFEM module extracts features at different scales from the first feature map through parallel global average pooling, thereby obtaining a second feature map that considers different receptive fields; then the GAM module calculates the channel attention weight and spatial attention weight of the second feature map, and Gaussian modeling is performed on the channel attention weight through one-dimensional Gaussian distribution, and Gaussian modeling is performed on the spatial attention weight through two-dimensional Gaussian distribution, thereby obtaining the third feature map after Gaussian modeling. This method can make the attention mechanism smoother and more focused, avoid information confusion, and reduce noise interference; finally, considering that the importance of feature maps at different scales to the same scene is different, the DWM module is used to calculate the weights of each third feature map and the first feature map, and set appropriate weights for each feature map, thereby enhancing the feature discrimination ability, enhancing the adaptability and robustness to different scenes, enabling it to more flexibly handle targets of different sizes, and improving the ability to capture small targets.
[0043] refer to Figure 3 , which is a small target detection method with multi-scale Gaussian attention provided in this embodiment, and only illustrates the data processing process of one stage. The data processing process of this stage includes the following steps:
[0044] Step 201, obtaining an image to be detected; performing convolution processing on the image to be detected to obtain a first feature map.
[0045] It can be understood that this step corresponds to Figure 2 The data processing process of the basic module in the network, the convolution layer close to the input end extracts low-level features, the convolution layer in the middle extracts more complex features, and the convolution layer close to the output end extracts deeper high-level features. Then the input end and the output end are connected through the identity connection layer, so that the image to be detected is added to the convolution feature map. The design of the identity connection layer enables information to be transmitted deeper in the network, reducing information loss and deformation, and can learn richer and more discriminative features. Finally, a multi-level and multi-scale feature map is obtained, which is recorded as the first feature map .
[0046] Specifically, the detected image After several layers of convolution processing, the convolution feature map is output; the convolution feature map is added to the image to be detected to obtain the first feature map .
[0047] Step 202: extract features from the first feature map through a plurality of parallel global average pooling operations, and output corresponding second feature maps at different scales.
[0048] It can be understood that this step corresponds to Figure 2The data processing process of the multi-scale feature extraction module (MFEM) in the MGAM module. Figure 4 , which is a schematic diagram of the multi-scale feature extraction module structure framework, which includes several parallel global average pooling layers. Through the parallel global average pooling layers, feature extraction is performed to obtain the corresponding feature maps at different scales, which are recorded as the second feature map By performing feature extraction through several parallel global average pooling layers, the characteristics of different receptive fields can be considered, thereby better capturing the multi-scale features of the input data and helping the network to better understand the overall structure and local details. It is worth noting that the convolution kernel size of each global average pooling layer is Set it according to your needs.
[0049] Specifically, in this embodiment, the first feature map is pooled by global average pooling layers with four different scales of kernel size 1×1, 3×3, 5×5 and 7×7. Perform feature extraction and obtain the corresponding second feature map, which are recorded as and .
[0050] In step 203, each second feature map is subjected to global average pooling and global maximum pooling processing to obtain channel attention weights; the channel attention weights are modeled by one-dimensional Gaussian distribution to obtain modeled channel attention weights; the modeled channel attention weights are multiplied by the corresponding channels of the second feature map to obtain a channel attention feature map; each second feature map is subjected to mean processing and maximization processing to obtain spatial attention weights; the spatial attention weights are modeled by two-dimensional Gaussian distribution to obtain modeled spatial attention weights; the modeled spatial attention weights are multiplied by the corresponding channels of the second feature map to obtain a spatial attention feature map; the channel attention feature map is added to the spatial attention feature map to obtain the corresponding third feature map at each scale.
[0051] It can be understood that this step corresponds to Figure 2 The data processing process of the Gaussian Attention Module (GAM) in the MGAM module. Figure 5 , is a schematic diagram of the Gaussian attention module structure framework, obtained by step 202 and Input the Gaussian attention module for processing respectively, so as to obtain the third feature map and .
[0052] The Gaussian attention module consists of two parts: channel attention and spatial attention. On the channel attention side, it includes a global average pooling layer and a global maximum pooling layer. The global average pooling layer and the global maximum pooling layer are used to respectively After processing, the two features are added together to obtain the corresponding channel attention weights at each scale , and then through the one-dimensional Gaussian distribution function Attention weights for channels Perform modeling and obtain the channel attention weight after modeling , the modeled channel attention weight With the second feature map Multiply the corresponding channels to get the channel attention feature map .
[0053] On the spatial attention side, including the layer that performs mean and maximum processing on a certain dimension, the second feature map After performing mean and maximization processing respectively, the two features are added together to obtain the corresponding spatial attention weights at each scale. , and then through the two-dimensional Gaussian distribution function Spatial attention weights Perform modeling and obtain the spatial attention weight after modeling , the modeled spatial attention weight With the second feature map Multiply the corresponding channels to get the spatial attention feature map .
[0054] Among them, the one-dimensional Gaussian distribution function The expression is:
[0055] ;
[0056] In the formula, represents the mean of a one-dimensional Gaussian distribution; Represents the variance of a one-dimensional Gaussian distribution; Indicates the coordinates of the point where the maximum value of the channel attention weight is located; Indicates the number of channels.
[0057] Two-dimensional Gaussian distribution function The expression is:
[0058] ;
[0059] In the formula, represents the mean of a two-dimensional Gaussian distribution; Represents the covariance matrix of a two-dimensional Gaussian distribution; The horizontal coordinate of the point where the maximum value of the spatial attention weight is located; The ordinate of the point where the maximum value of the spatial attention weight is located; Represents the width of the spatial attention weight; Represents the height of the spatial attention weight.
[0060] Finally, the channel attention feature maps at each scale are and spatial attention feature map Add them together to get the corresponding third feature map at each scale In this embodiment, the third feature maps at the corresponding scales are respectively recorded as and .
[0061] Step 204, performing weight calculation based on each third feature map and the first feature map to obtain the occupancy weight of each third feature map; performing calculation based on the first feature map, the third feature map and the occupancy weight of each third feature map to obtain an image containing small target detection results.
[0062] It can be understood that this step corresponds to Figure 2 The data processing process of the dynamic weight module (DWM) in the MGAM module. Figure 6 , which is a schematic diagram of the dynamic weight module structure framework, including the weight calculation layer and the identity connection layer. The weight calculation layer obtains the first feature map from the multi-scale feature extraction module (MFEM) On the other hand, the third feature map is obtained from the Gaussian Attention Module (GAM) , and then according to the third feature map With the first feature map Perform weight distribution calculation together to obtain the third feature map The corresponding occupancy weight , the calculation process expression is:
[0063] ;
[0064] In the formula, Indicates possession weight; represents the third feature map; represents the first feature map; Represents the third feature map And the first feature map The distance between represents the width of the first feature map; represents the height of the first feature map; Indicates that the convolution kernel size is The corresponding data at the time; Indicates The corresponding data under the stage, Indicates replaceable data.
[0065] Then, the third feature map The corresponding occupancy weight After multiplication, multiple summation is performed, and the first feature map obtained by the identity connection layer Add together to get an image containing the small target detection results. The calculation process expression is:
[0066] ;
[0067] In the formula, Indicates The image output by the stage contains the small target detection results.
[0068] Through repeated calculations in multiple stages, the final image containing small target detection results is obtained.
[0069] In one of the embodiments, the small target detection method of multi-scale Gaussian attention proposed in the present invention is verified.
[0070] The classic two-stage general target detector Faster R-CNN is used as the basic detector, and training and testing are performed on the AI-TOD dataset. The detection effect of the basic detector and the effect of adding the MGAM module proposed in the present invention to it are compared. Apart from this, the other settings of the model are the same.
[0071] Specific detection effects such as Figure 7 and Figure 8 As shown, the green, blue and red rectangular boxes represent the target objects that are correctly detected, falsely detected and missed respectively. By comparison, it can be intuitively seen that the small target detection method using the multi-scale Gaussian attention proposed in the present invention has a significant improvement in the detection effect.
[0072] In addition to the visual comparison, the present invention also conducts detailed experimental verification on the AI-TOD dataset. The specific results are shown in Table 1, where rows 1 to 5 are the results of a two-stage anchor-frame-based target detector, rows 6 and 7 are the detection results of a one-stage anchor-frame-based target detector, rows 8 to 10 are the detection results obtained using a detector without an anchor frame, rows 11 to 13 are the detection results of the three best existing attention mechanisms on the AI-TOD dataset, and rows 14 to 18 are the detection results of the small target detection method of the multi-scale Gaussian attention proposed in the present invention applied to the classic target detector.
[0073] The method proposed in the present invention can be easily embedded in various common target detectors. As can be seen from Table 1, by adding the MGAM module to the basic detectors RetinaNet, FCOS, Faster R-CNN, Cascade R-CNN and DetectoRS, the detection accuracy can be increased by 2.2, 5.1, 9.5, 8.6 and 10.2 percentage points respectively. Compared with the best attention mechanism, the method proposed in the present invention can bring an improvement of 3.7 percentage points.
[0074] Table 1 Comparison of test results accuracy on the AI-TOD dataset
[0075]
[0076] In summary, the multi-scale Gaussian attention mechanism for small target detection proposed in the present invention can handle small target detection tasks well, especially for target objects with very small sizes, the improvement of detection accuracy is more obvious.
[0077] Although this embodiment Figure 1 The steps in the process are shown in sequence as indicated by the arrows, but the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of the steps, and the steps can be executed in other orders. Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0078] Example 2
[0079] Based on the small target detection method of multi-scale Gaussian attention in Example 1, this embodiment discloses a small target detection device of multi-scale Gaussian attention, such as Fig. 9 As shown, the small target detection device of multi-scale Gaussian attention includes: a basic module 401, a multi-scale feature extraction module 402, a Gaussian attention module 403 and a dynamic weight module 404, wherein:
[0080] The basic module 401 is used to obtain an image to be detected; perform convolution processing on the image to be detected to obtain a first feature map;
[0081] A multi-scale feature extraction module 402, configured to extract features from the first feature map through a plurality of parallel global average pooling operations, and output corresponding second feature maps at different scales;
[0082] Gaussian attention module 403, used to perform global average pooling and global maximum pooling processing on each of the second feature maps to obtain channel attention weights; model the channel attention weights through one-dimensional Gaussian distribution to obtain modeled channel attention weights; multiply the modeled channel attention weights by the corresponding channels of the second feature map to obtain a channel attention feature map; perform mean processing and maximization processing on each of the second feature maps to obtain spatial attention weights; model the spatial attention weights through two-dimensional Gaussian distribution to obtain modeled spatial attention weights; multiply the modeled spatial attention weights by the corresponding channels of the second feature map to obtain a spatial attention feature map; add the channel attention feature map and the spatial attention feature map to obtain the corresponding third feature map at each scale;
[0083] The dynamic weight module 404 is used to calculate the weight according to each of the third feature maps and the first feature map to obtain the occupancy weight of each third feature map; calculate according to the first feature map, the third feature map and the occupancy weight of each third feature map to obtain an image containing small target detection results.
[0084] In this embodiment, the specific working process and working principle of the basic module 401, the multi-scale feature extraction module 402, the Gaussian attention module 403 and the dynamic weight module 404 are the same as those in the method of Embodiment 1, so they are not described in detail in this embodiment. Each unit module can be implemented in whole or in part by software, hardware and a combination thereof, and each unit module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above unit modules.
[0085] Example 3
[0086] like Fig.10 A computer device disclosed in this embodiment is shown, which may be a server, including a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data of Example 1. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the method in Example 1 is implemented.
[0087] Those skilled in the art will understand that Fig.10The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0088] Example 4
[0089] This embodiment discloses a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method in the above-mentioned embodiment 1 is implemented.
[0090] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0091] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0092] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims
1. A small target detection method with multi-scale Gaussian attention, characterized in that: The method comprises: Acquire an image to be detected; perform convolution processing on the image to be detected to obtain a first feature map; Performing feature extraction on the first feature map through a plurality of parallel global average pooling operations, and outputting corresponding second feature maps at different scales; Performing global average pooling and global maximum pooling processing on each of the second feature maps to obtain channel attention weights; modeling the channel attention weights through a one-dimensional Gaussian distribution to obtain modeled channel attention weights; multiplying the modeled channel attention weights by the corresponding channels of the second feature map to obtain a channel attention feature map; Performing mean processing and maximization processing on each of the second feature maps to obtain a spatial attention weight; modeling the spatial attention weight through a two-dimensional Gaussian distribution to obtain a modeled spatial attention weight; multiplying the modeled spatial attention weight by a corresponding channel of the second feature map to obtain a spatial attention feature map; Adding the channel attention feature map and the spatial attention feature map to obtain a corresponding third feature map at each scale; Performing weight calculation based on each of the third characteristic graphs and the first characteristic graph to obtain an occupation weight of each third characteristic graph; Calculate according to the first feature map, the third feature map and the occupation weight of each third feature map to obtain an image containing a small target detection result; Performing convolution processing on the image to be detected to obtain a first feature map, including: After performing several layers of convolution processing on the image to be detected, a convolution feature map is output; the convolution feature map is added to the image to be detected to obtain a first feature map; Constructing a one-dimensional Gaussian distribution function , the expression is: ; Constructing a two-dimensional Gaussian distribution function , the expression is: ; In the formula, represents the mean of a one-dimensional Gaussian distribution; Represents the variance of a one-dimensional Gaussian distribution; Indicates the coordinates of the point where the maximum value of the channel attention weight is located; Indicates the number of channels; represents the mean of a two-dimensional Gaussian distribution; Represents the covariance matrix of a two-dimensional Gaussian distribution; The horizontal coordinate of the point where the maximum value of the spatial attention weight is located; The ordinate of the point where the maximum value of the spatial attention weight is located; Represents the width of the spatial attention weight; Represents the height of the spatial attention weight; Through the one-dimensional Gaussian distribution function Attention weights for the channels Perform modeling and generate channel attention weights after modeling ; Through the two-dimensional Gaussian distribution function For the spatial attention weight Perform modeling and generate modeled spatial attention weights .
2. The small target detection method of multi-scale Gaussian attention according to claim 1 is characterized in that: The weight calculation is performed based on each of the third feature maps and the first feature map to obtain the occupation weight of each third feature map. The calculation process expression is: ; In the formula, Indicates possession weight; represents the third feature map; represents the first feature map; Represents the third feature map And the first feature map The distance between represents the width of the first feature map; represents the height of the first feature map; Indicates that the convolution kernel size is × The corresponding data at the time; Indicates The corresponding data under the stage, Indicates replaceable data.
3. The small target detection method of multi-scale Gaussian attention according to claim 2 is characterized in that: Calculating according to the first feature map, the third feature map and the occupancy weight of each third feature map to obtain an image containing a small target detection result, including: The third feature map is multiplied by the corresponding occupancy weights respectively, and then a multi-sum is performed, and then added to the first feature map, so as to obtain an image containing the small target detection result.
4. The small target detection method of multi-scale Gaussian attention according to claim 2 is characterized in that: The third feature map is multiplied by the corresponding occupancy weights and then multiplied, and then added to the first feature map to obtain an image containing the small target detection results. The calculation process expression is: ; In the formula, Indicates The image output by the stage contains the small target detection results.
5. A small target detection device with multi-scale Gaussian attention, characterized in that: The small target detection method of multi-scale Gaussian attention according to any one of claims 1 to 4 is adopted, and the device comprises: The basic module is used to obtain an image to be detected; perform convolution processing on the image to be detected to obtain a first feature map; A multi-scale feature extraction module, used to extract features from the first feature map through a plurality of parallel global average pooling operations, and output corresponding second feature maps at different scales; A Gaussian attention module is used to perform global average pooling and global maximum pooling on each of the second feature maps to obtain a channel attention weight; model the channel attention weight through a one-dimensional Gaussian distribution to obtain a modeled channel attention weight; multiply the modeled channel attention weight by the corresponding channel of the second feature map to obtain a channel attention feature map; perform mean processing and maximization processing on each of the second feature maps to obtain a spatial attention weight; model the spatial attention weight through a two-dimensional Gaussian distribution to obtain a modeled spatial attention weight; multiply the modeled spatial attention weight by the corresponding channel of the second feature map to obtain a spatial attention feature map; add the channel attention feature map and the spatial attention feature map to obtain a corresponding third feature map at each scale; A dynamic weight module is used to perform weight calculation based on each of the third feature maps and the first feature map to obtain the occupancy weight of each third feature map; and to perform calculation based on the occupancy weights of the first feature map, the third feature map and each third feature map to obtain an image containing small target detection results.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.