A small target detection method, system, storage medium and product based on Transformer

By employing a Transformer-based small target detection method, multi-scale feature extraction and cross-attention fusion, combined with mask attention operations, the problem of feature information loss in convolutional neural networks during small target detection is solved, thus achieving accurate detection of small targets.

CN116091890BActive Publication Date: 2024-09-27CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310004108.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-03
Publication Date
2024-09-27
Estimated Expiration
2043-01-03

AI Technical Summary

Technical Problem

Existing convolutional neural networks struggle to effectively extract complete feature information in small object detection, resulting in poor detection performance, especially due to blurred edge information and missing semantic information of small objects.

Method used

A small object detection method based on Transformer is adopted. The image is divided into a sequence of image blocks of different sizes and input into a vision transformer model with multiple branches to extract multi-scale features. The features are then fused through a cross-attention mechanism. The query vector is processed in the transformer decoder layer by combining mask attention operation to generate a fused feature map. Finally, the detection box and category are predicted through a fully connected layer.

Benefits of technology

It achieves accurate location and category determination for small targets, improves the completeness and accuracy of small target detection, avoids the feature information loss problem caused by convolutional neural networks, and improves the accuracy and speed of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116091890B
    Figure CN116091890B
Patent Text Reader

Abstract

The present invention discloses a small target detection method, system, storage medium and product based on Transformer. First, the image of the data set of the image to be predicted is passed through the feature extraction network of the three-branch vision transformer to extract the multi-scale features of the image; secondly, the feature fusion method based on the attention mechanism is adopted to fuse the extracted multi-scale features, so as to enhance the expression ability of the multi-scale features to the image content; finally, the fused features are input into the improved transformer decoder module to perform target detection. This method can not only solve the problem that the traditional method cannot effectively detect small targets, but also make up for the slow convergence speed of some Transformer-based methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and more specifically to a Transformer-based small target detection method, system, storage medium and product. Background Art

[0002] Among the two popular target detection methods, most of the one-stage target detection methods and the two-stage target detection methods require the use of convolutional neural networks to extract image features. However, when actually used in small target detection, due to the fuzzy edge information and little semantic information of small target objects, it is difficult to obtain complete feature information of small targets in most cases. The feature information of small target objects is lost, resulting in unsatisfactory detection results of small targets.

[0003] In the current object detection method based on ordinary convolutional neural network for feature extraction, the convolutional neural network needs to perform multiple downsampling operations to improve the network's receptive field, which makes the feature information loss of small objects more serious. In addition, the shallow network of the convolutional neural network extracts detail information, and the deep network extracts semantic information, and there is no fusion between the two types of information.

[0004] Therefore, how to improve the integrity of small target object information feature extraction is a problem that technical personnel in this field urgently need to solve. Summary of the invention

[0005] In view of this, the present invention provides a small target detection method, system, storage medium and product based on Transformer, which can accurately determine the position and category of small targets when facing small target object detection tasks, and give the confidence of the small target object category.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] A small target detection method based on transformer includes the following steps:

[0008] Step 1: Collect the images to be detected and form a data set. The images in the data set are divided into three image blocks of different sizes and converted into corresponding three types of image block sequences.

[0009] Step 2: Input the three types of image block sequences into the transformer encoder layer of the vision transformer model of the three branches respectively to extract the multi-scale features corresponding to the image;

[0010] Step 3: Fuse the feature vector corresponding to each branch of the extracted multi-scale features with the feature vectors of the other two branches to obtain a new feature vector for each branch;

[0011] Step 4: Concatenate the new feature vectors of the three branches after feature fusion to generate a fused feature map;

[0012] Step 5: Input the fused feature map into the improved transformer decoder layer in the transformer model, and input the query vector at the same time. In the improved transformer decoder layer, the query feature is obtained through the mask attention operation based on the fused feature map;

[0013] Step 6: Pass the query features to two fully connected layers, one fully connected layer obtains the center position, height and width of the predicted detection box corresponding to the image to be detected, and the other fully connected layer detects the category label of the target.

[0014] Preferably, three scale thresholds, large, medium and small, are set, and the images in the data set are divided according to the three scale thresholds to obtain three types of image block sequences, large, medium and small, which are input into the vision transformer models of the large branch, medium branch and small branch respectively.

[0015] Preferably, the multi-scale feature extraction process in step 2 includes:

[0016] Step 21: input the image block sequences of the three branches into the fully connected layers before the transformer encoder layer in the vision transformer model of the three branches respectively to obtain the corresponding image block embeddings;

[0017] Step 22: adding a classification vector before embedding each of the image blocks, and adding the classification vector to the preset position embedding element by element to obtain the corresponding overall image sequence data; the position embedding is a set of standard learnable 1-D position encoding embeddings;

[0018] Step 23: Input each group of the image sequence data into the transformer encoder layers of the three branches respectively, extract feature vectors of three scales, and obtain multi-scale features.

[0019] Preferably, in the feature fusion of the multi-scale features in step 3, the feature vector of each branch is fused with the feature vectors of the other two branches to obtain a new feature vector; the process includes:

[0020] Step 31: Use the projection function to process the classification vector of the first branch feature vector, and concatenate the processed feature vector with the second branch feature vector into feature vector T1;

[0021] Step 32: Calculate the key, value, and query respectively according to the three learnable weight vectors, and calculate the cross attention CA between the classification vector of the first branch feature vector processed by the projection function and the feature vector T1 1 ;

[0022] Step 33: Apply Cross Attention CA 1 Perform residual addition on the classification vector of the first branch feature vector processed by the projection function, and process the residual addition result by using the back-projection function to obtain a new classification vector Z1 that combines the features of the two branch feature vectors;

[0023] Step 34: concatenate the new classification vector Z1 with the third branch feature vector to obtain a concatenated feature vector T2;

[0024] Step 35: Calculate the key, value, and query respectively according to the three learnable weight vectors, and calculate the cross attention CA between the new classification vector Z1 and the feature vector T2 2 ;

[0025] Step 36: Apply Cross Attention CA 2 Perform residual addition with the new classification vector Z1 processed by the projection function, and process the residual addition result by using the back-projection function to obtain the new classification vector Z2;

[0026] Step 37: Concatenate the new classification vector Z2 with the first branch feature vector to obtain the first branch new feature vector.

[0027] Preferably, the new feature vectors of the three branches are dimensionally aligned and concatenated through a projection function to obtain a fused feature map; the expression is:

[0028] y=[f l (x l )||f m (x m )||f s (x s )]

[0029] In the above formula, x i represents the new feature vector of branch i, i = l, m, s, representing large branch, medium branch and small branch respectively; f i (·) represents the back-projection function, i = l, m, s; y represents the fused feature map.

[0030] Preferably, a mask is added to the transformer decoder layer in the transformer model to obtain an improved transformer decoder layer.

[0031] Preferably, the fused feature map is input into an improved transformer decoder layer;

[0032] Through the mask attention operation, the cross attention in the improved transformer decoder layer is limited to the local features centered on the query object or region, and the query vector query is processed according to the fused feature map, and the query feature X is finally output. l ; Query features are used to determine the target category and location;

[0033] Mask attention adjusts the attention matrix, the expression is:

[0034]

[0035] Q l =f Q (X l-1 )

[0036] K l =f K (X l-1 )

[0037] V l =f V (X l-1 )

[0038]

[0039] In the above formula, l represents the number of network layers; X l represents the query feature of the lth layer; X l-1 represents the query feature of the l-1 layer; Q l , K l and V l represents the query Q, key K, and value V at level l; f Q ,f k and f v Both represent linear transformation; MA l-1 Represents the value of the attention mask; M l-1 (x,y) represents a binary image.

[0040] A transformer-based small target detection system, comprising an image segmentation module, a feature extraction module, a feature fusion module, an attention module and a detection module;

[0041] The image segmentation module collects images and forms a data set, divides the images in the data set into image blocks according to a preset scale threshold, and outputs an image block sequence of three branches;

[0042] The feature extraction module receives the image block sequences of the three branches, performs feature extraction, and outputs multi-scale features;

[0043] The feature fusion module receives multi-scale features for feature fusion and outputs a fused feature map;

[0044] The attention module receives the fused feature map and the query vector and outputs the attention result.

[0045] The detection module receives the attention results and obtains the predicted detection box and small object classification results.

[0046] Through the above technical solutions, it can be known that compared with the prior art, the present invention discloses a small target detection method, system, storage medium and product based on Transformer, including: dividing the data set image into three image blocks of different sizes and converting them into corresponding image block sequences; inputting the three types of image block sequences into the feature extraction network to extract the multi-scale features of the image; performing feature fusion on the extracted multi-scale features to generate a fusion feature map; the feature fusion method is to perform a cross attention operation; inputting the fusion feature map into the improved transformer decoder layer, and inputting the query vector at the same time, and obtaining the output by combining the image information through mask attention; passing the output of the decoder to two fully connected layers to predict the detection frame and its category respectively. The feature extractor based on Transformer avoids the problems caused by feature extraction by convolutional neural network, and extracts the feature information of small targets as completely as possible. The present invention can accurately judge the number and category of targets in the image (especially small targets) when facing a picture that needs to detect a target, and give a prediction score for target classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0048] Figure 1 The accompanying drawing is a flow chart of the Transformer-based small target detection method provided by the present invention;

[0049] Figure 2 The accompanying drawing is a schematic diagram of a small target detection method based on Transformer provided by the present invention;

[0050] Figure 3The accompanying figure is a schematic diagram of feature fusion based on the cross-attention mechanism provided by the present invention. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] The embodiment of the present invention discloses a small target detection method based on transformer, the process is as follows Figure 1 As shown, the following steps are included:

[0053] S1: Divide the dataset images into three image blocks of different sizes and convert them into corresponding image block sequences;

[0054] S2: Input the three types of image block sequences into the transformer encoder layer (feature extraction network) of the three-branch vision transformer model to extract the multi-scale features of the image;

[0055] S21: The three types of image block sequences correspond to the large, medium and small branches respectively. The image block sequences of the three branches are input into the fully connected layers before the transformer encoder layer in the vision transformer model of the three branches respectively to obtain the corresponding image block embeddings;

[0056] S22: adding a classification vector before embedding each image block, and adding it to the preset position embedding element by element to obtain the corresponding overall image sequence data;

[0057] S23: Input each set of image sequence data into the transformer encoder layers of the three branches respectively, extract feature vectors of three scales, and obtain multi-scale features;

[0058] S3: The feature vector corresponding to each branch of the extracted multi-scale features is fused with the feature vectors of the other two branches to obtain a new feature vector for each branch; the feature fusion method is to perform a cross-attention operation; in the feature fusion of multi-scale features, the feature vector of the large branch is first fused with the feature vector of the middle branch and then with the feature vector of the small branch, the feature vector of the middle branch is first fused with the feature vector of the small branch and then with the feature vector of the large branch, and the feature vector of the small branch is first fused with the feature vector of the large branch and then with the feature vector of the middle branch;

[0059] The process of merging feature vectors of large branches includes:

[0060] S311: The classification vector of the large branch is projected by the function f l (·) processing, and then concatenated with the feature vector of the middle branch into feature vector T1;

[0061]

[0062]

[0063] Among them, b' l Represents the concatenated feature vector T1; The classification vector representing the large branch; The feature vector representing the branch in the representation;

[0064] Step 312: Calculate the key K, value V and query Q respectively according to the three learnable weight vectors, and calculate the classification vector and feature vector T1 b' of the large branch processed by the projection function l Cross-Attention CA 1 ; Calculate cross attention CA 1 The formula is:

[0065] K=b' l W k , V = b' l W v ,

[0066]

[0067] Among them, W q , W k , W v They represent three learnable weight vectors respectively; C and h represent the number of dimensions and the number of heads of multi-head attention respectively;

[0068] S313: Cross-Attention CA 1 The classification vector of the large branch processed by the projection function The residuals are added, and the residual addition result is processed by the back-projection function (dimensional alignment) to obtain a new classification vector Z1 that combines the large branch and medium branch features. The expression is:

[0069]

[0070] in, Represents the residual addition result;

[0071]

[0072] in, represents the new classification vector Z1; g l (·) represents the back-projection function;

[0073] S314: New classification vector Z1 Concatenate with the feature vector of the small branch into feature vector T2;

[0074]

[0075] Among them, c' l Represents the feature vector T2

[0076] S315: Calculate new key K, value V and query Q based on the three learnable weight vectors, and calculate new classification vector The cross attention CA between the feature vector T2 2 ; Calculate cross attention CA 2 The formula is:

[0077] K=c' l W k , V=c' l W v

[0078]

[0079] S316: Cross-Attention CA 2 The new classification vector Z1 that integrates large and medium branch features after projection function processing Add the residuals, and process the residual addition result through the back-projection function to obtain a new classification vector Z2 that integrates the features of large branches, medium branches, and small branches;

[0080]

[0081]

[0082] in, Represents the residual addition result; Represents the new classification vector Z2;

[0083] S317: New classification vector Z2 It is concatenated with the feature vector of the large branch to obtain a new feature vector of the large branch after feature fusion;

[0084]

[0085] In the above formula, z' l Represents the new feature vector of the large branch after the large branch merges the features of the medium and small branches;

[0086] The middle branch feature vector is first fused with the small branch feature vector and then with the large branch feature vector, specifically:

[0087] S321: Process the classification vector of the middle branch feature vector using a projection function, and concatenate the processed feature vector with the small branch feature vector into feature vector T1;

[0088] S322: Calculate the key, value and query respectively according to the three learnable weight vectors, and calculate the cross attention CA between the classification vector of the middle branch feature vector processed by the projection function and the feature vector T1 1 ;

[0089] S323: Cross-Attention CA 1 The residual is added to the classification vector of the middle branch feature vector processed by the projection function, and the residual addition result is processed by the back-projection function to obtain a new classification vector Z1 that combines the features of the middle and small branch feature vectors;

[0090] S324: concatenate the new classification vector Z1 with the large branch feature vector to obtain a fused feature vector T2;

[0091] S325: Calculate the key, value and query respectively according to the three learnable weight vectors, and calculate the cross attention CA between the new classification vector Z1 and the feature vector T2 2 ;

[0092] S326: Cross-Attention CA 2 Add the residuals to the new classification vector Z1 processed by the projection function, and process the residual addition result by using the back-projection function to obtain the new classification vector Z2;

[0093] S327: concatenate the new classification vector Z2 with the middle branch feature vector to obtain a new middle branch feature vector;

[0094] The small branch feature vector is first fused with the large branch feature vector and then with the middle branch feature vector. The specific process is as follows:

[0095] S331: Process the classification vector of the small branch feature vector using a projection function, and concatenate the processed feature vector with the large branch feature vector into feature vector T1;

[0096] S332: Calculate the key, value and query respectively according to the three learnable weight vectors, and calculate the cross attention CA between the classification vector of the small branch feature vector processed by the projection function and the feature vector T1 1 ;

[0097] S333: Cross-Attention CA 1The residual is added to the classification vector of the small branch feature vector processed by the projection function, and the residual addition result is processed by the back-projection function to obtain a new classification vector Z1 that combines the features of the small and large branch feature vectors;

[0098] S334: concatenate the new classification vector Z1 with the middle branch feature vector to obtain a fused feature vector T2;

[0099] S335: Calculate the key, value and query respectively according to the three learnable weight vectors, and calculate the cross attention CA between the new classification vector Z1 and the feature vector T2 2 ;

[0100] S336: Cross-Attention CA 2 Add the residuals to the new classification vector Z1 processed by the projection function, and process the residual addition result by using the back-projection function to obtain the new classification vector Z2;

[0101] S337: concatenate the new classification vector Z2 with the small branch feature vector to obtain a new feature vector of the small branch;

[0102] S4: concatenate the new feature vectors of the three branches after feature fusion to generate a fused feature map;

[0103] S5: Input the fused feature map into the improved transformer decoder layer in the transformer model, and input the query vector at the same time, and obtain the output by combining the fused feature map through mask attention; add the mask to the transformer decoder layer to obtain the improved transformer decoder layer;

[0104] The mask attention operation is used to limit the cross attention to the local features centered on the query vector or region, and the query vector query is processed according to the fused feature map, and the query feature X is finally output. l ;

[0105] Mask attention adjusts the attention matrix, the expression is:

[0106]

[0107] Q l =f Q (X l-1 )

[0108] K l =f K (X l-1 )

[0109] Vl =f V (X l-1 )

[0110]

[0111] In the above formula, l represents the number of network layers; X l represents the query feature of the lth layer; X l-1 represents the query feature of the l-1 layer; Q l , K l and V l represents the query Q, key K, and value V at level l; f Q ,f k and f v Both represent linear transformation; MA l-1 represents the value of maskattention; M l-1 (x,y) represents a binary image.

[0112] S6: The query features output by the decoder are passed to two fully connected layers. One fully connected layer predicts the center position, height and width of the detection box, and the other weighted connection layer predicts the category label of the target.

[0113] Example

[0114] In a specific embodiment, a Transformer-based small target detection method is provided. When faced with a picture that needs to detect a target, the method can accurately determine the number and classification of targets in the image (especially small targets), and give a predicted score for the target classification.

[0115] The following is a detailed description of the small target detection method:

[0116] Adjust the image size of the dataset and divide the image into three branches of image block sequences according to the three image block sizes of 12*12, 16*16, and 32*32. Figure 2 As shown in the figure, feature maps of three scales are extracted from the image block sequences of the three branches through the transformer encoder module respectively.

[0117] Specifically, the dataset image size is adjusted to 240*240*3 and 224*224*3. The 240*240*3 image is divided into an input sequence of length 400 according to the image block size of 12*12; the 224*224*3 image is divided into input sequences of length 196 and 49 according to the image block size of 16*16 and 32*32 respectively. Based on the improved transformer encoder feature extraction network, the dimension of the large branch feature vector is 50*3072; the dimension of the medium branch feature vector is 197*768; and the dimension of the small branch feature vector is 401*432.

[0118] Due to the complex correlation between the extracted three-branch features, in order to more effectively fuse multi-scale features and thus more effectively express the image content, a feature fusion method based on the cross-attention mechanism is adopted.

[0119] Reference Figure 2 and Figure 3 As shown, Figure 2 CAFF stands for the feature fusion method based on the cross-attention mechanism; CAFF refers to fusing the features of each two branches through the same cross-attention mechanism to obtain the final fused features.

[0120] Reference Figure 3 As shown (taking the large branch as an example), CAFF is: the classification vector of the large branch Through the projection function f l (·) is dimensionally aligned and aligned with the feature vector of the middle branch Splice into a new vector b' l ; b' l Multiply it with the weight vector and calculate the large branch eigenvector With the middle branch eigenvector The cross attention is combined with the classification vector of the large branch Add the residuals and then use the back projection function g l (·) Dimension alignment is performed to obtain a classification vector that combines the large and medium branch features The classification vector that combines the large and medium branch features Through the projection function f' l (·) Dimension alignment is performed to obtain a vector Compare it with the eigenvector of the small branch Splice into a new vector c' l ; Multiply the new vector by the weight vector and calculate and Cross-attention; Add the residuals and pass the back-projection function gl (·) Dimension alignment: Align the result with the feature vector of the large branch After concatenation, we finally get fused feature vectors of three scales: large, medium, and small.

[0121] The feature fusion calculation process based on the cross-attention mechanism is as follows:

[0122] The vectors of the two branches are concatenated into a new feature vector using the following formula:

[0123]

[0124]

[0125] In the above formula, b' l Represents the new vector formed by concatenation; Represents the classification vector of branch l; Represents the feature vector of branch m.

[0126] The cross attention of the two branch vectors is calculated by the following formula:

[0127] K=b' l W k , V = b' l W v ,

[0128]

[0129] In the above formula, W q , W k , W v represents a learnable weight vector; C and h represent the number of dimensions and the number of heads of multi-head attention, respectively.

[0130] The features of the two branches are fused using the following formula:

[0131]

[0132]

[0133] In the above formula, Represents the result after adding the residuals; Represents the fused feature vector.

[0134] The features fused based on the cross-attention mechanism are concatenated using the following formula to obtain a fused feature map:

[0135] y=[f l (x l )||f m (x m )||fs (x s )]

[0136] In the above formula, x i represents the feature vector of branch i, i = l, m, s; f i (·) represents the projection function of the alignment dimension, i = l, m, s, l represents the large branch, m represents the medium branch, s represents the small branch; y represents the fused feature map.

[0137] The fused feature map is input into the improved transformer decoder layer, and the query vector is input at the same time, and the output is obtained by combining the image information through mask attention; the output of the decoder is passed to two fully connected layers to finally obtain the predicted position and category of the target.

[0138] Specifically, the fused feature map is input into the improved transformer decoder layer; the cross attention is limited to local features centered on objects or regions through maskattention, and object queries are processed according to the fused feature map.

[0139] The cross attention calculation process based on mask attention is as follows:

[0140] The attention matrix is ​​adjusted by the following formula:

[0141]

[0142] In the above formula, MA l-1 Represents the value of mask attention.

[0143] MA is calculated by the following formula l-1 :

[0144]

[0145] In the above formula, l represents the number of network layers, X l represents the query feature of the lth layer, Q l =f Q (X l-1 ),K l =f K (X l-1 ),V l =f V (X l-1 ), f Q ,f k and f v is a linear transformation. l-1 (x,y) represents a binary image.

[0146] The target scale is one of the important factors affecting the target detection performance. In the small target detection method based on deep learning, if only a single-scale feature extraction network is used, the underlying features lack semantic information and the high-level features are prone to lose information, which seriously affects the detection performance of small targets. By using a multi-scale feature extraction network in this embodiment and combining image blocks of different sizes, stronger image features can be generated.

[0147] In the face of the extracted multi-scale features, if a simple series feature fusion or parallel strategy is adopted, the expression ability of the multi-scale features for the image will be weakened, thereby affecting the detection performance of small targets. This embodiment adopts a feature fusion method based on the cross-attention mechanism to better fuse multi-scale features.

[0148] In the small target detection method based on deep learning, if the traditional transformer decoder is used to interact with the global features of the image using a series of object query vectors, it will take a longer training time for the object query vector to accurately locate the object. This embodiment adopts the mask attention mechanism to limit the cross attention to the local features centered on the object or region, and processes the object query vector according to the image features to improve the convergence speed.

[0149] This method not only solves the problem that traditional methods cannot effectively detect small targets, but also makes up for the slow convergence speed of some Transformer-based methods.

[0150] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0151] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A small target detection method based on transformer, characterized in that: The steps include: Step 1: Collect the images to be detected and form a data set, divide the images in the data set into image blocks according to the preset scale threshold, and obtain three types of image block sequences; Step 2: Input the three types of image block sequences into the three-branch vision transformer model for feature extraction, and extract the multi-scale features corresponding to all image block sequences; Step 3: The feature vector corresponding to each branch in the extracted multi-scale features is fused with the feature vectors of the other two branches to obtain a new feature vector for each branch; in the feature fusion of the multi-scale features in step 3, the feature vector of each branch is fused with the feature vectors of the other two branches to obtain a new feature vector; the process includes: Step 31: Use the projection function to process the classification vector of the first branch feature vector, and concatenate the processed feature vector with the second branch feature vector into feature vector T1; Step 32: Calculate the key, value and query respectively according to the three weight vectors, and calculate the cross attention CA1 between the classification vector of the first branch feature vector processed by the projection function and the feature vector T1; Step 33: perform residual addition of the cross attention CA1 and the classification vector of the first branch feature vector processed by the projection function, and process the residual addition result using the back-projection function to obtain a new classification vector Z1 that combines the features of the two branch feature vectors; Step 34: concatenate the new classification vector Z1 with the third branch feature vector to obtain a concatenated feature vector T2; Step 35: Calculate the key, value and query respectively according to the three weight vectors, and calculate the cross attention CA2 between the new classification vector Z1 and the feature vector T2; Step 36: Add the cross attention CA2 to the new classification vector Z1 processed by the projection function, and use the back-projection function to process the residual addition result to obtain the new classification vector Z2; Step 37: concatenate the new classification vector Z2 with the first branch feature vector to obtain the first branch new feature vector; Step 4: Concatenate the new feature vectors of the three branches to generate a fused feature map; Step 5: Input the fused feature map into the improved transformer decoder layer in the transformer model, and input the query vector at the same time. In the improved transformer decoder layer, the query feature is obtained through the mask attention operation based on the fused feature map; Step 6: Input the query features into two fully connected layers respectively to obtain the center position, height and width of the predicted detection box corresponding to the image to be detected, as well as the category label of the detection target.

2. According to claim 1, a transformer-based small target detection method is characterized in that: Set three scale thresholds: large, medium and small. Divide the images in the dataset according to the three scale thresholds to obtain three types of image block sequences: large, medium and small. Input them into the vision transformer model of large branch, medium branch and small branch respectively.

3. The transformer-based small target detection method according to claim 1, characterized in that: The multi-scale feature extraction process in step 2 includes: Step 21: Input the image block sequence into the fully connected layers of the vision transformer model of the three branches respectively to obtain the corresponding image block embedding; Step 22: adding a classification vector before embedding each image block, and adding it element-wise with the preset position embedding to obtain the corresponding overall image sequence data; Step 23: Input each group of the image sequence data into the transformer encoder layer respectively, extract feature vectors of three scales, and obtain multi-scale features.

4. The transformer-based small target detection method according to claim 1, characterized in that: The new feature vectors of the three branches after feature fusion are dimensionally aligned through the projection function and spliced ​​into a fused feature map.

5. The transformer-based small target detection method according to claim 1, characterized in that: The mask attention operation is used to limit the cross attention in the improved transformer decoder layer to local features centered on the query vector or region, and the query of the query vector is processed according to the fused feature map.

6. A detection system for a small target detection method based on transformer according to any one of claims 1 to 5, characterized in that: It includes image segmentation module, feature extraction module, feature fusion module, attention module and detection module; The image segmentation module collects images and forms a data set, divides the images in the data set into image blocks according to a preset scale threshold, and outputs an image block sequence of three branches; The feature extraction module receives the image block sequences of the three branches, performs feature extraction, and outputs multi-scale features; The feature fusion module receives multi-scale features for feature fusion and outputs a fused feature map; The attention module receives the fused feature map and the query vector and outputs the attention result. The detection module receives the attention results and obtains the predicted detection box and small object classification results.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.