Camouflaged target detection method based on frequency-guided spatial adaptation

By introducing a frequency-guided spatial adaptive method in camouflaged target detection, frequency information is used to enhance the model's recognition ability of camouflaged targets, which solves the problem of underutilization of frequency domain information in the existing technology and achieves more efficient camouflaged target detection. performance.

CN118379484BActive Publication Date: 2024-10-18NORTHWESTERN POLYTECHNICAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410788932.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-10-18
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

The existing technology only fine-tunes the pre-trained basic model from the spatial domain in camouflaged target detection, and cannot fully utilize the frequency domain information, resulting in insufficient recognition of subtle differences between the camouflaged target and the background.

Method used

A frequency-guided spatial adaptive detection method is designed. Through the frequency-guided spatial attention module, the frequency-based subtle difference mining module and the frequency-based feature enhancement module, the frequency components and subtle features are dynamically adjusted to enhance the model's ability to detect camouflage. Target recognition ability.

Benefits of technology

Significantly improves the accuracy and performance of camouflaged target detection, is able to more accurately capture the fine features of camouflaged targets, outperforms baseline methods, and achieves state-of-the-art performance on multiple COD benchmark datasets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118379484B_ABST
    Figure CN118379484B_ABST
Patent Text Reader

Abstract

The present invention provides a camouflaged target detection method based on frequency-guided spatial adaptation. By designing an adapter to extract and enhance detail information from the frequency domain, the model can more accurately capture the fine features of the camouflaged target. The first is a frequency-guided spatial attention module, which focuses more on the camouflaged target by dynamically adjusting the frequency components. On the basis of the first module, two other modules are designed, namely a frequency-based subtle difference mining module and a frequency-based feature enhancement module. The two together constitute an adapter responsible for the extraction and enhancement of subtle features. The present invention combines the general knowledge from the visual basic model and the specific task knowledge learned from the downstream COD task, and guides the pre-trained basic model to pay more attention to the camouflaged target in the spatial domain by adaptively adjusting the frequency components in the frequency domain space, achieving state-of-the-art performance on four widely used COD benchmark datasets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of camouflaged target detection, and in particular to a method for improving model detection performance based on a pre-trained basic model and frequency-guided spatial adaptiveness. Background Art

[0002] Camouflaged Object Detection (COD) aims to effectively identify and segment objects that are perfectly hidden in the surrounding environment. It has a wide range of applications, including disaster search and rescue, rare species protection, medical image segmentation, and agricultural pest detection. In recent years, the COD task has made great progress, but it is still challenging due to the extremely low contrast between the camouflaged target and the surrounding background. In addition, the types of camouflaged targets are diverse, covering various types from naturally camouflaged targets (such as mammals, insects, etc.) to artificially camouflaged targets (such as soldiers on the battlefield, body painting art, etc.). Camouflaged targets of different shapes, sizes, and textures further increase the complexity of the COD task.

[0003] In the field of COD, some existing works are devoted to designing methods for progressive feature enhancement from coarse to fine, or using additional edge information to accurately locate boundaries from the spatial domain / RGB domain of the image, while some other works explore methods to introduce frequency domain clues, because frequency-enhanced features have stronger discrimination for camouflaged targets and backgrounds.

[0004] In addition, with the emergence of large-scale pre-trained visual base models, such as InternetImage and SegmentAnything Model (SAM), a new research paradigm has attracted much attention in visual tasks. This method is to adapt the base model to a specific downstream task by fine-tuning a small number of additional trainable parameters (such as prompters or adapters) while keeping the pre-trained model parameters unchanged. Existing adapters are mainly divided into three categories: serial adapters, parallel adapters, and LoRA. In order to introduce image-related inductive biases into the pre-trained base model ViT (Vision Transformer), ViT-Adapter proposes a specific parallel adapter that aims to better aggregate multi-scale contextual information to improve the performance of the model in pixel-level dense prediction tasks.

[0005] Existing adapters only compensate features or weights from the spatial domain. However, fine-tuning the pre-trained base model only from the spatial domain for downstream COD tasks cannot fully exploit the advantages of frequency domain information. Compared with spatial domain information, the frequency domain has unique advantages because it contains some information that is difficult to observe in the spatial domain. For example, subtle changes in texture and pattern can be revealed by specific frequency components, which is particularly important in the detection of camouflaged targets. The spectral features presented by the frequency domain can provide valuable clues for identifying camouflaged targets. By adjusting the weights of different frequency components in the frequency domain, the distinguishing features between the target and the background can be enhanced, thereby more accurately locating and identifying camouflaged objects. Summary of the invention

[0006] In order to overcome the shortcomings of the prior art, the present invention provides a camouflaged target detection method based on frequency-guided spatial adaptation. In order to overcome the shortcomings of the prior art that only global context information in the spatial domain is considered and the subtle differences between the foreground and the background cannot be accurately located, the present invention proposes a camouflaged target detection method based on frequency-guided spatial adaptation, which extracts and enhances detail information from the perspective of the frequency domain by designing an adapter, so that the model can more accurately capture the fine features of the camouflaged target.

[0007] The technical solution of the present invention mainly includes three modules: the first is a frequency-guided spatial attention module, which focuses more attention on the camouflaged target by dynamically adjusting the frequency components. Based on the first module, two other modules are designed, namely a frequency-based subtle difference mining module and a frequency-based feature enhancement module, which together constitute an adapter responsible for the extraction and enhancement of subtle features.

[0008] The specific steps of the technical solution adopted by the present invention to solve its technical problem include the following:

[0009] Step 1: Dataset preparation;

[0010] Download four COD benchmark datasets: (1) CHAMELEON: contains 76 images in total; (2) CAMO: contains 1250 images in total, of which 1000 are used for training and 250 are used for testing, divided into eight categories, covering natural camouflage and artificial camouflage; (3) COD10K: contains 5066 images in total, of which 3040 are used for training and 2026 are used for testing; (4) NC4K: contains 4121 images in total, which is the largest test dataset and is used to evaluate the generalization ability of the model;

[0011] The training sets of CAMO and COD10K will be used to train the model, and the entire datasets of CHAMELEON and NC4K, as well as the test sets of CAMO and COD 10K will be used to test the model performance;

[0012] Step 2: Build a network model;

[0013] The adapter model structure includes a frequency-guided spatial attention module, a frequency-based subtle difference mining module, and a frequency-based feature enhancement module; the specific construction process of each module is as follows:

[0014] Step 2-1: Construct a frequency-guided spatial attention module (FGSAttn, Frequency-Guided SpatialAttention Module);

[0015] The frequency-guided spatial attention module consists of three stages: (1) converting the input features from the spatial domain to the frequency domain through Fourier transform; (2) adaptively adjusting different spectral components in the frequency domain; (3) returning to the spatial domain to obtain a spatial attention map to focus on the key areas of the camouflaged target;

[0016] In the first stage, the input feature F is first processed by average pooling and maximum pooling along the channel dimension, and then the two features after average pooling and maximum pooling are added element-wise to obtain a single-channel global feature. , the process is expressed as:

[0017] F g =AvgPool(F)+MaxPool(F)

[0018] Among them, F g represents the global feature, F represents the input feature, represents the average pooling operation, and MaxPool (.) represents the maximum pooling operation;

[0019] Then, the single-channel global feature F is transformed into g Convert to frequency domain and get the corresponding amplitude spectrum and phase spectrum ,Right now:

[0020]

[0021]

[0022]

[0023] in, represents the Fourier transform, and Respectively The real and imaginary parts of represents the amplitude spectrum, represents the phase spectrum, H, W represent the height and width of the image, h, w represent the two-dimensional coordinates of the spatial domain image, u, v represent the two-dimensional coordinates of the frequency domain image, represents the inverse tangent function;

[0024] In the second stage, since the amplitude component and the phase component retain the brightness information and the structural information of the image respectively, in order to improve the contrast between the foreground and the background while avoiding destroying the shape and structural information of the target in the spatial domain, the present invention keeps the phase spectrum unchanged and only adjusts the different frequency components in the amplitude spectrum;

[0025] First, the amplitude spectrum is frequency-centered, with the low-frequency component located at the center of the image and the high-frequency component located around it. The distance between a point in the amplitude spectrum and the center of the amplitude spectrum represents the size of the frequency component corresponding to the point. Therefore, the eigenvalues ​​in circles of different radii represent frequency components of different sizes, corresponding to different feature attributes in the spatial domain, such as the general shape of the target or edge details.

[0026] Then the amplitude spectrum is decomposed into many non-overlapping circular rings of width d along the radius dimension, representing the low-frequency to high-frequency components in the frequency domain from the inside to the outside; then the features in the same circular ring are grouped into the same channel to obtain Since the radius of each ring is different, the number of frequency components on each channel is also different; the present invention uses a mask tensor of the same size as the spectrum to record the channel number to which each point on the spectrum belongs, and the channel number is proportional to the distance from the point to the center of the circle. Then, the mask tensor is used to perform a global average pooling operation to obtain the mean of the frequency of each channel. Then, a full connection operation is performed on the frequency mean of all channels to obtain the attention weight. The attention weight of each channel is then compared with the frequency value of the corresponding channel in the spectrum. Multiply to get , the process is expressed as:

[0027]

[0028] in, represents pixel-level broadcast multiplication, represents global average pooling, Represents a fully connected sequence of operations consisting of a 1×1 convolution and a LeakyReLU activation function;

[0029] In the third stage, the features With the help of the mask tensor, we stack them one by one to get a new amplitude spectrum , the new amplitude spectrum and the original phase spectrum After inverse Fourier transformation ( ), perform maximum and minimum normalization on the result after inverse Fourier transform to generate the spatial attention map M:

[0030]

[0031] Finally, the output F obtained by the spatial attention mechanism and residual addition structure is out It is expressed as:

[0032]

[0033] Step 2-2: Construct a frequency-based nuances mining module (FBNM).

[0034] Since camouflaged targets always show very similar appearance features to nearby interfering objects and backgrounds, it is difficult to distinguish these subtle differences based on the spatial domain features of the base model alone. This paper designs a frequency-based subtle difference mining module that is inserted before all Transformer Layers of the base model Vision Tranformer (ViT) to mine the subtle differences between foreground and background.

[0035] First, the local spatial context of the input image is modeled by borrowing the convolution module of ResNet, which includes three 3×3 convolution kernels and a maximum pooling layer; then, three sequence operations are applied continuously to obtain multi-scale feature maps F1, F2 and F3 with subtle difference amplification; each sequence operation is a 3×3 convolution kernel with a stride of 2 to reduce the scale of the feature map, followed by an FGSAttn module (Frequency-GuidedSpatial Attention Module) that uses frequency domain information to adaptively adjust the features representing different visual attributes from a global perspective, thereby effectively highlighting the subtle differences in texture-rich areas.

[0036] Next, a 1x1 convolution is used to project the feature maps F1, F2, and F3 to the same dimension, flatten them into a one-dimensional sequence, and then concatenate them along the channel dimension to obtain features from the adapter stream of different scales. , On the one hand, it is used as the input of the next adapter module, and on the other hand, it is combined with the features output by the pre-trained basic model ViT. Perform Cross-Attention operations to obtain features that incorporate task-related knowledge , this feature Will be used as input to subsequent layers of ViT.

[0037] Step 2-3: Construct a frequency-based feature enhancement module (FBFE);

[0038] ViT encodes the relationship between all input tokens. However, in the COD task, the feature differences between different tokens in the spatial domain are very small, which makes it difficult for the model to distinguish candidate targets; therefore, it is important to enhance the ViT stream with more discriminative features learned from the adapter stream. This paper designs a frequency-based feature enhancement module inserted into the ViT network to enhance the features of the ViT stream to make full use of general knowledge and task-related knowledge;

[0039] First, the output features from the pre-trained base model ViT After processing by FGSAttn module ,The purpose is to highlight the target related areas under the guidance of the frequency domain information and ,at the same time suppress the background interference.

[0040] Then put As a query from the updated general knowledge The information related to the target is extracted, and the new adapter features are obtained through the residual addition structure and the feedforward convolutional network. , the process is expressed as:

[0041]

[0042]

[0043] in, represents the cross attention mechanism, Represents a convolutional feed-forward network to make up for the shortcomings of fixed-size position embedding; represents a feature from an adapter stream, represents the features output by the FGSAttn module, represents the intermediate features obtained after the cross attention mechanism and residual addition, Represents the output features obtained after the feedforward convolutional network and the residual addition;

[0044] Then, As keys and values, As a query, we inject task-related knowledge into the features of the pre-trained base model ViT through the cross-attention mechanism and obtain :

[0045]

[0046] The last FBFE module only outputs the adapter features To the COD testing network;

[0047] Step 3: Loss function;

[0048] The loss function includes weighted binary cross entropy loss With weighted IoU loss ;

[0049] The overall loss function is defined as follows:

[0050]

[0051] By calculating the difference between the center pixel and its surroundings, each pixel is assigned a different weight, so that difficult pixels receive more attention. and They are used to form pixel constraints and global constraints on the network respectively;

[0052] The images in the training set are input into the network model to obtain the prediction results, and then the loss function is calculated by comparing the prediction results with the actual pixel-level labels. The model parameters are optimized by minimizing the loss function until the maximum number of iterations is reached. After the model training is completed, the test set images are input into the trained model to obtain advanced prediction results.

[0053] The beneficial effects of the present invention are:

[0054] 1) We propose a novel Frequency-Guided Spatial Adaptation Network (FGSA-Net) that combines general knowledge from the visual base model with task-specific knowledge learned from the downstream COD task.

[0055] 2) The present invention designs a frequency-guided spatial attention module, and designs an adapter module based on this, which guides the pre-trained basic model to pay more attention to the camouflaged target in the spatial domain by adaptively adjusting the frequency components in the frequency domain space.

[0056] The proposed method outperforms the baseline methods by a large margin and achieves state-of-the-art performance on four widely adopted COD benchmark datasets. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 4 is a frame diagram of the frequency-guided spatial adaptive network (FGSA-Net) of the method of the present invention.

[0058] Figure 24 is a structural diagram of a frequency-based subtle difference mining module (FBNM) of the method of the present invention.

[0059] Figure 3 It is a structural diagram of the frequency-based feature enhancement module (FBFE) of the method of the present invention.

[0060] Figure 4 It is a structural diagram of the frequency-guided spatial attention module (FGSAttn) of the method of the present invention.

[0061] Figure 5 It is a comparison chart of the visualization results of the method of the present invention and other six classical COD methods in the embodiment. DETAILED DESCRIPTION

[0062] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0063] In order to make the technical solution, purpose and effect of the present invention more clearly understood, the specific implementation mode of the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0064] like Figure 1 As shown, the present invention specifically includes the following steps:

[0065] Step 1: Dataset preparation;

[0066] Four COD benchmark datasets were downloaded: (1) CHAMELEON: contains 76 images in total; (2) CAMO: contains 1250 images in total (1000 for training and 250 for testing), divided into eight categories, covering natural camouflage and artificial camouflage; (3) COD10K: contains 5066 images in total (3040 for training and 2026 for testing); (4) NC4K: contains 4121 images in total, which is the largest test dataset and is used to evaluate the generalization ability of the model.

[0067] Among them, the training sets of CAMO and COD10K will be used to train the model, and the entire data sets of CHAMELEON and NC4K, as well as the test sets of CAMO and COD 10K will be used to test the detection model performance.

[0068] Before training, the input image needs to be augmented. The specific method is: first adjust the size of the input image to 2048×512, then use random cropping to get an image of size 512×512, and perform data augmentation by horizontally flipping the image with a probability of 0.5. When testing, you only need to scale the image input to the network to a size of 512×512.

[0069] At this point, the dataset preparation is complete.

[0070] Step 2: Network model construction;

[0071] The adapter model structure consists of three parts: frequency-guided spatial attention module, frequency-based subtle difference mining module and frequency-based feature enhancement module. The construction process of each part is as follows:

[0072] Step 2-1: Construct a frequency-guided spatial attention module (FGSAttn);

[0073] The detailed architecture of the frequency-guided spatial attention module is as follows Figure 2 As shown in Figure 2, the input feature F is processed by average pooling and maximum pooling operations along the channel dimension, and the obtained pooled features are then merged at the element level to obtain a unique single-channel global feature F. g , the process can be expressed as:

[0074]

[0075] Then, the global features are transformed into Convert to frequency domain and get the corresponding amplitude spectrum and phase spectrum ,Right now:

[0076]

[0077]

[0078]

[0079] in, represents the Fourier transform, and Respectively The real and imaginary parts of .

[0080] Amplitude spectrum After performing the frequency centering operation, the lowest frequency component is moved to the center, and the high frequency components are located around it. Then the amplitude spectrum is decomposed into many non-overlapping rings of width d along the radius dimension, representing the low-frequency to high-frequency components in the frequency domain from the inside to the outside. Then the features in the same ring are grouped into the same channel to obtain . Since the radius of each ring is different, the number of frequency components on each channel is also different. In order to deal with this situation, the solution of the present invention is to use a mask tensor of the same size as the spectrum to record the channel number to which each point on the spectrum belongs. The channel number is proportional to the distance from the point to the center of the circle. Then, the mask tensor is used to perform a global average pooling operation to obtain the mean of all frequencies of each channel, and a full connection operation is performed on it to obtain the attention weight, which is then combined with the frequency value of the corresponding channel in the spectrum. Multiply them together and you get , the process can be expressed as:

[0081]

[0082] in, represents pixel-level broadcast multiplication, represents global average pooling, Represents a sequence of operations consisting of a 1×1 convolution and a LeakyReLU activation function.

[0083] Then, the processed features With the help of the mask tensor, we stack them one by one to get a new amplitude spectrum . Combined with the original phase spectrum After inverse Fourier transform ( ) and maximum and minimum normalization can generate the spatial attention map M, that is:

[0084]

[0085] Finally, the output F obtained by the spatial attention mechanism and residual addition structure is out It can be expressed as:

[0086]

[0087] Step 2-2: Construct a frequency-based subtle difference mining module (FBNM);

[0088] The frequency-based subtle difference mining module is derived from FGSAttn and aims to mine the subtle differences between foreground and background. The detailed architecture is as follows: Figure 2 shown.

[0089] First, the local spatial context of the input image is modeled using the standard convolutional module of ResNet, which consists of three 3×3 convolutional kernels and a maximum pooling layer. Then, three consecutive sequences are applied to gradually aggregate multi-scale features with subtle difference amplification, each sequence containing a 3×3 convolutional kernel and a FGSAttn module, to obtain F1, F2, and F3.

[0090] Next, a 1x1 convolution kernel is used to project the feature maps F1, F2, and F3 to the same dimension, flatten them into a one-dimensional sequence, and then concatenate them along the channel dimension to obtain features from the adapter stream of different scales. . On the one hand, it is used as the input of the next adapter module, and on the other hand, it is combined with the features output by the pre-trained basic model ViT. Perform Cross-Attention operations to obtain features that incorporate task-related knowledge , this feature will be used as input to the subsequent layers of ViT.

[0091] Step 2-3: Construct a frequency-based feature enhancement module (FBFE);

[0092] The frequency-based feature enhancement module is inserted after each K layers of the ViT network to enhance the features of the ViT stream to fully utilize general knowledge and task-related knowledge. The detailed architecture is as follows: Figure 3 shown.

[0093] Output of the pre-trained ViT model First, we get the Then, As a query, As key key and value value, cross attention operation is performed, and the updated adapter features are obtained through residual addition and feed-forward convolution network. , the process can be expressed as:

[0094]

[0095]

[0096] in, represents the cross attention mechanism, Represents a feed-forward convolutional network.

[0097] Then As key and value, As a query, we inject task-related knowledge into the features of ViT through the cross-attention mechanism and obtain .Right now:

[0098]

[0099] Note that the last FBFE module only outputs the adapter features used for detection. .

[0100] Step 3: Loss function;

[0101] The loss function includes a weighted binary cross entropy loss ( ) and weighted IoU loss ( );

[0102] The overall loss function is expressed as:

[0103]

[0104] By calculating the difference between the center pixel and its surroundings, each pixel is assigned a different weight, so that difficult pixels receive more attention.

[0105] and They are used to form pixel constraints and global constraints on the network, respectively.

[0106] Step 4: Network training;

[0107] Training set: CAMO training set (1000 images) and COD10K training set (3040 images);

[0108] Experimental settings: ViT-Large is used as the pre-trained base model and initialized with the weights released by Uni-Perceiver-L. UperNet is used as the COD detection head. The images are uniformly resized to 512×512, and the initial learning rate is 6×10 −5 The model was optimized using the AdamW optimizer with a weight decay rate of 0.05, and the batch size was set to 2. The model was trained for 200 epochs in total. The validation set was used to test the network effect at the end of each epoch, and the network parameters with the best effect were saved.

[0109] Training process: The image containing the camouflaged target is input into the large pre-trained base model and the lightweight adapter module at the same time. The large base model loads the weights pre-trained on multimodal data and keeps the parameters frozen. The parameters of the adapter module and the COD detection head are randomly initialized, and only the parameters of the adapter module and the detection head are fine-tuned, so that the general knowledge learned by the base model can be effectively transferred to the downstream COD task.

[0110] The specific process is as follows Figure 4 As shown in Figure 1, the input image is first serialized into tokens and fed into the FBNM module together with the original image to capture the prior knowledge of the subtle differences between the foreground and background. Then, the tokens containing task-related knowledge and multi-scale features are fed into the backbone network and FBFE module along the ViT feature stream and the adapter feature stream, respectively. In order to adapt the general knowledge of the pre-trained model to specific downstream tasks, an FBFE module is inserted after each K layer of the base model, as shown in Figure 1. Figure 2 and Figure 3As shown in the figure, the feature distribution is automatically calibrated in the frequency domain, and the knowledge of the two streams is interactively operated, so that they can share information with each other and promote their respective feature enhancement. After adaptation, the multi-scale features output by the last FBFE module are input into the COD detection head to generate a more refined and accurate prediction map.

[0111] Step 5: Network test;

[0112] ① Test set: CHAMELEON dataset (76 images), NC4K dataset (4121 images), CAMO test set (250 images) and COD10K test set (2026 images);

[0113] ② Experimental settings: The image input is uniformly resized to 512×512, and the output is resized to the initial size;

[0114] ③Testing process: Load the best network parameters saved in the training phase to test the input image to verify the effectiveness of the model;

[0115] Output results: Visualization results are as follows Figure 5 As shown, from left to right are the original image, the true label, the prediction result of the present invention, and the visualization results of other comparison methods. The first column is the original image, the second column is the true label, the third column is the prediction result of the present invention, the fourth column is FDNet (Frequency Domain Network), the fifth column is JSCOD (Joint Salient Object and Camouflaged Object Detection), the sixth column is ZoomNet (Zoom In and Out Network), the seventh column is SINetV2 (Search Identification Network V2), the eighth column is TINet (Texture-aware Interactive guidance Network), and the ninth column is SINet (Search Identification Network)

[0116] It can be seen that the present invention (column 3) achieves more competitive visual performance mainly in the following aspects: more accurate positioning and complete prediction of targets in low-contrast scenes (row 1), stronger interference suppression ability when there are confusing objects in the surrounding environment (row 2), and more accurate recognition of complex fine structures (such as slender details of objects) (row 3). In addition, in the face of other challenging camouflage cases, such as unclear boundary definition, small targets, multiple targets and occluded targets (rows 4 to 7), the method proposed in the present invention can accurately identify and segment camouflaged targets. Other methods are more or less interfered, resulting in incorrect positioning, which further verifies the effectiveness of the frequency-guided spatial adaptive network proposed in the present invention.

Claims

1. A method for detecting camouflaged targets based on frequency-guided spatial adaptation, characterized in that The steps include: Step 1: Dataset preparation; Download four camouflaged object detection COD benchmark datasets: CHAMELEON, CAMO, COD10K, and NC4K; The training sets of CAMO and COD10K will be used to train the model, and the entire datasets of CHAMELEON and NC4K, as well as the test sets of CAMO and COD 10K will be used to test the model performance; Step 2: Build a network model; The network model includes an adapter model structure, which includes a frequency-guided spatial attention module FGSAttn, a frequency-based subtle difference mining module FBNM, and a frequency-based feature enhancement module FBFE; The specific construction process of constructing the network model in step 2 is as follows: Step 2-1: Construct a frequency-guided spatial attention module; The frequency-guided spatial attention module consists of three stages: (1) converting the input features from the spatial domain to the frequency domain through Fourier transform; (2) adaptively adjusting different spectral components in the frequency domain; (3) returning to the spatial domain to obtain a spatial attention map to focus on the key areas of the camouflaged target; Step 2-2: Build a frequency-based subtle difference mining module; Design a frequency-based subtle difference mining module and insert it before all Transformer Layers of the base model Vision Tranformer to mine the subtle differences between foreground and background; Vision Tranformer is ViT; First, the local spatial context of the input image is modeled by using the convolution module of ResNet, which includes three 3×3 convolution kernels and a maximum pooling layer. Then, three sequence operations are applied continuously to obtain multi-scale feature maps F1, F2 and F3 with subtle difference amplification. Each sequence operation is a 3×3 convolution kernel with a stride of 2 to reduce the scale of the feature map, followed by an FGSAttn module that uses frequency domain information to adaptively adjust the features representing different visual attributes from a global perspective, thereby effectively highlighting subtle differences in texture-rich areas. Next, a 1x1 convolution is used to project the feature maps F1, F2, and F3 to the same dimension, flatten them into a one-dimensional sequence, and then concatenate them along the channel dimension to obtain features from the adapter stream of different scales. On the one hand, it is used as the input of the next adapter module, and on the other hand, it is combined with the features output by the pre-trained basic model ViT. Perform cross-attention operations to obtain features that incorporate task-related knowledge This feature Will be used as input for subsequent layers of ViT; Step 2-3: Construct a frequency-based feature enhancement module; A frequency-based feature enhancement module is designed and inserted into the ViT network to enhance the features of the ViT stream to fully utilize general knowledge and task-related knowledge; Step 3: Loss function; The loss function consists of a weighted binary cross entropy loss With weighted IoU loss The overall loss function is defined as follows: By calculating the difference between the center pixel and its surroundings, each pixel is assigned a different weight, so that difficult pixels receive more attention. and They are used to form pixel constraints and global constraints on the network respectively; The images in the training set are input into the network model to obtain the prediction results, and then the loss function is calculated by comparing the prediction results with the actual pixel-level labels. The model parameters are optimized by minimizing the loss function until the maximum number of iterations is reached. After the model training is completed, the test set images are input into the trained model to obtain advanced prediction results.

2. The method for detecting camouflaged targets based on frequency-guided spatial adaptation according to claim 1, characterized in that: The specific steps of step 2-1 to construct the frequency-guided spatial attention module are: In the first stage, the input feature F is first processed by average pooling and maximum pooling along the channel dimension, and then the two features after average pooling and maximum pooling are added element-wise to obtain a single-channel global feature F g , the process is expressed as: F g =AvgPool(F)+MaxPool(F) Among them, F g represents global features, F represents input features, AvgPool(·) represents average pooling operation, and MaxPool(.) represents maximum pooling operation; Then, the single-channel global feature F is transformed into g Converted to the frequency domain, the corresponding amplitude spectrum A(F g ) and phase spectrum P(F g ),Right now: Among them, FT(.) represents Fourier transform, R(F g ) and I(F g ) represent FT(F g )'s real and imaginary parts; A(F g ) represents the amplitude spectrum, P(F g ) represents the phase spectrum, H, W represent the height and width of the image, h, w represent the two-dimensional coordinates of the spatial domain image, u, v represent the two-dimensional coordinates of the frequency domain image, arctan[.] represents the inverse tangent function; In the second stage, the phase spectrum is kept unchanged and only the different frequency components in the amplitude spectrum are adjusted; First, the amplitude spectrum is frequency-centered. The low-frequency component is located at the center of the image, and the high-frequency component is located around it. The distance between a point in the amplitude spectrum and the center of the amplitude spectrum represents the size of the frequency component corresponding to the point. Therefore, the eigenvalues ​​in circles of different radii represent frequency components of different sizes, corresponding to different characteristic attributes in the spatial domain. Then the amplitude spectrum is decomposed into many non-overlapping rings of width d along the radius dimension, representing the low-frequency to high-frequency components in the frequency domain from the inside to the outside; then the features in the same ring are grouped into the same channel to obtain F freq Since the radius of each ring is different, the number of frequency components on each channel is also different; a mask tensor of the same size as the spectrum is used to record the channel number to which each point on the spectrum belongs. The channel number is proportional to the distance from the point to the center of the circle. Then, the mask tensor is used to perform a global average pooling operation to obtain the mean of the frequency of each channel. Then, a full connection operation is performed on the frequency mean of all channels to obtain the attention weight. The attention weight of each channel is then combined with the frequency value F of the corresponding channel in the spectrum. freq Multiply to get F' freq , the process is expressed as: in, represents pixel-level broadcast multiplication, GAP(.) represents global average pooling, and FC(.) represents a sequence of fully connected operations consisting of a 1×1 convolution and a LeakyReLU activation function; In the third stage, the feature F freq With the help of the mask tensor, we stack them one by one and get a new amplitude spectrum A′(F g ), the new amplitude spectrum A′(F g ) and the original phase spectrum P(F g ) after inverse Fourier transform FT -1 ), perform maximum and minimum normalization on the result after inverse Fourier transform to generate the spatial attention map M: M=MinMax(FT -1 (A′(F g ),P(F g ))) Finally, the output F obtained by the spatial attention mechanism and residual addition structure is out It is expressed as:

3. The method for detecting camouflaged targets based on frequency-guided spatial adaptation according to claim 1, characterized in that: The specific steps of step 2-3: constructing a frequency-based feature enhancement module are: First, the output features from the pre-trained base model ViT After processing by FGSAtm module The purpose is to highlight the target-related area under the guidance of frequency domain information while suppressing background interference; Then put As a query from the updated general knowledge The information related to the target is extracted, and the new adapter features are obtained through the residual addition structure and the feedforward convolutional network. The process is represented as: Among them, Attention(.,.) represents the cross attention mechanism, and FFN(.) represents the convolutional feed-forward network to make up for the defects of fixed-size position embedding; represents a feature from an adapter stream, represents the features output by the FGSAttn module, represents the intermediate features obtained after the cross attention mechanism and residual addition, Represents the output features obtained after the feedforward convolutional network and the residual addition; Then, As keys and values, As a query, we inject task-related knowledge into the features of the pre-trained base model ViT through the cross-attention mechanism and obtain The last frequency-based feature enhancement module outputs only adapter features To the COD detection network.

4. A target detection device using the method according to any one of claims 1 to 3, characterized in that: The target detection device comprises: Frequency-guided spatial attention module, frequency-based subtle difference mining module, and frequency-based feature enhancement module; The frequency-guided spatial attention module converts the input features from the spatial domain to the frequency domain through Fourier transform; adaptively adjusts different spectral components in the frequency domain; returns to the spatial domain to obtain a spatial attention map to focus on the key areas of the camouflaged target; The frequency-based subtle difference mining module is inserted before all Transformer Layers of the base model Vision Transformer, aiming to mine the subtle differences between foreground and background; A frequency-based feature enhancement module is inserted into the ViT network to enhance the features of the ViT stream to fully exploit both general and task-related knowledge.

5. An electronic device, characterized in that: include: one or more processors; and memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, and the program codes can be called by a processor to execute the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Frequency domain enhancement-based camouflage object detection method

    CN115471675A

  • Frequency perception-based camouflage target detection method and system

    CN117173523A