Infrared small target detection method based on scene text information guidance
By introducing scene text information into infrared small target detection and combining high-level semantic feature fusion of images and text, the problem of insufficient visual information in the existing technology is solved and more accurate infrared small target detection is achieved.
Patent Information
- Application Number
- CN202410745798.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-10-11
AI Technical Summary
Existing infrared small target detection algorithms rely only on visual information, making it difficult to further improve detection performance in complex scenes, especially under conditions of small size, weak signal, and scarce visual features.
By constructing a paired data set of text and images, we design an infrared small target detection network guided by scene text information, and use a pre-trained language model to map text prompts into embedding vectors to achieve high-level semantic feature fusion of image and text information, and through global And the local enhancement module retains the detailed information of infrared small targets and enhances the background clutter suppression ability of the model.
It effectively improves the performance of infrared small target detection, enhances the model's detection ability in complex scenes, reduces the false detection rate, and improves the recognition accuracy of small targets.
Smart Images

Figure CN118762364A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of target detection, and in particular relates to an infrared small target detection method based on scene text information guidance. Background Art
[0002] Infrared small target detection has a wide range of applications in military and civilian fields such as air defense warning, precision guidance and maritime surveillance. Due to the long distance between the infrared camera and the target, under the influence of atmospheric scattering, refraction and various noises, the small targets in the infrared image have the characteristics of low signal-to-noise ratio and lack of texture details. Therefore, how to achieve accurate and real-time infrared small target detection is a difficult problem. At present, infrared small target detection methods are mainly divided into traditional methods and deep learning-based methods. Traditional methods have the advantages of good interpretability and simple implementation, including methods based on image filtering, methods based on saliency measurement and methods based on component analysis, etc. However, their detection performance depends largely on the empirically designed scene priors and hyperparameter settings, and it is difficult to adapt to complex detection scenarios. Unlike traditional methods, methods based on deep convolutional neural networks can better mine the semantic information of infrared small targets in a data-driven way, further improving the detection performance, for example:
[0003] The patent document with application number (CN202211086622.1) proposes an infrared single-frame small target detection method based on the attention mechanism, establishes a multi-dimensional attention perception network architecture, and designs an encoding-decoding interactive guidance module to screen channel features that contribute more to the target. At the same time, a false alarm identification attention module composed of a non-local attention module and a non-local feature fusion module is designed to reduce the false alarm rate of detection.
[0004] The patent document with application number (CN202210658277.8) proposes an infrared small target detection method based on a bidirectional attention aggregation mechanism, which generates two attention maps through two parallel attention modules to promote the reconstruction of target shape and edges. At the same time, a Taylor center difference residual block is designed based on the Taylor center difference equation, which can aggregate edge information from different levels to make the edge of the target more refined.
[0005] From the above literature, we can see that compared with traditional infrared small target detection algorithms, deep learning-based methods have achieved significant performance improvements in many aspects. This is mainly due to the powerful feature extraction capabilities of deep learning models, which can better capture semantic information in images and achieve more accurate target detection. However, existing deep learning algorithms usually only mine the visual features of images for detection, and their performance in complex scenes for infrared small targets with small size, weak signals, and scarce visual features is still not ideal. Summary of the invention
[0006] In view of the defects and shortcomings of the above-mentioned prior art, the present invention proposes an infrared small target detection method based on scene text information guidance. By introducing a text prompt strategy for target and detection scene information, an effective cross-modal information fusion method is designed, which provides additional high-level semantic information for the small target detection network, effectively improving the detection performance of the model in complex scenes.
[0007] The main purpose of the present invention is to solve the problem that the existing infrared small target detection algorithm only relies on visual information and is difficult to further improve the detection performance. The technical scheme is: 1) constructing a paired data set of text and image; 2) constructing an infrared small target detection network model guided by scene text information: including using an encoder to extract the visual features of the infrared image; using a pre-trained language model to map the text prompts describing the scene information into an embedding vector to extract text features; realizing the fusion of high-level semantic features of image and text information through inner product operations, and calculating the text-image global matching loss to guide the network to focus on the target area of interest; in the upsampling structure, constructing a context enhancement module guided by text features, fully integrating the global and local features of text and image, and effectively retaining the infrared small target detail information; processing the upsampled feature map through a segmentation module to obtain the detection result; 3) iteratively training the infrared small target detection network model; 4) inputting the infrared image and text prompts into the trained model and outputting the detection result. This method introduces text prompt technology into the infrared small target detection model. Through effective cross-modal information fusion, it extracts high-level semantic features of infrared images from scene text prompts, effectively enhances the model's background clutter suppression capability, and further improves detection performance.
[0008] In view of the shortcomings of the prior art, the present invention proposes a method for infrared small target detection based on scene text information guidance. The method applies a cross-modal strategy, introduces text prompts into the existing infrared image dataset, and constructs a paired dataset of text and image. It is worth noting that the common text prompt templates in the CLIP (Contrastive Language-Image Pre-training, CLIP) model mainly focus on the semantic description of the object, such as "A photo of a [cls]", where [cls] represents the target category. However, for the infrared small target detection task, since the number of pixels occupied by the detection target in the image is very small and the information contained in the target is limited, the traditional text prompt strategy based on object semantics is not effective in describing the characteristics of such small targets. Therefore, in view of the special needs of infrared small target detection, the present invention proposes a new text prompt strategy, which not only focuses on the target itself, but also describes more about the environment and scene in which the target is located. In this way, the CLIP model can better utilize the contextual information in the scene to enhance the detection ability of small targets. In terms of network structure, the encoding stage uses an image encoder and a text encoder to encode the infrared small target image and the text prompt describing the scene information respectively, extracts the features of the infrared small target image and the text features perceived by the scene context, and realizes the fusion of high-level semantic features of image and text information through inner product operation. By calculating the text-image global matching loss to guide the network encoding, the target and background features are modeled separately, so as to better focus on the semantic information of the small target and the global features of the region of interest. In the decoding stage, a text feature-guided context enhancement module (TFGCE) is designed to use the semantic information in the text to supplement the lack of visual information and enhance the detection ability of small targets. Specifically, the upsampled feature map and the encoded text features are passed through the text feature-guided context enhancement module to enhance the target detail information and suppress irrelevant background information, providing richer and higher-dimensional information for the recognition and detection of infrared small targets. At the same time, in the upsampling process, considering that deep features usually lose the detail information of small targets, and in some complex scenes, small targets and backgrounds have high local similarities, it is necessary to learn the discriminative features between the background and small targets on a global scale to reduce false detections. Therefore, the present invention introduces a local enhancement module (LEM) and a global enhancement module (GEM) before fusing text features with image features, combining shallow detail information with deep global information to facilitate the fusion of text features and image features in the next step.The present invention overcomes the problem that the existing infrared small target detection algorithm based on deep learning only relies on image visual features and is difficult to further improve the detection accuracy. It introduces a cross-modal strategy guided by scene text information, combines the advantages of image processing and natural language processing, and realizes accurate infrared small target detection in complex scenes.
[0009] To achieve the above purpose, the basic idea of the scheme design of the present invention is: first, the text prompts describing the infrared image scene are introduced into the existing infrared data set to construct a paired data set of text and image; then, the visual features of the infrared image are extracted by using an image encoder; the text prompts are mapped into an embedding vector using a pre-trained language model to realize the extraction of text features; then, the high-level semantic feature fusion of image and text information is realized through an inner product operation, and the text-image global matching loss is calculated to guide the network to model the target and background features respectively, focusing on the target area of interest; in the upsampling structure, a context enhancement module guided by text features is constructed to fully integrate the global and local features of text and image, and effectively retain the detail information of small infrared targets; finally, the upsampled feature map is processed by a segmentation module to obtain the detection result.
[0010] The technical solution specifically adopted by the present invention to solve the technical problem is:
[0011] An infrared small target detection method based on scene text information guidance:
[0012] Firstly, the textual hints describing the infrared image scenes are introduced into the existing infrared dataset to construct a paired dataset of text and images.
[0013] Then, the infrared small target detection network model guided by scene text information is used to extract the visual features of the infrared image using the image encoder; the text prompts describing the scene information are mapped into embedding vectors using the pre-trained language model to extract text features; the high-level semantic features of the image and text information are then fused through the inner product operation, and the text-image global matching loss is calculated to guide the network to model the target and background features respectively, focusing on the target area of interest; in the upsampling structure, the global and local features of the text and image are fused through the context enhancement module guided by the text features, thereby retaining the detailed information of the infrared small target; the upsampled feature map is processed by the segmentation module to obtain the detection result;
[0014] The infrared small target detection network model is iteratively trained; infrared images and text prompts are input into the trained model, and detection results are output.
[0015] Furthermore, the specific implementation method of constructing the paired data set of text and image is as follows:
[0016] Step 11: Obtain a public infrared small target dataset with mask labels;
[0017] Step 12: Use natural language to describe the scene context information of the image in text form, and construct multiple sets of data pairs of "infrared image-scene segmentation label-target segmentation label-scene text prompt"; the prompt template used is "A photo of a [scene1] target in the [scene2] background", where [scene1] represents the scene where the target is located, and [scene2] represents the scene around the target; Step 13: Randomly shuffle the paired data sets of text and image, and divide them into training set and test set according to a certain ratio.
[0018] Furthermore, the processing process of the infrared small target detection network model is as follows:
[0019] Step 21: Performing preprocessing operations of random transformation, rotation, and brightness adjustment on the acquired infrared image set, and then standardizing and normalizing the image;
[0020] Step 22: Input the image to be tested of size H×W into the backbone network to extract image features; the backbone network is composed of a convolutional layer and three downsampling blocks; the steps of extracting features of the backbone network include: extracting shallow features using the convolutional layer, and then introducing nonlinearity through batch normalization and activation function; finally, obtaining three feature maps of different scale resolutions through three residual connected downsampling blocks; defining the feature map output by the encoder in s represents the downsampling factor;
[0021] Step 23: Use the large-scale pre-trained language model CLIP as the text encoder, and convert the text prompt containing scene information into a format suitable for the CLIP model, and then input it into the text encoder to convert the text into a continuous vector space N text feature vectors in; where the scene context-aware text feature vector output by the text encoder is defined At the same time, the weights of the text encoder are frozen during the training process to preserve the original capabilities of the pre-trained language model;
[0022] Step 24: By performing an inner product operation on the image feature tensor I and the text feature vector T, the two cross-modal features are fused, and the result is standardized by the Sigmoid activation function to obtain a text-image score map that contains both image information and text information. The score map describes the result of image-text matching;
[0023] Step 25: The text-image score map f undergoes bilinear interpolation, 3×3 convolution, batch normalization, ReLU activation function, 1×1 convolution, and Sigmoid activation function to obtain the coarse segmentation result of the input infrared image corresponding to the global scene.
[0024] Step 26: upsample the output I of the encoder and enhance the target detail information; wherein the upsampling process includes three upsampling modules, each module includes two parts: bilinear interpolation and channel-by-channel convolution, wherein the bilinear interpolation is used to enlarge the low-resolution feature map to the same size as the original image; the target detail information enhancement is achieved by a context enhancement module guided by text features, and finally a feature map Z with the same size as the input infrared image is generated n ;
[0025] Step 27: Transform the feature map Z n Input segmentation module, apply 3×3 convolution, batch normalization, ReLU activation function, 1×1 convolution and Sigmoid activation function to obtain the small target detection result map corresponding to the input image;
[0026] Step 28: Perform binary processing on each value of the output detection image and output a grayscale image. In the grayscale image, the area with a grayscale value of 1 is a white pixel, and the corresponding position is detected as a small infrared target. The area with a grayscale value of 0 is a black pixel, and the corresponding position is the background of the infrared image.
[0027] Furthermore, the target detail information enhancement is implemented by a context enhancement module guided by text features, which specifically includes the following sub-steps:
[0028] Step 261: Through the local enhancement module, the shallow feature X output by the encoder is used as input, and after 1×1 convolution, ReLU activation function, 3×3 convolution and Sigmoid activation function, a weight map L(X) guided by local information is generated;
[0029] Step 262: Through the global enhancement module, the upsampled deep feature Y is used as input, and the weight map G(X) guided by global information is obtained after global average pooling, full connection layer and Sigmoid activation function. G(X) is multiplied element by element with the input feature map to obtain the weighted feature map, and finally added to the original deep feature to obtain the final global weighted deep feature Y';
[0030] Step 263: perform element-by-element multiplication of the weight map L(X) guided by the local information and the global weighted feature Y' to obtain a feature map that highlights the global information and incorporates key local details. Finally, perform a residual connection between the weighted feature map and the original deep feature Y to obtain a fused enhanced image feature Z.
[0031] Step 264: The enhanced image feature Z and the text feature T output by the text encoder are subjected to multimodal feature fusion using a cross attention mechanism, and the query Q, key K and value V are defined. The calculation formula is:
[0032] Q=ZW Q , K = TW K , V = TW V ,
[0033] Where W Q , W K , W V is a learnable feature mapping matrix, and the calculation formula of the text-image fusion feature Z' is as follows:
[0034]
[0035] where d k is the scaling factor, W Z is a learnable weight matrix, weight QK T is a square matrix, which encodes the relationship between each image feature and all text features through the inner product layer. The weight is used to weight the input value to achieve the fusion of text-image features; Step 265: Repeat the process of steps 261-264, upsample the feature map and input the context enhancement module guided by the text feature until a feature map Z with the same size as the input infrared image is generated n .
[0036] Furthermore, in the process of iteratively training the infrared small target detection network model guided by scene text information through the training set:
[0037] The text-image global matching loss is defined as the binary cross entropy loss between the global rough segmentation result F obtained in step 25 and its corresponding scene segmentation label, and the formula is:
[0038]
[0039] Where x i,j represents the rough segmentation prediction result of the network in row i and column j, y i,j The labeled data corresponding to the scene segmentation label in row i and column j;
[0040] According to the network prediction results and the annotated data of the infrared image, the segmentation loss is calculated by binary cross entropy loss:
[0041]
[0042] Where p i,j represents the segmentation prediction result of the network in row i and column j, t i,jis the annotation data of the infrared image in row i and column j;
[0043] During the training process, the total loss function of the network is calculated as follows:
[0044] L=L axu +λL seg ,
[0045] Where L axu represents the text-image global matching loss, L seg represents the segmentation loss, and λ represents the hyperparameter for adjusting the segmentation loss weight.
[0046] Furthermore, the infrared small target detection network is written using the PyTorch deep learning framework, the network is trained using the training set obtained in step 13, and the total loss function L is calculated to update the network parameters. A total of c rounds of training are performed, the accuracy of each round of training is recorded, and the model with the highest accuracy is saved for testing.
[0047] Furthermore, the model trained in step 3 is used to detect the test set, the test results are output and the detection accuracy of the model on the test set is calculated.
[0048] And, an infrared small target detection device based on scene text information guidance, characterized in that: based on a computer system, the infrared small target detection method based on scene text information guidance as described above is used during operation.
[0049] A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: during operation, the infrared small target detection method based on scene text information guidance as described above is used.
[0050] Compared with the prior art, the present invention and its preferred embodiments have at least the following outstanding features and beneficial effects:
[0051] (1) In the field of infrared small target detection, the text prompt technology in natural language processing is innovatively introduced, and a text prompt strategy based on scene information guidance is designed for the infrared small target detection task. The multimodal information fusion method is used to enhance the feature expression ability of the target, overcoming the problem that the existing infrared small target detection algorithm only relies on the visual features of the image and performs poorly in complex scenes.
[0052] (2) A high-level semantic feature fusion method for image and text information is designed. The text semantic information in natural language processing is used to guide and optimize the network feature extraction process. By introducing scene context-aware text features and calculating the text-image global matching loss, the network is guided to model the target and background features separately during encoding. This can effectively distinguish the target from the background and reduce the false detection of clutter interference in non-interested areas.
[0053] (3) A context enhancement module guided by text features is designed. This module guides the refinement of image features by introducing text features in the decoding process, fully integrating the global and local features of text and image, providing richer contextual information for small targets, and enhancing the detection capability of small targets in complex backgrounds or low-contrast environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0055] Figure 1 is an overall flow chart of an embodiment of the present invention;
[0056] Figure 2 A schematic diagram of the structure of an infrared small target detection network model based on scene text information guidance constructed in an embodiment of the present invention;
[0057] Figure 3 A schematic diagram of the structure of a context enhancement module guided by text features in an embodiment of the present invention;
[0058] Figure 4 is a schematic diagram of the structure of a local enhancement module in an embodiment of the present invention;
[0059] Figure 5 Schematic diagram of the structure of the global enhancement module in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] In order to make the features and advantages of this patent more obvious and easy to understand, the following embodiments are specifically described in detail as follows:
[0061] It should be noted that the following detailed descriptions are illustrative and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0062] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0063] like Figure 1-Figure 5As shown, the embodiment of the present invention discloses an infrared small target detection method based on scene text information guidance, which is mainly based on the constructed infrared small target detection network model based on scene text information guidance. The typical specific implementation steps for achieving the purpose of the invention are as follows:
[0064] Step 1: Build a paired dataset of text and images, including a training set and a test set:
[0065] Step 1.1: Obtain a public infrared small target dataset with mask labels;
[0066] Step 1.2: Use natural language to describe the scene context information of the image, and construct multiple sets of "infrared image-scene segmentation label-target segmentation label-scene text prompt" data pairs. In order to more accurately describe the scene information of the infrared image, the present invention proposes a new prompt template "A photo of a [scene1] target in the [scene2] background.", where [scene1] represents the scene where the target is located, which can be expressed as an aerial target, a ground target, a sea target, etc., and [scene2] represents the scene around the target, including the sky background, the ground background, the sea background, the air-ground background, the sea-air background, the sea-land background, etc. The template writes scene text prompts for different infrared images in the existing data set by inputting scene prompt words. Compared with free-writing text prompts, the use of this prompt template helps to provide clearer scene guidance information, so that the neural network can learn and understand the image more effectively. Figure 2 The corresponding text prompt for the detection scene is "A photo of a [sky] target in the [sky-ground] background." The scene text information can be adjusted according to different task requirements. This flexibility enables the model to better adapt to new challenges and environmental changes;
[0067] Step 1.3: Randomly shuffle the paired data set of text and image, and divide it into training set and test set in a ratio of 7:3;
[0068] Step 2: Build an infrared small target detection network model guided by scene text information. The network structure is as follows: Figure 2 As shown:
[0069] Step 2.1: Perform preprocessing operations such as random transformation, rotation, and brightness adjustment on the acquired infrared image set to increase the diversity of the data set and improve the generalization ability of the model. Subsequently, the images are standardized and normalized to ensure that they have similar statistical properties;
[0070] Step 2.2: Input the image to be tested of size H×W into the improved backbone network (such as ResNet-20) for image feature extraction. The backbone network consists of a convolutional layer and three downsampling blocks. The steps of extracting features from the backbone network include extracting shallow features using a convolutional layer, and then introducing nonlinearity through batch normalization and activation functions. Finally, through three residual connected downsampling blocks, three feature maps of different scales and resolutions are obtained. Define the feature map output by the encoder in s represents the downsampling factor;
[0071] Step 2.3: Use the large-scale pre-trained language model CLIP as the text encoder and convert the text prompt containing scene information into a format suitable for the CLIP model, and then input it into the text encoder. This process converts the text into a continuous vector space The N text feature vectors in . Define the scene context-aware text feature vector output by the text encoder At the same time, the weights of the text encoder are frozen during the training process to preserve the original capabilities of the pre-trained language model;
[0072] Step 2.4: The two cross-modal features are fused by performing an inner product operation on the image feature tensor I and the text feature vector T, and the result is standardized by the Sigmoid activation function to obtain a text-image score map that contains both image information and text information. The score graph describes the result of image-text matching, and the inner product calculation formula is as follows:
[0073] f=Sigmoid(I·T T ),
[0074] Step 2.5: The text-image score map f undergoes bilinear interpolation, 3×3 convolution, batch normalization, ReLU activation function, 1×1 convolution, and Sigmoid activation function to obtain the coarse segmentation result of the input infrared image corresponding to the global scene.
[0075]
[0076] Step 2.6: Upsample the encoder output I and enhance the target detail information. The upsampling process includes three upsampling modules, each of which includes bilinear interpolation and channel-by-channel convolution. Bilinear interpolation is used to enlarge the low-resolution feature map to the same size as the original image, while channel-by-channel convolution helps to maintain the richness and diversity of features during the upsampling process. Figure 3 As shown in Figure 1, target detail information enhancement is achieved through a context enhancement module guided by text features, which specifically includes the following sub-steps:
[0077] Step 2.6.1: Construct a local enhancement module. The specific structure is as follows Figure 4 As shown in the figure: Considering that deep features extract semantic information of small targets, but usually lose the detailed information of the target, and small targets only occupy a few pixels in the original image, multiple downsampling processes will inevitably lead to the loss of spatial information, resulting in the network being unable to effectively capture the target. Therefore, the local enhancement module uses shallow features containing rich detailed information to train an attention mechanism to focus on the spatial position and detailed information of the target. Specifically, the shallow feature X output by the encoder is used as input, and after 1×1 convolution, ReLU activation function, 3×3 convolution and Sigmoid activation function, a weight map L(X) guided by local information is generated. The calculation formula is as follows:
[0078] X'=L(X)=σ(conv 3×3 (δ(conv 1×1 (X)))),
[0079] Among them, conv 1×1 represents 1×1 convolution, δ represents ReLU activation function, conv 3×3 represents 3×3 convolution, σ represents Sigmoid activation function;
[0080] Step 2.6.2: Construct a global enhancement module. The specific structure is as follows Figure 5 As shown: Considering that in some complex scenes, small targets and backgrounds are highly similar, it is often difficult to clearly distinguish targets from backgrounds by relying solely on local features. Therefore, the global enhancement module enhances the upsampled deep features. By learning the discriminative features between the background and small targets on a global scale, the network can more accurately identify targets when the targets are similar to the background, thereby reducing false detections. Specifically, the upsampled deep feature Y is used as input, and the weight map G(X) guided by global information is obtained through global average pooling, a fully connected layer, and a Sigmoid activation function. G(X) is element-wise multiplied with the input feature map to obtain a weighted feature map, which is finally added to the original deep feature to obtain the final global weighted deep feature Y'. The calculation formula is as follows:
[0081]
[0082] Among them, AvgPool represents global average pooling, F represents the fully connected layer, σ represents the Sigmoid activation function, represents element-wise multiplication;
[0083] Step 2.6.3: Perform element-by-element multiplication of the weight map L(X) guided by local information with the global weighted feature Y' to obtain a feature map that highlights global information and incorporates key local details. Finally, perform a residual connection between the weighted feature map and the original deep feature Y to obtain the fused enhanced image feature Z. The calculation formula is as follows:
[0084]
[0085] Step 2.6.4: Considering that small targets occupy very few pixels and lack visual features such as color and texture, detection in complex scenes relying solely on the fused enhanced image feature Z usually performs poorly. The text features obtained using the CLIP text encoder can provide deeper semantic information, helping the model to better understand the scene and object during decoding, guide the reconstruction of the feature representation of the target area, refine the target features and suppress irrelevant background information. Therefore, for the enhanced image feature Z and the text feature T output by the text encoder, the cross-attention mechanism is used for multimodal feature fusion, and the query Q, key K and value V are defined. The calculation formula is:
[0086] Q=ZW Q , K = TW K , V = TW V ,
[0087] Where W Q , W K , W V is a learnable feature mapping matrix, and the calculation formula of the text-image fusion feature Z' is as follows:
[0088]
[0089] where d k is the scaling factor, W Z is a learnable weight matrix, weight QK T is a square matrix that encodes the relationship between each image feature and all text features through the inner product layer. The weight is used to weight the input value to achieve the fusion of text-image features;
[0090] Step 2.6.5: Repeat the process of steps 2.6.1-2.6..4, upsample the feature map and input it into the context enhancement module guided by the text feature until a feature map Z with the same size as the input infrared image is generated. n ;
[0091] Step 2.7: Transform the feature map Z n Input segmentation module, apply 3×3 convolution, batch normalization, ReLU activation function, 1×1 convolution, Sigmoid activation function, and obtain the small target detection result map corresponding to the input image;
[0092] Step 2.8: Perform binary processing on each value of the output detection image and output a grayscale image. In the grayscale image, the area with a grayscale value of 1 is a white pixel, and the corresponding position is a small infrared target. The area with a grayscale value of 0 is a black pixel, and the corresponding position is the background of the infrared image.
[0093] Step 3: Design a loss function and iteratively train the infrared small target detection network model guided by scene text information through the training set:
[0094] Step 3.1: Define the text-image global matching loss as the binary cross entropy loss between the global rough segmentation result F obtained in step 2.5 and its corresponding scene segmentation label, and the formula is:
[0095]
[0096] Where x i,j represents the rough segmentation prediction result of the network in row i and column j, y i,j The labeled data in row i and column j of the corresponding scene segmentation label. By introducing scene context-aware text features, calculating and minimizing the text-image global matching loss can guide the network to model the target and background features separately during encoding, better focus on the semantic information of small targets and the global features of the region of interest, thereby effectively distinguishing the target from the background and reducing false detection of clutter interference in non-interested regions;
[0097] Step 3.2: Based on the network prediction results and the labeled data of the infrared image, the segmentation loss is calculated using the binary cross entropy loss:
[0098]
[0099] Where p i,j represents the segmentation prediction result of the network in row i and column j, t i,j is the annotation data of the infrared image in row i and column j;
[0100] Step 3.3: During the training process, the total loss function of the network is calculated as follows:
[0101] L=L axu +λL seg ,
[0102] Where L axu represents the text-image global matching loss, L seg represents the segmentation loss, and λ represents the hyperparameter for adjusting the segmentation loss weight.
[0103] Step 3.4 Use the PyTorch deep learning framework to write the infrared small target detection network guided by scene text information described in step 2, randomly select 20% of the samples from the training set obtained in step 1.3 as the validation set, and use the remaining 80% of the samples to train the infrared small target detection network guided by scene text information, and calculate the total loss function L to update the network parameters. Perform 300 rounds of training in total, record the accuracy of each round of training, and save the model with the highest accuracy for testing;
[0104] Step 4: Input the infrared images and text prompts in the test set into the trained model and output the detection results:
[0105] Use the model trained in step 3 to test the test set, output the test results and calculate the detection accuracy of the model on the test set.
[0106] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0107] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0108] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0110] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0111] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
[0112] This patent is not limited to the above-mentioned optimal implementation mode. Anyone can derive other various forms of infrared small target detection methods based on scene text information guidance under the inspiration of this patent. All equal changes and modifications made according to the scope of the patent application of the present invention should be covered by this patent.
Claims
1. A method for infrared small target detection based on scene text information guidance, Features: Firstly, the textual hints describing the infrared image scenes are introduced into the existing infrared dataset to construct a paired dataset of text and images. Then, the infrared small target detection network model guided by scene text information is used to extract the visual features of the infrared image using the image encoder; the text prompts describing the scene information are mapped into embedding vectors using the pre-trained language model to extract text features; the high-level semantic features of the image and text information are then fused through the inner product operation, and the text-image global matching loss is calculated to guide the network to model the target and background features respectively, focusing on the target area of interest; in the upsampling structure, the global and local features of the text and image are fused through the context enhancement module guided by the text features, thereby retaining the detailed information of the infrared small target; the upsampled feature map is processed by the segmentation module to obtain the detection result; The infrared small target detection network model is iteratively trained; infrared images and text prompts are input into the trained model, and detection results are output.
2. According to claim 1, a method for detecting small infrared targets based on scene text information guidance, Features: The specific implementation method of constructing the paired data set of text and image is as follows: Step 11: Obtain a public infrared small target dataset with mask labels; Step 12: Use natural language to describe the scene context information of the image, and construct multiple sets of "infrared image-scene segmentation label-target segmentation label-scene text prompt" data pairs; the prompt template used is "A photo of a [scene1] target in the [scene2] background", where [scene1] represents the scene where the target is located, and [scene2] represents the scene around the target; Step 13: Randomly shuffle the paired data sets of text and images and divide them into training sets and test sets according to a certain ratio.
3. According to claim 1, the infrared small target detection method based on scene text information guidance, Features: The processing process of the infrared small target detection network model is as follows: Step 21: Performing preprocessing operations of random transformation, rotation, and brightness adjustment on the acquired infrared image set, and then standardizing and normalizing the image; Step 22: Input the image to be tested of size H×W into the backbone network to extract image features; the backbone network consists of a convolutional layer and three downsampling blocks; The steps of extracting features from the backbone network include: extracting shallow features using convolutional layers, then introducing nonlinearity through batch normalization and activation functions; finally, obtaining feature maps of three different scales and resolutions through three residual connected downsampling blocks; defining the feature map output by the encoder in s represents the downsampling factor; Step 23: Use the large-scale pre-trained language model CLIP as the text encoder, and convert the text prompt containing scene information into a format suitable for the CLIP model, and then input it into the text encoder to convert the text into a continuous vector space N text feature vectors in; where the scene context-aware text feature vector output by the text encoder is defined At the same time, the weights of the text encoder are frozen during the training process to preserve the original capabilities of the pre-trained language model; Step 24: By performing an inner product operation on the image feature tensor I and the text feature vector T, the two cross-modal features are fused, and the result is standardized by the Sigmoid activation function to obtain a text-image score map that contains both image information and text information. The score map describes the result of image-text matching; Step 25: The text-image score map f undergoes bilinear interpolation, 3×3 convolution, batch normalization, ReLU activation function, 1×1 convolution, and Sigmoid activation function to obtain the coarse segmentation result of the input infrared image corresponding to the global scene. Step 26: upsample the output I of the encoder and enhance the target detail information; wherein the upsampling process includes three upsampling modules, each module includes two parts: bilinear interpolation and channel-by-channel convolution, wherein the bilinear interpolation is used to enlarge the low-resolution feature map to the same size as the original image; the target detail information enhancement is achieved by a context enhancement module guided by text features, and finally a feature map Z with the same size as the input infrared image is generated n ; Step 27: Transform the feature map Z n Input segmentation module, apply 3×3 convolution, batch normalization, ReLU activation function, 1×1 convolution and Sigmoid activation function to obtain the small target detection result map corresponding to the input image; Step 28: Perform binary processing on each value of the output detection image and output a grayscale image. In the grayscale image, the area with a grayscale value of 1 is a white pixel, and the corresponding position is detected as a small infrared target. The area with a grayscale value of 0 is a black pixel, and the corresponding position is the background of the infrared image.
4. According to claim 3, a method for detecting small infrared targets based on scene text information guidance, Features: The target detail information enhancement is achieved through a context enhancement module guided by text features, which specifically includes the following sub-steps: Step 261: Through the local enhancement module, the shallow feature X output by the encoder is used as input, and after 1×1 convolution, ReLU activation function, 3×3 convolution and Sigmoid activation function, a weight map L(X) guided by local information is generated; Step 262: Through the global enhancement module, the upsampled deep feature Y is used as input, and the weight map G(X) guided by global information is obtained after global average pooling, full connection layer and Sigmoid activation function. G(X) is multiplied element by element with the input feature map to obtain the weighted feature map, and finally added to the original deep feature to obtain the final global weighted deep feature Y'; Step 263: perform element-by-element multiplication of the weight map L(X) guided by the local information and the global weighted feature Y' to obtain a feature map that highlights the global information and incorporates key local details. Finally, perform a residual connection between the weighted feature map and the original deep feature Y to obtain a fused enhanced image feature Z. Step 264: The enhanced image feature Z and the text feature T output by the text encoder are subjected to multimodal feature fusion using a cross attention mechanism, and the query Q, key K and value V are defined. The calculation formula is: Q=ZW Q ,K=TW K ,V=TW V , Where W Q , W K , W V is a learnable feature mapping matrix, and the calculation formula of the text-image fusion feature Z' is as follows: where d k is the scaling factor, W Z is a learnable weight matrix, weight QK T is a square matrix that encodes the relationship between each image feature and all text features through the inner product layer. The weight is used to weight the input value to achieve the fusion of text-image features; Step 265: Repeat the process of step 261 to step 264, upsample the feature map and input it into the context enhancement module guided by the text feature until a feature map Z with the same size as the input infrared image is generated. n .
5. According to claim 4, a method for detecting small infrared targets based on scene text information guidance, Features: In the process of iterative training of the infrared small target detection network model guided by scene text information through the training set: The text-image global matching loss is defined as the binary cross entropy loss between the global rough segmentation result F obtained in step 25 and its corresponding scene segmentation label, and the formula is: Where x i,j represents the rough segmentation prediction result of the network in row i and column j, y i,j The labeled data corresponding to the scene segmentation label in row i and column j; According to the network prediction results and the annotated data of the infrared image, the segmentation loss is calculated by binary cross entropy loss: Where p i,j represents the segmentation prediction result of the network in row i and column j, t i,j is the annotation data of the infrared image in row i and column j; During the training process, the total loss function of the network is calculated as follows: L=L axu +λL seg , Where L axu represents the text-image global matching loss, L seg represents the segmentation loss, and λ represents the hyperparameter for adjusting the segmentation loss weight.
6. The infrared small target detection method based on scene text information guidance according to claim 5, Features: Use the PyTorch deep learning framework to write the infrared small target detection network, use the training set obtained in step 13 to train the network, and calculate the total loss function L to update the network parameters. Perform c rounds of training in total, record the accuracy of each round of training, and save the model with the highest accuracy for testing.
7. The infrared small target detection method based on scene text information guidance according to claim 6, Features: Use the model trained in step 3 to test the test set, output the test results and calculate the detection accuracy of the model on the test set.
8. An infrared small target detection device guided by scene text information, Features: Based on a computer system, the infrared small target detection method based on scene text information guidance as described in any one of claims 1 to 7 is used during operation.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, Features: During operation, the infrared small target detection method based on scene text information guidance as described in any one of claims 1-7 is used.
Citation Information
Patent Citations
Infrared small target detection method based on bidirectional attention aggregation mechanism
CN114882322A
Infrared single-frame small target detection method based on attention mechanism
CN115375668A
Cited By
Domain knowledge-driven multi-mode power inspection method, device and system
CN119048842A
A domain knowledge-driven multi-modal power inspection method, device and system
CN119048842B
Chip ceramic packaging substrate surface defect detection method based on multi-mode large model
CN119205787A
Method and device for automatically segmenting material and refining animation local target
CN119359878A
A method and device for automatically segmenting materials and refining local animation targets
CN119359878B
