Visible and infrared image matching target detection method based on improved YOLOv7
By improving the YOLOv7 method, introducing the CBAM module and using the LeakyReLU activation function, the inaccuracy of target detection in visible light and infrared images under different angles and focal lengths was solved, thus improving detection accuracy and robustness.
Patent Information
- Application Number
- CN202311258367.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2043-09-27
AI Technical Summary
Existing technologies suffer from inaccurate target detection and high false negative rates when processing visible light and infrared images. In particular, when the image angle and focal length are inconsistent, the infrared image target is blurry and the edges are unclear, resulting in low matching accuracy of existing methods.
An improved YOLOv7 approach was adopted, which enhances feature representation and network robustness by introducing the CBAM module in the Neck part and replacing the activation function in the RepConv module with LeakyReLU.
It improved the mAP of ship target detection to 94.18%, reduced the false negative rate, outperformed other classic algorithms, and enhanced the detection performance under different angle and focal length conditions.
Smart Images

Figure CN117292258B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a visible and infrared image matching target detection method based on improved YOLOv7 and belongs to the technical field of image processing. BACKGROUND
[0002] By combining the information of visible light and infrared images, the sea target detection capability can be enhanced, the target recognition and tracking efficiency can be improved, and the execution of sea safety, cruising, search and rescue and military tasks can be strengthened. However, some low-cost infrared acquisition devices cannot be focused, so that a single target cannot be shot. Therefore, it is crucial to find the corresponding ship in the visible light and infrared images.
[0003] When collecting data of sea targets, visible light images and infrared images are two commonly used modalities. Visible light image acquisition devices usually have the function of adjustable focal length, which can adjust the focal point for specific targets to obtain single high-resolution target images. However, some low-cost infrared image acquisition devices usually cannot change the focal length, resulting in that the collected images contain some unnecessary ship information other than the target ship. Therefore, it is an indispensable task to simultaneously detect the corresponding targets in visible light images and infrared images. By jointly analyzing and comparing visible light images and infrared images, the accuracy and robustness of target detection can be effectively improved. For this task, many scholars and researchers have carried out extensive work. Some researches are dedicated to developing fusion algorithms to fuse visible light images and infrared images to obtain more comprehensive and rich target information. For example, the literature (Ding Q W, Qi H J, Zhao J B, et al. Infrared and visible light image fusion algorithm based on target enhancement[J]. Laser & Infrared, 2023, 53(03):457-463.) decomposes the visible light image and the infrared image into high-frequency information and low-frequency information, then fuses the low-frequency information of the two to reflect the pixel intensity distribution in the image, and fuses the high-frequency information of the two to reflect the details, textures and edges in the image, and finally performs image fusion. This kind of method can combine the high spatial resolution of visible light images and the target thermal features of infrared images to improve the performance of target detection, but it does not fully consider the comprehensive features of edge information. And the images need to exist in pairs, the shooting angle, time, place, etc. must be consistent. Some researches such as the literature (Savarese, P., et al., Information-Theoretic Segmentation by Inpainting Error Maximization. arXiv e-prints, 2020: p. arXiv:2012.07287.) use image segmentation techniques to separate the target from the background in the image, and extract the edge features of the target through the segmentation results. At the same time, these methods can also use the context information around the target, such as shape, texture, etc., to more accurately determine the existence and position of the target. Some other researches focus on developing cross-modal matching methods, such as the literature (Chen H. Visible light and infrared image matching method research[D]. Wuhan University, 2019. DOI:10.27379 / d.cnki.gwhdu.2019.001470.) uses deep learning or feature extraction and matching techniques to correspond the features of visible light images and infrared images, to achieve accurate matching and detection of targets. However, for the case where the target in the visible light image is large, the target in the infrared image is small and the edge information is unclear and similar ships are more, the matching accuracy is low.
[0004] The research results provide an important theoretical basis and practical method for simultaneously detecting corresponding targets in visible light images and infrared images in marine target data collection. Through continuous research and improvement of these methods, the accuracy and efficiency of marine target detection can be further improved, providing strong support for marine safety, military defense and related fields.
[0005] However, for data collected in visible light images and infrared images, the targets are not at the same angle and focal length, the images are of different sizes, and the targets in the infrared images are relatively blurred and the edges are not clear. The above existing target detection technology has the problems of missed detection and low small target recognition rate. SUMMARY
[0006] The present application aims to solve the problems of the prior art and provide a visible light infrared image matching target detection method based on improved YOLOv7. The improved YOLOv7 has an mAP of 94.18%, which is 1.91% higher than the original model, greatly improving the detection performance of ship targets and reducing the missed detection rate.
[0007] The visible light infrared image matching target detection method based on improved YOLOv7 of the present application has the following steps:
[0008] 1) Obtain marine target visible light and infrared image data sets, and use a semi-automatic labeling method for data labeling. Specifically, first label part of the images using LabelImg tools, then train using YOLOv7 to obtain a basic weight, and use the model and weight to label all images.
[0009] 2) Introduce a CBAM module after the Concat operation in the Neck part and before ELAN.
[0010] 3) Change the activation function in the RepConv module of the YOLOv7 target detection model to LeakyReLU function.
[0011] The data labeling steps in step 1) are as follows:
[0012] Use visible light and infrared equipment to obtain marine ship target video, and perform frame processing on the video data using a semi-automatic labeling method. Specifically, first label part of the images using LabelImg tools, then train using YOLOv7 model to obtain a basic weight, and use the model and weight to label all images. Since this weight is obtained by training a small amount of images, and there are some small targets in the images, the labeling results are not accurate, and manual fine-tuning is required.
[0013] The CBAM module introduced in step 2) is an attention module for convolutional neural networks, which enhances the network's attention to important features, extracts important features, and improves the performance of the model; it is composed of a channel attention module and a spatial attention module to dynamically adjust the weights of the feature map, enabling the network to adaptively focus on the most important features, improving model detection accuracy and detection effect; channel attention is used to capture the dependency between different channels to help the network select channels with important information, global average pooling and global maximum pooling are used to obtain feature descriptions in the channel dimension, then these features are processed through a fully connected network to obtain the weight of each channel, the weights of each channel are summed element by element to obtain a scalar value representing the importance of the entire feature layer, and then a Sigmoid activation function is used to convert the scalar value into a probability value between 0 and 1 to obtain the channel attention map M c The channel attention map is multiplied with the input feature layer at the element level to perform channel-by-channel weighting to weight each channel feature to obtain a specific feature map Fc, and the calculation formula is:
[0014] M c =σ(MLP(F c,avg )+MLP(F c,max ))
[0015]
[0016] where σ is the Sigmoid function activation; MLP is a multi-layer perceptron containing a fully connected layer; F c,avg and F c,max are global average pooling and global maximum pooling operations performed by the channel attention module on the feature map information; M c is the channel attention weight; F c is the feature map obtained after the input feature map passes through the channel attention.
[0017] Spatial attention is used to capture the dependency between different spatial positions in the feature map to help the network select important spatial regions, which captures the importance of the feature map at different spatial positions by performing global average pooling and global maximum pooling operations on the feature map to obtain maximum feature descriptions and average feature descriptions in the channel dimension, respectively. The maximum feature description and the average feature description are connected through a convolution layer and a Sigmoid function to obtain a spatial attention map M s , which represents the weight of each spatial position, where a larger value indicates a greater contribution of the position to the final feature representation, and the spatial attention map is multiplied with the input feature at the element level to realize the fusion of spatial attention and obtain the final feature map Fs , the calculation formula is:
[0018] M s = sigma (f 7×7 ([F s,avg ; F s,max ]))
[0019]
[0020] In the formula, f 7×7 is a 7*7 convolution operation; F s,avg and F s,max are global average pooling and global maximum pooling operations performed by the spatial attention module on F c ; M s is the spatial attention weight.
[0021] The RepConv module in step 3) is a convolution block used to increase the receptive field of the convolutional neural network to capture more extensive context information, which utilizes the idea of reparameterization to reduce the amount of calculation and parameters while improving speed, and uses SiLU as the activation function, which has an exponential function and complex calculation, as follows:
[0022]
[0023] Replace it with LeakyReLU, as follows:
[0024]
[0025] Where a is a positive number less than 1, and in the usual case, the value of a is set to 0.01.
[0026] The beneficial effects of the present application are:
[0027] Compared with the prior art, the visible light infrared image matching target detection method for improving YOLOv7 according to the technical solution described in the present application is obtained at different angles and different focal lengths, and the image size is not the same, and the target in the infrared image is relatively blurred and the edge is not clear. Data for ship target detection, the beneficial effects are:
[0028] (1) The present application introduces a CBAM module after the Concat operation in the Neck part, which improves the network performance and enhances the feature expression of the target ship.
[0029] (2) The method proposed in the present application replaces the SiLU activation function in the RepConv module with LeakyReLU, which alleviates the gradient vanishing problem, improves the network robustness, and reduces the computational overhead.
[0030] (3) Through ablation experiments and comparative experiments, it is verified that the mAP of the improved YOLOv7 is 94.18%, which is improved by 1.91% compared with the original model, and the missing detection rate is reduced, and it is better than other classic algorithms. BRIEF DESCRIPTION OF DRAWINGS
[0031] Figure 1 The figure is shown for part of the data set;
[0032] Figure 2 The figure is a YOLOv7 network structure diagram;
[0033] Figure 3 The figure is a CBAM structure diagram;
[0034] Figure 4 The figure is a function graph of three activation functions;
[0035] Figure 5 The figure is a Neck structure after adding a CBAM module;
[0036] Figure 6 The figure is the original YOLOv7 detection result diagram;
[0037] Figure 7 The figure is the improved YOLOv7 detection result. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0039] Embodiment 1
[0040] The visible light and infrared image matching target detection method based on the improved YOLOv7 of the present embodiment comprises the following steps:
[0041] 1 Experimental data
[0042] 1.1 Experimental data acquisition
[0043] The data set required by the experiment needs to contain a ship in the visible light image, and contain multiple ships in the infrared image and contain the ship in the visible light image. In view of this requirement, there is a lack of such public data set, and in this paper, the visible light and infrared acquisition equipment of the Naval Aviation University is used for data acquisition, and a total of 9 types of ships are obtained, including cargo ships, speedboats, passenger ships, container ships, cruise ships, rescue boats, etc., containing corresponding visible light ship targets and infrared ship targets, and the data set contains 5990 images. Part of the image is shown in the accompanying Figure 1 figure.
[0044] 1.2 Experimental data labeling and analysis
[0045] Due to the large number of images, a semi-automatic labeling method was used for data labeling. Specifically, first, some images were labeled using the LabelImg tool, then YOLOv7 was used for training to obtain a basic weight, and finally all images were labeled using the model and weight. Since this weight is obtained by training a small number of images, and there are some small targets in the images, the labeling results are not accurate for some targets, and manual fine-tuning is needed.
[0046] YOLOv7 is described in WANG C Y, BOCHKOVSKIY A, LIAO H Y M. YOLOv7: trainable bag-of-freebies sets new state-of-the-art for real time object detectors [EB / OL] [.2022-09-01]. https: / / arxiv.org / abs / 2207.02696.
[0047] 2 YOLOv7 target detection model and improvement
[0048] 2.1 YOLOv7 target detection model
[0049] YOLOv7 is proposed by the YOLOv4 team, which uses the ideas of module parameterization and dynamic label assignment strategy. In the range of 5FPS to 160FPS, the speed and accuracy of this model exceed existing detectors. It mainly consists of Inputs, Backbone and Head. The Head part is consistent in function with the Neck and Head in YOLOv5 network.
[0050] The Inputs part uses Mosaic data enhancement, adaptive anchor box calculation and adaptive image scaling method; the Backbone part is mainly used for feature extraction; the Head part uses PAFPN structure for feature fusion, and completes target prediction through classification and positioning. The structure diagram of YOLOv7 network is shown in Figure 2 .
[0051] Among them, the role of Efficient Layer Aggregation Networks (ELAN) is to control the shortest and longest gradient path, so that the network learns more features and improves robustness and accuracy. The RepConv module uses the idea of reparameterization to reduce the amount of calculation and parameters while improving speed.
[0052] 2.2 YOLOv7 algorithm
[0053] 2.2.1 Inputs section
[0054] The following tricks are used: Mosaic data augmentation, adaptive anchor box calculation, adaptive image scaling.
[0055] 2.2.2 Backbone section
[0056] ELAN and MP structures are used. ELAN structure: by controlling the shortest and longest gradient path, the deeper network can effectively learn and converge, with stronger robustness, with two branches, the first branch is through a 1x1 convolution to change the number of channels; the second branch first passes through a 1x1 convolution module to change the number of channels, and then passes through four 3x3 convolution modules to extract features, and finally the four features are stacked together to get the final feature extraction result. MP structure: there are two branches, which are used for downsampling, the first branch first passes through a MaxPool, that is, maximum pooling, the function of maximum pooling is to downsample, and then a 1x1 convolution is used to change the number of channels, the second branch first passes through a 1x1 convolution to change the number of channels, and then passes through a 3x3 convolution kernel with a stride of 2, which is also used for downsampling, and finally the results of the first branch and the second branch are added together to get the result of super downsampling.
[0057] 2.2.3 Neck, Head section
[0058] The Neck, Head section is used for feature fusion and classification and positioning to complete target prediction. SPPCSPC structure is used to help the model better cope with multi-scale target detection tasks and improve target detection performance. It consists of SPP and CSPC two parts. The main function of SPP structure is to perform different scale pooling operations on the input feature map to capture multi-scale context information. This helps the model better understand the different size targets in the image; including 3 pooling layers, 5x5, 9x9, 13x13 respectively, each pooling layer has different window size; these different scale pooling layers will extract features of different sizes to enhance the perception ability of the model; the output of SPP structure will be connected to CSPC structure to fuse multi-scale information; CSPC structure connects part of the features of the backbone network with the output of SPP structure, forming a richer feature representation; CSPC structure also uses channel division method, dividing the feature channels into two parts, one part is used for connection, the other part is used for subsequent processing; this channel division helps to reduce the computational complexity of the model.
[0059] 2.3 YOLOv7 target detection model improvement
[0060] The YOLOv7 target detection model is improved by introducing a CBAM module after the Concat operation in the Neck part, which improves the network performance and enhances the feature expression of the target ship. The SiLU activation function in the RepConv module is replaced by LeakyReLU to alleviate the gradient vanishing problem, improve the network robustness, and reduce the computational overhead.
[0061] 2.3.1 CBAM attention mechanism module
[0062] CBAM (Convolutional Block Attention Module) is an attention module for convolutional neural networks, which is used to enhance the network's attention to important features, extract important features, and improve the performance of the model. It is composed of a Channel Attention Module and a Spatial Attention Module to dynamically adjust the weights of the feature maps, so that the network can adaptively focus on the most important features, improve the detection accuracy and detection effect (Zhang, Chen, Wang, et al. Improved ship target detection algorithm based on YOLOv5[J / OL]. Optoelectronics and Control: 1-9 [2023-07-23]. http: / / kns.cnki.net / kcms / detail / 41.1227.TN.20230314.1418.002.html.), as shown in the structure of the following figure. Figure 3
[0063] Channel attention is used to capture the dependency between different channels to help the network select channels with important information. It uses global average pooling and global maximum pooling to obtain feature descriptions in the channel dimension, then processes these features through a fully connected network to obtain the weight of each channel, and performs element-wise summation of the weight of each channel to obtain a scalar value representing the importance of the entire feature layer. Then use the Sigmoid activation function to convert the scalar value to a probability value between 0 and 1 to obtain the channel attention map M c , which is element-wise multiplied with the input feature layer to perform channel-wise weighting operation to weight each channel feature, and obtain the specific feature map F c , the calculation formula is:
[0064] M c =σ(MLP(F c,avg )+MLP(F c,max ))
[0065]
[0066] where σ is the Sigmoid function activation; MLP is a multi-layer perceptron containing fully connected layers; F c,avg and F c,max are the global average pooling and global max pooling operations performed by the channel attention module on the feature map information; M c is the channel attention weight; F c is the feature map obtained after the input feature map passes through the channel attention (Zhang Z, Zhang R, Liu Y. A visual odometry calculation method based on deep learning[J]. Laser & Optoelectronics Progress, 2021, 58(04): 324-331.).
[0067] Spatial attention is used to capture the dependency between different spatial positions in the feature map, to help the network select important spatial regions. It captures the importance of the feature map at different spatial positions by performing global average pooling and global max pooling operations on the feature map, respectively obtaining the maximum feature description and average feature description in the channel dimension, and connecting the maximum feature description and average feature description to obtain a spatial attention map M s between 0 and 1 through a convolution layer and a Sigmoid function, which represents the weight of each spatial position, where the greater the value, the greater the contribution of the position to the final feature representation. The spatial attention map is multiplied with the input feature at the element level to realize the fusion of spatial attention, and the final feature map F s is obtained, and the calculation formula is:
[0068] M s =σ(f 7×7 ([F s,avg ; F s,max ]))
[0069]
[0070] where f 7×7 is a 7x7 convolution operation; F s,avg and F s,max are the global average pooling and global max pooling operations performed by the spatial attention module on F c ; M s is the spatial attention weight.
[0071] By introducing the CBAM module, the network can enhance the perception ability of the feature map after Concat, and improve the quality and discrimination performance of the feature representation. The Neck structure after adding the CBAM module is shown in Fig. Figure 5 .
[0072] 2.3.2 LeakyReLU activation function
[0073] LeakyReLU activation function (MAAS, ANDREW L. Rectifier Nonlinearities Improve Neural Network Acoustic Models [C] / / Proc. ICML. 2013) is a variant of ReLU activation function. ReLU is a commonly used nonlinear activation function, which outputs zero when the input is negative and equals the input value when the input is positive. However, ReLU has a problem that when the input is negative, the gradient is zero, causing the neuron to be unable to update the weight, resulting in "neuron necrosis". In order to solve this problem, LeakyReLU introduces a small slope, so that when the input is negative, the function still has a small gradient, and when the input is positive, the output is the same as the ReLU function. The advantage is to reduce the asymmetry of the output, which is beneficial to improve the performance and stability of the model. The mathematical expression is as follows:
[0074]
[0075] Where a is a positive number less than 1, and in general case, the value of a is set to 0.01.
[0076] Compared with ReLU and LeakyReLU, SiLU (Elfwing S, Uchibe E, Doya K. Sigmoid-weighted linear units for neural network function approximation in reinforcement learning [J]. Neural networks, 2018, 107: 3-11) used in RepConv requires calculation of Sigmoid, so it requires higher computational overhead, which is replaced by LeakyReLU in this paper. The function image of ReLU, LeakyReLU and SiLU is shown in Fig. 1. Figure 4
[0077] 3 Experimental results and analysis
[0078] 3.1 Experimental environment and parameter setting
[0079] The environment configuration and parameter setting used in this experiment are shown in Table 1.
[0080] Table 1 Experimental related hardware configuration and model parameters
[0081]
[0082]
[0083] 3.2 Evaluation Criteria
[0084] The mean average precision (mAP) was used as the evaluation criterion for network performance in this experiment, with an IoU threshold of 0.50.
[0085] The precision (P) is calculated as follows:
[0086]
[0087] In formula (1), T TP is the number of positive samples predicted as positive samples; T TP +F FP represents the total number of positive samples predicted.
[0088] The average precision (AP) is calculated as follows:
[0089]
[0090] The mean average precision (mAP) is obtained by summing the AP of all classes and dividing by the total number of classes, and is calculated as follows:
[0091]
[0092] Before model training, data augmentation methods were used to improve data diversity and enhance model generalization. First, the Mosaic method was used to combine multiple random images into a large mosaic image, thereby increasing the diversity of training data. Second, after Mosaic data augmentation, there was a 50% probability of further image MixUp data augmentation. The MixUp method generates new training samples by linearly combining two random images and corresponding labels, effectively improving model robustness and reducing the risk of overfitting. This comprehensive application of different data augmentation techniques helps to improve model performance.
[0093] To verify the effectiveness of the improvements made to YOLOv7, ablation experiments were conducted by adding each improvement module one by one. The results are shown in Table 2, with the original YOLOv7 mAP of 92.27%, replacing the activation function SiLU in RepConv with LeakyReLU, the mAP improved by 1.06%, and on this basis, adding the CBAM attention mechanism module after Concat in the Neck part, i.e. Figure 2position, so that more attention is paid to important features during feature fusion, and the mAP is improved by 0.85%. Experiments show that the improved algorithm has a certain improvement in accuracy compared with the original algorithm. Under the condition of confidence of 0.5 and non-maximum suppression of 0.3, the detection results are shown in Error! Reference source not found., 7, and the original model cannot detect the target ship, but the improved model can detect it with higher accuracy, which is more suitable for visible light and infrared image target matching.
[0094] Table 2 Ablation experiment results
[0095]
[0096] 3.4 Comparative test
[0097] To further verify the effectiveness of the algorithm in this paper, comparative tests are conducted with current mainstream target detection algorithms, including Faster RCNN, SSD, YOLOv7 and CBAM-YOLOv7 model in the literature (Zhang Y, Shen P, Guo A, et al. Intelligent detection method of road defects based on CBAM-YOLOv7 model [J / OL]. Journal of Chongqing University of Technology (Natural Science): 1-7 [2023-08-10].), and the position of the CBAM module added in CBAM-YOLOv7 is in Figure 2 the ① position in the feature map. After training, these models detect the ship targets in the test set. The comparative test uses the mAP value as the evaluation index of the model, and the results are shown in Error! Not a valid bookmark self-reference.. When the threshold value of IoU is 0.50, the mAP of Faster RCNN is 14.13% lower than that of the algorithm in this paper, the mAP of SSD is 9.55% lower than that of the algorithm in this paper, the mAP of YOLOv7 is 1.91% lower than that of the algorithm in this paper, and the mAP of CBAM-YOLOv7 is 11.66% lower than that of the algorithm in this paper; when the threshold value of IoU is 0.75, the mAP of Faster RCNN is 25.8% lower than that of the algorithm in this paper, the mAP of SSD is 10.5% lower than that of the algorithm in this paper, the mAP of YOLOv7 is 1.8% lower than that of the algorithm in this paper, and the mAP of CBAM-YOLOv7 is 34.2% lower than that of the algorithm in this paper; when the threshold value of IoU is 0.50:0.95, the mAP of Faster RCNN is 20.6% lower than that of the algorithm in this paper, the mAP of SSD is 14.6% lower than that of the algorithm in this paper, the mAP of YOLOv7 is 1.7% lower than that of the algorithm in this paper, and the mAP of CBAM-YOLOv7 is 26.9% lower than that of the algorithm in this paper, which verifies the superiority of the detection performance of the algorithm in this paper.
[0098] Table 3 comparison of experimental results of different network models
[0099]
[0100] The application constructs a required data set, that is, only one ship target on the visible light image, multiple ship targets on the infrared image and containing the ship target in the visible light image. And a target detection algorithm based on the improved YOLOv7 is proposed to match the corresponding ship targets in the visible light image and the infrared image. The main improvements include replacing the activation function of the RepConv module with the LeakyReLU activation function; improving the Neck part, and increasing the attention to important features when the model features are fused. Through the ablation experiment, it is verified that the improved model has been improved in accuracy, and through the comparative experiment, the detection effect of the improved YOLOv7 algorithm is better than that of other classical algorithms.
Claims
1. A visible-infrared image matching target detection method based on improved YOLOv7, characterized in that The method comprises the following steps: 1) Obtain a visible light and infrared image data set of a sea target, and perform data labeling by using a semi-automatic labeling method. Specifically, first, label part of the images by using a LabelImg tool, then train a YOLOv7 model to obtain a basic weight, and finally realize labeling of all the images by using the model and the weight; 2) Introduce a CBAM module after a Concat operation of a Neck part of the YOLOv7 and before an ELAN; 3) Change an activation function in a RepConv module in a target detection model of the YOLOv7 to a LeakyReLU function, construct a data set, and detect a ship target corresponding to a visible light image on an infrared image based on the improved YOLOv7 model.
2. The improved YOLOv7-based visible-infrared image matching target detection method according to claim 1, characterized in that The data labeling in the step 1) specifically comprises the following steps: Obtain a sea ship target video by using a visible light and infrared device, perform frame processing on the video data by using a computer, and perform data labeling by using a semi-automatic labeling method. Specifically, first, label part of the images by using a LabelImg tool, then train a YOLOv7 model to obtain a basic weight, and finally realize labeling of all the images by using the model and the weight. Since the weight is obtained by training a small amount of images and the images contain some small targets, the labeling result is not accurate, and manual fine-tuning is required.
3. The improved YOLOv7-based visible-infrared image matching target detection method according to claim 1, characterized in that The introduced CBAM module is an attention module for a convolutional neural network, which is used to enhance the attention ability of the network to important features, extract important features, and improve the performance of the model; composed of a channel attention module and a spatial attention module, to dynamically adjust the weight of the feature map, so that the network can adaptively focus on the most important features, improve the model detection precision and detection effect, the channel attention is used to capture the dependency between different channels, to help the network select the channel with important information, by using global average pooling and global maximum pooling to obtain the feature description in the channel dimension, then the features are processed through a fully connected network to obtain the weight of each channel, the weights of each channel are element-wise summed to obtain a scalar value representing the importance of the entire feature layer, and then the scalar value is converted into a probability value between 0 and 1 using a Sigmoid activation function to obtain a channel attention map M c The channel attention map is multiplied with the input feature layer at the element level to perform a channel-by-channel weighting operation to weight each channel feature to obtain a specific feature map F c The calculation formula is: ; where σ is a sigmoid function activation; MLP is a multi-layer perceptron including fully connected layers; F c,avg and F c,max is a global average pooling and global max pooling operation performed by the channel attention module on the feature map information; M c is a channel attention weight; F c is a feature map obtained after the input feature map passes through the channel attention. The spatial attention is used to capture the dependency between different spatial positions in the feature map, to help the network select important spatial regions, which captures the importance of the feature map at different spatial positions by performing global average pooling and global maximum pooling operations on the feature map, to obtain the maximum feature description and the average feature description in the channel dimension respectively, and connects the maximum feature description and the average feature description, and obtains a spatial attention map between 0 and 1 through a convolution layer and a Sigmoid function M s , which represents the weight of each spatial position, wherein the greater the value, the greater the contribution of the position to the final feature representation, and the spatial attention map is multiplied with the input feature at the element level to realize the fusion of the spatial attention, and obtain the final feature map F s , the calculation formula is: ; where f 7×7 is a 7x7 convolution operation; F s,avg and F s,max spatial attention module F c global average pooling and global max pooling operations performed by the spatial attention module; M s spatial attention weights.
4. The improved YOLOv7-based visible-infrared image matching target detection method according to claim 1, characterized in that The RepConv module in the step 3) is a convolution block used to increase a receptive field of a convolutional neural network to capture more extensive context information. The RepConv module uses a reparameterization idea to reduce a calculation amount and a parameter amount while improving a speed, and uses a SiLU as an activation function. The SiLU uses an exponential function, and the calculation is complex. The formula is as follows: ; The RepConv module is replaced by a LeakyReLU, and the formula is as follows: ; wherein a is a positive number less than 1, and the value of a is set to 0.01.