Dangerous goods detection method in X-ray security inspection images based on attention mechanism
By integrating the attention fusion network with multi-compression activation and multi-fusion global attention module in the YOLOv3-SPP network, the problems of low detection efficiency and easy missed detection of dangerous items in X-ray images are solved, and higher detection accuracy and recall rate are achieved.
Patent Information
- Application Number
- CN202211032537.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-26
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-08-26
AI Technical Summary
In the prior art, the detection efficiency of manually identifying X-ray images in public places is low and prone to missed inspection, resulting in safety hazards and low efficiency.
An X-ray security image hazardous item detection method based on attention mechanism is adopted, and an attention fusion network (AFN) is built by fusing the multi-compression activation (MSE) module and the multi-fusion global attention (MFGA) module on the YOLOv3-SPP network architecture. This method combines channel and spatial attention information to enhance feature representation capabilities and improve object detection performance.
It effectively improves the detection accuracy and recall rate of medium and large targets, improves detection performance, and reduces false detection and missed detection.
Smart Images

Figure CN115393796B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image target detection and relates to a method for detecting dangerous goods in X-ray security inspection images based on an attention mechanism. Background Art
[0002] In the field of public transportation management, X-ray baggage security inspection is an important way to protect the life and property of passengers. However, security inspectors use naked eye observation to confirm dangerous goods, which is easily affected by human factors and has low efficiency. Therefore, it is of great significance to establish a real-time and accurate X-ray baggage security inspection system.
[0003] Object recognition in X-ray images is mainly based on the Bag-of-Visual-Words (BoVW) model. With the emergence of AlexNet, deep neural networks such as Convolutional Neural Network (CNN) have achieved remarkable results in object detection and image classification. Akcay S et al. introduced CNN into the field of X-ray baggage images and used the transfer learning method to optimize the AlexNet structure for end-to-end feature extraction and classification, with a detection accuracy of 98.92%. Akcay S et al. explored the application of CNN in X-ray baggage image classification and detection tasks, showing that CNN is more effective than the BoVW model. Mery D et al. proposed a strategy based on deep features and nearest neighbor classifiers to deal with the problem of X-ray image recognition on the public GDXray (Grima X-ray Dataset), with a recognition accuracy of over 95%. In order to solve the problem of limited X-ray image datasets, Bhowmik N et al. proposed a synthetically composite (SC) data enhancement method, performed dangerous goods detection on the Faster R-CNN and RetinaNet architectures, and studied the differences in detection performance between real and synthetic X-ray training images.
[0004] Therefore, in the target detection task, in order to solve the problem that the existing methods of manually identifying dangerous objects in X-ray images in public places are inefficient and easy to miss, a new method for detecting dangerous objects in X-ray security inspection images is urgently needed. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a method for detecting dangerous goods in X-ray security inspection images based on an attention mechanism, which is used to solve the problem that the manual identification of dangerous goods in X-ray images in public places is inefficient and easy to miss, thereby improving the detection performance. The present invention integrates channel and spatial attention information to improve the target detection method of feature representation capability, and integrates the Multi-Squeeze Excitation (MSE) module and the Multi-Fusion Global Attention (MFGA) module based on the YOLOv3-SPP network. The MSE module can effectively utilize the channel information between feature maps, so that the target area containing dangerous goods in the shallow features is enhanced. Finally, the dilated convolution is used in the spatial attention branch of the MFGA module to expand the receptive field, so that the context information can be effectively used to construct a more effective spatial feature map than the standard convolution, and the final feature composed of global features and related local features can be refined before prediction.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A method for detecting dangerous goods in X-ray security inspection images based on an attention mechanism is proposed. The MSE module and the MFGA module are integrated on the YOLOv3-SPP architecture to form an attention fusion network (AFN). MSE is a multi-compression activation and MFGA is a multi-fusion global attention. The attention fusion network is used to detect dangerous goods in X-ray security inspection images, and the method specifically includes the following steps:
[0008] S1: Input the X-ray security inspection image of the luggage to be inspected, obtain the feature map through the YOLOv3-SPP backbone network, and input it into the MSE module to enhance the key information in the feature map and suppress the background information, so as to obtain the semantic features with channel globality;
[0009] S2: Use the SPP module to fuse multi-scale features and then pass them through the MSE module to refine the fused local features and global features, enrich the representation ability of the feature map, and enhance the acquired multi-scale semantic information; among them, SPP is spatial pyramid pooling;
[0010] S3: The channel branch and the spatial branch are connected in series to form the MFGA (Multi-Fused Global Attention) module, and this module is placed before the classifier of each detection branch to effectively fuse the channel and spatial information of the deep features, so that the multi-scale features have three-dimensional globality; each detection branch predicts small, medium and large targets in the X-ray security inspection image respectively.
[0011] Furthermore, the specific structure of the MSE module is as follows: First, the given input is mapped to the feature map X∈R C×H×WIn the figure above, H, W, and C correspond to the height, width, and channel dimension of the feature map, respectively. The MSE block concatenates the generated feature descriptors on the channel through global average pooling and maximum pooling in the compression operation. The second is the activation operation. The fully connected layer reduces the dimension of the channel through the reduction rate parameter and then restores the channel dimension. Finally, the feature is recalibrated. The C×1×1 vector obtained after the activation operation is weighted multiplied by the input feature on the channel and the result is output.
[0012] Furthermore, the weight w of the MSE module is calculated as follows:
[0013] w=σ(g ex {w 1 , w 2}([g avg (X); g max (X)]))
[0014] Let f = [g avg (X); g max (X)], and we get g ex {w 1 , w 2}(f)=w 2 ReLU(w 1 f), where g avg (·), g max (·) represent global average pooling and maximum pooling, σ represents the activation function, and w 1 represents the (C / r)×C parameter matrix, w 2 Indicates that w2 represents a C×(C / r) parameter matrix, and r represents the dilation rate; where the activation operation first uses standard convolution to reduce the dimension of the concatenated features on the channel.
[0015] Furthermore, the specific structure of the MFGA module is as follows: based on the HDC framework, three 3×3 convolution kernels with different dilation rates are used to expand the receptive field; the CAM module and the SAM module are placed sequentially; wherein HDC is a mixed dilated convolution, CAM is a channel attention, and SAM is a spatial attention.
[0016] Furthermore, the specific structure of the SAM module is as follows: first, a set of dilated convolutions with a convolution kernel size of K and a dilation rate of r = [1, 2, 5] are used to operate the input feature map; secondly, the feature descriptors generated by global average pooling and maximum pooling are concatenated on the channel to aggregate the channel information on the feature map; then, the channel dimension is reduced by dilated convolution with a convolution kernel size of K = 3 and a dilation rate of r = 2; finally, the final spatial attention map is generated by the Sigmoid function.
[0017] Furthermore, two principles must be followed when modifying SAM according to the HDC framework: (1) M n ≤K, K is the kernel size of the convolution kernel, M n Refers to the maximum distance between two non-zero values; (2) Within a group, the expansion rates cannot have a common factor, otherwise, the "gridding" problem will still occur.
[0018] Furthermore, the specific structure of the CAM module is as follows: first, the global spatial information of the feature map is aggregated through pooling operations, wherein the role of global average pooling is to aggregate information, and the maximum pooling is mainly used to refine the generated channel attention; secondly, the aggregated information is input into a shared network to generate a channel attention map, wherein the shared network is composed of a multi-layer perceptron (MLP); standard convolution is used to reduce the dimension of the spliced features on the channel.
[0019] Further, the calculation process of the CAM module is:
[0020]
[0021] Among them, M C represents the one-dimensional channel attention generated by the CAM module, represents a one-dimensional convolution operation with a convolution kernel size of 1, f MLP represents a multi-perceptron with one hidden layer, and σ represents the Sigmoid function.
[0022] The beneficial effects of the present invention are as follows: the present invention adopts the network architecture of YOLOv3-SPP, fuses channel and spatial attention information to enhance the target detection method of feature representation ability, and limits the problem of shallow features to a certain extent due to the loss of semantic information caused by a single pooling operation. It is specifically reflected in the following parts:
[0023] (1) The present invention adopts a multi-squeezed activation (MSE) module to generate more refined attention, thereby improving the detection performance of the target and enhancing the representation ability of channel attention.
[0024] (2) The present invention adopts the Multi-Fusion Global Attention (MFGA) module and adopts dilated convolution in the spatial attention branch of CBAM to construct a more effective spatial feature map than the standard convolution, effectively utilizing the contextual information while optimizing the final features of the input prediction network so that the model selects meaningful features.
[0025] (3) The present invention integrates the MSE module and the MFGA module into the network architecture of YOLOv3-SPP to achieve feature fusion of different scales, thereby obtaining a better target detection effect.
[0026] (4) The present invention can effectively improve the detection accuracy and recall rate of medium and large targets.
[0027] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0029] Figure 1 A schematic diagram of the structure of the attention fusion network (AFN) used in the present invention;
[0030] Figure 2 It is a schematic diagram of the SPP module structure;
[0031] Figure 3 It is a schematic diagram of the structure of the multi-squeezed activation (MSE) module;
[0032] Figure 4 It is a schematic diagram of the structure of the multi-fusion global attention (MFGA) module;
[0033] Figure 5 Schematic diagram of the spatial attention (SAM) module structure;
[0034] Figure 6 Schematic diagram of the channel attention (CAM) module structure;
[0035] Figure 7 The types of objects included in the SIXray dataset are knife, gun, pliers, wrench, hammer, and scissors. DETAILED DESCRIPTION
[0036] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0037] See also Figure 1 to Figure 7, the present invention provides a method for detecting dangerous goods in X-ray security inspection images based on an attention mechanism. Aiming at the problems of false detection and missed detection in the detection of dangerous goods in the X-ray baggage security inspection system, an attention fusion network (AFN) is constructed on the basis of effectively utilizing context information and enhancing feature representation capabilities. The network mainly integrates the multi-squeezed activation (MSE) module and the multi-fusion global attention (MFGA) module on the YOLOv3-SPP architecture. First, the features extracted by the feature extraction network are fused with the channel information extracted by the MSE to obtain semantic features with channel globality; then the MFGA module is set in each detection network branch to effectively fuse the channel and spatial information of the deep features, so that the multi-scale features have three-dimensional globality.
[0038] 1. Attention Fusion Network (AFN)
[0039] The X-ray security image dangerous goods detection model (abbreviated as attention fusion network) adopted by the present invention integrates channel and spatial attention. The specific framework is as follows Figure 1 As shown in the figure, two modules are mainly designed to integrate the local features extracted by the network with the global features extracted by attention, so as to obtain refined channel and spatial attention features, thereby improving the performance of the model in dangerous goods detection.
[0040] Input the X-ray security inspection image of the luggage to be inspected, obtain the feature map through the backbone network, and input it into the MSE (Multiple Squeezed Activation) module to enhance the key information in the feature map and suppress the background information, so as to obtain the semantic features with channel globality. After using the SPP module to fuse the multi-scale features and then pass it through the MSE module, the fused local features and global features can be refined, the representation ability of the feature map can be enriched, and the multi-scale semantic information obtained can be enhanced. The SPP module is as follows Figure 2 shown.
[0041] The three prediction branches predict small, medium and large targets in X-ray security inspection images respectively, which can effectively solve the problem of poor target detection performance. In order to obtain the contextual information of the target area, the spatial branch expands the receptive field through dilated convolution, thereby refining the final features composed of global features and related local features. The channel branch and the spatial branch are connected in series to form the MFGA module, and this module is placed before the classifier of each detection branch, effectively fusing the channel and spatial information of the deep features, so that the multi-scale features have three-dimensional globality. In this way, more attention is paid to the target area containing dangerous goods in the image, effectively improving the detection accuracy of the model for dangerous goods. In order to meet the real-time requirements, there is no need to add this module to all locations in the network.
[0042] 1) Multi-Squeezed Activation (MSE) Module
[0043] Map the given input to the feature map X∈RC×H×W In the figure above, H, W, and C correspond to the height, width, and channel dimensions of the feature map, respectively. The SE block downsamples the input features through global average pooling in the compression operation, thereby compressing the global spatial information into the operator to capture the channel correlation between features; the second is the activation operation, which uses the scaling parameter to reduce the channel dimension, thereby reducing the amount of network computation, and then restores the channel dimension; the last is the feature recalibration, which multiplies the C×1×1 vector obtained after the activation operation with the input feature weights on the channel and outputs the result.
[0044] However, the use of a single global average pooling in the compression operation not only retains a lot of background information, but also causes the feature map after pooling to lose target information. Maximum pooling can retain texture information that is beneficial to target detection. Therefore, the present invention utilizes global average pooling and maximum pooling to splice the generated descriptors on the channel, and then reduces the dimension of the channel through standard convolution. Compared with a single pooling operation, this can effectively retain the feature map information extracted by the neural network and reduce the interference of background information on dangerous goods detection. Since the commonly used network structure is a series structure from high resolution to high semantic feature information, that is, as the number of convolutional network layers increases, the amount of channel information will decrease. Therefore, after the features extracted by the MSE module are fused with the feature information of the previous layers, it is beneficial for the convolutional layer after the attention module to extract a more detailed channel feature representation. The MSE module is as follows: Figure 3 As shown, the weight calculation process of the MSE module is as follows:
[0045] w=σ(g ex {w 1 , w 2}([g avg (X); g max (X)]))
[0046] Let f = [g avg (X); g max (X)], and we get g ex {w 1 , w 2}(f)=w 2 ReLU(w 1 f). In the formula, the activation operation first uses standard convolution to reduce the dimension of the concatenated features on the channel.
[0047] 2) Multi-fusion global attention (MFGA) module
[0048] The spatial attention map generated by the spatial attention branch in the CBAM (convolutional block attention module) can emphasize features that are beneficial to dangerous goods detection, and can also suppress background features that are not conducive to detection. According to the hybrid dilated convolution (HDC) framework, the present invention uses three 3×3 convolution kernels with different dilation rates to expand the receptive field, thereby effectively aggregating contextual information and enhancing the representation ability of spatial attention. The channel attention module (CAM) and the spatial attention module (SAM) are placed sequentially, and the input feature map is first processed in terms of channels so that the network pays attention to "what" the image is, and then spatial processing is performed to make the network pay attention to "where" the useful information in the image is. The present invention calls the improved module the multi-fusion global attention (MFGA) module, and the overall structure is as follows: Figure 4 As shown, this module can be basically added to any location in the network, with the feature of "plug and play".
[0049] 2.1) Spatial Attention (SAM) Module
[0050] Dilated convolution is constructed by inserting zero values between each pixel in the convolution kernel, which can aggregate multi-scale contextual information and expand the receptive field without losing resolution. However, the current dilated convolution framework will have a "gridding" problem: after a set of dilated convolutions with equal dilation rates, the receptive field of the convolution kernel only covers the area of the checkerboard pattern, and when sampling, it will cause the loss of adjacent information, which is not conducive to the network's learning of input samples.
[0051] To address this problem, the present invention modifies SAM based on the HDC (hybrid dilated convolution) framework. Two principles need to be followed when using HDC: (1) M n ≤K, K is the kernel size of the convolution kernel, M n =r n , here r n Refers to the dilation rate of the nth dilated convolution in the group, M n Refers to the maximum distance between two non-zero values; (2) Within a group, the expansion rates cannot have a common factor, otherwise, the "grid" problem will still occur. When the expansion rates between convolutional layers meet the above two principles, the receptive field can completely cover a square area.
[0052] First, the present invention uses a set of dilated convolutions with a dilation rate of r = [1, 2, 5] and a convolution kernel size of K = 3 to operate on the input feature map. Secondly, the feature descriptors generated by global average pooling and maximum pooling are spliced on the channel to aggregate the channel information on the feature map, which can highlight the information area. Then, the channel dimension is reduced by dilated convolution with a convolution kernel size of 3 and a dilation rate of 2, which can encode and map the regional information that needs to be emphasized or suppressed in the space, thereby improving the representation ability of spatial attention. Finally, the final spatial attention map is generated by the Sigmoid function. The SAM module is as follows: Figure 5 shown.
[0053] The spatial attention calculation process is:
[0054]
[0055] in, Indicates that a set of dilated convolutions with a kernel size of 3 are used to operate on the input feature map. represents the dilated convolution with a kernel size of 3 and a dilation rate of 2; σ represents the Sigmoid function.
[0056] 2.2) Channel Attention (CAM) Module
[0057] First, the global spatial information of the feature map is aggregated through pooling operations. The role of global average pooling is to aggregate information, and the maximum pooling is mainly used to refine the generated channel attention. Secondly, the aggregated information is input into the shared network to generate the channel attention map. The shared network here is composed of a multi-layer perceptron (MLP). The reduction rate is fixed to 16 in the experiment. Different from using "summation" to merge the output feature vectors in CBAM, the present invention uses standard convolution to reduce the dimension of the spliced features on the channel. The CAM module is as follows: Figure 6 shown.
[0058] The channel attention calculation process is as follows:
[0059]
[0060] in, represents a one-dimensional convolution operation with a convolution kernel size of 1, f MLP Represents a multi-perceptron with one hidden layer. Here, the reduction rate is set to 16 to reduce parameter overhead.
[0061] 3. Comparative experiment:
[0062] 1) Dataset
[0063] X-ray security inspection images are generated due to the penetration of X-rays, photoelectric sensitivity and fluorescence effect.
[28] . Currently, the commonly used datasets for dangerous goods detection in X-ray security inspection images are: GDXray, OPIXray (Occluded Prohibited Items X-ray) and SIXray. Some images in GDXray contain pistols, darts and razor blades. These are grayscale images with little background interference, and there is usually only one object in each image. The detection is relatively simple, but there is a certain gap with the actual scene. OPIXray contains folding knives, straight knives, scissors, utility knives and multi-purpose knives, all of which are different shapes of knives, which is not conducive to the detection of other types of dangerous goods. SIXray contains 1,059,231 X-ray images, manually annotated with 6 types of dangerous goods: guns, knives, wrenches, pliers, scissors and hammers, a total of 8,929 images. Figure 7 is a sample example of each type of dangerous goods in the SIXray dataset. Compared with other datasets, the types and quantities of dangerous goods in SIXray meet the network's requirements for datasets. In addition to containing one dangerous object, an image also contains multiple dangerous objects of different types, and can also contain multiple dangerous objects of the same type, so it is used as the benchmark for this study.
[0064] 2) Experimental setup
[0065] The model of the present invention is based on the pytorch open source deep learning library, and RTX 3090 is used for experimental training. The batch size is set to 16, and the initial learning rate is 0.001. The model optimization method adopts stochastic gradient descent (SGD), the momentum is set to 0.937, the weight decay is set to 0.0005, and the maximum training epoch is set to 110. A total of five models were trained in the experiment, with YOLOv3-SPP as the benchmark model. When the attention mechanism is added, the weight file cannot be used, so the weight file is not used during training, but all convolutional layers are directly trained.
[0066] 3) Experimental results analysis
[0067] In the experiment, the COCO evaluation index was used to compare the performance of the MSE module and the MFGA module with different fusion methods of the benchmark network, showing the good performance of the attention fusion network model proposed in this invention on medium and large targets. Table 1 is a comparison of the experimental results of these five models on the SIXray dataset, where "IoU = 0.5:0.95" means that the mean average precision (mAP) is calculated for 10 intersection over union (IoU) thresholds between 0.5 and 0.95, and then the mAP corresponding to each IoU threshold is averaged. The experimental results show that compared with the benchmark network YOLOv3-SPP, the attention fusion network proposed in this invention improves the overall detection accuracy by 1.4%, and both medium and large targets are improved by 1.7%. In terms of recall rate, medium targets are improved by 2.1%, and large targets are improved by 2.6%, which effectively proves that the method in this paper has good advantages in the detection of medium and large targets. Table 2 shows the performance of each category when "IoU = 0.5". From the classification results, it can be seen that the attention mechanism proposed in this paper has a certain performance improvement in each category, among which the detection performance of "knife" is improved by 0.66%, the detection performance of "gun" is improved by 0.36%, the detection performance of "wrench" is improved by 0.77%, the detection performance of "pliers" is improved by 1.76%, and the detection performance of "scissors" is improved by 2.3%.
[0068] Table 1 Comparison of the results of the proposed method with other methods on the SIXray test set
[0069]
[0070] Table 2 Comparison of classification results of the proposed method and other methods at IoU=0.5 on the SIXray test set
[0071] method knife gun wrench pliers Scissors YOLOv3-SPP 77.72 95.97 75.38 87.47 77.52 SE+CBAM 77.54 96.08 74.06 88.94 77.85 MSE+CBAM 77.90 95.45 75.77 88.95 77.55 SE+MFGA 76.73 96.31 74.47 90.14 79.27 MSE+MFGA 78.38 96.33 76.15 89.23 79.82
[0072] 4) Ablation experiment
[0073] 4.1) Multi-Squeezed Activation (MSE) Module
[0074] The experiment only retains the SE and MSE modules, and after integrating the modules into the backbone network and SPP module, tests are conducted on the SIXray dataset. A total of three groups of experiments are designed. As can be seen from Table 3, the overall detection accuracy of the network is improved by 0.5%, and the small and medium targets are slightly reduced, but the large targets are improved by 1.5%, the recall rate of medium targets is improved by 0.9%, and the recall rate of large targets is improved by 2.2%. It can be seen that the use of average pooling and maximum pooling can improve the detection accuracy of the model to a certain extent.
[0075] Table 3 Comparison of the results of the multi-compression activation module with other methods on the SIXray test set
[0076]
[0077] 4.2) Multi-fusion Global Attention (MFGA) Module
[0078] Only the CBAM and MFGA modules are retained in the benchmark network, and the modules are still integrated into the three detection branches respectively. Three sets of experiments are designed for testing on the SIXray dataset. As shown in Table 4, the detection performance of the network has been improved by 0.8% in terms of detection accuracy, 1.6% in medium targets, and 0.9% in large targets; in terms of recall rate, the small targets have been improved by 1.1%, the medium targets have been improved by 1.9%, and the large targets have been improved by 1.2%.
[0079] Table 4 Comparison of the results of the multi-fusion global attention module with other methods on the SIXray test set
[0080]
[0081] In summary, the present invention is tested on the public SIXray dataset, and the average accuracy of the model is 51.1%, which is 1.4% higher than the classic YOLOv3-SPP algorithm; in addition, the method proposed in this paper effectively improves the detection accuracy and recall rate of medium and large targets. The experimental results show that the channel attention and spatial attention used in the present invention can effectively enhance the detailed information in the input feature map for detecting dangerous objects, and improve the detection performance of the model for medium and large targets.
[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A method for detecting dangerous goods in X-ray security inspection images based on an attention mechanism, characterized in that: The MSE module and MFGA module are integrated on the YOLOv3-SPP architecture to build an AFN network; Among them, MSE is multi-compression activation, MFGA is multi-fusion global attention, and AFN is attention fusion network; The specific structure of the MSE module is as follows: First, the given input is mapped to the feature map On, among which H , W , C Corresponding to the height, width and channel dimensions of the feature map respectively, the MSE module uses global average pooling and maximum pooling in the compression operation to splice the generated feature descriptors on the channel; the second is the activation operation, the fully connected layer reduces the channel dimension through the expansion rate parameter, and then restores the channel dimension; the last is the feature recalibration, the obtained after the activation operation The vector of is multiplied by the weight of the input feature on the channel; The specific structure of the MFGA module is as follows: based on the HDC framework, three 3×3 convolution kernels with different dilation rates are used to expand the receptive field; the CAM module and the SAM module are placed in sequence; HDC is a mixed dilated convolution, CAM is a channel attention, and SAM is a spatial attention; The specific structure of the SAM module is as follows: First, a set of convolution kernels with dilation rates r=[1,2,5] and sizes are K The input feature map is operated by a dilated convolution of ; secondly, the feature descriptors generated by global average pooling and maximum pooling are concatenated on the channel to aggregate the channel information on the feature map; then, the convolution kernel size is K =3, and the dilated convolution with dilation rate r=2 reduces the channel dimension; finally, the final spatial attention map is generated through the Sigmoid function; The specific structure of the CAM module is as follows: first, the global spatial information of the feature map is aggregated through pooling operations, wherein the global average pooling is used to aggregate information, and the maximum pooling is used to refine the generated channel attention; second, the aggregated information is input into a shared network to generate a channel attention map, wherein the shared network is composed of a multi-layer perceptron; standard convolution is used to reduce the dimension of the spliced features on the channel; Using the attention fusion network to detect dangerous goods in X-ray security inspection images specifically includes the following steps: S1: Input the X-ray security inspection image of the luggage to be inspected, obtain the feature map through the YOLOv3-SPP backbone network, and then input it into the MSE module to obtain the semantic features with channel globality; S2: Use the SPP module to fuse multi-scale features and then pass them through the MSE module to refine the fused local features and global features and enhance the acquired multi-scale semantic information; SPP is spatial pyramid pooling; S3: The channel branch and the spatial branch are connected in series to form the MFGA module, and the module is placed before the classifier of each detection branch; each detection branch predicts small, medium and large targets in the X-ray security inspection image respectively.
2. The method for detecting dangerous goods using X-ray security inspection images according to claim 1, characterized in that: The weights of the MSE module The calculation formula is: make ,get ,in, , Represent global average pooling and maximum pooling respectively, represents the activation function, represents the (C / r)×C parameter matrix, Represents the C×(C / r) parameter matrix, r represents the expansion rate; where the activation operation first uses standard convolution to reduce the dimension of the concatenated features on the channel.
3. The method for detecting dangerous goods using X-ray security inspection images according to claim 1, characterized in that: When modifying SAM according to the HDC framework, two principles must be followed: (1) , is the kernel size of the convolution kernel, Refers to the maximum distance between two non-zero values; (2) Within a group, the expansion rates cannot have a common factor.
4. The method for detecting dangerous goods using X-ray security inspection images according to claim 3, characterized in that: The calculation process of the CAM module is: in, represents the one-dimensional channel attention generated by the CAM module, represents a one-dimensional convolution operation with a convolution kernel size of 1. represents a multi-perceptron with one hidden layer, and σ represents the Sigmoid function.