Infrared small target detection method based on query set optimization and contextual prior constraint

By constructing a contextual prior knowledge base and a cross-attention mechanism, combined with support set prototype matching and consistency verification, the problems of insufficient query set optimization and inadequate context utilization in infrared small target detection are solved, and highly reliable detection results are achieved.

CN122336264APending Publication Date: 2026-07-03CHINA UNIV OF MINING & TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610791779.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-03
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing infrared small target detection methods suffer from problems such as lack of query set optimization, crude use of context, and absence of verification mechanisms in scenarios with complex background interference, low target signal-to-noise ratio, and drastic scale changes, resulting in unreliable detection results and high false alarm rates.

Method used

A contextual prior knowledge base containing scene semantics, spatial layout, and neighborhood statistical characteristics is constructed. Adaptive frequency domain enhancement and multi-scale decomposition are performed on the infrared image query set. Joint reasoning of query features and contextual priors is realized through cross-attention mechanism. The detection results are output through dual constraints of supporting set prototype matching and contextual consistency verification.

Benefits of technology

It achieves high reliability, interpretability, and controllable false alarms in infrared small target detection under complex backgrounds, improving the reliability and adaptability of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122336264A_ABST
    Figure CN122336264A_ABST
Patent Text Reader

Abstract

This invention discloses an infrared small target detection method based on query set optimization and contextual prior constraints, belonging to the field of infrared image processing and target detection technology. The method first constructs a contextual prior knowledge base including scene semantics, spatial layout, and neighborhood statistical characteristics. Then, it adaptively enhances the infrared image query set, designs filters based on the frequency domain characteristics of the support set, and performs multi-scale decomposition according to the target size prior. Next, it performs cross-attention calculation between the optimized query features and the contextual prior to achieve query-context joint reasoning. Finally, it outputs the detection result through dual constraints of support set prototype matching and contextual consistency verification. This invention solves the problems of missed detections and false alarms caused by passive query set input and single saliency prior dependence in traditional methods, providing a highly reliable technical solution for infrared small target detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of infrared image processing and target detection technology, specifically involving an infrared small target detection method based on query set optimization and contextual prior constraints. It is particularly suitable for scenarios with complex background interference, low target signal-to-noise ratio, and drastic scale changes. The method adaptively enhances the infrared image query set, constructs a contextual prior knowledge base, and performs cross-attention joint reasoning. Through the dual constraints of support set prototype matching and contextual consistency verification, it realizes query-context joint reasoning and dynamic detection optimization, generating an intelligent infrared small target detection system with high reliability detection results. Background Technology

[0002] With the development of infrared imaging and target detection technologies, infrared small target detection has been widely explored for use in low signal-to-noise ratio scenarios such as security monitoring, precision guidance, and remote sensing. Leveraging its all-weather capability and concealed target perception advantages, infrared small target detection can integrate diverse information such as scene semantics, spatial layout, and neighborhood statistics to support high-reliability target recognition. However, infrared small target detection faces challenges such as complex background interference, drastic target scale changes, and extremely low signal-to-noise ratio. Traditional methods often struggle to build reliable, low-false-alarm, and low-false-detection intelligent detection systems due to passive query set input, single reliance on saliency priors, and fragmented contextual reasoning.

[0003] Existing infrared small target detection methods mostly rely on single feature extraction or template matching models, such as background suppression with filters, local contrast enhancement, and end-to-end detection using deep learning. While effective in local scenes, they generally suffer from three major drawbacks when facing complex environments: First, query set optimization is lacking; query features are passively input without adaptive enhancement based on the frequency domain characteristics of the support set, leading to noise sensitivity and insufficient feature representation. Second, context utilization is crude, relying solely on saliency priors or local contrast without integrating scene semantics, spatial layout, and neighborhood statistical characteristics for joint reasoning, resulting in limited background suppression capabilities. Third, verification mechanisms are absent; when query features contradict context priors, the lack of dual constraints based on support set prototype matching and context consistency verification raises questions about output reliability.

[0004] In recent years, techniques such as few-shot learning, attention mechanisms, and multi-scale decomposition have been introduced into the field of infrared target detection, making progress in improving feature representation capabilities. However, they still have significant limitations in infrared small target scenarios: they lack a unified optimization framework covering "scene-target-context-support-query," achieving only local feature enhancement; filter designs are mostly based on fixed parameters, without incorporating prior target size for multi-scale adaptive decomposition; and more importantly, a closed-loop detection mechanism from query optimization → context reasoning → prototype matching → consistency verification has not yet been established, resulting in stagnant system robustness and an inability to dynamically adjust with scene changes.

[0005] Therefore, there is an urgent need for an infrared small target detection method that can achieve adaptive optimization of the query set, deep constraints of the context prior, and support for prototype matching and intelligent consistency verification. This method should use a context prior knowledge base as the core semantic hub to break down the information barriers between query features and scene context. Through frequency domain filtering enhancement, multi-scale decomposition, and cross-attention joint reasoning, it should generate a dynamic detection view that includes spatial layout and neighborhood statistical characteristics, ultimately meeting the core requirements of modern infrared detection for detection reliability, reasoning interpretability, controllable false alarms, and target adaptability. Summary of the Invention

[0006] This invention provides an infrared small target detection method based on query set optimization and contextual prior constraints. The method constructs a contextual prior knowledge base encompassing scene semantics, spatial layout, and neighborhood statistical characteristics. It then performs adaptive frequency domain enhancement and multi-scale decomposition on the infrared image query set. Furthermore, it achieves joint inference of query features and contextual priors based on a cross-attention mechanism. Finally, it outputs highly reliable detection results through dual constraints of support set prototype matching and contextual consistency verification. This addresses the challenges of infrared small target detection in scenarios with complex background interference, low target signal-to-noise ratio, and drastic scale changes.

[0007] To achieve the above objectives, this invention provides an infrared small target detection method based on query set optimization and contextual prior constraints, comprising the following steps:

[0008] S1. Construct a contextual prior knowledge base that includes scene semantics, spatial layout and neighborhood statistical characteristics, and map the scene category, target spatial distribution pattern and background statistical features in infrared images to a unified prior representation space to form a multi-dimensional contextual prior vector.

[0009] S2. Adaptively enhance the infrared image query set, design an adaptive filter based on the frequency domain characteristics of the support set, and perform multi-scale decomposition according to the target size prior to generate an optimized query feature representation.

[0010] S3. Perform cross-attention calculation on the optimized query features and context priors to achieve query-context joint reasoning. Generate target candidate representations that integrate context constraints through multi-scale feature interaction and semantic alignment.

[0011] S4. By supporting the dual constraints of prototype matching and contextual consistency verification, the detection results are output. Similarity is calculated in the prototype metric space, and contextual consistency verification and spatial continuity constraints are applied to finally output highly reliable infrared small target detection results.

[0012] Furthermore, in S1, a contextual prior knowledge base is constructed that includes scene semantics, spatial layout, and neighborhood statistical characteristics, specifically including the following:

[0013] S1.1 Receive infrared image input data, including support for collecting infrared images and corresponding target object annotations ,in To support the number of images collected; and to simultaneously receive scene annotation information. It includes scene category tags such as sky, sea, ground, and city buildings;

[0014] S1.2. Perform scene semantic encoding on the support set images, and extract scene semantic vectors using a pre-trained scene classification network. It captures global semantic features and scene context information from infrared images; it performs spatial layout encoding on target location annotations that support a set of criteria, and uses a location embedding layer to embed the target bounding box coordinates. Mapped to spatial layout vector ,in To support the centralized target quantity, The coordinates of the target center are Target width and height;

[0015] S1.3 Perform statistical characteristic analysis on the neighborhood regions of the support set image, and extract a fixed-size neighborhood window centered on each target. Calculate the average gray value within the neighborhood. ,variance Local contrast and texture entropy This forms a neighborhood statistical feature vector. ;

[0016] S1.4, Transfer scene semantic vectors Spatial layout vector and domain statistical feature vector The input multi-dimensional prior fusion module aligns and fuses the data through concatenation, weighted summation, or cross-modal attention mechanisms to generate contextual prior vectors in a unified prior representation space. This vector comprehensively reflects the semantics of scene categories, the spatial distribution patterns of targets, and the statistical characteristics of the background. It serves as a contextual constraint for cross-attention calculation in the subsequent S3 module, guiding the target detection reasoning process of the query set.

[0017] Furthermore, the adaptive enhancement of the infrared image query set in S2 specifically includes the following:

[0018] S2.1, For the query set image Perform frequency domain analysis based on the support set image. To design an adaptive filter based on its frequency domain characteristics, firstly, a Fast Fourier Transform (FFT) is performed on the support set image to obtain its frequency domain representation. Analyze its spectral energy distribution to estimate the dominant frequency components of the background clutter. and the characteristic frequency band of the target signal ;

[0019] S2.2 Design of an adaptive bandpass filter based on the support set frequency domain characteristics Its transfer function satisfies:

[0020] ;

[0021] in, The center frequency of the target characteristic frequency band, For passband width parameter, For passband gain, The stopband attenuation coefficient is... For stopband width parameters, This is the dominant frequency of clutter. The transition band gain is used; an adaptive filter is applied to the query set image to obtain the frequency-domain enhanced query image. ;

[0022] S2.3. Perform multi-scale decomposition based on the prior target size, and estimate the target scale parameter set based on the size statistical distribution of the target in the support set. , of which each scale Cluster centers are determined by the width and height of the target support set; a Gaussian pyramid or Laplace pyramid is constructed for the enhanced query image. Perform multi-scale decomposition to generate multi-scale image sequences. :

[0023] S2.4. Feature extraction is performed on images at various scales using a shared-weight feature extraction network. Generate multi-scale query feature maps ,in , , For the first Spatial dimensions of a feature map at each scale The number of feature channels is used; an adaptive weighted fusion of multi-scale features is performed through a scale selection gating mechanism to generate an optimized query feature representation. Its calculation process satisfies:

[0024] ;

[0025] in, For the first The adaptive weights at each scale are determined by the gating network. Output and through Normalization yields, This is an upsampling operation used to align features at different scales to a uniform spatial resolution.

[0026] Furthermore, in S3, the optimized query features are cross-attentioned with the context prior to achieve query-context joint reasoning, specifically including the following:

[0027] S3.1 Optimize the query features With context prior vector Perform cross-attention calculations to construct a query-context joint reasoning module; define the spatial location of query features. The eigenvector at that location is , context prior vector Expanded to a prior feature map with the same size as the query feature space. Generate key vectors through linear projection Sum value vector ,in This indicates a splicing operation. The projection matrix is ​​learnable. For the prior feature map at the location The vector at that location;

[0028] S3.2 Calculate the query-context cross-attention weights for each position in the query feature map. Calculate its attention response relative to the global context prior:

[0029] ;

[0030] in, To query the projection matrix, These are the prior features after flattening. The dimension of the key vector. For position Spatial attention distribution to the global context; aggregate contextual information through attention weighting to obtain context-enhanced query features.

[0031] ;

[0032] in, Attention weight matrix The One element, For the first A vector of values ​​at each position;

[0033] S3.3 Perform multi-scale feature interaction and semantic alignment to enhance the contextualized query features. Cross-scale information interaction is performed with feature maps generated at various scales during the multi-scale decomposition stage; deformable convolutional or feature pyramid network (FPN) structures are used to pass contextual constraint information between different scales to ensure consistent alignment of small targets between deep semantic features and shallow spatial features.

[0034] S3.4 Generate target candidate representations with fused context constraints. Predict the target presence probability map on the context-enhanced feature map using a Region Proposal Network (RPN). and target attribute regression plot ,in The target attribute dimensions (including center point offset, target size, confidence, etc.) are defined; the output is a set of target candidate representations with fused context constraints. ,in For the first 1 candidate context-enhanced feature vector, For candidate bounding boxes, For candidate scores, The number of candidates.

[0035] Furthermore, the detection results output in S4, through dual constraints of supporting set prototype matching and context consistency verification, specifically include the following:

[0036] S4.1 Construct a prototype representation of the support set for the support set image. Feature extraction is performed on the target regions marked in the table, using a feature extraction network shared with the query set. Obtain target features from the support set The prototype vectors of the categories are calculated through the prototype network:

[0037] ;

[0038] in, To support the prototype vector of the target set, representing the central position of the target class in the feature space; for multi-class scenarios, the prototype of each class is calculated separately. ,in Number of categories;

[0039] S4.2. Perform similarity calculation in the prototype metric space for each target candidate representation generated in S3. Calculate the distance metric between it and the prototype of each category. Euclidean distance or cosine similarity can be used:

[0040] ;

[0041] Calculate the probability distribution of candidates belonging to each category based on distance metrics:

[0042] ;

[0043] in, This is a temperature coefficient used to adjust the sharpness of the probability distribution; the category corresponding to the maximum probability is used as the candidate predicted category, and... As prototype matching confidence ;

[0044] S4.3 Apply context consistency checks to perform dual verification on candidate targets that pass prototype matching:

[0045] Spatial consistency verification calculates the degree of matching between the candidate target location and the spatial distribution pattern of the target in the prior context, requiring the candidate location to... Satisfy spatial distribution constraints:

[0046] ;

[0047] in, This is a spatial distribution probability model learned based on the target location in the support set. Spatial consistency threshold;

[0048] Statistical property consistency verification involves extracting statistical features from the neighborhood of candidate targets. Calculate its neighborhood statistical features in the context prior. Similarity:

[0049] ;

[0050] in, This is an estimate of the standard deviation of a statistical characteristic distribution. The threshold is the statistical consistency threshold. If a candidate target fails the spatial consistency check or the statistical characteristic consistency check, it is judged as a false alarm and filtered out.

[0051] S4.4 Implement dual constraints on the output of support set prototype matching and context consistency verification, and retain only candidate targets that simultaneously meet the following conditions as the final detection result:

[0052] Condition 1: Prototype matching confidence ,in The preset prototype matching threshold;

[0053] Condition 2: Spatial consistency check passes, i.e. ;

[0054] Condition 3: Statistical characteristic consistency check passes, i.e. ;

[0055] Condition 4: Candidate Score ,in To detect the confidence threshold;

[0056] The final output is a set of highly reliable infrared small target detection results. ,in For the coordinates of the detection box, To predict category labels, The overall confidence score is calculated by weighted fusion of prototype matching confidence score, context consistency score, and candidate score; the detection result set It supports full-process backtracking, manual review, and performance evaluation, achieving high reliability and interpretability in infrared small target detection.

[0057] Beneficial Effects: This invention upgrades infrared small target detection from a passive input mode of single query features to a closed-loop detection framework of "prior guidance - query optimization - joint reasoning - dual verification" by constructing a contextual prior knowledge base that includes scene semantics, spatial layout, and neighborhood statistical characteristics. This effectively solves the problems of missed detections and false alarms caused by passive input of query sets and single reliance on saliency priors in traditional methods. By designing adaptive filters based on the frequency domain characteristics of support sets and performing multi-scale decomposition according to target size priors, the signal-to-noise ratio and scale adaptability of query features under complex background clutter are significantly enhanced. Through cross-attention joint reasoning of query features and contextual priors, the information barrier between query features and scene context is broken down, realizing deep constraints and dynamic fusion of scene semantics, spatial layout, and neighborhood statistical characteristics. Furthermore, through a dual-constraint output mechanism of support set prototype matching and contextual consistency verification, the similarity of candidate targets is quantified in the prototype metric space, and contextual consistency verification and spatial continuity constraints are applied, significantly improving the reliability, interpretability, and controllability of false alarms in the detection results. In summary, this invention provides a highly reliable technical solution for infrared small target detection, and is especially suitable for intelligent infrared detection tasks in challenging scenarios such as complex background interference, low target signal-to-noise ratio, and drastic scale changes. Attached Figure Description

[0058] Figure 1 This is a schematic diagram of the overall process of the present invention;

[0059] Figure 2 This is a flowchart of the construction process for the context-prior knowledge base;

[0060] Figure 3 This is a flowchart of query set adaptive enhancement and multi-scale decomposition.

[0061] Figure 4 This is a flowchart of query-context cross-attention joint reasoning;

[0062] Figure 5 It supports the output flowchart of prototype matching and consistency verification constraints; Detailed Implementation

[0063] The invention will now be further described with reference to the accompanying drawings.

[0064] Example

[0065] Furthermore, such as Figure 1 As shown, an infrared small target detection method based on query set optimization and contextual prior constraints includes the following steps:

[0066] S1. Construct a contextual prior knowledge base that includes scene semantics, spatial layout and neighborhood statistical characteristics, and map the scene category, target spatial distribution pattern and background statistical features in infrared images to a unified prior representation space to form a multi-dimensional contextual prior vector.

[0067] S2. Adaptively enhance the infrared image query set, design an adaptive filter based on the frequency domain characteristics of the support set, and perform multi-scale decomposition according to the target size prior to generate an optimized query feature representation.

[0068] S3. Perform cross-attention calculation on the optimized query features and context priors to achieve query-context joint reasoning. Generate target candidate representations that integrate context constraints through multi-scale feature interaction and semantic alignment.

[0069] S4. By supporting the dual constraints of prototype matching and contextual consistency verification, the detection results are output. Similarity is calculated in the prototype metric space, and contextual consistency verification and spatial continuity constraints are applied to finally output highly reliable infrared small target detection results.

[0070] Furthermore, such as Figure 2 As shown, the specific steps for constructing a contextual prior knowledge base in S1, which includes scene semantics, spatial layout, and neighborhood statistical characteristics, are as follows:

[0071] S1.1 Receive infrared image input data, including support for collecting infrared images and corresponding target object annotations ,in To support the number of images collected; and to simultaneously receive scene annotation information. It includes scene category tags such as sky, sea, ground, and city buildings;

[0072] S1.2. Perform scene semantic encoding on the support set images, and extract scene semantic vectors using a pre-trained scene classification network. It captures global semantic features and scene context information from infrared images; it performs spatial layout encoding on target location annotations that support a set of criteria, and uses a location embedding layer to embed the target bounding box coordinates. Mapped to spatial layout vector ,in To support the centralized target quantity, The coordinates of the target center are Target width and height;

[0073] S1.3 Perform statistical characteristic analysis on the neighborhood regions of the support set image, and extract a fixed-size neighborhood window centered on each target. Calculate the average gray value within the neighborhood. ,variance Local contrast and texture entropy This forms a neighborhood statistical feature vector. ;

[0074] S1.4, Transfer scene semantic vectors Spatial layout vector and domain statistical feature vector The input multi-dimensional prior fusion module aligns and fuses the data through concatenation, weighted summation, or cross-modal attention mechanisms to generate contextual prior vectors in a unified prior representation space. This vector comprehensively reflects the semantics of scene categories, the spatial distribution patterns of targets, and the statistical characteristics of the background. It serves as a contextual constraint for cross-attention calculation in the subsequent S3 module, guiding the target detection reasoning process of the query set.

[0075] Furthermore, such as Figure 3 As shown, the adaptive enhancement of the infrared image query set in S2 specifically includes the following:

[0076] S2.1, For the query set image Perform frequency domain analysis based on the support set image. To design an adaptive filter based on its frequency domain characteristics, firstly, a Fast Fourier Transform (FFT) is performed on the support set image to obtain its frequency domain representation. Analyze its spectral energy distribution to estimate the dominant frequency components of the background clutter. and the characteristic frequency band of the target signal ;

[0077] S2.2 Design of an adaptive bandpass filter based on the support set frequency domain characteristics Its transfer function satisfies:

[0078] ;

[0079] in, The center frequency of the target characteristic frequency band, For passband width parameter, For passband gain, The stopband attenuation coefficient is... For stopband width parameters, This is the dominant frequency of clutter. The transition band gain is used; an adaptive filter is applied to the query set image to obtain the frequency-domain enhanced query image. ;

[0080] S2.3. Perform multi-scale decomposition based on the prior target size, and estimate the target scale parameter set based on the size statistical distribution of the target in the support set. , of which each scale Cluster centers are determined by the width and height of the target support set; a Gaussian pyramid or Laplace pyramid is constructed for the enhanced query image. Perform multi-scale decomposition to generate multi-scale image sequences. ;

[0081] S2.4. Feature extraction is performed on images at various scales using a shared-weight feature extraction network. Generate multi-scale query feature maps ,in , , For the first Spatial dimensions of a feature map at each scale The number of feature channels is used; an adaptive weighted fusion of multi-scale features is performed through a scale selection gating mechanism to generate an optimized query feature representation. Its calculation process satisfies:

[0082] ;

[0083] in, For the first The adaptive weights at each scale are determined by the gating network. Output and through Normalization yields, This is an upsampling operation used to align features at different scales to a uniform spatial resolution.

[0084] Furthermore, such as Figure 4 As shown, in step S3, the optimized query features are cross-attentioned with the context prior to achieve query-context joint reasoning, specifically including the following:

[0085] S3.1 Optimize the query features With context prior vector Perform cross-attention calculations to construct a query-context joint reasoning module; define the spatial location of query features. The eigenvector at that location is , context prior vector Expanded to a prior feature map with the same size as the query feature space. Generate key vectors through linear projection Sum value vector ,in This indicates a splicing operation. The projection matrix is ​​learnable. For the prior feature map at the location The vector at that location;

[0086] S3.2 Calculate the query-context cross-attention weights for each position in the query feature map. Calculate its attention response relative to the global context prior:

[0087] ;

[0088] in, To query the projection matrix, These are the prior features after flattening. The dimension of the key vector. For position Spatial attention distribution to the global context; aggregate contextual information through attention weighting to obtain context-enhanced query features:

[0089] ;

[0090] in, Attention weight matrix The One element, For the first A vector of values ​​at each position;

[0091] S3.3 Perform multi-scale feature interaction and semantic alignment to enhance the contextualized query features. Cross-scale information interaction is performed with feature maps generated at various scales during the multi-scale decomposition stage; deformable convolutional or feature pyramid network (FPN) structures are used to pass contextual constraint information between different scales to ensure consistent alignment of small targets between deep semantic features and shallow spatial features.

[0092] S3.4 Generate target candidate representations with fused context constraints. Predict the target presence probability map on the context-enhanced feature map using a Region Proposal Network (RPN). and target attribute regression plot ,in The target attribute dimensions (including center point offset, target size, confidence, etc.) are defined; the output is a set of target candidate representations with fused context constraints. ,in For the first 1 candidate context-enhanced feature vector, For candidate bounding boxes, For candidate scores, The number of candidates.

[0093] Furthermore, such as Figure 5 As shown, the detection results output in S4 through dual constraints of supporting set prototype matching and context consistency verification specifically include the following:

[0094] S4.1 Construct a prototype representation of the support set for the support set image. Feature extraction is performed on the target regions marked in the table, using a feature extraction network shared with the query set. Obtain target features from the support set The prototype vectors of the categories are calculated through the prototype network:

[0095] ;

[0096] in, To support the prototype vector of the target set, representing the central position of the target class in the feature space; for multi-class scenarios, the prototype of each class is calculated separately. ,in Number of categories;

[0097] S4.2. Perform similarity calculation in the prototype metric space for each target candidate representation generated in S3. Calculate the distance metric between it and the prototype of each category. Cosine similarity is used:

[0098] ;

[0099] Calculate the probability distribution of candidates belonging to each category based on distance metrics:

[0100] ;

[0101] in, This is a temperature coefficient used to adjust the sharpness of the probability distribution; the category corresponding to the maximum probability is used as the candidate predicted category, and... As prototype matching confidence ;

[0102] S4.3 Apply context consistency checks to perform dual verification on candidate targets that pass prototype matching:

[0103] Spatial consistency verification calculates the degree of matching between the candidate target location and the spatial distribution pattern of the target in the prior context, requiring the candidate location to... Satisfy spatial distribution constraints:

[0104] ;

[0105] in, This is a spatial distribution probability model learned based on the target location in the support set. This is the spatial consistency threshold;

[0106] Statistical property consistency verification involves extracting statistical features from the neighborhood of candidate targets. Calculate its neighborhood statistical features in the context prior. Similarity:

[0107] ;

[0108] in, This is an estimate of the standard deviation of a statistical characteristic distribution. The threshold is the statistical consistency threshold. If a candidate target fails the spatial consistency check or the statistical characteristic consistency check, it is judged as a false alarm and filtered out.

[0109] S4.4 Implement dual constraints on the output of support set prototype matching and context consistency verification, and retain only candidate targets that simultaneously meet the following conditions as the final detection result:

[0110] Condition 1: Prototype matching confidence ,in The preset prototype matching threshold;

[0111] Condition 2: Spatial consistency check passes, i.e. ;

[0112] Condition 3: Statistical characteristic consistency check passes, i.e. ;

[0113] Condition 4: Candidate Score ,in To detect the confidence threshold;

[0114] The final output is a set of highly reliable infrared small target detection results. ,in For the coordinates of the detection box, To predict category labels, The overall confidence score is calculated by weighted fusion of prototype matching confidence score, context consistency score, and candidate score; the detection result set It supports full-process backtracking, manual review, and performance evaluation, achieving high reliability and interpretability in infrared small target detection.

[0115] Furthermore, in this embodiment, to verify the performance of the method of the present invention in infrared small target detection under complex backgrounds, the test set is input into the detection network with the same image patch size as in the training phase for prediction. The Intersection over Union (IoU), detection rate Pd, and false alarm rate Fa are used as quantitative evaluation indicators to compare the performance of this method with representative infrared small target detection methods. Considering that infrared small target detection is an image segmentation and target discovery task with a very low target area and a very high background pixel area, relying solely on a single accuracy indicator is insufficient to fully reflect the detection effect. Therefore, this embodiment uses three types of indicators—region overlap, target detection, and background false alarms—for comprehensive evaluation.

[0116] Among them, the Intersection over Union (IoU) measures the degree of overlap between the predicted target region and the real target region at the pixel level. A larger IoU indicates a more consistent prediction mask with the real mask, resulting in higher detection accuracy. The Detection Rate (Pd) measures the proportion of real infrared small targets successfully detected. A larger Pd indicates fewer missed detections and stronger target detection capability. The False Alarm Rate (Fa) characterizes the frequency of false alarms generated by the algorithm, reflecting the situation where background clutter or noise is mistaken for a target. A smaller Fa indicates a stronger ability of the algorithm to suppress complex backgrounds. The formulas for calculating the above indicators are:

[0117] ;

[0118] ;

[0119] ;

[0120] Where TP represents the number of pixels that are actually targets and are predicted as targets by the model, FP represents the number of pixels that are actually background but are incorrectly predicted as targets by the model, FN represents the number of pixels that are actually targets but are missed by the model and are predicted as background, TN represents the number of pixels that are actually background and are correctly predicted as background by the model, T=TP+FN represents the total number of pixels that are actually targets, and P=TP+FP represents the total number of pixels that are predicted as targets by the model.

[0121] In this embodiment, NUAA-SIRST, IRSTD-1K, and NUDT-SIRST were selected as test datasets. The method of this invention was compared with representative infrared small target detection methods such as ACM, ALCNet, DNA-Net, UIU-Net, MSHNet, SCTransNet, IstdVit, and HAFNet under a unified evaluation protocol. The comparison results are shown in the table below.

[0122]

[0123] The units for IoU and Pd in ​​the table are %, and the units for Fa are %. The results from the NUAA-SIRST dataset show that the IoU, Pd, and Fa of the method in this invention reach 80.02, 98.62, and 10.24, respectively. Compared with the best results of the comparison methods, the IoU is improved by 0.79 percentage points, the Pd is improved by 0.92 percentage points, and the Fa is reduced by 1.43×10^-6. This indicates that the method in this invention can detect weak targets more fully and reduce false alarms caused by background clutter while maintaining high regional overlap accuracy.

[0124] On the IRSTD-1K dataset, the IoU, Pd, and Fa of the method in this invention reached 71.53, 95.42, and 10.57, respectively. The IoU improved by 1.33 percentage points compared with the best result of the comparative methods, the Pd improved by 0.74 percentage points, and the Fa was also lower than the lowest value of the existing comparative methods. This shows that the query set adaptive enhancement and multi-scale decomposition under the target size prior can improve the target representation in low signal-to-noise ratio scenes, so that the model can still maintain stable target detection ability in complex backgrounds.

[0125] On the NUDT-SIRST dataset, the method of this invention achieves IoU, Pd, and Fa of 97.92, 99.54, and 0.75, respectively. Compared with the best results of the comparison methods, IoU is improved by 1.54 percentage points, Pd is improved by 0.24 percentage points, and Fa is reduced by 0.54 × 10⁻⁶. This demonstrates that, in situations with complex background structures and small target sizes, supporting prototype matching and contextual consistency verification can further filter candidate responses that are inconsistent with the real target, thereby improving the credibility of the detection results.

[0126] The experimental results from the three datasets show that the method of this invention achieves superior results in terms of IoU, Pd, and Fa, improving both the overlap between the predicted and actual target regions and reducing false alarms in complex backgrounds. These results demonstrate that the present invention, through query set adaptive optimization, contextual prior constraints, cross-attention joint inference, and support set prototype matching and consistency verification, forms a closed-loop detection mechanism, enabling more reliable detection results under conditions of weak texture, low contrast, and strong background interference for small infrared targets.

[0127] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. The scope of protection of the present invention should be determined by the scope of protection of the appended claims.

Claims

1. A method for infrared small target detection with query set optimization and contextual prior constraints, characterized in that, Includes the following steps: S1. Construct a contextual prior knowledge base that includes scene semantics, spatial layout and neighborhood statistical characteristics, and map the scene category, target spatial distribution pattern and background statistical features in infrared images to a unified prior representation space to form a multi-dimensional contextual prior vector. S2. Adaptively enhance the infrared image query set, design an adaptive filter based on the frequency domain characteristics of the support set, and perform multi-scale decomposition according to the target size prior to generate an optimized query feature representation. S3. Perform cross-attention calculation on the optimized query features and context priors to achieve query-context joint reasoning. Generate target candidate representations that integrate context constraints through multi-scale feature interaction and semantic alignment. S4. By supporting the dual constraints of prototype matching and contextual consistency verification, the detection results are output. Similarity is calculated in the prototype metric space, and contextual consistency verification and spatial continuity constraints are applied to finally output highly reliable infrared small target detection results.

2. The infrared small target detection method based on query set optimization and contextual prior constraints according to claim 1, characterized in that, The steps in S1 for constructing a contextual prior knowledge base that includes scene semantics, spatial layout, and neighborhood statistical characteristics specifically include: S1.1 Receive infrared image input data, including support for collecting infrared images and corresponding target object annotations ,in To support the number of images collected; and to simultaneously receive scene annotation information. It includes scene category tags such as sky, sea, ground, and city buildings; S1.

2. Perform scene semantic encoding on the support set images, and extract scene semantic vectors using a pre-trained scene classification network. It captures global semantic features and scene context information from infrared images; it performs spatial layout encoding on target location annotations that support a set of criteria, and uses a location embedding layer to embed the target bounding box coordinates. Mapped to spatial layout vector ,in To support the centralized target quantity, The coordinates of the target center are Target width and height; S1.3 Perform statistical characteristic analysis on the neighborhood regions of the support set image, and extract a fixed-size neighborhood window centered on each target. Calculate the average gray value within the neighborhood. ,variance Local contrast and texture entropy This forms a neighborhood statistical feature vector. ; S1.4, Transfer scene semantic vectors Spatial layout vector and domain statistical feature vector The input multi-dimensional prior fusion module aligns and fuses the data through concatenation, weighted summation, or cross-modal attention mechanisms to generate contextual prior vectors in a unified prior representation space. This vector comprehensively reflects the semantics of scene categories, the spatial distribution patterns of targets, and the statistical characteristics of the background. It serves as a contextual constraint for cross-attention calculation in the subsequent S3 module, guiding the target detection reasoning process of the query set.

3. The infrared small target detection method based on query set optimization and contextual prior constraints according to claim 1, characterized in that, The step of adaptively enhancing the infrared image query set in S2 specifically includes: S2.1, For the query set image Perform frequency domain analysis based on the support set image. To design an adaptive filter based on its frequency domain characteristics, firstly, a Fast Fourier Transform (FFT) is performed on the support set image to obtain its frequency domain representation. Analyze its spectral energy distribution to estimate the dominant frequency components of the background clutter. and the characteristic frequency band of the target signal ; S2.2 Design of an adaptive bandpass filter based on the support set frequency domain characteristics Its transfer function satisfies: ; in, The center frequency of the target characteristic frequency band, For passband width parameter, For passband gain, The stopband attenuation coefficient is... For stopband width parameters, This is the dominant frequency of clutter. The transition band gain is used; an adaptive filter is applied to the query set image to obtain the frequency-domain enhanced query image. ; S2.

3. Perform multi-scale decomposition based on the prior target size, and estimate the target scale parameter set based on the size statistical distribution of the target in the support set. , of which each scale Cluster centers are determined by the width and height of the target support set; a Gaussian pyramid or Laplace pyramid is constructed for the enhanced query image. Perform multi-scale decomposition to generate multi-scale image sequences. : S2.

4. Feature extraction is performed on images at various scales using a shared-weight feature extraction network. Generate multi-scale query feature maps ,in , , For the first Spatial dimensions of a feature map at each scale The number of feature channels is used; an adaptive weighted fusion of multi-scale features is performed through a scale selection gating mechanism to generate an optimized query feature representation. Its calculation process satisfies: ; in, For the first The adaptive weights at each scale are determined by the gating network. Output and through Normalization yields, This is an upsampling operation used to align features at different scales to a uniform spatial resolution.

4. The infrared small target detection method based on query set optimization and contextual prior constraints according to claim 1, characterized in that, The steps in S3 that involve performing cross-attention calculation between the optimized query features and contextual priors to achieve query-context joint reasoning specifically include: S3.1 Optimize the query features With context prior vector Perform cross-attention calculations to construct a query-context joint reasoning module; define the spatial location of query features. The eigenvector at that location is , context prior vector Expanded to a prior feature map with the same size as the query feature space. Generate key vectors through linear projection Sum value vector ,in This indicates a splicing operation. The projection matrix is ​​learnable. For the prior feature map at the location The vector at that location; S3.2 Calculate the query-context cross-attention weights for each position in the query feature map. Calculate its attention response relative to the global context prior: ; in, To query the projection matrix, These are the prior features after flattening. The dimension of the key vector. For position Spatial attention distribution to the global context; aggregate contextual information through attention weighting to obtain context-enhanced query features. ; in, Attention weight matrix The One element, For the first A vector of values ​​at each position; S3.3 Perform multi-scale feature interaction and semantic alignment to enhance the contextualized query features. Cross-scale information interaction is performed with feature maps generated at various scales during the multi-scale decomposition stage; deformable convolutional or feature pyramid network (FPN) structures are used to pass contextual constraint information between different scales to ensure consistent alignment of small targets between deep semantic features and shallow spatial features. S3.4 Generate target candidate representations with fused context constraints. Predict the target presence probability map on the context-enhanced feature map using a Region Proposal Network (RPN). and target attribute regression plot ,in The target attribute dimensions (including center point offset, target size, confidence, etc.) are defined; the output is a set of target candidate representations with fused context constraints. ,in For the first 1 candidate context-enhanced feature vector, For candidate bounding boxes, For candidate scores, The number of candidates.

5. The infrared small target detection method based on query set optimization and contextual prior constraints according to claim 1, characterized in that, The steps in S4 for outputting the detection results through the dual constraints of support set prototype matching and context consistency verification specifically include: S4.1 Construct a prototype representation of the support set for the support set image. Feature extraction is performed on the target regions marked in the table, using a feature extraction network shared with the query set. Obtain target features from the support set The prototype vectors of the categories are calculated through the prototype network: ; in, To support the prototype vector of the target set, representing the central position of the target class in the feature space; for multi-class scenarios, the prototype of each class is calculated separately. ,in Number of categories; S4.

2. Perform similarity calculation in the prototype metric space for each target candidate representation generated in S3. Calculate the distance metric between it and the prototype of each category. Euclidean distance or cosine similarity can be used: ; Calculate the probability distribution of candidates belonging to each category based on distance metrics: ; in, This is a temperature coefficient used to adjust the sharpness of the probability distribution; the category corresponding to the maximum probability is used as the candidate predicted category, and... As prototype matching confidence ; S4.3 Apply context consistency checks to perform dual verification on candidate targets that pass prototype matching: Spatial consistency verification calculates the degree of matching between the candidate target location and the spatial distribution pattern of the target in the prior context, requiring the candidate location to... Satisfy spatial distribution constraints: ; in, This is a spatial distribution probability model learned based on the target location in the support set. Spatial consistency threshold; Statistical property consistency verification involves extracting statistical features from the neighborhood of candidate targets. Calculate its neighborhood statistical features in the context prior. Similarity: ; in, This is an estimate of the standard deviation of a statistical characteristic distribution. The threshold is the statistical consistency threshold. If a candidate target fails the spatial consistency check or the statistical characteristic consistency check, it is judged as a false alarm and filtered out. S4.4 Implement dual constraints on the output of support set prototype matching and context consistency verification, and retain only candidate targets that simultaneously meet the following conditions as the final detection result: Condition 1: Prototype matching confidence ,in The preset prototype matching threshold; Condition 2: Spatial consistency check passes, i.e. ; Condition 3: Statistical characteristic consistency check passes, i.e. ; Condition 4: Candidate Score ,in To detect the confidence threshold; The final output is a set of highly reliable infrared small target detection results. ,in For the coordinates of the detection box, To predict category labels, The overall confidence score is calculated by weighted fusion of prototype matching confidence score, context consistency score, and candidate score; the detection result set It supports full-process backtracking, manual review, and performance evaluation, achieving high reliability and interpretability in infrared small target detection.