A full-stage small target detection method for infrared raw data

By constructing a full-stage small target detection model for infrared raw data and utilizing feature extraction and multi-scale feature fusion technology, the false alarm and complex background problems in infrared small target detection are solved, and efficient target segmentation and recognition are achieved in different scenarios.

CN115471735BActive Publication Date: 2025-09-05NANJING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211233846.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-10
Publication Date
2025-09-05
Estimated Expiration
2042-10-10

AI Technical Summary

Technical Problem

Existing infrared dim small target detection methods are prone to false alarms and are unable to effectively handle the complexity of real scenes. In addition, general target detection deep network models fail to fully consider the special characteristics of small targets, resulting in information loss.

Method used

A full-stage small target detection model for infrared raw data is constructed, including an image block embedding module, a large/small target classification module, a small target detection module, and a large target detection module. Feature extraction is performed using center difference convolution and ordinary convolution, and feature mapping is performed by combining adaptive average pooling layers, fully connected layers, and a sigmoid function. A total loss function is designed for fast convergence, an encoder and a decoder are used to extract multi-scale features, and synthetic simulation training images are constructed to enhance the dataset.

Benefits of technology

It can effectively segment targets in scenarios with different distances from the target to the imaging device, reduce false alarm rates, and improve the accuracy and robustness of infrared weak target detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115471735B_ABST
    Figure CN115471735B_ABST
Patent Text Reader

Abstract

This application discloses a full-stage small target detection method for infrared raw data. First, an infrared small target detection model is constructed, which includes an image block embedding module, a large / small target classification module, a small target detection module, and a large target detection module. Secondly, a training set is constructed for training the infrared small target detection model. Thirdly, a total loss function is designed to ensure rapid convergence of the large / small target classification module, the small target detection module, and the large target detection module. The training set is then used to train the infrared small target detection model. Finally, a test image is input into the trained model for detection. This method can not only effectively segment targets in scenarios where the target is far from the imaging device, but also in scenarios where the target distance is approaching the imaging device. At the same time, the segmentation result has a low false alarm rate, and the network can better identify infrared small targets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of infrared image analysis, and in particular relates to a method for detecting small and weak targets in all stages of infrared raw data. Background Art

[0002] Infrared small target detection targets targets that are not only small in size but also very weak, often being submerged in complex backgrounds, resulting in high missed detection and false detection rates. Existing infrared small target detection methods still have technical flaws in addressing this problem. For example, traditional local contrast-based methods can achieve good results when the target meets the designed saliency metric assumptions, but the background often contains some areas that meet these assumptions, resulting in many false alarms. Traditional methods do not involve any feature learning and cannot effectively handle the complexity of real scenes. Common deep network models for target detection do not fully consider the special characteristics of small targets, resulting in the loss of small target information in the deep network, making them ineffective. In short, robust small target detection in infrared images remains challenging. Summary of the Invention

[0003] The present invention aims to solve the problem in the prior art that false alarms are easily caused and it is difficult to effectively handle the complexity in real scenes.

[0004] To achieve the purpose of the present invention, the present invention discloses a method for detecting small and dim targets in full-stage infrared raw data, comprising the following steps:

[0005] Step 1, build an infrared small target detection model. The infrared small target detection model includes an image block embedding module, a large / small target classification module, a small target detection module, and a large target detection module. The image block embedding module of the infrared small target detection model is used to extract features from the input original infrared image. The large / small target classification module of the infrared small target detection model is used to determine whether the target in the original image is a small target or a large target. The small target detection module and the large target detection module of the infrared small target detection model are used to detect small targets or large targets respectively.

[0006] Step 2: Construct a training set for training the infrared small target detection model;

[0007] Step 3: Design the total loss function so that the large / small object classification module, the weak and small object detection module, and the large object detection module converge quickly.

[0008] Step 4: Use the training set to train the infrared small target detection model;

[0009] Step 5: Input the test image into the trained model for detection.

[0010] Furthermore, the image block embedding module of the infrared dim target detection model includes a central difference convolution (CDC) and two ordinary convolutions (Conv). The convolution kernel size of these three convolution operations is 3×3, the step size of the central difference convolution is 1, and the step size of the ordinary convolution is 2. The image block embedding module sequentially passes the input infrared image through a central difference convolution and two ordinary convolutions to perform preliminary feature extraction and output a feature matrix.

[0011] Furthermore, the large / small target classification module of the infrared small target detection model includes an adaptive average pooling layer, a fully connected layer (FC), and a sigmoid function; the feature matrix extracted by the image block embedding module first passes through the adaptive average pooling layer to compress the matrix size, then passes through the fully connected layer for feature extraction, and finally uses the sigmoid function to map the values ​​in the feature matrix to between 0 and 1.

[0012] Furthermore, the infrared small target detection model small target detection module includes an encoder and a decoder; the infrared small target detection model encoder is divided into 4 stages, each stage consists of multiple basic feature extraction modules (Basic Block) (the number of Basic Blocks in each stage is 2, 2, 6, and 2 respectively), extracting features on a scale, and each stage is connected by a downsampling module; the infrared small target detection model decoder consists of a fully connected layer (Fully The decoder consists of a first layer, a pooling layer, a layer normalization (LayerNorm, LN), an activation layer (GELU) and an upsample (Upsample). In the first step, the decoder uses pooling layers with different ratios to compress the feature matrix output by the encoder in the fourth stage to generate four feature matrices of different sizes; these four feature matrices are respectively mapped using fully connected layers, layer normalization and activation layers; finally, the four different feature matrices are upsampled at different ratios and then concatenated along the channel dimension to generate a new feature matrix; in the second step, the decoder upsamples the feature matrix generated in the first step and the features extracted in the 1st, 2nd and 3rd stages of the encoder at different ratios, concatenates them along the channel dimension, and re-extracts features through fully connected layers, layer normalization layers and activation layers in turn, and finally outputs a binary image with target pixels of 255 and background pixels of 0.

[0013] Furthermore, the large target detection module of the infrared small target detection model includes a convolutional layer, a batch normalization layer (BatchNorm), an upsampling layer and a sigmoid function; first, the feature matrix extracted by the image block embedding module is extracted through the convolutional layer, and the feature matrix output by the convolutional layer is normalized using the batch normalization layer, and then the feature matrix is ​​upsampled to 512×512, and finally the values ​​in the feature matrix are mapped to between 0 and 1 through the sigmoid function.

[0014] Furthermore, in step 2, the training set includes infrared images and synthetic simulation images of small targets in real application scenarios. Currently, there are few public infrared weak target data sets, and neural network training requires a large amount of data. In order to be able to detect targets in scenarios where the targets are constantly approaching the imaging device, this application constructs a portion of synthetic simulation training images. The specific steps are:

[0015] Step 2-1: Prepare a 512×512 matrix with all zero values, and set r=100;

[0016] Step 2-2, draw a circle with the center of the matrix as the center and a radius of r, set the values ​​in the matrix within the circle to 255, and save the matrix;

[0017] Step 2-3, r=r+1;

[0018] Step 2-4: If r≤300, execute step 2-2; otherwise, execute step 2-5.

[0019] Steps 2-5, end.

[0020] Furthermore, in step 3, the total loss function formula is segmentation loss SL + classification loss CL. These two loss functions can respectively enable the small and weak target detection module, large target detection module and large / small target classification module to converge quickly.

[0021] Loss=SL+CL

[0022]

[0023]

[0024] Among them, y1 is 0 or 1, indicating the true value of the segmentation, p1∈[0,1] indicates the output of the detection module, and x indicates the intermediate result of the calculation;

[0025] The classification loss uses the cross entropy loss function:

[0026] CL=y2log2(p2)+(1-y2)log2(1-p2)

[0027] Where y2 is 0 or 1, indicating the true value of the segmentation, and p2∈[0, 1] indicates the output of the large / small object classification module.

[0028] Furthermore, in step 4, the specific steps of using the training set to train the infrared small target detection model are as follows:

[0029] Step 4-1: Scale the training set images to 512×512 and input them into the model in batches.

[0030] Step 4-2: After one round of iteration on the entire training set, re-shuffle the entire dataset and train again until the model converges;

[0031] Step 4-3: After 300 rounds of training, save the model parameters with the best results for testing.

[0032] Furthermore, in step 5, the test image is input into the trained model for detection as follows: the model parameters saved after training are loaded and the model is set to no longer calculate gradients, and the test image is scaled to 512×512 and input into the model to obtain a binary image with a target pixel value of 255 and a background pixel value of 0.

[0033] Furthermore, the encoder is divided into four stages, and the number of basic feature extraction modules in each stage is 2, 2, 6, and 2 respectively, extracting features on a scale, and each stage is connected by a downsampling module; the output of the basic feature extraction module in each stage is a feature matrix, and the input is the feature matrix output by the basic feature extraction module in the previous stage; the basic feature extraction module consists of a self-attention calculation module and a feedforward network. The self-attention module first uses layer normalization to standardize the input feature matrix, and then performs feature mapping through the fully connected layer to generate a feature matrix Q, and copies Q twice to obtain matrices K and V; then Bayer interpolation is used on Q, K, and V, and they are rearranged to generate Q′, K′, and V′. Q′, K′, and V′ are divided into 4×4 small blocks and then rearranged separately, that is, Finally, the block-based self-attention matrix is ​​calculated. The feedforward network mainly extracts features from the feature matrix output by the self-attention module through the fully connected layer and the activation layer, expands the receptive field of the fully connected layer through shift and residual connections, enhances the model's contextual understanding ability, and finally outputs a new feature matrix.

[0034] Compared with the existing technology, the significant progress of the present invention is: 1) This method can not only segment the target well in the scenario where the target is far away from the imaging device, but also segment the target in the scenario where the target distance is getting closer to the imaging device; 2) The image block embedding module can effectively suppress the background, so that the final segmentation result has a low false alarm rate; 3) The encoder can fuse the diverse features extracted by different fully connected layers, so that the network can better identify weak infrared targets.

[0035] In order to more clearly illustrate the functional characteristics and structural parameters of the present invention, further description is given below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0037] Figure 1 This is a schematic diagram of the infrared small target detection model of the present invention;

[0038] Figure 2 It is the encoder module in the small target detection module;

[0039] Figure 3 It is the decoder module in the small target detection module;

[0040] Figure 4 It is the interpolation diagram of matrix Q;

[0041] Figure 5 is the interpolation diagram of matrix K;

[0042] Figure 6 is the interpolation diagram of matrix V;

[0043] Figure 7 A schematic diagram showing leftward shift, rightward shift, upward shift, and downward shift;

[0044] Figure 8 Comparison of the test results of the present invention and some existing methods;

[0045] Figure 9 The detection result of the process of the target changing from small to large;

[0046] Figure 10 This is a schematic diagram of the overall process of the full-stage small target detection method for infrared raw data. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0048] like Figure 10 As shown, a method for detecting small targets in all stages of infrared raw data includes the following steps:

[0049] Step 1: Construct an infrared small target detection model, which includes an image block embedding module, a large / small target classification module, a small target detection module, and a large target detection module; the image block embedding module is used to extract features from the input original infrared image, the large / small target classification module is used to determine whether the target in the original image is a small target or a large target, and the small target detection module and the large target detection module are used to detect small targets or large targets respectively;

[0050] Step 2: Construct a training set for training the infrared small target detection model;

[0051] Step 3: Design the total loss function so that the large / small object classification module, the weak and small object detection module, and the large object detection module converge quickly.

[0052] Step 4: Use the training set to train the infrared small target detection model;

[0053] Step 5: Input the test image into the trained model for detection.

[0054] like Figure 1 As shown, the image patch embedding module consists of one center-difference convolution and two ordinary convolutions. The kernel size of all three convolutions is 3×3, the stride of the center-difference convolution is 1, and the stride of the ordinary convolution is 2. The large / small object classification module consists of an adaptive average pooling layer, a fully connected layer, and a sigmoid function. The large / small object classification module uses the features extracted by the image patch embedding module to determine whether the object in the original image is a small or salient object. If it is a small object, the features extracted by the image patch embedding module are fed into the small object detection module. If it is a salient object, the features are fed into the salient object detection module. Salient objects are easier to detect than small objects, so the salient object detection module consists of only one convolution layer (with a stride of 1), a batch normalization layer (BatchNorm), and an upsampling layer. After the input features pass through the convolution and batch normalization layers, a 128×128 feature matrix is ​​obtained, which is finally upsampled to 512×512.

[0055] like Figure 2 As shown in Figure 2, the encoder of the small target detection module consists of four stages, each of which consists of a different number of basic feature extraction modules, Basic Block, to extract features at a certain scale. The size of the feature matrix output by each stage is as follows: Figure 2 As shown. The output of the Basic Block in each stage is a feature matrix, and the input is the feature matrix output by the Basic Block in the previous stage. The Basic Block consists of a self-attention calculation module and a feedforward network. The self-attention module first uses layer normalization (LayerNorm) to normalize the input feature matrix. Then, feature mapping is performed through the fully connected layer to generate a feature matrix Q, and Q is copied twice to obtain matrices K and V. Bayer interpolation is then performed on Q, K, and V, and they are rearranged to generate Q', K', and V', which are divided into 4×4 small blocks and then rearranged separately, that is, Finally, the block-based self-attention matrix is ​​calculated. The feedforward network primarily extracts features from the feature matrix output by the self-attention module through fully connected layers and activation layers. Shifting and residual connections expand the receptive field of the fully connected layers, enhancing the model's contextual understanding capabilities. Finally, a new feature matrix is ​​output.

[0056] Basic Block takes the input feature matrix X∈R n×c The processing process is as follows:

[0057] like Figure 4 、 Figure 5 、 Figure 6 As shown:

[0058] (1) Apply layer normalization (LayerNorm) to X to obtain X′;

[0059] (2) If it is the Basic Block of the fourth stage, execute (3), otherwise execute (4);

[0060] (3) X′ passes through a fully connected layer to obtain the feature matrix Q∈R n×c , let K=V=Q, and use Bayer interpolation for Q, K, and V. Let i and j be subscript indices. When i is odd and j is even, When i is an even number and j is an odd number, When i is an odd number and j is an even number, When i is an even number and j is an odd number, When i is an even number and j is an even number, v i,j The calculation is the same as ki,j. When i is an odd number and j is an even number, When i is an even number and j is an odd number, When i is an even number and j is an even number,

[0061] Execute (5);

[0062] (4) X′ passes through three fully connected layers to obtain three feature matrices Q∈R n×c , K∈R n×c 、V∈R n×c ;

[0063] (5) Rearrange Q, K, and V separately, i.e., Q->Q′∈R h×w×c , K->K′∈r h×w×c , y->V′∈R h×w×c ,in

[0064] (6) Divide Q′, K′, and V′ into 4×4 blocks and rearrange them respectively, that is, q i 、k i 、v i The dimensions are all 16×c,

[0065] (7) Calculate the block-based self-attention matrix but

[0066] like Figure 7 As shown:

[0067] (8) Let Y = V × A + X, apply layer normalization (LayerNorm) to Y, and obtain Y1;

[0068] (9) Y1 passes through a fully connected layer, an activation layer, and is shifted to the left to obtain Y1′, and let Y2 = Y1 + Y1′;

[0069] (10) Y2 passes through a fully connected layer, an activation layer, and is shifted to the right to obtain Y2′, and let Y3 = Y2 + Y2′;

[0070] (11) Y3 passes through a fully connected layer, an activation layer, and is shifted upward to obtain Y3′, and let Y4 = Y3 + Y3′;

[0071] (12) Y4 passes through a fully connected layer, an activation layer, and is shifted downward to obtain Y4′, and let Y5 = Y4 + T4′;

[0072] (13) Let Y6 = Y5 + Y1, and output Y6.

[0073] The decoder for weak targets is as follows Figure 3As shown in Figure 1, the feature matrices output by the encoder in the four stages are X1, X2, X3, and X4. The decoder upsamples these four feature matrices at different ratios, concatenates them along the channel dimension, and then passes them through the fully connected layer, layer normalization layer (LayerNorm), and activation layer (GELU) for feature extraction. Finally, it outputs a binary image with target pixels of 255 and background pixels of 0.

[0074] The specific processing process of the decoder for X1, X2, X3, and X4 is as follows:

[0075] (1) Use different sizes of pooling layers (Pool) on X4 to obtain X4 (1) 、X4 (2) 、X4 (3) 、X4 (4) ,

[0076] Then it goes through a fully connected layer (FC), a layer normalization layer (LN), an activation layer (GELU) and upsamples to the same size to get X4 (1) ′、X4 (2) ′、X4 (3 ) ′ 、X4 (4) ';

[0077] (2) For X4 (1) ′,X4 (2) ′,X4 (3) ′,X4 (4) ′, X4 are spliced ​​according to the channel direction, that is, Y=[X4 (1)′ , X4 (2) ′,X4 (3) ′,X4 (4)′ , X4], after a fully connected layer, a layer normalization layer (LayerNorm), an activation layer (GELU) and a fully connected layer to obtain Y′;

[0078] (3) X1, X2, X a After a fully connected layer, a normalization layer (LayerNorm), and an activation layer (GELU), we get X1″, X2″, and X3″. After upsampling Y′ to 32×32, we add it to X3″ to get Y″1. After upsampling Y″1 to 64×64, we add it to X2″ to get Y2″. After upsampling Y2″ to 128×128, we add it to X1″ to get Y3″.

[0079] (4) Upsample Y″1, Y″2, and Y′ to 128×128 respectively and concatenate them with Y3″ to obtain S, that is, S = [Up(Y″1), Up(Y″2), Up(Y′), Y3″], where Up represents upsampling;

[0080] (5) S passes through a fully connected layer, a normalization layer (LayerNorm), an activation layer (GELU), and a fully connected layer, and is then upsampled to 512×512 and mapped to [0, 1] using the sigmoid function.

[0081] Specifically, in step 2, the training set includes infrared images containing small targets in real application scenarios and synthetic simulation images. Currently, there are few public infrared weak small target data sets, and neural network training requires a large amount of data. In order to detect targets in scenarios where the target is constantly approaching the imaging device, the present invention constructs a portion of synthetic simulation images. The specific steps are:

[0082] (1) Prepare a 512×512 matrix with all values ​​​​zero, and set r = 100;

[0083] (2) Draw a circle with the center of the matrix as the center and a radius of r, set the values ​​in the matrix within the circle to 255, and save the matrix;

[0084] (3) r = r + 1;

[0085] (4) If r≤300, execute (2), otherwise execute (5);

[0086] (5)End.

[0087] Specifically, in step 3, the total loss function formula is segmentation loss (SL) + classification loss (CL). These two loss functions can make the weak and small target detection module, large target detection module and large / small target classification module converge quickly.

[0088] Loss=SL+CL

[0089]

[0090]

[0091] Where y1 is 0 or 1, indicating the true value of the segmentation, p1∈[0, 1] indicates the output of the detection module, and x indicates the intermediate result of the calculation.

[0092] The classification loss uses the cross entropy loss function:

[0093] CL=y2log2(p2)+(1-y2)log2(1-p2)

[0094] Where y2 is 0 or 1, indicating the true value of the segmentation, and p2∈[0, 1] indicates the output of the large / small object classification module.

[0095] Specifically, in step 4, the infrared small target detection model was trained using the training set images. The training set was fed into the model in batches. After one round of iteration on the entire training set, the entire dataset was reshuffled and trained again for a total of 300 rounds. The network parameters were initialized using the Xavier normal distribution and optimized using the AdamW optimizer with a learning rate of 0.001 and a weight_decay of 0.01. Training was performed for a total of 300 rounds. The best model parameters were saved for testing.

[0096] Specifically, in step 5, this method scales the image to be detected to 512×512 and feeds it into the network, performing only the forward propagation process. The large / small object classification module uses the features extracted by the image block embedding module to determine whether the object in the original image is a small or salient object. If it is a small object, the features extracted by the image block embedding module are fed into the small object detection module. If it is a salient object, the features are fed into the salient object detection module, resulting in the final segmentation result.

[0097] like Figure 8 As shown, Figure 8 The comparison of the detection results of the present invention and some existing detection methods is given. Figure 8 In the infrared images in the second and third rows, small targets exhibit low contrast, especially in the second row, where the background contains significant interference. In this situation, traditional methods produce numerous false alarms, as do deep learning-based ACM methods, and MDvsFA misses detections. Figure 8 The infrared image in the third row has a simple background and a high contrast target, but both the traditional method and the deep learning-based method have false alarms. In these cases, this method can achieve the best detection effect.

[0098] like Figure 9 As shown, Figure 9 The results of the target changing from small to large are shown, and it can be seen that the present invention also has excellent detection effect on large targets. Therefore, it can be proved that the present invention has excellent detection capability for infrared weak small targets in all stages.

[0099] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.

[0100] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for detecting small and weak targets in all stages of infrared raw data, characterized in that: The following steps are involved: Step 1: Construct an infrared small target detection model, which includes an image block embedding module, a large / small target classification module, a small target detection module, and a large target detection module; the image block embedding module is used to extract features from the input original infrared image, the large / small target classification module is used to determine whether the target in the original image is a small target or a large target, and the small target detection module and the large target detection module are used to detect small targets or large targets respectively; Step 2: Construct a training set for training the infrared small target detection model; Step 3: Design the total loss function so that the large / small object classification module, the weak and small object detection module, and the large object detection module converge quickly. Step 4: Use the training set to train the infrared small target detection model; Step 5: Input the test image into the trained model for detection; The image block embedding module includes a center difference convolution (CDC) and two ordinary convolutions (Conv). The convolution kernel size of the three convolution operations is 3×3, the step size of the center difference convolution is 1, and the step size of the ordinary convolution is 2. The image block embedding module sequentially passes the input infrared image through a center difference convolution and two ordinary convolutions to perform preliminary feature extraction and output a feature matrix. The small target detection module includes an encoder and a decoder; The encoder is divided into four stages, each of which consists of several basic feature extraction modules to extract features at a scale, and each stage is connected by a downsampling module; The decoder consists of a fully connected layer, a pooling layer, a layer normalization layer, an activation layer, and an upsampling layer. In the first step, the decoder uses a pooling layer with different ratios to compress the feature matrix output by the encoder in the fourth stage to generate four feature matrices of different sizes. The four feature matrices are respectively subjected to feature mapping using a fully connected layer, a layer normalization layer, and an activation layer. Finally, the four different feature matrices are upsampled at different ratios and then concatenated along the channel dimension to generate a new feature matrix. In the second step, the decoder uses different ratios to upsample the feature matrix generated in the first step and the features extracted in the first, second, and third stages of the encoder, and then concatenates the matrices along the channel dimension. The features are then re-extracted through a fully connected layer, a layer normalization layer, and an activation layer in sequence, and finally a binary image with target pixels of 255 and background pixels of 0 is output. The encoder is divided into four stages. The number of basic feature extraction modules in each stage is 2, 2, 6, and 2 respectively. They extract features at a certain scale. Each stage is connected by a downsampling module. The output of the basic feature extraction module in each stage is a feature matrix, and the input is the feature matrix output by the basic feature extraction module in the previous stage. The basic feature extraction module consists of a self-attention calculation module and a feedforward network. The self-attention module first uses layer normalization to normalize the input feature matrix, then performs feature mapping through the fully connected layer to generate a feature matrix Q. Q is copied twice to obtain matrices K and V. Bayer interpolation is then used on Q, K, and V, and they are rearranged to generate Q', K', and V'. Q', K', and V' are divided into 4×4 blocks and then rearranged separately, i.e. Finally, the block-based self-attention matrix is ​​calculated. The feedforward network is the feature matrix output by the self-attention module. Feature extraction is performed through the fully connected layer and the activation layer. The receptive field of the fully connected layer is expanded through shift and residual connection to enhance the context understanding ability of the model. Finally, a new feature matrix is ​​output.

2. The infrared raw data full-stage small target detection method according to claim 1, characterized in that: The large / small object classification module includes an adaptive average pooling layer, a fully connected layer and a sigmoid function; the feature matrix extracted by the image block embedding module first passes through the adaptive average pooling layer to compress the matrix size, then passes through the fully connected layer to extract features, and finally uses the sigmoid function to map the values ​​in the feature matrix to between 0 and 1.

3. The infrared raw data full-stage small target detection method according to claim 1, characterized in that: The large object detection module includes a convolutional layer, a batch normalization layer, an upsampling layer, and a sigmoid function. First, the feature matrix extracted by the image block embedding module is subjected to feature extraction through the convolutional layer. The feature matrix output by the convolutional layer is normalized using the batch normalization layer. The feature matrix is ​​then upsampled to 512×512. Finally, the sigmoid function is used to map the values ​​in the feature matrix to between 0 and 1.

4. The infrared raw data full-stage small target detection method according to claim 1, characterized in that: In step 2, the training set includes infrared images containing small targets in real application scenarios and synthetic simulation images. The steps for synthesizing the simulation images are: Step 2-1: Prepare a 512×512 matrix with all zero values, and set r=100; Step 2-2, draw a circle with the center of the matrix as the center and a radius of r, set the values ​​in the matrix within the circle to 255, and save the matrix; Step 2-3, r=r+1; Step 2-4: If r≤300, execute step 2-2; otherwise, execute step 2-5. Steps 2-5, end.

5. The infrared raw data full-stage small target detection method according to claim 1, characterized in that: In step 3, the total loss function formula is segmentation loss SL + classification loss CL. These two loss functions can respectively enable the small and weak target detection module, large target detection module and large / small target classification module to converge quickly. Loss=SL+CL Among them, y1 is 0 or 1, indicating the true value of the segmentation, p1∈[0,1] indicates the output of the detection module, and x indicates the intermediate result of the calculation; The classification loss uses the cross entropy loss function: CL=y2log2(p2)+(1-y2)log2(1-p2) Where y2 is 0 or 1, indicating the true value of the segmentation, and p2∈[0, 1] indicates the output of the large / small object classification module.

6. The infrared raw data full-stage small target detection method according to claim 1, characterized in that: In step 4, the specific steps of using the training set to train the infrared small target detection model are as follows: Step 4-1: Scale the training set images to 512×512 and input them into the model in batches. Step 4-2: After one round of iteration on the entire training set, re-shuffle the entire dataset and train again until the model converges; Step 4-3: After 300 rounds of training, save the model parameters with the best results for testing.

7. The infrared raw data full-stage small target detection method according to claim 1, characterized in that: In step 5, the test image is input into the trained model for detection. Specifically, the model parameters saved after training are loaded and the model is set to no longer calculate gradients. The test image is scaled to 512×512 and input into the model to obtain a binary image with a target pixel value of 255 and a background pixel value of 0.