Millimeter-wave contraband detection method based on multi-head attention and BIFPN to improve YOLOv7
By introducing multi-head self-attention mechanism and BiFPN feature fusion technology in YOLO v7 network, the problem of small object characteristics being ignored and multi-scale transformation detection is solved, and the accuracy and stability of millimeter wave image contraband detection is improved, and the implementation of the realization of the detection of contraband in millimeter wave image is achieved. Efficient identification of multi-scale targets.
Patent Information
- Application Number
- CN202410490952.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-23
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2044-04-23
AI Technical Summary
The prior art has problems in the detection of millimeter wave image contraband, which is difficult to detect small object features and multi-scale transform objects, resulting in insufficient detection accuracy and stability.
The introduction of a multi-head self-attention mechanism between the Backbone and the efficient object detection module of the traditional YOLO v7 network, and the weighted bidirectional feature pyramid network (BiFPN) is used to replace the original FPN feature fusion technology to enhance the network's attention and feature extraction for small targets ability.
It improves the detection accuracy of multi-scale contraband in millimeter wave images, reduces missed detection, improves the accuracy and stability of detection, and can identify targets of multiple sizes and proportions in real time in complex environments.
Smart Images

Figure CN118261900B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and relates to a millimeter wave image contraband detection method based on an improved YOLO v7 algorithm with a multi-head attention mechanism and a weighted bidirectional feature pyramid. Background Art
[0002] In the field of security, with the rapid growth of security inspection and security monitoring technology, the millimeter wave security inspection devices deployed in public safety places generate a large amount of millimeter wave security inspection image data that needs to be processed efficiently. Traditional detection methods such as manual detection and machine learning cannot meet the actual application needs because they rely on artificially designed features, have poor robustness and are limited to small sample data sets. Therefore, it is necessary to use the characteristics and advantages of millimeter wave images, combine neural networks, deep learning and optimization algorithms to detect and identify contraband in millimeter wave images, and improve the detection performance of contraband in millimeter wave images. At present, contraband detection methods based on deep learning and neural networks are not uncommon. For example, Du et al. built a feature extraction network based on the weighted bidirectional fusion feature pyramid network WDFPN, and combined the RPN network, ROI pooling layer and classification regression network to construct a contraband detection network. However, as the convolution of the neural network deepens, the features of large objects are easily retained, while the features of small objects are easily ignored, making it difficult to detect small targets and multi-scale transformation targets, and easy to miss. Therefore, it is necessary to improve and optimize the original neural network and algorithm, and further explore and develop contraband detection and recognition methods suitable for millimeter wave images to improve the accuracy and stability of detection.
[0003] Based on the above problems and current status, the method improves the traditional YOLO v7 network. By introducing a multi-head self-attention mechanism between the Conv module and the efficient target detection module (ELAN) in the traditional network Backbone and replacing the FPN feature fusion technology used in the Cat module of the Head part of the original YOLO v7 algorithm with a weighted bidirectional feature pyramid network (BiFPN), the method can effectively solve the problem of multi-scale contraband missed detection in cluttered backgrounds in X-ray security inspection images and improve the accuracy of contraband detection. Summary of the invention
[0004] The present invention aims to solve the above problems of the prior art. A millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 is proposed. The technical solution of the present invention is as follows:
[0005] A millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7, which includes the following steps:
[0006] S1: Use millimeter-wave radar to actively capture the target echo, then use the range migration algorithm (RMA) to reconstruct the millimeter-wave 3D image of the target, and obtain a 2D millimeter-wave image by projecting upward at the distance;
[0007] S2: Input the millimeter wave image into the trained improved YOLO v7 network for image preprocessing and feature extraction; the improved YOLO v7 network introduces multi-head attention and BIFPN weighted bidirectional feature pyramid network;
[0008] S3: Detect and identify contraband objects based on the feature extraction information obtained from the network output layer;
[0009] S4: According to the obtained contraband detection and identification information, annotated contraband detection results are automatically generated, including target category, coordinates and confidence.
[0010] Furthermore, the step S1: using the millimeter wave radar to actively capture the target echo, then using the range migration algorithm (RMA) to reconstruct the millimeter wave three-dimensional image of the target, and obtaining a two-dimensional millimeter wave image by projecting upward at a distance, specifically includes:
[0011] S11: Use (on-chip) millimeter wave radar to actively obtain the target's spatial position, speed, reflection intensity and other echo information by transmitting and receiving low-power frequency modulated continuous FMCW millimeter waves;
[0012] S12: Use RMA imaging algorithm to obtain millimeter wave radar three-dimensional imaging;
[0013] S13: Convert the preprocessed data into an image format to obtain a millimeter wave image. First, the amplitude and phase of the three-dimensional imaging data are calculated, and then the amplitude data is mapped to a grayscale value range (0-255) to obtain the final two-dimensional millimeter wave image.
[0014] Furthermore, the step S12: using the RMA imaging algorithm to obtain millimeter wave radar three-dimensional imaging specifically includes:
[0015] S121: Acquire three-dimensional echo data s(x, y, k);
[0016] S122: Perform a two-dimensional Fourier transform on the three-dimensional echo data along the scanning direction (x, y), thereby obtaining x, k y ,k) echo data evenly arranged in the domain;
[0017] S123: For the three-dimensional wave number domain (k x, k y ,k) echo data are interpolated and dimensionally converted to obtain the three-dimensional wave number domain (k x, k y,k z )Evenly distributed data;
[0018] S124: For the three-dimensional wave number domain (k x, k y ,k z ) is used to perform an inverse three-dimensional Fourier transform on the echo data to obtain a reconstructed image of the target in the three-dimensional spatial domain (x, y, z).
[0019] Furthermore, the S2: inputting the millimeter wave image into the trained improved YOLO v7 network for image preprocessing and feature extraction specifically includes:
[0020] S21: preprocessing the acquired millimeter wave image, including image normalization, size adjustment and image enhancement;
[0021] S22: Input the preprocessed image into the improved YOLO v7 backbone network, and extract image features by performing convolution and pooling in the network to distinguish different categories;
[0022] The improved YOLO v7 network introduces multi-head self-attention between the standard convolution layer (Conv layer) and the efficient target detection network (ELAN) in the traditional network Backbone. The standard convolution layer (Conv layer) extracts features from the image, and the efficient target detection network (ELAN) regresses the extracted feature points to control the shortest and longest gradient paths and increase the network robustness. The multi-head self-attention can enhance the network's attention to small targets, so that the network can extract richer feature information to reduce the occurrence of missed detections.
[0023] S23: Fuse the feature maps of different scales extracted by the backbone network with the feature fusion layer of the improved YOLO v7 network to obtain richer feature information;
[0024] The improved YOLO v7 network also uses a weighted bidirectional feature pyramid network (BiFPN) to replace the FPN feature fusion technology used in the Cat module of the Head part of the original YOLO v7. The weighted bidirectional feature pyramid network (BiFPN) allows the network to pay more attention to important layers and reduces node connections of some unnecessary layers;
[0025] Furthermore, in step S22, the improved YOLO v7 network introduces multi-head self-attention between the standard convolutional layer (Conv layer) in the traditional network Backbone and the efficient object detection network (ELAN), specifically including the following steps:
[0026] S221: Multiply the input vector of each channel by the three matrices in the training process to create a query vector, a key vector, and a value vector;
[0027] S222: dot product of the query vector and the key vector corresponding to each channel vector to obtain parameter score;
[0028] S223: Divide the score by the default value 8, and then use the Softmax function to normalize the score;
[0029] S224: Multiply each value vector by the Softmax score to keep the values of the image blocks that need attention intact and drown out irrelevant image blocks;
[0030] S225: Sum the weighted vector and calculate the output of the attention layer.
[0031] Furthermore, in step S23, the improved YOLO v7 network uses BiFPN to replace the FPN feature fusion technology used in the Cat module of the Head part of the original YOLO v7 algorithm, which specifically includes the following steps:
[0032] S231: Construct a multi-level feature pyramid including the bottom layer of high-resolution features and the top layer of low-resolution features, where each level represents different scale features;
[0033] S232: performing a bidirectional feature fusion operation in each layer; fusing the features of the upper or lower layer with the current layer from bottom to top or from top to bottom to generate a fused feature;
[0034] S233: Weight and normalize the fused features to balance the contributions of different levels and eliminate the differences between features.
[0035] S24: Calculate the network output layer by layer of the fused feature map.
[0036] Furthermore, the step S3 performs contraband target detection and identification based on the feature extraction information obtained by the network output layer, specifically including the following steps:
[0037] S31: Decode the network output according to the predefined anchor box shape, and use the algorithm to generate candidate boxes and confidence scores that may contain contraband targets;
[0038] S32: Screening candidate target frames, and removing target frames whose confidence is lower than a threshold;
[0039] S33: Apply the non-maximum suppression (NMS) algorithm to further optimize the filtered target frame. The specific steps are as follows:
[0040] S331: Select the target frame with the highest confidence and the current target frame;
[0041] S332: Calculate the intersection over union (IoU) between two target boxes;
[0042] S333: Compare with the threshold. If the IoU between the current target box and other high-confidence target boxes is greater than the predetermined threshold, the target box is considered to have a high degree of overlap, and the box is deleted to obtain the final target detection result.
[0043] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a millimeter wave contraband detection method based on multi-head attention and BIFPN to improve YOLO v7 as described in any one of the items is implemented.
[0044] A non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, a millimeter wave contraband detection method based on multi-head attention and BIFPN to improve YOLO v7 as described in any one of the items is implemented.
[0045] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the method for detecting contraband in millimeter waves based on improving YOLO v7 by multi-head attention and BIFPN as described in any one of the items is implemented.
[0046] The advantages and beneficial effects of the present invention are as follows:
[0047] The present invention optimizes the YOLO v7 neural network structure by introducing multi-head self-attention between the Conv module and the ELAN module in the Backbone of the traditional network and using BiFPN to replace the FPN feature fusion technology used in the Cat module of the Head part of the original algorithm, and combines deep learning and optimization algorithms to improve the detection capabilities of multi-scale targets and small targets in millimeter wave images. The present invention promotes the development of related contraband detection fields and the expansion of application prospects, and has a broad application market.
[0048] The advantages of the present invention are:
[0049] 1. Fast speed: Compared with traditional target detection algorithms, the YOLO v7 neural network has a faster recognition speed and can perform target detection in real time on the GPU, thus meeting the real-time requirements.
[0050] 2. Good adaptability: The YOLO neural network can enhance its detection capabilities through self-online learning, can handle images of various sizes, targets of various sizes and proportions, and can detect objects in complex environments.
[0051] 3. High detection accuracy: The step S22 improves the YOLO v7 network by introducing multi-head self-attention between the standard convolution layer (Conv layer) in the traditional network Backbone and the efficient target detection network (ELAN). The standard convolution layer (Conv layer) extracts features from the image, and the efficient target detection network (ELAN) regresses the extracted feature points to control the shortest and longest gradient paths and increase the network robustness. The multi-head self-attention can enhance the network's attention to small targets, so that the network can extract richer feature information to reduce the occurrence of missed detections.
[0052] 4. The network layer is simpler: The step S22 improves the YOLO v7 network and replaces the FPN feature fusion technology used in the Cat module of the Head part of the original YOLO v7 with a weighted bidirectional feature pyramid network (BiFPN). The weighted bidirectional feature pyramid network (BiFPN) allows the network to pay more attention to important layers and reduces the node connections of some unnecessary layers. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 It is a flowchart of a method for detecting contraband in millimeter wave images based on an improved YOLO v7 algorithm based on a multi-head attention mechanism and a weighted bidirectional feature pyramid according to a preferred embodiment of the present invention.
[0054] Figure 2 This is a schematic diagram of the implementation process of the multi-head self-attention mechanism introduced in the YOLO v7 algorithm in the embodiment of the present application.
[0055] Figure 3 The figure is a schematic diagram of the BiFPN implementation process introduced in the YOLO v7 algorithm in the embodiment of the present application.
[0056] Figure 4 This is a diagram showing the vise scanning results in the training model of the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm of the present invention.
[0057] Figure 5 This is a diagram showing the machete scanning results in the training model of the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm of the present invention.
[0058] Figure 6 This is a diagram showing the air gun scanning results in the training model of the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm of the present invention.
[0059] Figure 7 This is a diagram showing the scanning results of a spring gun in the training model of the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm of the present invention.
[0060] Figure 8 This is a diagram showing the scanning results of a hacksaw frame in the training model of the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm of the present invention. DETAILED DESCRIPTION
[0061] The following will describe the technical solutions in the embodiments of the present invention in detail in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention.
[0062] The technical solution of the present invention to solve the above technical problems is:
[0063] A millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm, comprising the following steps:
[0064] S1: Use millimeter-wave radar to actively capture the target echo, then use the range migration algorithm (RMA) to reconstruct the millimeter-wave 3D image of the target, and obtain a 2D millimeter-wave image by projecting upward at the distance;
[0065] S11: Use (on-chip) millimeter wave radar to actively obtain the target's spatial position, speed, reflection intensity and other echo information by transmitting and receiving low-power frequency modulated continuous FMCW millimeter waves;
[0066] S12: Use RMA imaging algorithm to obtain millimeter wave radar three-dimensional imaging;
[0067] S121: Acquire three-dimensional echo data s(x, y, k);
[0068] S122: Perform a two-dimensional Fourier transform on the three-dimensional echo data along the scanning direction (x, y), thereby obtaining x, k y ,k) echo data evenly arranged in the domain;
[0069] S123: For the three-dimensional wave number domain (k x, k y ,k) echo data are interpolated and dimensionally converted to obtain the three-dimensional wave number domain (k x, k y ,k z )Evenly distributed data;
[0070] S124: For the three-dimensional wave number domain (k x, k y ,k z ) is used to perform an inverse three-dimensional Fourier transform on the echo data to obtain a reconstructed image of the target in the three-dimensional spatial domain (x, y, z).
[0071] S13: Convert the preprocessed data into an image format to obtain a millimeter wave image. First, the amplitude and phase of the data are calculated, and then the amplitude data is mapped to a grayscale value range (0-255) to obtain the final two-dimensional millimeter wave image.
[0072] S2: Input the millimeter wave image into the trained improved YOLO v7 network for image preprocessing and feature extraction;
[0073] S21: preprocessing the acquired millimeter wave image, such as normalization, resizing and image enhancement, to make it meet the input requirements of the improved YOLO v7 algorithm;
[0074] S22: Input the preprocessed image into the improved YOLO v7 backbone network, and extract image features by performing convolution and pooling in the network to help distinguish different categories. The improved YOLO v7 network introduces multi-head self-attention between the standard convolution layer (Conv layer) in the traditional network Backbone and the efficient object detection network (ELAN). The steps are as follows:
[0075] S221: Multiply the input vector of each channel by the three matrices in the training process to create a query vector, a key vector, and a value vector;
[0076] S222: dot product of the query vector and the key vector corresponding to each channel vector to obtain parameter score;
[0077] S223: Divide the score by the default value 8, and then use the Softmax function to normalize the score;
[0078] S224: Multiply each value vector by the Softmax score to keep the values of the image blocks that need attention intact and drown out irrelevant image blocks;
[0079] S225: Sum the weighted vector and calculate the output of the attention layer.
[0080] S23: Fuse the feature maps of different scales extracted by the backbone network with the feature fusion layer of the improved YOLO v7 network to obtain richer feature information. The improved YOLO v7 network uses BiFPN to replace the FPN feature fusion technology used in the Cat module of the Head part of the original YOLO v7 algorithm, which specifically includes the following steps:
[0081] S231: Construct a weighted bidirectional feature pyramid network (BiFPN) with multiple levels of high-resolution features at the bottom layer and low-resolution features at the top layer, where each level represents different scale features;
[0082] S232: performing a bidirectional feature fusion operation in each layer; fusing the features of the upper or lower layer with the current layer from bottom to top or from top to bottom to generate a fused feature;
[0083] S233: Weight and normalize the fused features to balance the contributions of different levels and eliminate the differences between features.
[0084] S24: Calculate the network output layer by layer of the fused feature map.
[0085] S3: Detect and identify contraband objects based on the feature extraction information obtained from the network output layer;
[0086] S31: Decode the network output according to the predefined anchor box shape, and use the algorithm to generate candidate boxes and confidence scores that may contain contraband targets;
[0087] S32: Screening candidate target frames, and removing target frames whose confidence is lower than a threshold;
[0088] S33: Apply the non-maximum suppression (NMS) algorithm to further optimize the filtered target frame. The specific steps are as follows:
[0089] S331: Select the target frame with the highest confidence and the current target frame;
[0090] S332: Calculate the intersection over union (IoU) between two target boxes;
[0091] S333: Compare with the threshold. If the IoU between the current target box and other high-confidence target boxes is greater than the predetermined threshold, the target box is considered to have a high degree of overlap, and the box is deleted to obtain the final target detection result.
[0092] S4: According to the obtained contraband detection and identification information, the contraband detection results with annotations are automatically generated, and the final detection results are output, including the target box position, size, category information and confidence. At this point, the contraband in the millimeter wave image has been successfully detected and identified.
[0093] For implementation, please refer to Figure 1 This content is a flowchart of the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm. The specific method is as follows:
[0094] a. Acquisition of millimeter wave images
[0095] 1. Set the millimeter wave radar operating frequency to 60GHz-64GHz, and the effective beam width is greater than 60°.
[0096] 2. Use the (on-chip) millimeter-wave radar to actively capture the target echo and use the range migration (RMA) imaging algorithm to reconstruct the millimeter-wave radar 3D imaging.
[0097] 3. Calculate the amplitude and phase of the three-dimensional imaging data, then map the amplitude data to a grayscale value range (0-255), and obtain a two-dimensional millimeter wave image by projecting upward at a distance.
[0098] b. Input the image into the trained improved YOLO v7 network
[0099] 1. Preprocess the acquired millimeter wave images, such as normalization, resizing, and image enhancement, to make them meet the input requirements of the improved YOLO v7 algorithm.
[0100] 2. Input the preprocessed image into the improved YOLO v7 backbone network, and extract image features by performing convolution and pooling in the network to help distinguish different categories.
[0101] 3. The feature maps of different scales extracted by the backbone network are fused with the feature fusion layer of the improved YOLO v7 network to obtain richer feature information.
[0102] 4. Calculate the network output layer by layer based on the fused feature map.
[0103] c. Detect and identify contraband targets based on feature extraction information obtained from the network output layer
[0104] 1. According to the feature map output by the network and the predefined anchor box shape, the position and confidence of the candidate target box are decoded.
[0105] 2. Set a threshold, such as 0.5, to filter out candidate target boxes with confidence levels higher than the threshold.
[0106] 3. Apply the non-maximum suppression (NMS) algorithm to eliminate candidate target boxes with high overlap.
[0107] d. Generate corresponding detection results based on the target information, including target category, coordinates, and confidence.
[0108] The category label and confidence of each target are extracted from the target frame processed by NMS. According to the feature map output by the network and the position information of the target frame, the coordinates of the target frame are converted into the coordinates of the original image space, and combined with other contraband detection and identification information obtained, the contraband detection results with annotations are automatically generated, and finally the final detection results are output.
[0109] In this example, the training model input types of the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 algorithm are 5 types, namely vise, machete, air gun, spring gun, hacksaw frame. For different inputs and their corresponding output results, please refer to Figures 4 to 8 .
[0110] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0111] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0112] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0113] The above embodiments should be understood to be only used to illustrate the present invention and not to limit the protection scope of the present invention. After reading the contents of the present invention, technicians can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7, characterized in that: The following steps are involved: S1: Use millimeter-wave radar to actively capture the target echo, then use the range migration algorithm (RMA) to reconstruct the millimeter-wave 3D image of the target, and obtain a 2D millimeter-wave image by projecting upward at the distance; S2: Input the millimeter wave image into the trained improved YOLO v7 network for image preprocessing and feature extraction. The improved YOLO v7 network introduces multi-head attention and BIFPN weighted bidirectional feature pyramid network; S3: Detect and identify contraband objects based on the feature extraction information obtained from the network output layer; S4: According to the obtained contraband detection and identification information, automatically generate annotated contraband detection results, including target category, coordinates and confidence level; S2: inputting the millimeter wave image into the trained improved YOLO v7 network for image preprocessing and feature extraction. The improved YOLO v7 network introduces multi-head attention and BIFPN weighted bidirectional feature pyramid network, specifically including: S21: preprocessing the acquired millimeter wave image, including image normalization, size adjustment and image enhancement; S22: Input the preprocessed image into the improved YOLO v7 network, and extract image features by performing convolution and pooling in the network to distinguish different categories; The improved YOLO v7 network introduces multi-head self-attention between the standard convolution layer Conv layer in the traditional network Backbone and the efficient target detection network ELAN. The standard convolution layer Conv layer extracts features from the image, and the efficient target detection network ELAN regresses the extracted feature points to control the shortest and longest gradient paths. S23: Fuse the feature maps of different scales extracted by the backbone network with the feature fusion layer of the improved YOLO v7 network to obtain richer feature information; The improved YOLO v7 network also replaces the FPN feature fusion technology used in the Cat module of the Head part of the original YOLO v7 with a weighted bidirectional feature pyramid network BIFPN. The weighted bidirectional feature pyramid network BIFPN allows the network to pay more attention to important levels. S24: Calculate the network output layer by layer according to the fused feature map; The improved YOLO v7 network in step S22 introduces multi-head self-attention between the standard convolution layer Conv layer in the traditional network Backbone and the efficient target detection network ELAN, specifically including the following steps: S221: Multiply the input vector of each channel by the three matrices in the training process to create a query vector, a key vector, and a value vector; S222: dot product of the query vector and the key vector corresponding to each channel vector to obtain parameter score; S223: Divide the score by the default value 8, and then use the Softmax function to normalize the score; S224: Multiply each value vector by the normalized score to obtain a weighted value vector S225: sum the weighted value vectors in step S224 to calculate the output of the attention layer; The improved YOLO v7 network in step S23 also replaces the FPN feature fusion technology used in the Cat module of the Head part of the original YOLO v7 with a weighted bidirectional feature pyramid network BIFPN, which specifically includes the following steps: S231: Construct a weighted bidirectional feature pyramid network BIFPN with multiple levels of high-resolution features at the bottom layer and low-resolution features at the top layer, where each level represents different scale features; S232: performing a bidirectional feature fusion operation in each layer; fusing the features of the current layer and the upper layer from bottom to top, and fusing the features of the current layer and the lower layer from top to bottom, to generate fused features; S233: Weight and normalize the fused features to balance the contributions of different levels and eliminate the differences between features.
2. The millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 according to claim 1 is characterized in that: The step S1: using the millimeter wave radar to actively capture the target echo, then using the range migration algorithm RMA to reconstruct the millimeter wave three-dimensional image of the target, and obtaining a two-dimensional millimeter wave image by upward projection at a distance, specifically includes: S11: Use on-chip millimeter wave radar to actively obtain the target's spatial position, speed, and reflection intensity echo information by transmitting and receiving low-power frequency-modulated continuous FMCW millimeter waves; S12: Use RMA imaging algorithm to obtain millimeter wave radar three-dimensional imaging; S13: Convert the preprocessed data into an image format to obtain a millimeter wave image. First, the amplitude and phase of the three-dimensional imaging data are calculated, and then the amplitude data is mapped to a grayscale value range of 0 to 255 to obtain a final two-dimensional millimeter wave image.
3. The millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 according to claim 2 is characterized in that, The step S12: using the RMA imaging algorithm to obtain millimeter wave radar three-dimensional imaging specifically includes: S121: Acquisition of three-dimensional echo data s ( x , y, k ); S122: Calculate the three-dimensional echo data along the scanning direction ( x , y) to perform a two-dimensional Fourier transform, thereby obtaining the three-dimensional wave data domain ( k x, k y , k )Evenly arranged echo data; S123: For the three-dimensional wave data domain ( k x, k y , k ) echo data is interpolated and dimensionally converted to obtain the three-dimensional wave data domain ( k x, k y , k )Evenly distributed data; S124: For the three-dimensional wave data domain ( k x, k y , k ) is used to perform inverse 3D Fourier transform on the echo data to obtain the target in the 3D space domain ( x , y, z ) in the reconstructed image.
4. The millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 according to claim 1 is characterized in that: The step S3 performs contraband target detection and identification based on the feature extraction information obtained by the network output layer, specifically comprising the following steps: S31: Decode the network output according to the predefined anchor box shape to generate candidate target boxes and confidence scores that may contain contraband; S32: Screening the candidate target frames, and removing the candidate target frames whose confidence is lower than a threshold; S33: Apply the non-maximum suppression (NMS) algorithm to further optimize the selected candidate target boxes. The specific steps are as follows: S331: Select the candidate target frame with the highest confidence and the current candidate target frame; S332: Calculate the intersection over union (IoU) between two candidate target frames; S333: Compare the intersection over union (IoU) with a predetermined threshold. If the IoU between the current candidate target frame and other high-confidence candidate target frames is greater than the predetermined threshold, the current candidate target frame is considered to have a high degree of overlap, and the current candidate target frame is deleted, thereby obtaining the final target detection result.
5. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 as claimed in any one of claims 1 to 4 is implemented.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLOv7 as described in any one of claims 1 to 4 is implemented.
7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the millimeter wave contraband detection method based on multi-head attention and BIFPN improved YOLO v7 as described in any one of claims 1 to 4 is implemented.