Camouflage target detection method based on CNN-Transformer cross fusion

By employing the CNN-Transformer cross-fusion method, ResNet-50 and PVT networks are used to extract features and fuse local and global information. This addresses the performance limitations of existing camouflage target detection methods in small and multi-target scenarios, achieving higher accuracy in camouflage target detection.

CN117876706BActive Publication Date: 2026-11-27FUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410050474.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2026-11-27
Estimated Expiration
2044-01-12

AI Technical Summary

Technical Problem

Existing methods for detecting camouflaged targets do not perform well in scenarios with small or multiple targets. CNN methods are less effective at detecting small targets, while Transformer methods are less effective at detecting multiple targets, making it difficult to fully utilize the complementarity between local features and global contextual features.

Method used

We design a camouflage target detection method based on CNN-Transformer cross-fusion. We extract features through ResNet-50 and PVT backbone networks, and use the cross-fusion module and pyramid progressive aggregation module to fuse local and global information to generate a camouflage target mask.

Benefits of technology

It improves the accuracy and performance of camouflaged target detection, and can better handle small and multi-target scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117876706B_ABST
    Figure CN117876706B_ABST
Patent Text Reader

Abstract

The application provides a camouflage target detection method based on CNN-Transformer cross fusion, comprising: data preprocessing, including data pairing and data enhancement processing, to obtain a training data set; designing a camouflage target detection network based on CNN-Transformer cross fusion composed of a parallel feature extraction network, a plurality of cross fusion modules and a pyramid progressive aggregation module; designing a loss function to guide the parameter optimization of the network designed in step B; training the camouflage target detection network based on CNN-Transformer cross fusion in step B using the training data set obtained in step A to obtain a trained camouflage target detection model based on CNN-Transformer cross fusion; inputting a to-be-detected image into the trained camouflage target detection model based on CNN-Transformer cross fusion to output a camouflage target mask image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing and computer vision technology, specifically relating to a method for detecting camouflaged targets based on CNN-Transformer cross-fusion. Background Technology

[0002] With the rapid development of technology, digital image processing has become an indispensable part of people's daily lives. Among these tasks, camouflage target detection is a particularly noteworthy digital image processing task. Over long periods of evolution, organisms in nature have developed a defense mechanism called "camouflage," which refers to the process by which organisms alter their external characteristics to blend into their environment, thereby reducing their chances of being detected by predators and increasing their survival and reproduction success. The purpose of camouflage target detection is to separate camouflaged targets from the background in an image. In the field of biology, camouflage target detection can be used to monitor and protect wildlife, such as studying the impact of animal herding behavior in different habitats. In the medical field, it can be applied to the analysis of medical images. In the industrial manufacturing field, camouflage target detection can be used for product quality control, detecting defects in products. In short, the task of camouflage target detection has wide applications and high practical and research value.

[0003] Traditional camouflage target detection methods rely on handcrafted features to help distinguish the foreground and background of camouflaged targets, such as texture, color, and optical flow. However, because the appearance of camouflaged targets is highly consistent with the environmental background, these features have limited ability to distinguish camouflaged targets. For example, color-based methods will fail when the color difference between the camouflage target and the environmental background is very small, and optical flow-based methods will fail in poor lighting conditions.

[0004] With the development of deep learning, deep learning-based camouflage target detection methods have attracted much attention due to their excellent feature representation learning and strong generalization ability. These methods utilize ResNet-50 and Pyramid Vision Transformer (PVTv2) as backbone networks to extract original image features, improving model performance and generalization ability, thereby enhancing the performance of image processing tasks. However, current camouflage target detection methods perform poorly in challenging scenarios with small and multiple targets. CNN-based methods show good detection results for small targets, but perform poorly in scenarios with multiple targets. Transformer-based methods can handle scenarios with varying numbers of targets, but their performance is poor for small targets. Therefore, researching how to effectively utilize the local feature extraction capabilities of CNNs and the global context feature extraction capabilities of Transformers, fully leveraging the complementarity between local and global context features to improve the accuracy of camouflage target detection models, is a worthwhile research topic. Summary of the Invention

[0005] The purpose of this invention is to provide a camouflage target detection method based on CNN-Transformer cross-fusion. This method improves the performance of camouflage target detection by cross-fusion CNN backbone features and Transformer backbone features.

[0006] This invention designs a camouflage target detection method based on CNN-Transformer cross-fusion. First, image features are extracted using a ResNet-50 backbone network and a PVT backbone network as parallel feature extraction networks. Then, a cross-fusion module is designed, where a collaborative fusion sub-module complementaryly fuses local information from CNN features with global contextual information from Transformer features. A secondary fusion sub-module adaptively performs deep fusion on the fused features. For deep-fused features at various scales, a pyramid-style progressive aggregation module progressively aggregates features from adjacent scales. Finally, the designed network is used to generate a more refined camouflage target mask.

[0007] This invention relates to a camouflage target detection method based on CNN-Transformer cross-fusion, comprising: performing data preprocessing, including data pairing and data augmentation, to obtain a training dataset; designing a camouflage target detection network based on CNN-Transformer cross-fusion, which consists of a parallel feature extraction network, multiple cross-fusion modules, and a feature progressive aggregation module; designing a loss function to guide the parameter optimization of the network designed in step B; training the camouflage target detection network based on CNN-Transformer cross-fusion in step B using the training dataset obtained in step A, to obtain a trained camouflage target detection model based on CNN-Transformer cross-fusion; inputting the image to be tested into the trained camouflage target detection model based on CNN-Transformer cross-fusion, and outputting a mask image of the camouflage target.

[0008] The specific technical solution adopted by this invention to solve its technical problem is as follows:

[0009] A method for detecting camouflaged targets based on CNN-Transformer cross-fusion includes the following steps:

[0010] Step A: Perform data preprocessing, including data pairing and data augmentation, to obtain the training dataset;

[0011] Step B: Design a camouflage target detection network based on CNN-Transformer cross-fusion, consisting of a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module;

[0012] Step C: Design a loss function to guide the parameter optimization of the network designed in Step B;

[0013] Step D: Use the training dataset obtained in Step A to train the camouflage target detection network based on CNN-Transformer cross-fusion in Step B, and obtain the trained camouflage target detection model based on CNN-Transformer cross-fusion.

[0014] Step E: Input the image to be tested into the trained camouflage target detection model based on CNN-Transformer cross-fusion, and output the mask image of the camouflage target.

[0015] Furthermore, the specific implementation steps of step A are as follows:

[0016] Step A1: Pair each original image with its corresponding label image to obtain an image tuple;

[0017] Step A2: Scale the size of each image tuple to H×W, where H represents the height of the image and W represents the width of the image. Then, randomly flip and rotate each image tuple vertically.

[0018] Furthermore, the specific implementation steps of step B are as follows:

[0019] Step B1: Design a parallel feature extraction network, including a ResNet-50 backbone network and a PVT backbone network. Take the original image obtained in step A2 as input, use the ResNet-50 backbone network to extract multi-scale CNN backbone features, and use the PVT backbone network to extract multi-scale Transformer backbone features.

[0020] Step B2: Design a cross-fusion module. Take the CNN backbone features and Transformer backbone features obtained in Step B1 as input, and use multiple designed cross-fusion modules to fuse the CNN backbone features and Transformer backbone features of the same scale to obtain complementary fused features of multiple scales.

[0021] Step B3: Design a pyramid-shaped progressive aggregation module. Take the multiple complementary fusion features obtained in step B2 as input, and use the designed pyramid-shaped progressive aggregation module to fuse the complementary fusion features at multiple scales to generate a camouflage target mask.

[0022] Step B4: Design a camouflage target detection network based on CNN-Transformer cross-fusion, including a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module. The original image obtained in step A2 is processed by the parallel feature extraction network to obtain multi-scale CNN backbone features and multi-scale Transformer backbone features. The CNN backbone features and Transformer backbone features at each scale are processed by the cross-fusion module to obtain complementary fusion features. The complementary fusion features at multiple scales are processed by the pyramid-style progressive aggregation module to generate a camouflage target mask. The obtained camouflage target mask is then upsampled to generate the final camouflage target mask.

[0023] Furthermore, the specific implementation steps of step B1 are as follows:

[0024] Step B11: Design a parallel feature extraction network, which includes a ResNet-50 backbone network and a PVT backbone network;

[0025] Step B12: Extract CNN backbone features from the original image I obtained in step A2 using the ResNet-50 backbone network; specifically, denote the features output by I through the first, second, third, fourth and fifth stages of the ResNet-50 network as F0, F1, F2, F3 and F4 respectively.

[0026] Step B13: Extract Transformer backbone features from the original image I obtained in step A2 using the PyramidVisionTransformer network as the PVT backbone network; specifically, denote the features output by I through the first, second, third, and fourth stages of the PyramidVisionTransformer network as P1, P2, P3, and P4, respectively.

[0027] Furthermore, the specific implementation steps of step B2 are as follows:

[0028] Step B21: Design a cross-fusion module, which includes a collaborative fusion sub-module and a secondary fusion sub-module;

[0029] Step B22: Design the collaborative fusion submodule in the cross-fusion module; in the collaborative fusion submodule, let F be the two input features of the collaborative fusion submodule. in and F in The output feature is F out F' in and P' in ;F in The output feature F' is obtained by sequentially passing through a channel attention layer, a spatial attention layer, and a convolutional layer with a kernel size of 3×3. in P in The output feature P' is obtained by passing the data through two convolutional layers with a kernel size of 3×3. in , F' in With P' in Having the same size; F' in With P' in The features obtained by concatenating along the channel dimension are sequentially processed through a 3×3 convolutional layer, a global average pooling operation, a two-layer perceptron, and a sigmoid activation function to obtain feature F. cat F cat The weighted feature W is obtained after segmentation along the channel dimension. a and W b , F' in With W a Feature F is obtained through pixel-by-pixel multiplication. w , P' in With feature W b Feature P is obtained through pixel-by-pixel multiplication. w , will F w With P w After concatenation along the channel dimension, the output feature F is obtained by passing the convolutional layer with a kernel size of 3×3 and the ReLU activation function. out The specific formula is as follows:

[0030] F′ in =Conv3(SA(CA(F in )))

[0031] P′ in =Conv3(Conv3(P in ))

[0032] F cat =Sigmoid(MLP(GAP(Conv3(Concat(F′ in ,P′ in )))))

[0033] W a W b =Chunk(F cat )

[0034]

[0035]

[0036] F out =ReLU(Conv3(Concat(F w ,P w )))

[0037] In this context, CA(·) is the channel attention layer, SA(·) is the spatial attention layer, Conv3(·) is a convolutional layer with a kernel size of 3×3, Concat(·,·) is a concatenation operation along the channel dimension, MLP is a two-layer perceptron, GAP is a global average pooling operation, and Chunk(·) is a segmentation operation along the channel dimension. It is a pixel-wise multiplication operation. ReLU(·) is the ReLU activation function, and Sigmoid(·) is the Sigmoid activation function.

[0038] Step B23: Design the secondary fusion submodule in the cross-fusion module; in the secondary fusion submodule, let F be the input feature of the secondary fusion submodule. in1 F in2 F in3 The output features are denoted as F in1 With F in2 Feature F is obtained by concatenating along the channel dimension. in12 F in2 With F in3 Feature F is obtained by concatenating along the channel dimension. in23 F in12 and F in23 Having the same size; F in12The weight features W1 and F are obtained by sequentially passing the convolutional layers with a depth of 3×3 kernel, a convolutional layer with a kernel of 1×1, a ReLU activation function, another convolutional layer with a kernel of 1×1, and a Sigmoid activation function. in23 The weighted feature W2 is obtained by sequentially passing the convolutional layer with a depthwise separable convolutional layer of size 3×3, a convolutional layer with a kernel size of 1×1, a ReLU activation function, another convolutional layer with a kernel size of 1×1, and a Sigmoid activation function; W1 and F in12 The feature F is obtained by performing pixel-by-pixel multiplication. w1 W2 and F in23 The feature F is obtained by performing pixel-by-pixel multiplication. w2 F w1 With F w2 Features are obtained by splicing along the channel dimension The specific formula is expressed as follows:

[0039] F in12 =Concat(F in1 ,F in2 )

[0040] F in23 =Concat(F in2 ,F in3 )

[0041] W1=Sigmoid(Conv1(ReLU(Conv1(DWConv3(F in12 )))))

[0042] W2=Sigmoid(Conv1(ReLU(Conv1(DWConv3(F in23 )))))

[0043]

[0044]

[0045]

[0046] Here, Concat(·,·) is a concatenation operation along the channel dimension, DWConv3(·) is a depthwise separable convolutional layer with a kernel size of 3×3; Conv1(·) is a convolutional layer with a kernel size of 1×1, ReLU(·) is the ReLU activation function, and Sigmoid(·) is the Sigmoid activation function. It is a pixel-by-pixel multiplication operation;

[0047] Step B24: The designed camouflage target detection network based on CNN-Transformer cross-fusion has four cross-fusion modules: cross-fusion module 1, cross-fusion module 2, cross-fusion module 3, and cross-fusion module 4. The input of the collaborative fusion submodule in cross-fusion module 1 is F1 and P1 obtained in step B1, and the output is F... out1 The inputs of the secondary fusion submodule in cross-fusion module 1 are F'1, F'1, and P'1. out1 And P'1, the output is The inputs to the collaborative fusion submodule in cross-fusion module 2 are F2 and P2 obtained in step B1, and the output is F. out2 The inputs to the secondary fusion submodule in cross-fusion module 2 are F'2 and F'2. out2 And P'2, the output is The input to the collaborative fusion submodule in cross-fusion module 3 is F3 and P3 obtained in step B1, and the output is F. out3 The inputs to the secondary fusion submodule in cross-fusion module 3 are F'3 and F'3. out3 And P'3, the output is The input to the collaborative fusion submodule in cross-fusion module 4 is F4 and P4 obtained in step B1, and the output is F. out4 The inputs to the secondary fusion submodule in cross-fusion module 4 are F'4 and F'4. out4 And P'4, the output is

[0048] Furthermore, the specific implementation steps of step B3 are as follows:

[0049] Step B31: Design a pyramid-shaped progressive aggregation module. The input to the pyramid-shaped progressive aggregation module is the feature obtained in step B2. and Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain feature F. fuse12 ;feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain feature F. fuse23 ;feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain feature F. fuse34 Use upsampling operation to transform feature F fuse23 Adjust to and feature F fuse12 Having the same size, we obtain feature F′ fuse23 Use upsampling operation to transform feature F fuse34 Adjust to and feature F fuse23 Having the same size, we obtain feature F′ fuse34 Feature F fuse12 and F′ fuse23 The features obtained by concatenating along the channel dimension are then passed through a convolutional layer with a kernel size of 1×1 to obtain feature F. fuse123 Feature F fuse23 and F′ fuse34 The features obtained by concatenating along the channel dimension are then passed through a convolutional layer with a kernel size of 1×1 to obtain feature F. fuse234 Use upsampling operation to transform feature F fuse234 Adjust to and feature F fuse123 Having the same size, we obtain feature F′ fuse234 ; feature F fuse123 and feature F′ fuse234 Pixel-by-pixel addition is performed, and the resulting features are sequentially processed through two 3×3 convolutional layers to compress the number of channels, yielding the camouflage target mask M; the specific formula is as follows:

[0050]

[0051]

[0052]

[0053] F fuse123 =Conv1(Concat(F fuse12 Up(F) fuse23 )))

[0054] F fuse234 =Conv1(Concat(F fuse23 Up(Ffuse) 34 )))

[0055]

[0056] in, It is a pixel-wise addition operation, Up(·) is an upsampling operation, Conv3(·) is a convolutional layer with a kernel size of 3×3, Concat(·,·) is a concatenation operation along the channel dimension, and Conv1(·) is a convolutional layer with a kernel size of 1×1.

[0057] Furthermore, the specific implementation steps of step B4 are as follows:

[0058] Step B41: Design a camouflage target detection network based on CNN-Transformer cross-fusion. This network consists of a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module, and generates the final camouflage target mask.

[0059] Step B42: Input the original image I output from step A2 into the camouflage target detection network based on CNN-Transformer cross-fusion. After steps B1 and B2, and then step B3, the camouflage target mask M is obtained. M is upsampled by 4 times to obtain the final camouflage target mask M. camo The specific formula is as follows:

[0060] M camo =Up scale=4 (M)

[0061] Among them, Up scale=4 (·) is an upsampling operation with a magnification of 4.

[0062] Furthermore, the specific implementation steps of step C are as follows:

[0063] Step C: Design a loss function as a constraint to optimize the camouflage target detection network based on CNN-Transformer cross-fusion. The specific formula is as follows:

[0064]

[0065] Among them, M camo G represents the final camouflage target mask output by the designed CNN-Transformer cross-fusion camouflage target detection network. camo This represents the label image corresponding to the original image I output in step A2. This is expressed as a weighted average loss. This represents the weighted binary cross-entropy loss. This is expressed as the total loss function.

[0066] Furthermore, the specific implementation steps of step D are as follows:

[0067] Step D1: Randomly divide the training dataset obtained in step A into several batches, each batch containing N pairs of images;

[0068] Step D2: For the original image I in each batch, the camouflage target mask M is obtained after passing through the camouflage target detection network based on CNN-Transformer cross-fusion in step B. camo Calculate the loss using the formula in step C.

[0069] Step D3: Calculate the gradient of the network parameters using the backpropagation method based on the loss, and update the network parameters using the stochastic gradient descent optimization method;

[0070] Step D4: Repeat steps D2 to D3 in batches until the target loss function of the network converges numerically. Save the network parameters to obtain the camouflage target detection model based on CNN-Transformer cross-fusion.

[0071] Further, in step E, the image to be tested is input into the camouflage target detection model trained in step D based on CNN-Transformer cross-fusion, and the mask image of the camouflage target is output.

[0072] Furthermore, a camouflaged target detection model based on CNN-Transformer cross-fusion, comprising, according to steps B and C as described above, the camouflaged target detection network based on CNN-Transformer cross-fusion designed in step B, and the designed loss function used for network parameter optimization.

[0073] Compared to existing technologies, this invention and its preferred solution improve the performance of camouflaged target detection methods by cross-fusing CNN backbone features and Transformer backbone features. Attached Figure Description

[0074] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:

[0075] Figure 1 This is a flowchart illustrating the implementation of the method in an embodiment of the present invention;

[0076] Figure 2 This is a network structure diagram of the camouflage target detection model based on CNN-Transformer cross-fusion in an embodiment of the present invention;

[0077] Figure 3 This is a schematic diagram of the structure of the collaborative fusion submodule in the cross-fusion module of this invention embodiment;

[0078] Figure 4 This is a schematic diagram of the structure of the secondary fusion submodule in the cross-fusion module of this invention embodiment;

[0079] Figure 5 This is a schematic diagram of the pyramid-shaped progressive aggregation module in an embodiment of the present invention. Detailed Implementation

[0080] To make the features and advantages of this patent more apparent and understandable, specific embodiments are provided below for detailed explanation:

[0081] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0082] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0083] The following describes the structure of the present invention in further detail with reference to a specific embodiment:

[0084] This invention provides a method for detecting camouflaged targets based on CNN-Transformer cross-fusion, such as... Figures 1-5 As shown, it includes the following steps:

[0085] Step A: Perform data preprocessing, including data pairing and data augmentation, to obtain the training dataset;

[0086] Step B: Design a camouflage target detection network based on CNN-Transformer cross-fusion, consisting of a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module;

[0087] Step C: Design the loss function to guide the parameter optimization of the network designed in Step B;

[0088] Step D: Use the training dataset obtained in Step A to train the camouflage target detection network based on CNN-Transformer cross-fusion in Step B, and obtain the trained camouflage target detection model based on CNN-Transformer cross-fusion.

[0089] Step E: Input the image to be tested into the trained camouflage target detection model based on CNN-Transformer cross-fusion, and output the mask image of the camouflage target.

[0090] As a preferred embodiment, step A includes the following steps:

[0091] Step A1: Pair each original image with its corresponding label image to obtain an image tuple.

[0092] Step A2: Scale the size of each image tuple to H×W, where H represents the height of the image and W represents the width of the image. Then, randomly flip and rotate each image tuple vertically.

[0093] As a preferred embodiment, step B includes the following steps:

[0094] Step B1: Design a parallel feature extraction network, including a ResNet-50 backbone network and a PVT backbone network. Take the original image obtained in step A2 as input, use the ResNet-50 backbone network to extract multi-scale CNN backbone features, and use the PVT backbone network to extract multi-scale Transformer backbone features.

[0095] Step B2: Design a cross-fusion module. Take the CNN backbone features and Transformer backbone features obtained in Step B1 as input, and use multiple designed cross-fusion modules to fuse the CNN backbone features and Transformer backbone features of the same scale to obtain complementary fused features of multiple scales.

[0096] Step B3: Design a pyramid-shaped progressive aggregation module. Take the multiple complementary fusion features obtained in step B2 as input, and use the designed pyramid-shaped progressive aggregation module to fuse the complementary fusion features at multiple scales to generate a camouflage target mask.

[0097] Step B4: Design a camouflage target detection network based on CNN-Transformer cross-fusion, including a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module. The original image obtained in step A2 is processed by the parallel feature extraction network to obtain multi-scale CNN backbone features and multi-scale Transformer backbone features. The CNN backbone features and Transformer backbone features at each scale are processed by the cross-fusion module to obtain complementary fusion features. The complementary fusion features at multiple scales are processed by the pyramid-style progressive aggregation module to generate a camouflage target mask. The obtained camouflage target mask is then upsampled to generate the final camouflage target mask.

[0098] As a preferred embodiment, step B1 includes the following steps:

[0099] Step B11: Design a parallel feature extraction network, which includes a ResNet-50 backbone network and a PVT backbone network.

[0100] Step B12: Extract CNN backbone features from the original image I obtained in step A2 using the ResNet-50 backbone network. Specifically, the features output by the first, second, third, fourth, and fifth stages of the ResNet-50 network are denoted as F0, F1, F2, F3, and F4, respectively.

[0101] Step B13: Extract Transformer backbone features from the original image I obtained in step A2 using the Pyramid Vision Transformer (PVTv2) network as the PVT backbone network. Specifically, the features output by I after the first, second, third, and fourth stages of the Pyramid Vision Transformer (PVTv2) network are denoted as P1, P2, P3, and P4, respectively.

[0102] As a preferred embodiment, step B2 includes the following steps:

[0103] Step B21: Design a cross-fusion module, which includes a collaborative fusion sub-module and a secondary fusion sub-module.

[0104] Step B22: Design the collaborative fusion submodule within the cross-fusion module. In the collaborative fusion submodule, let F be the two input features. in and P in The output feature is F out F' in and P' in F in The output feature F' is obtained by sequentially passing through a channel attention layer, a spatial attention layer, and a convolutional layer with a kernel size of 3×3. in P in The output feature P' is obtained by passing the data through two convolutional layers with a kernel size of 3×3. in , F' in With P' in They have the same size. (The last part, "F'", appears to be a fragment and doesn't translate directly.) in With P' in The features obtained by concatenating along the channel dimension are sequentially processed through a 3×3 convolutional layer, a global average pooling operation, a two-layer perceptron, and a sigmoid activation function to obtain feature F. cat F cat The weighted feature W is obtained after segmentation along the channel dimension. a and W b , F' in With W a Feature F is obtained through pixel-by-pixel multiplication. w , P' in With feature W bFeature P is obtained through pixel-by-pixel multiplication. w , will F w With P w After concatenation along the channel dimension, the output feature F is obtained by passing the convolutional layer with a kernel size of 3×3 and the ReLU activation function. out The specific formula is as follows:

[0105] F′ in =Conv3(SA(CA(F in )))

[0106] P′ in =Conv3(Conv3(P in ))

[0107] F cat =Sigmoid(MLP(GAP(Conv3(Concat(F′ in ,P′ in ))))))

[0108] W a W b =Chunk(F cat )

[0109]

[0110]

[0111] F out =ReLU(Conv3(Concat(F) w ,P w )))

[0112] In this context, CA(·) is the channel attention layer, SA(·) is the spatial attention layer, Conv3(·) is a convolutional layer with a kernel size of 3×3, Concat(·,·) is a concatenation operation along the channel dimension, MLP is a two-layer perceptron, GAP is a global average pooling operation, and Chunk(·) is a segmentation operation along the channel dimension. It is a pixel-wise multiplication operation. ReLU(·) is the ReLU activation function, and Sigmoid(·) is the Sigmoid activation function.

[0113] Step B23: Design the secondary fusion submodule in the cross-fusion module. In the secondary fusion submodule, let F be the input feature. in1 F in2 F in3 The output features are denoted as F in1 With F in2 Feature F is obtained by concatenating along the channel dimension.in12 F in2 With F in3 Feature F is obtained by concatenating along the channel dimension. in23 F in12 and F in23 They have the same size. F in12 The weight features W1 and F are obtained by sequentially passing the convolutional layers with a depth of 3×3 kernel, a convolutional layer with a kernel of 1×1, a ReLU activation function, another convolutional layer with a kernel of 1×1, and a Sigmoid activation function. in23 The weighted feature W2 is obtained by sequentially passing through a depthwise separable convolutional layer with a kernel size of 3×3, a convolutional layer with a kernel size of 1×1, a ReLU activation function, another convolutional layer with a kernel size of 1×1, and a Sigmoid activation function. W1 and F in12 The feature F is obtained by performing pixel-by-pixel multiplication. w1 W2 and F in23 The feature F is obtained by performing pixel-by-pixel multiplication. w2 F w1 With F w2 Features are obtained by splicing along the channel dimension The specific formula is expressed as follows:

[0114] F in12 =Concat(F in1 ,F in2 )

[0115] F in23 =Concat(F in2 ,F in3 )

[0116] W1=Sigmoid(Conv1(ReLU(Conv1(DWConv3(F in12 )))))

[0117] W2=Sigmoid(Conv1(ReLU(Conv1(DWConv3(F in23 )))))

[0118]

[0119]

[0120]

[0121] Here, Concat(·,·) is a concatenation operation along the channel dimension, DWConv3(·) is a depthwise separable convolutional layer with a kernel size of 3×3, Conv1(·) is a convolutional layer with a kernel size of 1×1, ReLU(·) is the ReLU activation function, and Sigmoid(·) is the Sigmoid activation function. It is a pixel-by-pixel multiplication operation.

[0122] Step B24: The designed camouflage target detection network based on CNN-Transformer cross-fusion has four cross-fusion modules: cross-fusion module 1, cross-fusion module 2, cross-fusion module 3, and cross-fusion module 4. The input to the collaborative fusion submodule in cross-fusion module 1 is F1 and P1 obtained in step B1, and the output is F... out1 The inputs of the secondary fusion submodule in cross-fusion module 1 are F'1, F'1, and P'1. out1 And P'1, the output is The inputs to the collaborative fusion submodule in cross-fusion module 2 are F2 and P2 obtained in step B1, and the output is F. out2 The inputs to the secondary fusion submodule in cross-fusion module 2 are F'2 and F'2. out2 And P'2, the output is The input to the collaborative fusion submodule in cross-fusion module 3 is F3 and P3 obtained in step B1, and the output is F. out3 The inputs to the secondary fusion submodule in cross-fusion module 3 are F'3 and F'3. out3 And P'3, the output is The input to the collaborative fusion submodule in cross-fusion module 4 is F4 and P4 obtained in step B1, and the output is F. out4 The inputs to the secondary fusion submodule in cross-fusion module 4 are F'4 and F'4. out4 And P'4, the output is

[0123] As a preferred embodiment, step B3 includes the following steps:

[0124] Step B31: Design a pyramid-shaped progressive aggregation module. The input to the pyramid-shaped progressive aggregation module is the feature obtained in step B2. and Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain feature F. fuse12 .feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain feature F. fuse23 .feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain feature F. fuse34 Use upsampling operation to transform feature F fuse23 Adjust to and feature F fuse12 Having the same size, we obtain feature F' fuse23 Use upsampling operation to transform feature F fuse34 Adjust to and feature F fuse23 Having the same size, we obtain feature F' fuse34 . The feature F fuse12 and F' fuse23 The features obtained by concatenating along the channel dimension are then passed through a convolutional layer with a kernel size of 1×1 to obtain feature F. fuse123 Feature F fuse23 and F' fuse34 The features obtained by concatenating along the channel dimension are then passed through a convolutional layer with a kernel size of 1×1 to obtain feature F. fuse234 Use upsampling operation to transform feature F fuse234 Adjust to and feature F fuse123 Having the same size, we obtain feature F' fuse234 . The feature F fuse123 and feature f' fuse234 Pixel-by-pixel addition is performed, and the resulting features are then processed through two 3×3 convolutional layers to compress the number of channels, yielding the camouflage target mask M. The specific formula is as follows:

[0125]

[0126]

[0127]

[0128] F fuse123 =Conv1(Concat(F fuse12 ,Up(F fuse23 )))

[0129] F fuse234 =Conv1(Concat(F fuse23 ,Up(F fuse34 )))

[0130]

[0131] in, It is a pixel-wise addition operation, Up(·) is an upsampling operation, Conv3(·) is a convolutional layer with a kernel size of 3×3, Concat(·,·) is a concatenation operation along the channel dimension, and conv1(·) is a convolutional layer with a kernel size of 1×1.

[0132] As a preferred embodiment, step B4 includes the following steps:

[0133] Step B41: Design a camouflage target detection network based on CNN-Transformer cross-fusion. This network consists of a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module, and generates the final camouflage target mask.

[0134] Step B42: Input the original image I output from step A2 into the camouflage target detection network based on CNN-Transformer cross-fusion. After steps B1 and B2, and then step B3, the camouflage target mask M is obtained. M is upsampled by 4 times to obtain the final camouflage target mask M. camo The specific formula is as follows:

[0135] M camo =Up scale=4 (M)

[0136] Among them, Up scale=4 (·) is an upsampling operation with a magnification of 4.

[0137] As a preferred embodiment, step C includes the following steps:

[0138] Step C: Design a loss function as a constraint to optimize the camouflage target detection network based on CNN-Transformer cross-fusion. The specific formula is as follows:

[0139]

[0140] Among them, M camo G represents the final camouflage target mask output by the designed CNN-Transformer cross-fusion camouflage target detection network. camo This represents the label image corresponding to the original image I output in step A2. This is expressed as a weighted average loss. This represents the weighted binary cross-entropy loss. This is expressed as the total loss function.

[0141] As a preferred embodiment, step D includes the following steps:

[0142] Step D1: Randomly divide the training dataset obtained in step A into several batches, each batch containing N pairs of images.

[0143] Step D2: For the original image I in each batch, the camouflage target mask M is obtained after passing through the camouflage target detection network based on CNN-Transformer cross-fusion in step B. camo Calculate the loss using the formula in step C.

[0144] Step D3: Calculate the gradient of the network parameters using the backpropagation method based on the loss, and update the network parameters using the stochastic gradient descent optimization method.

[0145] Step D4: Repeat steps D2 to D3 in batches until the target loss function of the network converges numerically. Save the network parameters to obtain the camouflage target detection model based on CNN-Transformer cross-fusion.

[0146] As a preferred embodiment, step E includes the following steps:

[0147] Step E: Input the image to be tested into the camouflage target detection model trained in Step D based on CNN-Transformer cross-fusion, and output the mask image of the camouflage target.

[0148] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0149] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0150] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0151] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0152] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

[0153] This patent is not limited to the above-described preferred embodiments. Anyone can derive other forms of camouflaged target detection methods based on CNN-Transformer cross-fusion under the guidance of this patent. All equivalent changes and modifications made within the scope of this patent application shall fall within the scope of this patent.

Claims

1. A method for detecting camouflaged targets based on CNN-Transformer cross-fusion, characterized by: Includes the following steps: Step A: Perform data preprocessing, including data pairing and data augmentation, to obtain the training dataset; Step B: Design a camouflage target detection network based on CNN-Transformer cross-fusion, consisting of a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module; Step C: Design a loss function to guide the parameter optimization of the network designed in Step B; Step D: Use the training dataset obtained in Step A to train the camouflage target detection network based on CNN-Transformer cross-fusion in Step B, and obtain the trained camouflage target detection model based on CNN-Transformer cross-fusion. Step E: Input the image to be tested into the trained camouflage target detection model based on CNN-Transformer cross-fusion, and output the mask image of the camouflage target; The specific implementation steps of step A are as follows: Step A1: Pair each original image with its corresponding label image to obtain an image tuple; Step A2: Scale the size of each image tuple to [size missing]. ,in, Indicates the height of the image, The width of the image is represented by a tuple, and then each pair of image tuples is randomly vertically flipped and randomly rotated. The specific implementation steps of step B are as follows: Step B1: Design a parallel feature extraction network, including a ResNet-50 backbone network and a PVT backbone network. Take the original image obtained in step A2 as input, use the ResNet-50 backbone network to extract multi-scale CNN backbone features, and use the PVT backbone network to extract multi-scale Transformer backbone features. Step B2: Design a cross-fusion module. Take the CNN backbone features and Transformer backbone features obtained in Step B1 as input, and use multiple designed cross-fusion modules to fuse the CNN backbone features and Transformer backbone features of the same scale to obtain complementary fused features of multiple scales. Step B3: Design a pyramid-shaped progressive aggregation module. Take the multiple complementary fusion features obtained in step B2 as input, and use the designed pyramid-shaped progressive aggregation module to fuse the complementary fusion features at multiple scales to generate a camouflage target mask. Step B4: Design a camouflage target detection network based on CNN-Transformer cross-fusion, including a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module. The original image obtained in step A2 is processed by the parallel feature extraction network to obtain multi-scale CNN backbone features and multi-scale Transformer backbone features. The CNN backbone features and Transformer backbone features at each scale are processed by the cross-fusion module to obtain complementary fusion features. The complementary fusion features at multiple scales are processed by the pyramid-style progressive aggregation module to generate a camouflage target mask. The obtained camouflage target mask is then upsampled to generate the final camouflage target mask. The specific implementation steps of step B1 are as follows: Step B11: Design a parallel feature extraction network, which includes a ResNet-50 backbone network and a PVT backbone network; Step B12: Process the original image obtained in step A2 using a ResNet-50 backbone network. Perform CNN backbone feature extraction; specifically, record respectively The features output by the first, second, third, fourth, and fifth stages of the ResNet-50 network are: , , , and ; Step B13: Process the original image obtained in step A2 using a Pyramid Vision Transformer network as the PVT backbone network. Perform Transformer backbone feature extraction; specifically, denote the following: The features output by the first, second, third, and fourth stages of the Pyramid Vision Transformer network are: , , and ; The specific implementation steps of step B2 are as follows: Step B21: Design a cross-fusion module, which includes a collaborative fusion sub-module and a secondary fusion sub-module; Step B22: Design the collaborative fusion submodule in the cross-fusion module; in the collaborative fusion submodule, let the two input features of the collaborative fusion submodule be denoted as . and The output features are , and ; The output features are obtained by sequentially passing through a channel attention layer, a spatial attention layer, and a convolutional layer with a kernel size of 3×3. , The output features are obtained by sequentially passing the data through two convolutional layers with kernel size of 3×3. , and Having the same size; and The features are concatenated along the channel dimension and then sequentially passed through a 3×3 convolutional layer, a global average pooling operation, a two-layer perceptron, and... Activation function obtains features , Weight features are obtained after segmentation along the channel dimension. and , and Features are obtained through pixel-by-pixel multiplication. , With features Features are obtained through pixel-by-pixel multiplication. ,Will and After being stitched along the channel dimension, it passes through a convolutional layer with a kernel size of 3×3. Activation function obtains output features The specific formula is as follows: in, It is the channel attention layer. Spatial attention layer It is a convolutional layer with a kernel size of 3×3. It is a splicing operation along the channel dimension. It is a two-layer sensor. It is a global average pooling operation. It is a segmentation operation along the channel dimension. "This is a pixel-by-pixel multiplication operation." yes Activation function yes Activation function; Step B23: Design the secondary fusion submodule in the cross-fusion module; in the secondary fusion submodule, let the input feature of the secondary fusion submodule be denoted as... , , The output features are denoted as ; and Features are obtained by splicing along the channel dimension , and Features are obtained by splicing along the channel dimension , and They have the same size; The convolutional layers are sequentially passed through a separable convolutional layer with a kernel size of 3×3, and a convolutional layer with a kernel size of 1×1. Activation function, convolutional layer with 1×1 kernel size and Weight features are obtained after activation function , The convolutional layers are sequentially passed through a separable convolutional layer with a kernel size of 3×3, and a convolutional layer with a kernel size of 1×1. Activation function, convolutional layer with 1×1 kernel size and Weight features are obtained after activation function ; and Features are obtained by performing pixel-by-pixel multiplication. , and Features are obtained by performing pixel-by-pixel multiplication. , and Features are obtained by splicing along the channel dimension The specific formula is as follows: in, It is a splicing operation along the channel dimension. It is a depth-separable convolutional layer with a kernel size of 3×3; It is a convolutional layer with a kernel size of 1×1. yes Activation function yes Activation function, "This is a pixel-by-pixel multiplication operation; Step B24: The designed camouflage target detection network based on CNN-Transformer cross-fusion has four cross-fusion modules: cross-fusion module 1, cross-fusion module 2, cross-fusion module 3, and cross-fusion module 4. The input to the collaborative fusion submodule in cross-fusion module 1 is the result obtained in step B1. and The output is , and The input to the secondary fusion submodule in cross-fusion module 1 is... , and The output is The input to the collaborative fusion submodule in cross-fusion module 2 is the result obtained in step B1. and The output is , and The input to the secondary fusion submodule in cross-fusion module 2 is... , and The output is The input to the collaborative fusion submodule in cross-fusion module 3 is the result obtained in step B1. and The output is The input to the secondary fusion submodule in cross-fusion module 3 is... The output is The input to the collaborative fusion submodule in cross-fusion module 4 is the result obtained in step B1. and The output is The input to the secondary fusion submodule in cross-fusion module 4 is... The output is ; The specific implementation steps of step B3 are as follows: Step B31: Design a pyramid-shaped progressive aggregation module. The input to the pyramid-shaped progressive aggregation module is the feature obtained in step B2. , , and Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. Use upsampling operation to transform features Adjust to and features Having the same size, we obtain the feature. ;feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain the final feature value. ;feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain the final feature value. ;feature and After pixel-by-pixel addition, the resulting features are processed by a 3×3 convolutional layer to obtain the final feature value. Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. Use upsampling operation to transform features Adjust to and features Having the same size, we obtain the feature. ; Features and The features obtained by concatenating along the channel dimension are then processed by a convolution kernel of size [size missing]. The convolutional layer obtains features ,feature and The features obtained by concatenating along the channel dimension are then processed by a convolution kernel of size [size missing]. The convolutional layer obtains features Use upsampling operation to extract features Adjust to and features Having the same size, we obtain the feature. ; Features and characteristics The pixel-by-pixel addition operation is performed, and the resulting features are then passed through two convolutional layers with a kernel size of 3×3 to compress the number of channels, thus obtaining the camouflage target mask. The specific formula is as follows: in," "It is a pixel-by-pixel addition operation." It is an upsampling operation. It is a convolutional layer with a kernel size of 3×3. It is a splicing operation along the channel dimension. It is a convolutional layer with a kernel size of 1×1.

2. The camouflaged target detection method based on CNN-Transformer cross-fusion according to claim 1, characterized in that: The specific implementation steps of step B4 are as follows: Step B41: Design a camouflage target detection network based on CNN-Transformer cross-fusion. This network consists of a parallel feature extraction network, multiple cross-fusion modules, and a pyramid-style progressive aggregation module, and generates the final camouflage target mask. Step B42: The original image output in step A2 The input is a camouflaged target detection network based on CNN-Transformer cross-fusion. After steps B1 and B2, and then step B3, the camouflaged target mask is obtained. ; The final camouflaged target mask is obtained by upsampling the image by a factor of 4. The specific formula is as follows: in, It is an upsampling operation with a magnification of 4.

3. The camouflaged target detection method based on CNN-Transformer cross-fusion according to claim 2, characterized in that: The specific implementation steps of step C are as follows: Step C: Design a loss function as a constraint to optimize the camouflage target detection network based on CNN-Transformer cross-fusion. The specific formula is as follows: in, This represents the final camouflage target mask output by the designed camouflage target detection network based on CNN-Transformer cross-fusion. This represents the original image output from step A2. The corresponding label image, This is expressed as a weighted average loss. This represents the weighted binary cross-entropy loss. This is expressed as the total loss function.

4. The camouflaged target detection method based on CNN-Transformer cross-fusion according to claim 1, characterized in that: The specific implementation steps of step D are as follows: Step D1: Randomly divide the training dataset obtained in Step A into several batches, each batch containing... For images; Step D2: For the original images within each batch After passing through the camouflage target detection network based on CNN-Transformer cross-fusion in step B, the camouflage target mask is obtained. Calculate the loss using the formula in step C. ; Step D3: Calculate the gradient of the network parameters using the backpropagation method based on the loss, and update the network parameters using the stochastic gradient descent optimization method; Step D4: Repeat steps D2 to D3 in batches until the target loss function of the network converges numerically. Save the network parameters to obtain the camouflage target detection model based on CNN-Transformer cross-fusion.

5. A camouflaged target detection model based on CNN-Transformer cross-fusion, comprising steps B and C as described in any one of claims 1-4, including the camouflaged target detection network based on CNN-Transformer cross-fusion designed in step B, and the designed loss function used for network parameter optimization.

Citation Information

Patent Citations

  • Marine organism detection method based on CNN (Convolutional Neural Network) and Transform bidirectional collaborative guidance network

    CN116152650A

  • Camouflage target detection method based on edge feature fusion and high-order space interaction

    CN116310693A