Adaptive sampling deformable attention for meta-learning small sample target detection

Through adaptive sampling, the number of sampling points can be adjusted to adjust the number of sampling points in meta-learning small sample object detection, and the feature extraction and detection performance is improved.

CN120411554APending Publication Date: 2025-08-01HENAN UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510382732.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the existing small sample object detection algorithm based on meta-learning, the number of deformable attention sampling points is fixed, resulting in insufficient extraction of target features and affecting detection performance.

Method used

Adaptive sampling is used to deform attention, determine the optimal threshold of the sampling point through the maximum inter-class variance method, and adaptively adjust the number of sampling points to improve the adequacy of feature extraction.

Benefits of technology

The performance of small sample object detection is improved, and the generalization ability of model detection in new class and the accuracy of feature extraction is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120411554A_ABST
    Figure CN120411554A_ABST
Patent Text Reader

Abstract

According to the adaptive sampling deformable attention used for meta-learning small sample target detection, an input feature map is processed through the adaptive sampling deformable attention, and the adaptive sampling deformable attention measures the correlation between feature points by calculating the cosine similarity between the feature points. According to the method, feature points are extracted, then the feature points are preliminarily screened according to a cosine similarity threshold, and finally the final sampling point number of the target feature points is calculated by using the thought of maximum between-class variance, so that the condition that some feature points are sampled too much or too little is avoided, and accurate sampling is realized. According to the method, adaptive sampling deformable attention is applied to small sample target detection based on meta-learning, the optimal threshold value of the sampling points is determined based on the maximum between-class variance method, the situation that the number of the deformable attention sampling points is fixed is avoided, the learning process of the detection algorithm pays more attention to the target itself, feature extraction is more sufficient, and the detection accuracy is improved. And the target detection performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of few-shot object detection methods based on meta-learning, and in particular to adaptive sampling deformable attention for few-shot object detection based on meta-learning. Background Art

[0002] Object detection models based on deep learning require a large number of labeled samples for training. When there are not enough samples or it is difficult to obtain annotations of samples, it is very difficult for existing mainstream object detection methods to achieve satisfactory results. Therefore, many scholars are currently exploring few-shot object detection tasks to solve this problem. Few-shot object detection is the integration of traditional object detection technology and few-shot learning technology, aiming to learn a detection model with generalization performance through a small number of labeled samples. Currently, the main methods of few-shot object detection are roughly divided into methods based on transfer learning and methods based on meta-learning.

[0003] The core idea of the few-shot object detection method based on transfer learning is as follows: First, pre-train the source domain model on a large-scale base class labeled dataset; then, fine-tune the parameters of the model based on a small number of target domain training samples. Although the training method of the few-shot object detection method based on transfer learning is simple, when the number of samples is extremely small, it is difficult to accurately represent the feature distribution of the entire category, resulting in a serious overfitting problem of the model and poor generalization ability. To overcome this overfitting problem and further improve the generalization ability of the model in few-shot object detection, a meta-learning strategy can be used.

[0004] The core idea of the few-shot object detection method based on meta-learning is as follows: By simulating a series of similar few-shot tasks, transfer the prior knowledge from the well-annotated base classes to the data-scarce new classes to address the problem of insufficient sample quantity. There are still two potential problems in the meta-learning-based method that hinder the full utilization of base class knowledge. First, the region-based detection framework relies on region proposals to generate the final predictions, so the detection results are sensitive to low-quality region proposals. And in the few-shot object detection task, it is not easy to generate high-quality region proposals for limited new classes. Second, most meta-learning-based methods use "feature reweighting" or its variants to aggregate query features and support features, and can only process one support class (i.e., the target class to be detected) at a time. In this case, the important inter-class correlations between different support classes are largely ignored.

[0005] To address the above limitations, scholars such as Zhang Gongjie abandoned the regional bounding box method in the paper "Meta-DETR: Image-level few-shot object detection with inter-class correlation exploitation", fully utilized the complementary relationship between classification and regression tasks, combined the popular Transformer model in recent years with meta-learning, and constructed a Meta-DETR framework. Meta-DETR combines meta-learning with Deformable DETR and performs pure image-level prediction. This framework can skip region proposal generation, avoid the problem of low quality of region proposals for new classes, and directly perform detection at the image level. In addition, Meta-DETR also introduces an inter-class correlation meta-learning strategy, allowing multiple support classes to be focused on at one time, fully utilizing the inter-class correlation, and reducing misclassification between similar classes. Although Meta-DETR solves the above problems, the deformable attention module in Meta-DETR selects a fixed number of values corresponding to each query, which will greatly limit the extraction of information related to target features. Summary of the Invention

[0006] To solve the problem that the number of sampling points of deformable attention in the meta-learning few-shot object detection algorithm is fixed, which leads to insufficient extraction of target features, the present invention provides an adaptive sampling deformable attention for meta-learning few-shot object detection.

[0007] The technical solution adopted by the present invention to solve the above technical problems is: an adaptive sampling deformable attention for meta-learning few-shot object detection processes the input feature map through the adaptive sampling deformable attention, and defines z q as the feature vector corresponding to the point in the input feature map x in q . p q is the position coordinate corresponding to the point in the input feature map q . The input feature map generates corresponding values Values through a convolution linear layer with learnable weights, and then z q generates K sampling offsets and K attention weights A respectively according to the adaptive sampling strategy through two different fully connected linear layers. Then, the generated sampling offset is superimposed on p q, obtain the positions of the corresponding points in Values, and then multiply the eigenvectors at the corresponding positions element-wise with the attention weights A and sum them up to obtain the corresponding q new eigenvector of the point. Finally, pass this vector through a fully connected linear layer to obtain the final output; The adaptive sampling deformable attention is expressed as: (1); In formula (1), M is the number of attention heads, and are the weights of the corresponding linear layers, K is the number of sampling offsets and attention weights, K The value-taking process of includes the following steps: Step 1: Flatten the input feature map into U = H×W , H and W are the height and width of the feature map, C is the number of channels; Let represent z the eigenvector of the m th feature point in , construct the similarity matrix (2); In formula (2), m and n represent two feature points, represents the dot product calculation, represents taking the modulus of Z ; Step 2: Filter the similarity matrix T through the similarity threshold S , and separately count the number of relevant feature points of each feature point in z to obtain the relevant number vector , z The number of relevant feature points of the i th feature point in (3); In formula (3), represents the indicator function, which takes 1 when ( S ( i , j ) > T ) and 0 otherwise; Step 3: Determine the optimal threshold based on the Otsu method Let v i denote N the i th value in n i denote N the i th occurrence count of the value in N The probability that the i th value in appears is: (4); N The global mean of is: (5); Using the threshold t to threshold N into C 1 and C 2, C The values in class 1 belong to the interval Min , t , Min being N the minimum value in N The probability that the i th value in C is assigned to class 1 is: (6); The cumulative mean of N is: (7); The between-class variance of N is: (8); Finally, the optimal threshold satisfying equation (9) is obtained t * : (9); Step 4: Separate the target features and background features in t * using the optimal threshold N The values greater than or equal to t * correspond to the target. Retain the values corresponding to the target in N Set the values less than t * to 0. Finally, take the value with the most occurrences after removing the 0 values in N as the value of K .

[0008] According to the above technical solution, the beneficial effects of the present invention are as follows: The present invention applies adaptive sampling deformable attention to few-shot object detection based on meta-learning. The adaptive sampling deformable attention determines the optimal threshold of sampling points based on the maximum inter-class variance method, avoiding the situation where the number of sampling points of deformable attention is fixed in existing few-shot object detection algorithms. Thus, it improves the few-shot object detection method based on meta-learning, making the learning process of the detection algorithm pay more attention to the object itself and the feature extraction more sufficient, and improving the object detection performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 represents deformable attention; Figure 2 represents the relevant aggregation module; Figure 3 represents the Meta-DETR few-shot object detection algorithm framework based on adaptive sampling deformable attention; Figure 4 represents heatmap visualization; Figure 5 represents the visualization result. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0010] The present invention provides adaptive sampling deformable attention for few-shot object detection based on meta-learning. The input feature map is processed by adaptive sampling deformable attention. Assume z q is a feature vector corresponding to a point in the input feature map x in q and p q is the position coordinate corresponding to a point in the input feature map q . First, the input feature map generates corresponding values Values through a weight-learnable convolutional linear layer. Then, z q generates K sampling offsets and K attention weights A respectively according to the adaptive sampling strategy through two different fully connected linear layers. Then, the generated offsets are superimposed on p q to find the position of the corresponding point in Values. Then, the feature vector at the corresponding position is multiplied element-wise with the attention weight A and added together to obtain a new feature vector corresponding to the q point. Finally, this vector passes through a fully connected linear layer to obtain the final output.

[0011] The adaptive sampling deformable attention is expressed as: (1); In formula (1), M is the number of attention heads, and are the weights of the corresponding linear layer, K is the number of sampling offsets and attention weights.

[0012] In the deformable attention mechanism, it is obviously unreasonable to sample a fixed number of times for each feature point q . For different feature points q , the number of their relevant feature points should not be fixed. For example, for the features in a complex background area, they usually contain more diverse elements, which will result in a lower correlation between background features, and the number of their relevant feature points should be less. While for the features in the target area, they usually have similar features, such as color, texture, etc., and the number of their relevant feature points should be more. A reasonable situation is to sample as many feature points related to the current feature point q as possible, and the degree of relevance can be measured by calculating the similarity between features. The process of obtaining the value of the present invention K is specifically as follows.

[0013] Step 1: Apply cosine similarity to describe the similarity degree between features.

[0014] Cosine similarity focuses on the direction of the vector and is not seriously affected by the length and amplitude of the vector. In addition, it is less sensitive to noise. In a convolutional network, feature vectors often have a lot of channel information, and cosine similarity can represent these features more stably.

[0015] The present invention applies cosine similarity to describe the similarity degree between features. First, flatten the input feature map into , where U = H×W , H and W are the height and width of the feature map, C is the number of channels. Let represent z the feature vector of the m -th feature point in , construct a similarity matrix , and calculate the cosine similarity between feature points. The formula is: In formula (2), m and n represent two feature points, represents the dot product calculation, represents taking the modulus of Z .

[0016] Step 2: Through the similarity threshold T filter the similarity matrix S and count the number of feature points related to each feature point in. The related number vector represents z the number of other feature points related to each feature point in, then z the number of other feature points related to the i th feature point in can be expressed as: (3); In formula (3), represents the indicator function, which takes 1 when ( S ( i , j ) > T ) is satisfied, and 0 otherwise.

[0017] Step 3: The object detection algorithm usually performs iterative training in batches, and the values in the related number vector N are not all equal. If different numbers of offsets and weights are to be generated for each feature, this will increase the computational complexity of the model. Therefore, before generating the offsets and weights for the feature map, a sampling number Num needs to be determined to represent the sampling number of each point in the entire feature map, and Num should be suitable for most target feature points. Through the learning of the network model, the cosine similarity between target feature points is often large, while the cosine similarity between the target and the background and between complex background feature points is small. After filtering through the similarity threshold T , in N for target feature points, the number of sampling points will be relatively large, while the number of sampling points for background feature points will be relatively small. Thus, the values in N will generally show two clusters. The present invention uses the maximum inter-class variance to find the optimal threshold t * of the cluster, and separates the target feature points from the background feature points through t * .

[0018] Assume N has L different values, where the maximum value is Max , and the minimum value is Min . Let v i represent N the i th value in, n i represents N thei The number of occurrences of a value N in i is such that the probability of the -th value occurring is: N The global mean of is: Suppose a threshold t is chosen such that Min ≤ t ≤ Max and it is used to threshold N into two classes C 1 and C 2, where the values in class C 1 belong to the interval Min , t . N The probability that the i -th value in C is assigned to class 1 is: N The cumulative mean of is: N The between-class variance of is: Thus, the optimal threshold t * maximizes to obtain the optimal threshold t * satisfying Equation (9), i.e.: (9).

[0019] Step Four: After obtaining t * it can be used to separate the target from the background features. Values greater than or equal to t * correspond to the target. Retain the values in N corresponding to the target and set the values less than t * to 0, i.e.: (10); In Equation (10), is the indicator function, which takes 0 when the condition in the parentheses is not satisfied and otherwise retains the original value.

[0020] Finally, find NThe value that appears most frequently after removing 0 values from K , K is the sampling number of the feature map.

[0021] The deformable attention structure based on adaptive sampling of the present invention is as Figure 1 shown.

[0022] Example: Combine the deformable attention based on adaptive sampling of the invention with the Meta-DETR few-shot object detection algorithm based on meta-learning. Use the deformable attention based on adaptive sampling to construct the encoder and decoder, and perform feature enhancement on the output of the relevant aggregation module in Meta-DETR, and finally realize object detection under few-shot conditions.

[0023] Meta-DETR combines meta-learning with Deformable DETR. This detection algorithm can skip region proposal generation and directly perform detection at the image level, completely bypassing the constraint of inaccurate region proposals, thus avoiding the problem of low quality of new class region proposals and being able to better generalize the base class knowledge to new classes. In addition, Meta-DETR also introduces a correlational aggregation module (CAM). CAM allows the model to focus on multiple support classes at one time, while aggregating the features of multiple support classes with the query feature to capture and utilize the inter-class correlations between different classes. To distinguish different support classes in a class-agnostic manner, CAM introduces a set of task encodings assigned to each support class. Finally, the decoder detects the object by predicting the location of the object and the corresponding task encoding.

[0024] CAM is a key component for associating inter-class features in Meta-DETR. It aggregates the query feature with the support feature for subsequent object class prediction. CAM can aggregate multiple support classes simultaneously, enabling it to capture the inter-class correlations between them to reduce misclassification and enhance the generalization ability of the model. The structure of CAM is as Figure 2 shown. The query feature and the support feature are first processed by weight-sharing multi-head attention to encode them into the same embedding space. Then, the support feature is aligned through the region of interest to obtain the class prototype vector of each support class, and then the class prototype vectors are average-pooled. Next, the query feature is feature-matched with the support class prototype vector, and the query feature is encoding-matched with the task encoding. Finally, the matching results are added and fed into a feed-forward network (FFN) to produce the final output.

[0025] (1) Feature matching Feature matching aims to filter out features irrelevant to the support classes and is achieved through the attention mechanism. Specifically, given a query feature map and the support class prototypes , where U = H×W , H and W are the height and width of the feature map, C is the number of support classes, d is the feature dimension, and the matching coefficient is obtained as follows: (11); where is and shared linear weights, ensuring that the support features and query features are encoded into the same feature space.

[0026] Subsequently, the output of the feature matching module can be expressed as: (12); where represents the sigmoid function, represents the Hadamard product. is the feature filter for each support class, which extracts only class-related features from the query features. By applying the matching coefficient L to , any query features that do not match the support classes can be filtered out, generating a query feature map that only highlights the targets of the given support classes .

[0027] (2) Encoding matching To implement relevant meta-learning, a task encoding is assigned to each support class, and the query features are matched with their corresponding task encodings to predict the task encodings. The task encoding is implemented by the sine function, and the encoding matching uses the same matching coefficient as the feature matching. The output of the encoding matching can be expressed as: (13); where L is the matching coefficient.

[0028] (3) Background modeling Since the background usually occupies most of the spatial positions in the query image, a learnable background prototype (BG-Prototype) and background encoding (BG-Encoding) are introduced to explicitly model the background class. When the query does not match any given support class, it can be considered as the background class.

[0029] Although Meta-DETR solves the above problems, the deformable attention module in Meta-DETR selects a fixed number of values corresponding to each query, which greatly limits the extraction of information related to target features.

[0030] The deformable attention based on adaptive sampling of the present invention is combined with the Meta-DETR few-shot object detection algorithm based on meta-learning. The encoder and decoder are constructed using the deformable attention based on adaptive sampling, and the output of the relevant aggregation module in Meta-DETR is feature-enhanced, ultimately achieving object detection under few-shot conditions. The overall framework of the Meta-DETR (improved Meta-DETR) algorithm based on deformable attention with adaptive sampling is as Figure 3 shown.

[0031] Experimental verification: Hardware environment: The CPU model is Intel(R) Core(TM) i7-14700KF, and the running memory is 32GB. The GPU model is NVIDIA GeForceRTX 4090D, and the video memory size is 24GB. Software environment: The operating system is Ubuntu22.04, based on the Pytorch deep learning framework, the programming language is Python3.8, and CUDA12.4 is used to accelerate the GPU. Experimental details: Use the AdamW optimizer with an initial learning rate of 2×10 -4 and a weight decay of 1×10 -4 , the batch size is set to 4, and the similarity threshold T takes the empirical value of 0.8. In the base training stage, the model is trained for 50 epochs, and the learning rate is decayed by 0.1 at the 45th epoch. In the fine-tuning stage, the same settings are applied to fine-tune the model until convergence.

[0032] 1. Dataset The present invention uses the Pascal VOC dataset for experiments. VOC2007 trainval + VOC2012trainval are used as training samples, and the test is conducted on VOC2007 test. The VOC dataset contains a total of 20 categories. The experiment adopts three different partitioning methods, which are consistent with the partitioning method in Meta-DETR. Each method selects 5 categories as new classes, and the remaining categories are regarded as base classes. The first partitioning method takes birds, buses, cows, motorcycles, and sofas as new classes. The second partitioning method takes airplanes, bottles, cows, horses, and sofas as new classes. The third partitioning method takes boats, cats, motorcycles, sheep, and sofas as new classes. For few-shot object detection, each new class has k target instances. kThey are 1, 2, 3, 5, and 10.

[0033] 2. Comparison with Advanced Methods To evaluate the effectiveness of this model, some representative classic small-sample object detection algorithms were selected for comparison, and the detection results are shown in Table 1. The algorithms involved in the comparison include: RepMet (RepMet: Representative-based metric learning for classification and one-shot object detection); Meta YOLO (Few-shot object detection via feature reweighting); Meta Det (Meta-learning to detect rare objected); Meta R-CNN (Meta R-CNN: Towards general solver for instance-level low-shot learning); TFA w / fc and TFA w / cos (Frustratingly simple few-shot object detection); FsDetView (Few-shot object detection and viewpoint estimation for objects in the wild); MPSR (Multi-Scale positive sample refinement for few-shot object detection); DCNet (Dense relation distillation with context-aware aggregation for few-shot object detection); FSCE (FSCE: Few-shot object detection via contrastive proposal encoding); CRK-Net (Class-relation reasoning with knowledge-transfer for few-shot object detection); MPF-Net (MPF-Net: multi-projection filtering network for few-shot object detection); Meta-DETR (Meta-DETR: Image-level few-shot object detection with inter-class correlation exploitation).

[0034] Table 1 New class detection results of different algorithms on the Pascal VOC dataset As can be seen from Table 1, compared with the classic Meta-DETR, Meta-DETR based on adaptive sampling deformable attention improves the new class detection accuracy by 0.9%, 0.7%, 1.4% and 2.1% respectively under 1, 2, 3, 10 shots in Partition Method 1, by 0.5%, 0.1%, 5.5% and 5.7% respectively under 2, 3, 5, 10 shots in Partition Method 2, and by 1.9%, 1.0%, 2.1% and 0.1% respectively under 2, 3, 5, 10 shots in Partition Method 3. Additionally, compared with other advanced algorithms, Meta-DETR based on adaptive sampling deformable attention has been improved to varying degrees under most Shot conditions in the three partition methods. Among them, compared with the advanced algorithm CRK-Net, Meta-DETR based on adaptive sampling deformable attention improves the new class detection accuracy by 0.4%, 5.1%, 8.5%, 1.3% and 0.2% respectively under 1, 2, 3, 5, 10 shots in Partition Method 1, by 3.0%, 0.5%, 3.2% and 6.0% respectively under 2, 3, 5, 10 shots in Partition Method 2, and by 4.4%, 9.1%, 7.8% and 3.3% respectively under 2, 3, 5, 10 shots in Partition Method 3. Compared with the advanced algorithm MPF-Net, Meta-DETR based on adaptive sampling deformable attention improves the new class detection accuracy by 3.3%, 0.4%, 4.9%, 4.6%, 2.1%, 5.5%, 4.9% and 3.6% respectively under 3 shots in Partition Method 1, 2, 5, 10 shots in Partition Method 2, and 2, 3, 5, 10 shots in Partition Method 3.

[0035] Table 2 shows the detection results on the base classes of Pascal VOC dataset Class Split 1 compared with other advanced algorithms. It can be seen that compared with Meta-DETR, the improved algorithm can not only achieve good detection results for new classes under limited training samples, but also improve the detection performance for most base classes. Under 1, 3, 10 shots in this partition method, the base class detection performance has been improved by 0.3%, 0.6% and 0.5% respectively. Compared with advanced algorithms such as FSCE, the improved algorithm also has certain competitiveness in the detection performance of base classes.

[0036] Table 2 Detection Results of Base Classes and New Classes in Pascal VOC Dataset Class Split 1 3. Ablation Experiment To verify the superiority of using cosine similarity to measure the similarity of two feature vectors, ablation experiments were conducted on 10-shot of Pascal VOC dataset Class Split 1 using multiple similarity measurement methods. The experimental results are shown in Table 3. Compared with Euclidean distance, Pearson distance, Manhattan distance, and Chebyshev distance, when using cosine similarity to measure the similarity degree of feature vectors, the new class detection results are 0.8%, 0.5%, 2.2%, and 1.5% higher respectively. Thus, it can be concluded that using cosine similarity to measure the similarity degree of feature vectors can more accurately determine the sampling number of deformable attention, thereby supporting object detection under few-shot conditions.

[0037] Table 3 Detection results of base classes and new classes using different similarity measurement methods 4. Visualization analysis (1) Visualization results of deformable attention To more clearly show the effect of the network model on the feature attention area, Eigen-CAM is used to visualize the features learned by the model, and observe the changes in the feature attention area of the detection algorithm at the encoder output layer after using fixed sampling and adaptive sampling. In the visualization results, different colors represent the degree of attention of the algorithm to different regions in the image. The red region represents the region that the algorithm pays the most attention to, and yellow, green, and blue represent the degree of attention to the image region decreasing in turn. As Figure 4 shown. The left column in the figure is the heatmap visualization result of Meta-DETR, and the right side is the heatmap visualization result of the improved Meta-DETR algorithm. Observing Figure 4 (b), it is found that the improved algorithm pays more attention to the potted plant itself, while Meta-DETR has a weaker degree of attention to the potted plant area. Observing Figure 4 (d), it can be obtained that the improved Meta-DETR algorithm focuses all its attention on the person, while Meta-DETR pays too much attention to the background part. Thus, it can be concluded that the improved Meta-DETR algorithm can still pay attention to the target itself under multi-object and complex background conditions. Observing Figure 4 other visualization results in it, the improved Meta-DETR algorithm can focus the attention on the target.

[0038] (2) Detection visualization results To further verify the detection performance of the algorithm of the present invention, Meta-DETR and the improved Meta-DETR algorithm are used to predict the image, and some representative images under different classifications are selected for visualization analysis, as Figure 5 shown. The left column in the figure is the detection result of Meta-DETR, and the right column is the detection result of the improved Meta-DETR algorithm. Figure 5In (a), for the occluded target, Meta-DETR missed the occluded white car, while the improved Meta-DETR algorithm detected the occluded white car; Figure 5 In (b), for small targets, Meta-DETR detected the two cars in the lower left corner as one car and the detection position was inaccurate, while the improved Meta-DETR algorithm detected the two cars in the lower left corner separately; Figure 5 In (c), for overlapping targets, Meta-DETR missed the person on the motorcycle and the person obscured by sand. The improved Meta-DETR algorithm not only detected both the overlapping person and the motorcycle, but also detected the person buried in the sand; Figure 5 In (d), for blurred targets, Meta-DETR missed the bicycle on the track, while the improved Meta-DETR algorithm detected it; Figure 5 In (e), for large targets, although both Meta-DETR and the improved Meta-DETR algorithm detected the target, the detection confidence of the improved Meta-DETR algorithm was higher. From the comparison, it can be seen that Meta-DETR has difficulty in detecting occluded targets ( Figure 5 (a)), small targets ( Figure 5 (b)), overlapping targets ( Figure 5 (c)), blurred targets ( Figure 5 (d)) and large targets ( Figure 5 (e)), while the performance of the improved Meta-DETR algorithm is relatively more robust.

Claims

1. Adaptive Sampling Deformable Attention for Few-Shot Object Detection in Meta-Learning, characterized in that: Process the input feature map through adaptive sampling deformable attention, and define z q as the feature vector corresponding to the point in the input feature map x in q . The input feature map generates corresponding values Values through a convolution linear layer with learnable weights. Then p q generates, according to the adaptive sampling strategy, q through two different fully connected linear layers z q a sampling offset K and and K an attention weight A . Then, the generated sampling offset is superimposed on p q to obtain the position of the corresponding point in Values. Then, the feature vector at the corresponding position is multiplied element-wise with the attention weight A and added together to obtain the new feature vector corresponding to the q point. Finally, this vector passes through a fully connected linear layer to obtain the final output; The adaptive sampling deformable attention is expressed as: (1); In formula (1), M is the number of attention heads, and are the weights of the corresponding linear layer, K is the number of sampling offsets and attention weights, K The value-taking process of includes the following steps: Step 1: Flatten the input feature map into , where U = H×W , H and W are the height and width of the feature map, C is the number of channels; Let denote z the feature vector of the m th feature point in , construct the similarity matrix, and calculate the cosine similarity between feature points. The formula is as follows: (2); In formula (2), m and n represent two feature points, denotes dot product calculation, denotes taking the modulus of Z ; Step 2: Through the similarity threshold T screen the similarity matrix S and respectively count z the number of related feature points of each feature point in to obtain the related number vector z wherein the number of the i th feature point related to other feature points is: (3); In formula (3), represents the indicator function, which takes 1 when the condition ( S ( i , j ) > T ) is satisfied, and 0 otherwise; Step 3. Determine the optimal threshold based on the Otsu method Let v i denote N the i -th value in n i denote N the number of times the i -th value appears in N The probability that the i -th value appears in is: (4); N The global mean value is: (5); By a threshold t threshold the N threshold processing to C 1 and C 2, C The values in class 1 belong to the interval Min , t , Min is N the minimum value in, N in the i th value is assigned to C The probability that the value belongs to class 1 is: (6); N The cumulative mean is: (7); N The between-class variance is: (8); Finally, the optimal threshold that satisfies Equation (9) is obtained t * : (9); Step 4: Through the optimal threshold t * Separate the target features from the background features in N . Values greater than or equal to t * correspond to the target. Retain the values corresponding to the target in N . Set the values less than t * to 0. Finally, use the value that appears most frequently after removing the 0 values in N as the value of K .