A method for infrared image target detection based on Transformer architecture
The infrared image target detection method based on the Transformer architecture solves the problems of poor detection results and high computational complexity of existing algorithms in small and dense target detection, achieves efficient detection on low computing power devices, and improves detection accuracy. and efficiency.
Patent Information
- Application Number
- CN202410734068.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-07
AI Technical Summary
Existing infrared image target detection algorithms are ineffective when dealing with small targets and dense targets, are not friendly to low-computing power computing devices, and have high computational complexity, resulting in limited real-time performance and applicability.
An infrared image target detection method based on the Transformer architecture is used to extract features layer by layer through the backbone network, combined with the AIFI module for scale interaction, a feature fusion module is designed for feature fusion, and the perceptual query module and decoder are used to generate candidate frames and target detection results. Reduce the amount of calculation and improve detection efficiency and accuracy.
It achieves efficient detection of small targets and dense targets on low computing power devices, reduces the amount of model parameters and calculations, improves detection accuracy and efficiency, and is suitable for multiple scenarios and real-time applications.
Smart Images

Figure CN118314333B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of infrared image target detection, and in particular to an infrared image target detection method based on a Transformer architecture. Background Art
[0002] The characteristics of infrared images, such as distance, noise, poor spatial resolution, and sensitivity to ambient temperature changes, limit the construction of infrared image models. Traditional target detection algorithms rely heavily on manually designed features and region proposal methods, including techniques based on sliding windows and image segmentation. Some studies have explored the possibility of detecting targets in infrared images using methods such as spatial filtering, frequency domain filtering, and sparse representation. However, these traditional infrared image target detection methods are limited to specific application scenarios, have slow recognition speeds, weak generalization capabilities, and are difficult to extract important features in multi-scenario and real-time detection applications.
[0003] The early RCNN (Regional Convolutional Neural Network) series of algorithms have an important position in the field of target detection. They detect targets by generating and classifying candidate boxes, but they have some shortcomings. First, these methods usually require independent candidate box generation and classification networks, which leads to high algorithm complexity and time-consuming training and inference processes. Second, the generation and classification of candidate boxes are performed separately, which may cause some candidate boxes to be detected repeatedly or missed. In addition, these methods are not effective for detecting small targets, because the generation of candidate boxes usually adopts methods such as sliding windows or selective search, which are easy to lose small targets or generate a large number of candidate boxes, increasing the computational overhead. The YOLO (You Only Look Once) series of algorithms (such as YOLOv1 to YOLOv5) use a single neural network to complete target detection end-to-end, which has the advantages of real-time and simplicity, but also has some disadvantages. First, the YOLO algorithm is not as good as other methods in detecting small and dense targets, and it is easy to miss or misdetect. Secondly, because the YOLO network uses a single-scale feature map for target detection, its performance is not ideal when dealing with multi-scale targets. In addition, the YOLO algorithm has relatively low positioning accuracy for targets, which is prone to deviation or misalignment of bounding boxes. The SSD (Single-step Multi-box Target Detection) series of algorithms improves target detection performance by introducing multi-layer convolutional networks and multi-scale feature maps, but there are also some shortcomings. First, the SSD algorithm uses a fixed-scale default box for target detection, which may lead to insufficient adaptability to targets of different scales. Second, the SSD algorithm has poor performance when dealing with small and dense targets, and it is easy to miss or misdetect. In addition, the SSD algorithm does not have high enough positioning accuracy for targets, which may lead to deviation or inaccuracy of bounding boxes.
[0004] The RT-DETR (a real-time target detection architecture based on Transformer) algorithm is an end-to-end target detection method based on the Transformer network. The algorithm achieves end-to-end target detection by introducing the attention mechanism and the Transformer network, and has good performance and accuracy. Although it has many advantages, it also has some shortcomings. Due to the characteristics of the Transformer network in processing global information, RT-DETR may not work well when processing small targets and dense targets. The high complexity of the RT-DETR network structure leads to high computational complexity. During the training and inference process, a large amount of computing resources are required, which limits the real-time and applicability of the algorithm. Its official minimum model uses ResNet18 as the backbone network of the detection model, but it still has about 20M parameters and 58 GFLOPs (billion floating-point operations per second). The model scale is still huge and is still not friendly to some low-computing computing devices. Summary of the invention
[0005] The present invention aims to solve at least one of the technical problems that the RT-DETR model has large number of parameters and calculations, is unfriendly to low-computing computing devices, and has poor processing effect on small targets. To this end, the present invention provides an infrared image target detection method based on the Transformer architecture.
[0006] The present invention provides an infrared image target detection method based on Transformer architecture, comprising the following steps:
[0007] S1: Extract feature information from the infrared image through the backbone network, and use layer-by-layer convolution to obtain the first feature, the second feature, and the third feature in sequence;
[0008] S2: The third feature is scaled interactively performed through the AIFI module to obtain the fourth feature, and the fourth feature, the first feature, and the second feature are respectively passed to the feature fusion module as three input features for fusion to obtain the feature fusion result;
[0009] S3: query the feature fusion result through the perception query module to obtain the interactive information between the candidate box and the target image;
[0010] S4: Decode the interactive information through a decoder to obtain a candidate box;
[0011] S5: Classify and locate the candidate boxes through the detection head to obtain the target detection results.
[0012] According to an infrared image target detection method based on Transformer architecture provided by the present invention, step S1 comprises:
[0013] S11: performing convolution and maximum pooling calculations on the infrared image to obtain the first shallow feature;
[0014] S12: extracting the first shallow feature through the first feature extraction module to obtain a second shallow feature;
[0015] S13: performing convolution on the second shallow feature to achieve feature channel expansion, performing feature extraction on the channel expansion result through the second feature extraction module to obtain the first feature, and saving the first feature to the first storage module;
[0016] S14: performing convolution on the first feature in the first storage module to achieve feature channel expansion, performing feature extraction on the channel expansion result through the third feature extraction module to obtain a second feature, and saving the second feature to the second storage module;
[0017] S15: Convolve the second feature in the second storage module to achieve feature channel expansion, and extract features from the channel expansion result through the fourth feature extraction module to obtain the third feature.
[0018] According to the infrared image target detection method based on Transformer architecture provided by the present invention, in step S13, the feature extraction process of the second feature extraction module is: performing partial convolution, dimension increase convolution, BN layer, activation function and dimension reduction convolution processing on the channel expansion result in sequence to realize feature mapping and obtain the first feature;
[0019] In step S15, the feature extraction process of the fourth feature extraction module is: performing partial convolution, dimensionality increase convolution, BN layer, activation function and dimensionality reduction convolution processing on the channel expansion result in sequence to realize feature mapping and obtain the third feature.
[0020] According to an infrared image target detection method based on a Transformer architecture provided by the present invention, in step S2, the fourth feature, the first feature, and the second feature are respectively transmitted as three input features to a feature fusion module for fusion, and the process of obtaining a feature fusion result includes:
[0021] S21: upsampling the fourth feature to achieve the same size as the second feature, obtaining the fifth feature, performing CBS processing on the fifth feature, concatenating the processing result with the second feature, performing feature extraction on the concatenated result through the first attention module, obtaining the first attention feature, and saving the first attention feature to the first attention storage module;
[0022] S22: upsampling the first attention feature to achieve the same size as the first feature, obtaining a sixth feature, performing CBS processing on the sixth feature, concatenating the processing result with the first feature, performing feature extraction on the concatenated result through the second attention module, obtaining a second attention feature, and saving the second attention feature to the second attention storage module;
[0023] S23: performing CBS processing on the second attention feature, splicing the processing result with the first attention feature in the first attention storage module, performing feature extraction on the splicing result through the third attention module to obtain a third attention feature, and saving the third attention feature to the third attention storage module;
[0024] S24: performing CBS processing on the third attention feature, concatenating the processing result with the fourth feature, and performing feature extraction on the concatenated result through the fourth attention module to obtain the fourth attention feature;
[0025] S25: Concatenate the second attention feature in the second attention storage module, the third attention feature in the third attention storage module, and the fourth attention feature to obtain a feature fusion result.
[0026] According to an infrared image target detection method based on a Transformer architecture provided by the present invention, in step S21, the first attention module feature extraction process includes:
[0027] S211: performing CBS processing on the splicing result to obtain a first splicing layer, and saving the first splicing layer to a first splicing storage module;
[0028] S212: extracting fusion information from the first concatenated layer through a first attention submodule to obtain a first fusion feature;
[0029] S213: summing the first fusion feature and the first splicing layer in the first splicing storage module, and performing CBS processing on the summation result to obtain a first attention feature;
[0030] In step S22, the second attention module feature extraction process includes:
[0031] S221: performing CBS processing on the splicing result to obtain a second splicing layer, and saving the second splicing layer to a second splicing storage module;
[0032] S222: extracting fusion information from the second concatenated layer through a second attention submodule to obtain a second fusion feature;
[0033] S223: summing the second fusion feature and the second splicing layer in the second splicing storage module, and performing CBS processing on the summation result to obtain a second attention feature;
[0034] In step S23, the third attention module feature extraction process includes:
[0035] S231: Perform CBS processing on the splicing result to obtain a third splicing layer, and save the third splicing layer to a third splicing storage module;
[0036] S232: extracting fusion information from the third concatenated layer through a third attention submodule to obtain a third fusion feature;
[0037] S233: summing the third fusion feature and the third splicing layer in the third splicing storage module, and performing CBS processing on the summation result to obtain a third attention feature;
[0038] In step S24, the fourth attention module feature extraction process includes:
[0039] S241: Perform CBS processing on the splicing result to obtain a fourth splicing layer, and save the fourth splicing layer to a fourth splicing storage module;
[0040] S242: extracting fusion information from the fourth concatenated layer through a fourth attention submodule to obtain a fourth fusion feature;
[0041] S243: summing the fourth fusion feature and the fourth splicing layer in the fourth splicing storage module, performing CBS processing on the summation result, and obtaining a fourth attention feature.
[0042] According to an infrared image target detection method based on a Transformer architecture provided by the present invention, in step 212, the first attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the first splicing layer in sequence, summing the processing result and the first splicing layer in the first splicing storage module to obtain a first fusion feature;
[0043] In step 222, the second attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the second splicing layer in sequence, summing the processing result and the second splicing layer in the second splicing storage module to obtain the second fusion feature;
[0044] In step 232, the third attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the third splicing layer in sequence, summing the processing result and the third splicing layer in the third splicing storage module to obtain a third fusion feature;
[0045] In step 242, the extraction process of the fourth attention submodule is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the fourth splicing layer in sequence, summing the processing results and the fourth splicing layer in the fourth splicing storage module to obtain the fourth fusion feature.
[0046] According to an infrared image target detection method based on Transformer architecture provided by the present invention, in step S3, the perception query module adopts a greedy query or a best match query strategy based on the Hungarian algorithm.
[0047] According to an infrared image target detection method based on Transformer architecture provided by the present invention, in step S5, the detection head includes a classifier and a regressor, the classifier is used to determine the target category of the candidate box, and the regressor is used to locate the candidate box.
[0048] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:
[0049] The present invention provides an infrared image target detection method based on a Transformer architecture. The method extracts useful feature information from an infrared image through a designed backbone network to obtain a first feature, a second feature and a third feature that can better summarize the target image. The method performs self-attention processing on only the third feature with the smallest scale and richer semantic information through an AIFI (intra-scale feature interaction) module to obtain a fourth feature, thereby reducing the amount of calculation. The method fuses the input fourth feature with the first feature and the second feature through a designed feature fusion module to construct a more diverse and representative feature fusion result. The method converts the feature fusion result into a target detection result through a perception query module, a decoder and a detection head, thereby improving the efficiency and accuracy of target detection.
[0050] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 It is a flow chart of an infrared image target detection method based on Transformer architecture provided by the present invention. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.
[0054] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance.
[0055] Combine the following Figure 1 The present invention describes an infrared image target detection method based on Transformer architecture.
[0056] The present invention provides an infrared image target detection method based on Transformer architecture, comprising the following steps:
[0057] S1: Extract feature information from the infrared image through the backbone network, and use layer-by-layer convolution to obtain the first feature, the second feature, and the third feature in sequence;
[0058] The backbone network adopts the Faster-resnet18 architecture. Faster-resnet18 is an architecture improvement based on ResNet18 (a residual network with a network depth of 18 layers), in which ResNet18 includes residual modules in four stages (stage 1, stage 2, stage 3, and stage 4). Faster-resnet18 replaces the residual modules in the second and fourth stages of ResNet18 with FasterBlock in Fasternet (fast network). On the one hand, it reduces the detection of redundant features in the infrared image feature extraction process, thereby reducing the number of backbone network parameters and calculations, achieving lightweight and reducing computing power waste; on the other hand, it inherits the residual module of ResNet18 to ensure the accuracy of feature extraction of the backbone network to the greatest extent.
[0059] Wherein step S1 comprises:
[0060] S11: performing convolution and maximum pooling calculations on the infrared image to obtain the first shallow feature;
[0061] Maximum pooling can retain the main features in the infrared image while reducing the size of the infrared image and reducing the amount of calculation; the number of channels of the first shallow feature is 64.
[0062] S12: extracting the first shallow feature through the first feature extraction module to obtain a second shallow feature;
[0063] The first feature extraction module uses the residual module of the first stage of ResNet18, in which the residual module can learn residual information, solve the problems of gradient vanishing and gradient explosion in the backbone network, and better perform feature extraction and processing; the number of channels of the second shallow feature is 64.
[0064] S13: performing convolution on the second shallow feature to achieve feature channel expansion, performing feature extraction on the channel expansion result through the second feature extraction module to obtain the first feature, and saving the first feature to the first storage module;
[0065] The convolution (convolution kernel size is 1×1) method is used to achieve feature channel expansion, that is, to increase the number of feature channels, so that more complex features can be captured and the number of second shallow feature channels is expanded to 128; the second feature extraction module uses 8 FasterBlocks. On the one hand, FasterBlock only extracts local features to reduce the consumption of computing power by redundant features. On the other hand, FasterBlock can effectively utilize the feature information of all channels to ensure feature diversity; the number of channels of the first feature is 128.
[0066] S14: performing convolution on the first feature in the first storage module to achieve feature channel expansion, performing feature extraction on the channel expansion result through the third feature extraction module to obtain a second feature, and saving the second feature to the second storage module;
[0067] The number of channels of the first feature is expanded to 256 by using convolution (the convolution kernel size is 1×1); the third feature extraction module uses the residual module of the third stage of ResNet18, which has the same function as the residual module of the first stage of ResNet18; the number of channels of the second feature is 256.
[0068] S15: performing convolution on the second feature in the second storage module to achieve feature channel expansion, and performing feature extraction on the channel expansion result through the fourth feature extraction module to obtain a third feature;
[0069] The convolution method (convolution kernel size is 1×1) is used to expand the number of channels of the second feature to 512; the fourth feature extraction module uses 2 FasterBlocks; the number of channels of the third feature is 512.
[0070] In step S13, the feature extraction process of the second feature extraction module is: performing partial convolution, dimension-up convolution, BN layer, activation function and dimension-down convolution processing on the channel expansion result in sequence to realize feature mapping and obtain the first feature;
[0071] In step S15, the feature extraction process of the fourth feature extraction module is: performing partial convolution, dimensionality increase convolution, BN layer, activation function and dimensionality reduction convolution processing on the channel expansion result in sequence to realize feature mapping and obtain the third feature.
[0072] Furthermore, the second feature extraction module and the fourth feature extraction module both adopt FasterBlock, in which partial convolution, dimensionality increase convolution, BN layer, activation function and dimensionality reduction convolution are performed in sequence, which reduces the number of parameters and calculations of the backbone network while effectively utilizing the feature information of all channels to ensure feature diversity.
[0073] Furthermore, partial convolution only performs ordinary convolution on one-quarter of the features to extract local features, thereby reducing the consumption of computing power by redundant features and abandoning the deep separable convolution with high memory access frequency. Calculated as:
[0074]
[0075] in, is the height of the feature map, is the width of the feature map, is the size of the convolution kernel, is the number of channels for regular convolution.
[0076] In actual scenarios, there are usually ,in express and The ratio of the two, is the total number of channels of the input tensor. So It is only 1 / 16 of the number of floating-point operations of regular convolution.
[0077] Number of partial convolution memory accesses Calculated as:
[0078]
[0079] Just the number of memory accesses for regular convolutions , the rest The channel does not participate in the calculation, so no memory access is required.
[0080] In order to fully and effectively utilize the information from all channels, point convolution is added after the partial convolution to jointly map all features. The number of floating-point operations for all feature maps is for:
[0081]
[0082] Furthermore, the dimensionality-raising convolution uses point convolution to increase the number of channels to achieve dimensionality raising, and the dimensionality-reducing convolution uses point convolution to reduce the number of channels to achieve dimensionality reduction. The combination of dimensionality-raising convolution and dimensionality-reducing convolution effectively utilizes the information of all channels and performs common mapping of all features. BN (batch normalization) layers and ReLU (rectified linear unit) activation functions are added between dimensionality-raising convolution and dimensionality-reducing convolution in sequence. On the one hand, feature redundancy, the number of network parameters and the amount of calculation are reduced; on the other hand, feature integration is performed to ensure feature diversity. However, the number of BN layers and ReLU activation functions added should not be too large to prevent feature diversity from being limited.
[0083] S2: The third feature is scaled interactively performed through the AIFI module to obtain the fourth feature, and the fourth feature, the first feature, and the second feature are respectively passed to the feature fusion module as three input features for fusion to obtain the feature fusion result;
[0084] The first feature, the second feature, and the third feature output by the backbone network are all input into the encoder, where the encoder includes an AIFI (intra-scale feature interaction) module and a feature fusion module of a PAN-FPN (path aggregation network-feature pyramid network) structure. The encoder is responsible for processing and fusing the features extracted by the backbone network at different levels to enhance the expressiveness of the features.
[0085] Furthermore, the AIFI module only performs scale interaction on the third feature with the smallest scale and richer semantic information, that is, performs self-attention processing, improves the intra-scale feature interaction capability, and performs global information integration to obtain the fourth feature.
[0086] Furthermore, the designed feature fusion module adopts the PAN-FPN structure based on the feature fusion part of RT-DETR (a real-time target detection architecture based on Transformer), including four attention modules (the first attention module, the second attention module, the third attention module and the fourth attention module). The structure and function of the four attention modules are the same. On the one hand, the number of parameters is significantly reduced and the amount of calculation is reduced. On the other hand, the efficiency of effective feature extraction and fusion is improved. The fourth feature and the first feature and the second feature are respectively used as three input features for feature fusion through the feature fusion module to obtain the second attention feature, the third attention feature and the fourth attention feature. The PAN-FPN structure fully realizes the fusion of global feature information and improves the efficiency of feature fusion.
[0087] In step S2, the fourth feature, the first feature, and the second feature are respectively transmitted as three input features to the feature fusion module for fusion, and the process of obtaining the feature fusion result includes:
[0088] S21: upsampling the fourth feature to achieve the same size as the second feature, obtaining the fifth feature, performing CBS processing on the fifth feature, concatenating the processing result with the second feature, performing feature extraction on the concatenated result through the first attention module, obtaining the first attention feature, and saving the first attention feature to the first attention storage module;
[0089] S22: upsampling the first attention feature to achieve the same size as the first feature, obtaining a sixth feature, performing CBS processing on the sixth feature, concatenating the processing result with the first feature, performing feature extraction on the concatenated result through the second attention module, obtaining a second attention feature, and saving the second attention feature to the second attention storage module;
[0090] S23: performing CBS processing on the second attention feature, splicing the processing result with the first attention feature in the first attention storage module, performing feature extraction on the splicing result through the third attention module to obtain a third attention feature, and saving the third attention feature to the third attention storage module;
[0091] S24: performing CBS processing on the third attention feature, concatenating the processing result with the fourth feature, and performing feature extraction on the concatenated result through the fourth attention module to obtain the fourth attention feature;
[0092] S25: Concatenate the second attention feature in the second attention storage module, the third attention feature in the third attention storage module, and the fourth attention feature to obtain a feature fusion result.
[0093] After upsampling the high-semantic features, the length and width of the high-semantic features are made the same as the corresponding low-semantic features; CBS processing is to sequentially pass through a set of convolutions with a convolution kernel size of 1×1, BN layers and SiLU activation functions to achieve the retention of feature maps and feature information; splicing is performed in a concat (feature connection) manner to splice different features together according to the channel dimension to make full use of feature information from different levels and realize multi-scale feature fusion.
[0094] Furthermore, each attention module includes three attention sub-modules (i.e., the first attention module includes three first attention sub-modules, the second attention module includes three second attention sub-modules, the third attention module includes three third attention sub-modules, and the fourth attention module includes three fourth attention sub-modules). The structure and function of each attention sub-module are the same, which reduces the number of parameters while efficiently performing feature fusion.
[0095] In step S21, the first attention module feature extraction process includes:
[0096] S211: performing CBS processing on the splicing result to obtain a first splicing layer, and saving the first splicing layer to a first splicing storage module;
[0097] S212: extracting fusion information from the first concatenated layer through a first attention submodule to obtain a first fusion feature;
[0098] S213: summing the first fusion feature and the first splicing layer in the first splicing storage module, and performing CBS processing on the summation result to obtain a first attention feature;
[0099] In step S22, the second attention module feature extraction process includes:
[0100] S221: performing CBS processing on the splicing result to obtain a second splicing layer, and saving the second splicing layer to a second splicing storage module;
[0101] S222: extracting fusion information from the second concatenated layer through a second attention submodule to obtain a second fusion feature;
[0102] S223: summing the second fusion feature and the second splicing layer in the second splicing storage module, and performing CBS processing on the summation result to obtain a second attention feature;
[0103] In step S23, the feature extraction process of the third attention module includes:
[0104] S231: Perform CBS processing on the splicing result to obtain a third splicing layer, and save the third splicing layer to a third splicing storage module;
[0105] S232: extracting fusion information from the third concatenated layer through a third attention submodule to obtain a third fusion feature;
[0106] S233: summing the third fusion feature and the third splicing layer in the third splicing storage module, and performing CBS processing on the summation result to obtain a third attention feature;
[0107] In step S24, the fourth attention module feature extraction process includes:
[0108] S241: Perform CBS processing on the splicing result to obtain a fourth splicing layer, and save the fourth splicing layer to a fourth splicing storage module;
[0109] S242: extracting fusion information from the fourth concatenated layer through a fourth attention submodule to obtain a fourth fusion feature;
[0110] S243: summing the fourth fusion feature and the fourth splicing layer in the fourth splicing storage module, performing CBS processing on the summation result, and obtaining a fourth attention feature.
[0111] The attention submodule (including the first attention submodule, the second attention submodule, the third attention submodule and the fourth attention submodule) is a bottleneck structure. It uses partial convolution to effectively reduce the number of parameters, which may lead to a decrease in feature extraction efficiency, thereby reducing the fusion efficiency to a certain extent. Then, EMA (efficient multi-scale attention without dimensionality reduction) is used to reshape some channels into batch dimensions to avoid reducing the feature channel dimension, so as to retain the information of each channel and reduce the computational cost. It not only encodes global information to adjust the channel weights of parallel subnetworks, but also integrates the output features of two parallel subnetworks through cross-dimensional interaction, further lightweighting while improving the efficiency and accuracy of effective feature fusion, thereby improving target detection accuracy.
[0112] In step 212, the first attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the first splicing layer in sequence, summing the processing result and the first splicing layer in the first splicing storage module to obtain the first fusion feature;
[0113] In step 222, the second attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the second splicing layer in sequence, summing the processing results and the second splicing layer in the second splicing storage module to obtain the second fusion feature;
[0114] In step 232, the third attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the third splicing layer in sequence, summing the processing result and the third splicing layer in the third splicing storage module to obtain the third fusion feature;
[0115] In step 242, the fourth attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the fourth splicing layer in sequence, summing the processing result and the fourth splicing layer in the fourth splicing storage module to obtain the fourth fusion feature;
[0116] Furthermore, EMA initially takes as input the feature map Divide into G groups along the channel dimension, denoted as:
[0117]
[0118] in, Indicates The input feature map of the group, Indicates aisle, It is the dimension shape of the feature map tensor after feature grouping.
[0119] The weight descriptors of the grouped feature maps are extracted through two parallel paths on the 1×1 branch and one on the 3×3 branch. Two 1-dimensional global average pooling operations are used in the 1×1 branch to encode the information channels along the two spatial directions, and the two encoded features are connected to maintain their dimensions in the 1×1 branch. The output after the 1×1 convolution is then decomposed back into 2 vectors, and two Sigmoid nonlinear activation functions are used to fit the 2-dimensional binary distribution on the linear convolution. Finally, cross-channel interaction is achieved by multiplicative aggregation of channel attention. A 3×3 convolution is used in the 3×3 branch to capture multi-scale feature representations while expanding the feature space. In the cross-space learning part, two-dimensional global average pooling is used to encode the global spatial information of the output of the 1×1 branch, and 2-dimensional global pooling is used to encode the global spatial information of the output of the 1×1 branch. Calculated as:
[0120]
[0121] in, Indicates The input characteristics of the channel, express pixels, express pixels, and All start from 1.
[0122] The linear transformation is fitted by the Softmax nonlinear function, and a 3×3 convolution is used in the 3×3 branch to capture multi-scale feature representation and expand the feature space. Similarly, two-dimensional global average pooling is used to encode global spatial information in the 3×3 branch. Finally, the attention weights of the two spaces are integrated, and the pairwise relationship between the weights and the pixel level of the feature map is captured by the Sigmoid function to obtain the fusion feature without dimensionality reduction.
[0123] S3: query the feature fusion result through the perception query module to obtain the interactive information between the candidate box and the target image;
[0124] In step S3, the perception query module adopts a greedy query or a best matching query strategy based on the Hungarian algorithm;
[0125] S4: Decode the interactive information through a decoder to obtain a candidate box;
[0126] S5: Classify and locate the candidate boxes through the detection head to obtain the target detection result;
[0127] In step S5, the detection head includes a classifier and a regressor. The classifier is used to determine the target category of the candidate box, and the regressor is used to locate the candidate box.
[0128] Furthermore, the perception query module, decoder and detection head of RT-DETR are used to ensure high detection accuracy.
[0129] Specifically, the perceptual query module first calculates the intersection-over-union (IOU) between each target image and all candidate boxes to obtain an IOU matrix, and then performs a query operation on the feature fusion result to obtain the interaction information between the candidate box and the target image, providing a high-quality initialization query for the decoder. This process can adopt strategies such as greedy query or best match query based on the Hungarian algorithm.
[0130] The interactive information between the candidate box and the target image obtained by the perception query module is input into the decoder, and the decoder decodes the interactive information to generate the candidate box.
[0131] The detection head is a key component of the infrared image target detection method, including a classifier and a regressor. It is responsible for determining the target category of the candidate box based on the candidate box output by the decoder through the classifier, locating the candidate box through the regressor, and generating the final target detection result. The internal structure of the detection head is usually composed of multiple fully connected layers and convolutional layers, which are used to extract the target category and location information from the candidate box output by the decoder. The design of the detection head takes into account the characteristics of the target detection task and aims to achieve high-precision and high-efficiency target detection.
[0132] In a specific embodiment:
[0133] A1: Build infrared image target detection training set and validation set;
[0134] In the first stage of model training, the method of the present invention uses the FLIR (Flier) thermal infrared image target detection dataset (released in July 2018 to help developers develop and train convolutional neural networks) to train the target detection network architecture designed by the present invention (including the backbone network, encoder, perception query module, decoder and detection head).
[0135] The FLIR thermal infrared dataset is obtained by a thermal imager installed on a vehicle. The forward-looking infrared thermal imager FLIRTau2 is used, and the parameters are set to 13mm f / 1.0, 45-degree horizontal field of view (HFOV) and 37-degree vertical field of view (VFOV) to obtain thermal images. Both cameras are running in default mode. The infrared thermal imager FLIR Tau2 dataset contains a total of 14,452 annotated thermal images, of which 10,228 are from short videos and 4,224 are from 144 seconds of continuous video.
[0136] We conducted training experiments on objects with a reasonable number of labels for the three categories in the dataset, and finally selected "people", "bicycles" and "cars" as experimental objects. The number of target annotations in the training set was 22,372 for "people", 3,986 for "bicycles" and 41,260 for "cars", and the number of "people", "bicycles" and "cars" in the validation set was 5,779 for "people", 471 for "bicycles" and 5,432 for "cars". The training used cocodataset-detection-eval (COCO dataset, which has become the standard test platform for image captions) as the accuracy evaluation standard.
[0137] A2: Train the network model;
[0138] The overall network model is trained based on the Pytorch deep learning framework, and the performance of the network model is verified using the validation set. During the experiment, the NVIDIA GeForce RTX 3080Ti graphics card is used for training and testing, and the experimental parameter settings are shown in Table 1.
[0139] Table 1 Experimental parameter settings
[0140]
[0141] Among them, epochs represents the number of model training rounds, batch size represents the size of each batch of data selected during training, workers represents the number of threads used by the CPU when loading data, image size represents the image size, amp represents automatic mixed precision training, mosaic (probability) represents data enhancement, optimizer represents optimizer, finallr represents feedforward neural network learning rate, momentum represents momentum, weight_decay represents weight decay, which aims to reduce the complexity of the model and prevent overfitting, warmup_epochs represents the number of training rounds for model warmup, and warmup_momentum represents the momentum setting during warmup training.
[0142] A3: Build a new infrared image target detection dataset;
[0143] Fine-tune the network model training parameters such as batch size, final lr, momentum, etc., and train the network model constructed by the algorithm multiple times to obtain better training results, so that the network model has better target detection performance.
[0144] A4: Input the trained target detection model to obtain the infrared target detection result.
[0145] The existing public data set and the infrared imaging device are used to obtain infrared images and manually annotate the image targets to form a new infrared image target detection data set. The PC (personal computer) device is selected to input the newly formed infrared image target detection data set images into the trained network model designed by the present invention to obtain the final infrared image target detection results. The experimental results are shown in Table 2.
[0146] Table 2 Experimental results
[0147]
[0148] Among them, mAP(0.5) represents the average accuracy of target detection when IOU (intersection over union) = 0.5, mAP(0.5:0.95) represents the average accuracy of target detection when IOU = 0.5, 0.55, 0.6...0.95, mAR(0.5) represents the average recall rate, Parameters(M) represents the number of network model parameters, and FLOPs(G) represents the amount of network model calculation.
[0149] The higher the mAP(0.5), mAP(0.5:0.95) and mAR(0.5) values are, the higher the accuracy of target detection is; the lower the Parameters(M) and FLOPs(G) values are, the lighter the network model of target detection is.
[0150] The lightweighting of the backbone network and the simplification of its parameters have led to a certain degree of accuracy degradation; the improvement of replacing the feature fusion module alone is slightly higher than the RT-DETR model in terms of accuracy;
[0151] The experimental results of the present invention using Faster-resnet18 and feature fusion modules show that the feature fusion module with partial convolution and EMA can simplify the model parameters while focusing more attention on specific object features, which can achieve more efficient feature extraction and verify the effectiveness of the proposed feature fusion module.
[0152] After about 100 rounds of training, a very similar level of accuracy is achieved. The highest mAP (0.5:0.95) of the infrared image target detection method proposed by the present invention reaches the same value as the RT-DETR model, and the infrared image target detection method proposed by the present invention reduces the number of parameters by about 36.5% and the amount of calculation by about 27.4% compared with the RT-DETR model method, realizing an infrared image target detection method with a smaller algorithm scale and higher detection accuracy.
[0153] The beneficial effects of the present invention are as follows: the infrared image target detection method based on the Transformer architecture proposed in the present invention inherits the excellence of RT-DETR, converts the object detection task into an end-to-end sequence modeling problem, realizes global modeling of object sequences through the self-attention mechanism, no longer relies on prior candidate boxes, thereby eliminating the need for anchor boxes, and has excellent infrared image target detection accuracy.
[0154] The infrared image target detection method of the present invention uses the designed backbone network Faster-resnet18, reduces the detection of redundant features by performing partial convolution on features, reduces the model parameters and calculation amount, realizes the lightweight infrared image target detection, and inherits the residual module of ResNet18 to maximize the accuracy of feature extraction of the backbone network, thereby ensuring the accuracy of infrared image target detection; the feature fusion module designed by the present invention uses partial convolution to effectively reduce the number of parameters of the model, but this lightweight method may cause the feature extraction efficiency to decrease, thereby reducing the detection accuracy to a certain extent, and at the same time, the feature fusion module designed by the present invention uses an efficient multi-scale attention mechanism on the basis of partial convolution to increase the attention to useful features to realize useful feature screening and extraction, avoids the problem of accuracy reduction caused by partial convolution, and realizes the lightweight model scale and improved detection accuracy.
[0155] In summary, the Faster-resnet18 designed in the present invention constitutes a lightweight infrared image target detection backbone network. The designed feature fusion module constitutes a lightweight and efficient fusion module through partial convolution and multi-scale attention mechanism, and uses the post-processing module of RT-DETR to realize an infrared image target detection method with smaller algorithm scale and higher detection accuracy.
[0156] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for infrared image target detection based on Transformer architecture, characterized in that: The steps include: S1: Extract feature information from the infrared image through the backbone network, and use layer-by-layer convolution to obtain the first feature, the second feature, and the third feature in sequence, including: S11: performing convolution and maximum pooling calculations on the infrared image to obtain the first shallow feature; S12: extracting the first shallow feature through the first feature extraction module to obtain a second shallow feature; S13: Convolve the second shallow feature to achieve feature channel expansion, extract features on the channel expansion result through the second feature extraction module to obtain the first feature, and save the first feature to the first storage module. The feature extraction process of the second feature extraction module is: perform partial convolution, dimension increase convolution, BN layer, activation function and dimension reduction convolution on the channel expansion result in sequence to achieve feature mapping and obtain the first feature; S14: performing convolution on the first feature in the first storage module to achieve feature channel expansion, performing feature extraction on the channel expansion result through the third feature extraction module to obtain a second feature, and saving the second feature to the second storage module; S15: Convolve the second feature in the second storage module to achieve feature channel expansion, and extract features from the channel expansion result through the fourth feature extraction module to obtain the third feature. The feature extraction process of the fourth feature extraction module is: perform partial convolution, dimension increase convolution, BN layer, activation function and dimension reduction convolution on the channel expansion result in sequence to achieve feature mapping and obtain the third feature. S2: The third feature is scaled interactively performed through the AIFI module to obtain the fourth feature, and the fourth feature, the first feature, and the second feature are respectively transferred to the feature fusion module as three input features for fusion to obtain the feature fusion result. The process includes: S21: upsampling the fourth feature to achieve the same size as the second feature, obtaining the fifth feature, performing CBS processing on the fifth feature, splicing the processing result with the second feature, performing feature extraction on the splicing result through the first attention module, obtaining the first attention feature, and saving the first attention feature to the first attention storage module. The feature extraction process of the first attention module includes: S211: performing CBS processing on the splicing result to obtain a first splicing layer, and saving the first splicing layer to a first splicing storage module; S212: extracting fusion information from the first concatenated layer through a first attention submodule to obtain a first fusion feature; S213: summing the first fusion feature and the first splicing layer in the first splicing storage module, and performing CBS processing on the summation result to obtain a first attention feature; S22: upsampling the first attention feature to achieve the same size as the first feature, obtaining a sixth feature, performing CBS processing on the sixth feature, splicing the processing result with the first feature, performing feature extraction on the splicing result through the second attention module, obtaining a second attention feature, and saving the second attention feature to the second attention storage module. The feature extraction process of the second attention module includes: S221: performing CBS processing on the splicing result to obtain a second splicing layer, and saving the second splicing layer to a second splicing storage module; S222: extracting fusion information from the second concatenated layer through a second attention submodule to obtain a second fusion feature; S223: summing the second fusion feature and the second splicing layer in the second splicing storage module, and performing CBS processing on the summation result to obtain a second attention feature; S23: Perform CBS processing on the second attention feature, splice the processing result with the first attention feature in the first attention storage module, perform feature extraction on the splicing result through the third attention module to obtain a third attention feature, and save the third attention feature to the third attention storage module. The feature extraction process of the third attention module includes: S231: Perform CBS processing on the splicing result to obtain a third splicing layer, and save the third splicing layer to a third splicing storage module; S232: extracting fusion information from the third concatenated layer through a third attention submodule to obtain a third fusion feature; S233: summing the third fusion feature and the third splicing layer in the third splicing storage module, and performing CBS processing on the summation result to obtain a third attention feature; S24: performing CBS processing on the third attention feature, splicing the processing result with the fourth feature, performing feature extraction on the splicing result through the fourth attention module to obtain the fourth attention feature. The feature extraction process of the fourth attention module includes: S241: Perform CBS processing on the splicing result to obtain a fourth splicing layer, and save the fourth splicing layer to a fourth splicing storage module; S242: extracting fusion information from the fourth concatenated layer through a fourth attention submodule to obtain a fourth fusion feature; S243: summing the fourth fusion feature and the fourth splicing layer in the fourth splicing storage module, and performing CBS processing on the summation result to obtain a fourth attention feature; S25: splicing the second attention feature in the second attention storage module, the third attention feature in the third attention storage module, and the fourth attention feature to obtain a feature fusion result; S3: query the feature fusion result through the perception query module to obtain the interactive information between the candidate box and the target image; S4: Decode the interactive information through a decoder to obtain a candidate box; S5: Classify and locate the candidate boxes through the detection head to obtain the target detection results.
2. According to claim 1, a method for infrared image target detection based on Transformer architecture is characterized in that: In step 212, the first attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the first splicing layer in sequence, summing the processing result and the first splicing layer in the first splicing storage module to obtain the first fusion feature; In step 222, the second attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the second splicing layer in sequence, summing the processing result and the second splicing layer in the second splicing storage module to obtain the second fusion feature; In step 232, the third attention submodule extraction process is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the third splicing layer in sequence, summing the processing result and the third splicing layer in the third splicing storage module to obtain a third fusion feature; In step 242, the extraction process of the fourth attention submodule is: performing partial convolution, BN layer, EMA, BN layer, activation function and CBS processing on the fourth splicing layer in sequence, summing the processing results and the fourth splicing layer in the fourth splicing storage module to obtain the fourth fusion feature.
3. The infrared image target detection method based on Transformer architecture according to claim 1 is characterized in that: In step S3, the perception query module adopts a greedy query or a best matching query strategy based on the Hungarian algorithm.
4. The infrared image target detection method based on Transformer architecture according to claim 1 is characterized in that: In step S5, the detection head includes a classifier and a regressor. The classifier is used to determine the target category of the candidate box, and the regressor is used to locate the candidate box.
