Jigsaw type learning strategy target detection method and window circulation dynamic attention encoder
By introducing a window cyclic dynamic attention encoder into the object detector, using the window attention and loop dynamic attention mechanism, the problems of insufficient detection capabilities of small and medium-sized targets and large self-attention calculation parameters in the existing technology are solved, and higher detection accuracy and characterization capabilities are achieved.
Patent Information
- Application Number
- CN202411727152.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-04
AI Technical Summary
The existing Transformer-based object detector has insufficient small object detection capabilities, and the encoder's self-attention calculation parameters are large, making it difficult to capture the dependencies between sequences.
A window cyclic dynamic attention encoder is proposed, which windows the image through the window attention mechanism, and uses the cyclic dynamic attention mechanism to build dependencies between local windows to enhance the representation ability.
Through the interaction and fusion of global and local information, the accuracy of object detection and model representation ability are improved, especially in small object detection.
Smart Images

Figure CN119762746A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and more specifically, to a jigsaw learning strategy target detection method and a window cyclic dynamic attention encoder. Background Art
[0002] Object detection is a core task in computer vision. It combines image classification and positioning technology to identify and locate specific targets from images or videos. It is an important manifestation of computer vision technology in practical applications. With the rapid development of deep learning technology, its high detection efficiency and accuracy have become the mainstream algorithm in this field, greatly promoting the progress of object detection. At present, object detection has been widely used in many fields such as autonomous driving, intelligent security, face recognition, and medical image analysis.
[0003] Although current object detection algorithms, such as two-stage detection algorithms and single-stage detection algorithms, have made significant achievements in performance and speed, they still face some challenges. In particular, Transformer-based object detectors, such as DETR, simplify the detection process by converting the object detection task into a set prediction problem and simplifying the detection process, avoiding the redundant prediction and non-maximum suppression (NMS) post-processing steps in traditional methods, but their high computational cost and slow model training convergence speed limit the real-time application of the model. In addition, when DETR and its improved models detect objects of different scales, although they generally adopt a multi-scale feature fusion strategy to improve performance, this may also introduce redundant contextual information and increase the computational complexity and amount of the algorithm. At the same time, although the attention mechanism in the Transformer model can dynamically focus on important parts of the data and improve model performance, it will significantly increase the computational complexity and number of parameters of the model when capturing long-distance dependencies.
[0004] To address these issues, the DN-DETR model introduced a query denoising training method to improve the slow convergence speed of the DETR model and its low sensitivity to targets of different scales, mainly at the decoder layer. However, despite significant progress in many aspects, the DN-DETR model still has deficiencies in small target detection capabilities. Summary of the invention
[0005] The present invention aims to overcome at least one defect (shortcoming) of the above-mentioned prior art and provide a jigsaw learning strategy target detection method and a window recurrent dynamic attention encoder to solve the problem that the encoder self-attention calculation parameters are large and it is difficult to capture the dependencies between sequences.
[0006] According to a first aspect of the present application, a window cyclic dynamic attention encoder is provided, the encoder comprising a window attention and a cyclic dynamic attention mechanism; the window attention mechanism comprises: Obtaining a preprocessed first feature map, and evenly dividing the first feature map into a plurality of sub-window images using a window of a preset size; Performing a linear transformation on each of the sub-window images to obtain a first query vector, a first key vector and a first value vector for each of the sub-window images; Based on the first query vector, the first key vector and the first value vector, the self-attention of each of the sub-window images is calculated respectively to obtain a second feature map of each of the sub-window images; The second feature maps of all the sub-window images are concatenated and reshaped to obtain a third feature map; Performing a linear transformation on the third characteristic map, and connecting the result of the linear transformation with the first characteristic map to obtain a fourth characteristic map; The cyclic dynamic attention mechanism is used to evenly divide the fourth feature map into a plurality of local window images and construct a dependency relationship between each of the local window images.
[0007] The window recurrent dynamic attention encoder performs windowed processing on the image and controls the transmission of key information in the image window through the recurrent dynamic attention mechanism. Through the recurrent dynamic attention mechanism, the dependency relationship between all windows in the image is constructed, which effectively promotes the interaction and fusion between global and local information, and enhances the representation ability of the window recurrent dynamic attention encoder, enabling it to understand the key information of the target object more comprehensively and deeply.
[0008] Optionally, the cyclic dynamic attention mechanism includes an input unit, wherein the input unit is used to evenly divide the fourth feature map into a plurality of local window images, and obtain a second query vector, a second key vector, and a second value vector for each local window image; The cyclic dynamic attention mechanism also includes a filtering unit, an adjustment unit, a candidate attention unit, an attention unit and an output unit for cyclically iterating each of the local window images; The filtering unit, the adjusting unit, the candidate attention unit, the attention unit, and the output unit are connected in sequence.
[0009] The cyclic dynamic attention mechanism realizes attention control of local areas through filtering units and adjustment units. The filtering unit controls the correlation between the output value of the candidate attention unit and the output value of the previous window attention unit, reducing the influence of the previous window output value on the output value of the current candidate attention unit; the adjustment unit determines the relationship between the output value of the current local window image in the attention unit and the output value of the previous local window image in the attention unit and the output value of the candidate attention unit. By dynamically adjusting local and global information, the dependency relationship between different windows in the image is constructed.
[0010] Optionally, the output value of the filtering unit is obtained by element-wise multiplication of the second query vector and the output value of the attention unit corresponding to the previous local window image, and the calculation formula of the output value of the filtering unit is specifically: in, is the output value of the filter unit corresponding to the current local window image, is the output value of the attention unit corresponding to the previous local window image, is a learnable weight parameter, symbol is the Hadamard product operator, is the second query vector of the current local window image, is the activation function.
[0011] Optionally, the calculation formula of the adjustment unit is specifically: in, is the output value of the current local window image in the adjustment unit, is the learnable weight parameter, is the second key vector of the current local window image, is the output value of the attention unit corresponding to the previous local window image.
[0012] Optionally, the output value of the candidate attention unit is obtained by the following steps: Acquire an attention weight corresponding to the current local window image based on a second query vector of the current local window image and a second key vector of the current local window image; Based on the attention weight corresponding to the current local window image, the output value of the candidate unit corresponding to the current local window image is obtained.
[0013] Optionally, obtain the attention weight corresponding to the current local window image. The specific calculation formula is as follows: in, is the attention weight corresponding to the current local window image, is the second query vector of the current local window image, is the second key vector of the current local window image, is the bias parameter, is a matrix operator.
[0014] Optionally, the specific calculation formula of the output value of the candidate unit is as follows: in, is the output value of the local image of the current window in the candidate unit, is the output value of the current local window image corresponding to the filtering unit, is the output value of the attention unit corresponding to the previous local window image.
[0015] Optionally, the output value of the attention unit is calculated based on the output value of the adjustment unit corresponding to the current local window image, the output value of the attention unit corresponding to the previous local window image, and the output value of the current local window image in the candidate attention unit. The calculation formula of the output value of the attention unit is as follows: in, is the output value of the attention unit corresponding to the current local window image, is the output value of the current local window image in the adjustment unit, is the output value of the attention unit corresponding to the previous local window image.
[0016] Optionally, a specific calculation formula for the output value of the output unit is as follows: in, is the output value of the output unit corresponding to the current local window image, is the output value of the attention unit corresponding to the current local window image, is the second value vector of the current local window image, is a matrix operator.
[0017] According to a second aspect of the present application, a jigsaw learning strategy target detection method is provided, applying the window cyclic dynamic attention encoder described in the first aspect above, the method comprising: Collecting an image data set, and constructing a training set based on the image data set; Constructing a WDA-DETR model based on the DN-DETR model, replacing the Transformer encoder of the DN-DETR model with the window recurrent dynamic attention encoder, and training the WDA-DETR model based on the training set; The image to be detected is input into the trained WDA-DETR model, and the target detection result is output.
[0018] Based on any one of the above aspects, the jigsaw learning strategy target detection method and window cyclic dynamic attention encoder provided in the embodiments of the present application are: 1. The window recurrent dynamic attention encoder loops through each local window and calculates and updates the attention information of each local window, builds the long-distance dependency between each local window, realizes the interaction and fusion between global and local information, and thus enhances the representation ability of the window recurrent dynamic attention encoder.
[0019] 2. The puzzle learning strategy target detection method constructs the dependency relationship between different windows in the image by windowing the image and dynamically adjusting the local and global information, thereby improving the image representation ability of the encoder and making the target features in the image more specific, obvious and easy to distinguish. When the feature information output by the encoder is passed to the decoder, the decoder can more accurately locate and identify the target in the image, thereby improving the accuracy of target detection and significantly improving the overall performance of the model in target detection tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A schematic application scenario diagram of the jigsaw learning strategy target detection method provided in this embodiment.
[0022] Figure 2 It is a structural schematic diagram of the DN-DETR model in the prior art.
[0023] Figure 3 A schematic diagram of the structure of the WDA-DETR model provided in this embodiment.
[0024] Figure 4 A schematic diagram of the structure of the window recurrent dynamic attention encoder provided in this embodiment.
[0025] Figure 5 A schematic diagram of the structure of the recurrent dynamic attention mechanism provided for this embodiment.
[0026] Figure 6 Flowchart of the window self-attention mechanism provided for this embodiment.
[0027] Figure 7 A flowchart of the jigsaw learning strategy target detection method provided in this embodiment. DETAILED DESCRIPTION
[0028] The drawings of this application are only used for illustrative purposes and should not be construed as limiting the present application. In order to better illustrate the following embodiments, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; it is understandable to those skilled in the art that some well-known structures and their descriptions in the drawings may be omitted.
[0029] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Although the DN-DETR, DAB-DETR, Conditional-DETR and other models in the existing technology have improved the convergence speed of the DETR model and the detection sensitivity of multi-scale targets by introducing strategies such as query denoising training, multi-scale feature fusion and decoupling of spatial and content information, and these improvements are to optimize the decoder layer to better utilize and parse the feature information extracted by the encoder layer, the model's detection ability for small targets is still limited, and there is a problem of insufficient detection accuracy.
[0032] This embodiment provides a technical solution that can solve the above-mentioned problem. The specific implementation methods of this application are described in detail below in conjunction with the accompanying drawings.
[0033] For example, a schematic diagram of an application scenario of a jigsaw learning strategy target detection method provided in an embodiment of the present application is provided. Figure 1As shown, the application scenario at least includes a server 100 and a terminal 200 that can communicate with the server 100, the server 100 has an image processing function; the terminal 200 has a streaming media playback function and may also have an image processing function.
[0034] It is understandable that the server 100 can be an independent electronic device or a cluster of multiple electronic devices; the terminal 200 can be a smart phone terminal, a personal computer, a tablet computer, a car terminal, etc., but is not limited thereto.
[0035] In one practicable manner, the server 100 and the terminal 200 may respectively execute the jigsaw learning strategy target detection method provided in the embodiment of the present application, or, optionally, the jigsaw learning strategy target detection method provided in the embodiment of the present application is partially executed in the server 100 and partially executed in the terminal 200.
[0036] This embodiment provides a window cyclic dynamic attention encoder, which adopts a window self-attention mechanism and a cyclic dynamic attention mechanism (Cyclic Dynamic Attention Mechanism, CDAM).
[0037] like Figure 6 As shown, the window self-attention mechanism includes: S1. Obtain a preprocessed first feature map, and use a window of a preset size to evenly divide the first feature map into a plurality of sub-window images.
[0038] In the specific implementation process, the preprocessed first feature map The feature map of the image to be detected can be obtained by extracting it through the backbone network, where: represents the real number set of feature maps of the image to be detected, , and They represent the height, width and number of channels of the feature map respectively.
[0039] like Figure 4 As shown, the first feature map is mapped using a window of a preset size. Evenly divide it into several sub-windows, specifically including: using a window of size M×M to evenly divide the feature map from the upper left corner of the feature map (partition), you can get k×k sub-windows , ... , the feature map set of all sub-windows can be expressed as For example, assuming that the first feature map can be evenly divided into 4×4 parts, and a 2×2 window is used to evenly divide the first feature map, then k=2, and 4 sub-window images can be obtained.
[0040] S2, for each of the sub-window images A linear transformation is performed to obtain a first query vector, a first key vector and a first value vector of each sub-window.
[0041] Set all subwindow images Perform linear transformation respectively to obtain the first query vector , the first key vector and the first value vector , the first query vector , the first key vector and the first value vector The expression is as follows: in, Indicates subwindow images, Indicates The weight parameter of each window, Represents the matrix multiplication operator. In the specific implementation process, It can be obtained by random initialization.
[0042] S3, based on the first query vector, the first key vector and the first value vector, respectively calculate the self-attention of each of the sub-window images to obtain a second feature map of each of the sub-windows; Calculate the self-attention of k×k sub-window images respectively to obtain the second feature map , the second feature map The expression is as follows: S4, concatenating and reshaping the second feature maps of all the sub-window images to obtain a third feature map ; like Figure 4 As shown, by Reshape, we can get the third feature map .
[0043] S5, the third feature map Perform a linear transformation, and connect the result of the linear transformation with the first feature map to obtain a fourth feature map. The representation formula of the fourth feature map is as follows: in, is the weight parameter of the sub-window image. In this embodiment, the weight parameter of each sub-window image is They are all different, the weight parameters It can be obtained by random initialization.
[0044] In this embodiment, the recurrent dynamic attention mechanism includes an input unit.
[0045] The input unit is used to obtain the fourth feature map, divide the fourth feature map into a plurality of sub-windows, and obtain the query vector, key vector and value vector of each sub-window. The input unit specifically includes: obtaining the fourth feature map , use the M×M window size to evenly divide it into multiple local windows, and divide each local window Perform linear transformation to obtain the second query vector , the second key vector and the second value vector The second query vector , the second key vector and the second value vector The expression formula is: In this embodiment, the cyclic dynamic attention mechanism further includes a dynamic attention unit, which is used to perform cyclic iterative processing on each local window image, thereby constructing a dependency relationship between each local window image. Figure 5 As shown, the dynamic attention unit includes a filtering unit, an adjustment unit, a candidate attention unit, an attention unit (not shown in the figure) and an output unit which are connected in sequence.
[0046] The acquisition of the filtering unit includes: converting the second query vector The output value of the attention unit in the previous local window is multiplied element by element, and the multiplied value is controlled in the range of (0, 1) through a fully connected layer with a nonlinear activation function. The calculation formula of the output value of the filtering unit is specifically: in, is the output value of the filter unit corresponding to the current local window image, is the output value of the attention unit corresponding to the previous local window image, is a learnable weight parameter, symbol is the Hadamard product operator, is the second query vector of the current local window image, is the activation function.
[0047] Specifically, the calculation formula of the output value of the adjustment unit is as follows: in, is the output value of the current local window image in the adjustment unit, is the learnable weight parameter, is the second key vector of the current local window image, is the output value of the attention unit corresponding to the previous local window image.
[0048] In the specific implementation process, the weight parameter and It can be obtained through random initialization and then adjusted during the model training process through strategies such as back propagation algorithm and gradient descent.
[0049] In this embodiment, obtaining the output value of the candidate attention unit includes: A1. Obtaining an attention weight corresponding to the current local window image based on a second query vector of the current local window image and a second key vector of the current local window image; In the specific implementation process, the candidate attention unit converts the second query vector and the second key vector Multiply to gather attention, filter out important information, and filter out meaningless information. Use the softmax function to normalize the result and output a probability distribution as the attention weight of the candidate attention unit. The calculation formula of the attention weight of the current local window is as follows: in, is the attention weight corresponding to the current local window image, is the second query vector of the current local window image, is the second key vector of the current local window image, is the bias parameter, is a matrix operator.
[0050] A2. Obtain the output value of the candidate unit corresponding to the current local window image based on the attention weight corresponding to the current local window image.
[0051] In this embodiment, the filter unit of the current local window With the attention unit of the previous local window Integration, the candidate attention unit is calculated by the nonlinear activation function tanh. The calculation formula of the output value of the candidate unit in the current local window is as follows: in, is the output value of the local image of the current window in the candidate unit, is the output value of the current local window image corresponding to the filtering unit, is the output value of the attention unit corresponding to the previous local window image. and Multiplication can reduce the interference of the previous local window information.
[0052] The attention unit is used to calculate the attention weight of the current local window image. In this implementation, by combining the output value of the current local window image in the adjustment unit The information can further determine how much of the attention weight information of the current local window image comes from the output value of the previous local window image in the attention unit and the output value of the current local window image in the candidate attention unit The output value of the attention unit is calculated based on the output value of the adjustment unit corresponding to the current local window image, the output value of the attention unit corresponding to the previous local window image, and the output value of the candidate attention unit corresponding to the current local window image. and the output value of the candidate attention unit Perform element-by-element convex combination to obtain the output value of the attention unit. The output value of the attention unit is expressed as follows: in, is the output value of the attention unit corresponding to the current local window image, is the output value of the current local window image in the adjustment unit, is the output value of the attention unit corresponding to the previous local window image.
[0053] It can be understood that when the output value corresponding to the current local window image in the adjustment unit When it is close to 1, the model will tend to retain the attention information of the previous local window image. On the contrary, when the output value of the adjustment unit Close to 0, the output value of the current local window image in the attention unit will be close to the output value of the corresponding current window local image in the candidate unit. By dynamically adjusting the attention unit, it helps to capture the long-distance dependencies between different locations in the image.
[0054] In a specific implementation, since the first local window image does not have a previous local window image, the output value of the first local window image in the attention unit can be initialized to an all-zero tensor.
[0055] The output unit is used to convert the second value vector of the current local window and the output value of the current local window image in the attention unit Perform matrix multiplication to obtain the output of each local window image in the output unit , the output of each local window image in the output unit The calculation formula is as follows: The window recurrent dynamic attention encoder provided in this embodiment is optimized for the Transformer encoder in the DN-DETR model. It combines window attention with the recurrent dynamic attention mechanism, calculates and updates the attention information of each local window image in a cyclic traversal manner to construct the long-distance dependency relationship between each local window image, solves the problem that the sliding window image can only construct the short-distance relationship between adjacent window images, and effectively promotes the interaction and fusion between global and local information, thereby enhancing the representation ability of the encoder.
[0056] like Figure 7 As shown, the embodiment of the present application also provides a jigsaw learning strategy target detection method, optionally, the method may include: S100: Collect an image data set, and construct a training set based on the image data set.
[0057] S200: construct a WDA-DETR model based on the DN-DETR model, and train the WDA-DETR model based on the training set.
[0058] The DN-DETR model includes a backbone feature extraction network, a Transformer encoder-decoder and an output layer connected in sequence, and the Transformer encoder is replaced by the window recurrent dynamic attention encoder.
[0059] like Figure 2 As shown in the figure, the DN-DETR model includes a backbone feature extraction network ResNet-50, a Transformer encoder-decoder, and an output layer connected in sequence. The Transformer encoder Encoder includes multiple Transformer encoding layers (Encoder layer), each encoding layer includes a multi-head self-attention mechanism (Multi-Head Self-Attention), a residual connection and normalization layer (Add&Norm), and a feed-forward neural network (FFN). The decoder (Decoder) includes multiple decoding layers (Decoder layer), and the decoder is connected to a feed-forward neural network (FFN) to generate the category (cls) and bounding box information (bbox) of each target.
[0060] The WDA-DETR model of this embodiment is improved based on the DN-DETR model. Figure 3As shown, the improvement of the WDA-DETR model is to replace the Transformer encoder of the DN-DETR model with the window recurrent dynamic attention encoder, which is used to solve the problems that the DN-DETR model has poor performance in small target detection, the global calculation parameters of self-attention in the Transformer encoder are large, and the sliding window attention calculation is limited to adjacent windows.
[0061] like Figure 3 As shown in Figure 1, the WDA-DETR model includes a backbone feature extraction network, an encoder-decoder, and an output layer connected in sequence. In the figure, WLDAE represents the windowed recurrent dynamic attention encoder.
[0062] The backbone feature extraction network is used to extract an image feature map of an input image; The window recurrent dynamic attention encoder is used to encode the image feature map; The decoder is used to decode the encoded image feature map; The output layer is used to output the category and bounding box coordinates of each object.
[0063] The WDA-DETR model of this embodiment is improved based on the DN-DETR model. Figure 3 As shown, the specific improvement is to replace the Transformer encoder of the DN-DETR model with the window recurrent dynamic attention encoder. It is understandable that the backbone feature extraction network can be ResNet-50 or other backbone networks. In a specific embodiment, the input image is extracted through the backbone feature extraction network to extract image feature information, and then the number of channels is reduced through 1×1 convolution.
[0064] S300: Input the image to be detected into the trained WDA-DETR model, and output the target detection result.
[0065] In the specific implementation process, the image to be detected is input into the trained WDA-DETR model to obtain the target detection results. Specifically, the feature information of the image is extracted through the backbone network, and the number of channels is reduced by 1x1 convolution. Then the window recurrent dynamic attention encoder uses window attention and recurrent attention mechanisms to perform deep feature extraction on the feature map and generate fixed-length embedding vectors. These embedding vectors are combined with a set of learnable target queries in the decoder, and the target information is decoded through the cross-attention mechanism. Finally, the output layer predicts and outputs the category and bounding box coordinates of each target in the image to be detected.
[0066] The jigsaw learning strategy target detection method provided in this embodiment uses a jigsaw learning strategy to evenly divide the image feature map of the input encoder into multiple ordered local windows, and then cyclically iterates the learning of the attention information of each local window until the attention information of the target area of all local windows of the image feature map is learned and integrated. When learning each local window, the information concerned by the local window in front of the current window and the logical relationship between the local windows in front of the current window are comprehensively analyzed and reasoned, so as to accurately locate the area that the current window really needs to pay attention to.
[0067] By replacing the encoder in Transformer with a windowed recurrent dynamic attention encoder, the windowed recurrent dynamic attention encoder builds dependencies between different windows in the image by windowing the image and dynamically adjusting local and global information, thereby improving the encoder's image representation ability and making the target features in the image more specific, obvious and easy to distinguish. When the feature information is output from the encoder and passed to the decoder, the decoder can more accurately locate and identify targets in the image, thereby greatly improving the accuracy of target detection, and significantly improving the overall performance of the WDA-DETR model in target detection tasks.
[0068] Obviously, the above embodiments of the present application are merely examples for clearly illustrating the technical solution of the present application, and are not intended to limit the specific implementation methods of the present application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present application shall be included in the protection scope of the claims of the present application.
Claims
1. A window recurrent dynamic attention encoder, characterized in that The encoder includes a window attention and a cyclic dynamic attention mechanism; the window attention mechanism includes: Obtaining a preprocessed first feature map, and evenly dividing the first feature map into a plurality of sub-window images using a window of a preset size; Performing a linear transformation on each of the sub-window images to obtain a first query vector, a first key vector and a first value vector for each of the sub-window images; Calculate the self-attention of each of the sub-window images based on the first query vector, the first key vector and the first value vector to obtain a second feature map of each of the sub-window images; The second feature maps of all the sub-window images are concatenated and reshaped to obtain a third feature map; Performing a linear transformation on the third characteristic map, and connecting the result of the linear transformation with the first characteristic map to obtain a fourth characteristic map; The cyclic dynamic attention mechanism is used to evenly divide the fourth feature map into a plurality of local window images and construct a dependency relationship between each of the local window images.
2. A window recurrent dynamic attention encoder according to claim 1, characterized in that The cyclic dynamic attention mechanism includes an input unit, which is used to evenly divide the fourth feature map into a plurality of local window images, and obtain a second query vector, a second key vector and a second value vector for each local window image; The cyclic dynamic attention mechanism also includes a filtering unit, an adjustment unit, a candidate attention unit, an attention unit and an output unit for cyclically iterating each of the local window images; The filtering unit, the adjusting unit, the candidate attention unit, the attention unit, and the output unit are connected in sequence.
3. A window recurrent dynamic attention encoder according to claim 2, characterized in that The output value of the filtering unit is obtained by element-wise multiplication of the second query vector and the output value of the attention unit corresponding to the previous local window image. The calculation formula of the output value of the filtering unit is specifically: in, is the output value of the filter unit corresponding to the current local window image, is the output value of the attention unit corresponding to the previous local window image, is a learnable weight parameter, symbol is the Hadamard product operator, is the second query vector of the current local window image, is the activation function.
4. A window recurrent dynamic attention encoder according to claim 2, characterized in that The calculation formula of the output value of the adjustment unit is specifically: in, is the output value of the current local window image in the adjustment unit, is the learnable weight parameter, is the second key vector of the current local window image, is the output value of the attention unit corresponding to the previous local window image.
5. A window recurrent dynamic attention encoder according to claim 2, characterized in that: The output value of the candidate attention unit is obtained by the following steps: Acquire an attention weight corresponding to the current local window image based on a second query vector of the current local window image and a second key vector of the current local window image; Based on the attention weight corresponding to the current local window image, the output value of the candidate unit corresponding to the current local window image is obtained.
6. A window recurrent dynamic attention encoder according to claim 5, characterized in that Get the attention weight corresponding to the current local window image. The specific calculation formula is as follows: in, is the attention weight corresponding to the current local window image, is the second query vector of the current local window image, is the second key vector of the current local window image, is the bias parameter, is a matrix operator.
7. A window recurrent dynamic attention encoder according to claim 6, characterized in that The specific calculation formula of the output value of the candidate attention unit is as follows: in, is the output value of the local image of the current window in the candidate unit, is the output value of the current local window image corresponding to the filtering unit, is the output value of the attention unit corresponding to the previous local window image.
8. A window recurrent dynamic attention encoder according to claim 2, characterized in that: The output value of the attention unit is calculated based on the output value of the adjustment unit corresponding to the current local window image, the output value of the attention unit corresponding to the previous local window image, and the output value of the current local window image in the candidate attention unit. The calculation formula of the output value of the attention unit is as follows: in, is the output value of the attention unit corresponding to the current local window image, is the output value of the current local window image in the adjustment unit, is the output value of the attention unit corresponding to the previous local window image.
9. A windowed recurrent dynamic attention encoder according to claim 2, characterized in that: The specific calculation formula of the output value of the output unit is as follows: in, is the output value of the output unit corresponding to the current local window image, is the output value of the attention unit corresponding to the current local window image, is the second value vector of the current local window image, is a matrix operator.
10. A jigsaw learning strategy target detection method, characterized in that: Applying the window recurrent dynamic attention encoder according to any one of claims 1 to 9, the method comprising: Collecting an image data set, and constructing a training set based on the image data set; Constructing a WDA-DETR model based on the DN-DETR model, replacing the Transformer encoder of the DN-DETR model with the window recurrent dynamic attention encoder, and training the WDA-DETR model based on the training set; The image to be detected is input into the trained WDA-DETR model, and the target detection result is output.