Multispectral image semantic segmentation method based on modality divergence difference fusion

Through the combination of modal divergence difference fusion and semantic weight generation module, the problem of insufficient fusion of modal divergence areas and semantic consistency areas in multispectral semantic segmentation is solved, and high-precision segmentation under adverse lighting conditions is achieved, especially Accurate positioning of small objects and edges.

CN118485835BActive Publication Date: 2024-10-01SHENZHEN OUFEIGUANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410946977.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-10-01
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

Existing multispectral semantic segmentation methods fail to fully consider the differential fusion of modal divergence areas and semantic consistency areas, resulting in reduced segmentation accuracy under adverse lighting conditions and difficulty in accurately segmenting small objects and object edges.

Method used

A multispectral image semantic segmentation method based on modal divergence difference fusion is adopted, feature encoders are extracted through 4 cascaded converter networks, a difference fusion module is constructed to handle semantic divergence and consistent areas respectively, and a semantic weight generation module is used to dynamically adjust Decoder weights, combined with cross-entropy loss optimization model.

Benefits of technology

It achieves accurate semantic segmentation under adverse lighting conditions, reduces model calculations, can better capture small objects and edge features, and improves the segmentation accuracy of multispectral images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118485835B_ABST
    Figure CN118485835B_ABST
Patent Text Reader

Abstract

The present invention discloses a multispectral image semantic segmentation method based on modal divergence difference fusion. The method of the present invention first uses a dual-stream feature extractor to obtain RGB and Thermal image features; then constructs a four-layer difference fusion module that considers modal divergence, and performs differential modal fusion on semantically divergent areas and semantically consistent areas; then constructs a foreground segmentation head to obtain a foreground mask, and obtains a prediction mask through a dynamic fully connected decoder and a semantic segmentation head. The method of the present invention establishes a modal interaction relationship between semantically consistent and semantically divergent areas through differential fusion, and depicts the semantic association between high-level and low-level features. It can fully mine modal complementary information and reduce the amount of model calculation, and can accurately locate small objects and contour edges, thereby improving the performance of the multispectral semantic segmentation method. This method can solve the problem of the model's weak ability to capture small objects and boundaries, and can be applied to actual scenarios such as film and television creation, service robots, and intelligent inspections.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of multispectral semantic segmentation and relates to a multispectral image semantic segmentation method based on modal divergence difference fusion. Background Art

[0002] In the Internet 3.0 era, intelligent visual perception technology has been applied to autonomous driving perception. For example, the refined detection of pedestrians, traffic signs, and other vehicles around the vehicle directly affects the decision-making and judgment of the central control system, and provides technical support for ensuring intelligent traffic safety. Refined and accurate detection requires pixel-level segmentation of vehicle-mounted video images and giving the semantic category to which the pixels belong, that is, image semantic segmentation. Generally speaking, traditional semantic segmentation methods rely on stable lighting conditions. When lighting conditions change, such as when the light becomes dim at night, its segmentation performance will drop significantly. In order to cope with the challenges of adverse lighting conditions, multispectral image semantic segmentation methods have emerged, that is, using complementary fusion information of different spectra (such as RGB and Thermal images) at the same time to enhance pixel-level semantic perception, that is, to obtain pixel-level category labels. RGB-T semantic segmentation aims to integrate the image semantics of two different modalities, RGB and Thermal. It improves the accuracy of distinguishing the contours of a given semantic category area by modeling the difference and complementary information between the modalities (for example, it is difficult for RGB images to detect small road cones in dim light, but Thermal images can easily capture them) and suppressing noise interference between the modalities. It can be widely used in film and television creation, service robots, intelligent inspection and other scenarios.

[0003] Generally, multispectral semantic segmentation methods use a dual-stream encoder-decoder structure with different modal fusions, where the dual-stream encoder uses a convolutional neural network (CNN) or a transformer to extract image features in a non-parameter sharing form; the decoder uses a dilated convolutional network (DeepLabv3) or a panoramic segmentation network (PSPNet), and uses the relationship between different levels and multi-scale features after modal fusion, as well as skip connections and layer-by-layer upsampling to restore the image of the original resolution size; some works usually customize multimodal decoders, such as using a cascaded decoder structure to introduce additional supervisory information such as edges for assistance. In order to effectively fuse multimodal features, the relationship between multimodal features is usually established to mine complementary information, such as using an attention mechanism or a gating mechanism to dynamically adjust the feature fusion weights according to the feature layer from different dimensions such as channels and space. At the same time, in response to the problem of insufficient fusion caused by the existing implicit channel attention method, the researchers proposed an explicit attention mechanism for feature fusion, by introducing interactive attention and complementary attention to handle different activation situations between modal channels, and finally introducing a gating mechanism to merge the outputs to achieve better fusion effects. In addition, in order to utilize the relationship between multi-layer features, subsequent studies proposed a feature hierarchical fusion strategy, designing deep fusion modules and shallow fusion modules respectively; the shallow fusion module uses pooling and large kernel convolution to reduce the large amount of noise interference in low-level features, and the deep fusion module uses dense connections to enhance semantic features. In addition, the researchers used the inductive bias of convolutional neural networks and transformer networks to decouple global information (such as background and large-scale environment) from local information (such as texture and edges) between modalities, and promoted feature fusion between modalities by maximizing the global mutual information between modalities and minimizing the local mutual information.

[0004] The shortcomings of the above methods are mainly reflected in the following aspects: (1) Due to the modal divergence between RGB and Thermal images, the corresponding divergent areas are more challenging to fuse than the semantically consistent areas, and have a greater contribution to the improvement of segmentation accuracy, but the existing methods do not consider the differentiated fusion of divergent areas and semantically consistent areas; (2) The existing methods use the same fusion method for the features of the two modalities, but due to the semantic divergence between the modalities, the same fusion method is difficult to fully capture the semantic characteristics of different modalities; (3) The existing methods do not consider the relationship between the decoding process of high-level semantic features and low-level detail features, that is, different semantics require different local detail features to be restored, which makes it difficult to accurately segment small objects and object edges. Based on the above considerations, for practical application scenarios such as film and television creation, service robots, and intelligent inspection, it is urgent to design an image segmentation method that can fully integrate the complementary information of multispectral modalities and accurately mine the semantics between modalities. Summary of the invention

[0005] The purpose of the present invention is to address the deficiencies of the prior art and to provide a multispectral image semantic segmentation method based on modal divergence difference fusion, which can not only fully mine the modal complementary information and reduce the model calculation amount, but also accurately locate small objects and contour edges, thereby achieving accurate semantic segmentation of multispectral images.

[0006] The present invention provides a multispectral image semantic segmentation method based on modal divergence difference fusion, comprising the following steps:

[0007] Step (1) constructing a multispectral image data set, wherein the image data in the multispectral image data set includes: RGB modality images and Thermal modality images;

[0008] A feature encoder is constructed using four cascaded converter networks, and two feature encoders are used to extract feature representations of RGB modality images and Thermal modality images respectively; the feature encoder for extracting RGB modality images is denoted as R, and the feature encoder for extracting Thermal modality images is denoted as T;

[0009] The four cascaded converter networks that make up R are denoted as R1, R2, R3, and R4 in order;

[0010] The four cascaded converter networks that make up T are denoted as T1, T2, T3, and T4 in order;

[0011] The two feature encoders form a dual-stream feature encoder;

[0012] Step (2) constructing a difference fusion module considering modal divergence, wherein the difference fusion module is composed of four difference fusion submodules; each difference fusion submodule is composed of a semantic divergence detection submodule, a divergence coordination submodule, a semantic enhancement submodule, and a channel mixing submodule;

[0013] The four difference fusion submodules are respectively difference fusion submodule 1, difference fusion submodule 2, difference fusion submodule 3, and difference fusion submodule 4;

[0014] The features obtained by processing the RGB modality image by R1, R2, R3, and R4 in sequence, and the features obtained by processing the Thermal modality image by T1, T2, T3, and T4 in sequence, are input into the difference fusion submodule 4 together to obtain

[0015] Step (3) constructs a foreground segmentation head, which consists of two fully connected layers and an upsampling module. The input of the foreground segmentation head is The output is the foreground mask, denoted as M;

[0016] Step (4) The features obtained after the RGB modal image is processed by R1 Features obtained after T1 processing of Thermal modality images Input the difference fusion submodule 1; at the same time, input M into the semantic divergence detection submodule to limit the scope of the semantic divergence detection submodule, and obtain

[0017] Features obtained after R2 processing and Features obtained after T2 processing Input the difference fusion submodule 2, and at the same time, input M into the semantic divergence detection submodule to limit the scope of the semantic divergence detection submodule, and obtain

[0018] Features obtained after R1 processing and Features obtained after T1 processing Input the difference fusion submodule 3, and at the same time, input M into the semantic divergence detection submodule to limit the scope of the semantic divergence detection submodule, and obtain

[0019] Step (5) constructs a fully connected decoder and a fully connected semantic segmentation head. The input of the fully connected decoder is The output of the fully connected decoder is directly input into the fully connected semantic segmentation head to obtain a prediction mask; and the multispectral image is segmented based on the prediction mask.

[0020] Step (6) constructs a loss function based on the cross entropy loss and uses the stochastic gradient descent method to optimize the multispectral semantic segmentation model until the model converges.

[0021] Preferably, in step (5), the fully connected decoder is a semantically guided dynamic fully connected decoder;

[0022] The dynamic fully connected decoder consists of 4 semantic weight generation modules and 4 fully connected decoders;

[0023] The Input the four semantic weight generation modules respectively, and obtain

[0024] Will As the weight parameters of 4 fully connected decoders;

[0025] The The four fully connected decoders are input respectively, and the four outputs obtained are all input into the fully connected semantic segmentation head.

[0026] Preferably, step (1) further includes preprocessing the data set.

[0027] The image data in the dataset includes RGB modality images and Thermal modality images and their category semantic tags, wherein the category semantic tags are composed of a semantic category index for each pixel.

[0028] All semantic category indexes except the background category are regarded as foreground areas to obtain foreground labels;

[0029] In step (1), constructing a multispectral image data set includes:

[0030] (1-1) For multispectral RGB-T images (4 is the number of RGB-T channels) The image is split into two modes along the channel: RGB image and Thermal image. The Thermal image is copied three times along the channel to adapt to the feature extractor. and Where W and H are the width and height of the image respectively, and 3 is the number of RGB channels;

[0031] (1-2) Convert the semantic region into the foreground region. Specifically, convert the pixel-level semantic label tensor Convert to pixel-level foreground label tensor Right now The value range of elements in Y is {1, 2, .., K}, K is the number of semantic categories, y u,v Represents the pixel mark at the coordinate (u, v), where the subscripts u and v represent the coordinates of the feature map height and width respectively;

[0032] In step (1), a feature encoder is constructed by using four cascaded transformer networks, and two feature encoders are used to extract feature representations of RGB modality images and Thermal modality images respectively, including:

[0033] (1-3) Four hybrid transformers MIT are used to construct the feature encoder to extract the feature representations of the two modal images respectively, namely and in i represents the i-th layer of the feature extractor, where is the feature map of RGB channels, It is the feature map of the Thermal channel, R is the abbreviation of RGB, T is the abbreviation of Thermal, C is the number of feature channels, C2=2C1, C3=4C1, C3=8C1, C4=16C1.

[0034] Preferably, in step (2), the construction of the semantic divergence detection submodule, divergence coordination submodule, semantic enhancement submodule, and channel mixing submodule, and the obtaining The process includes the following steps:

[0035] (2-1) constructing a semantic divergence detection submodule, which divides the feature representations of the two modalities obtained in step (1) into semantic divergence areas and semantic consistency areas, and measures the semantic divergence from the perspectives of feature differences and neighborhood differences, respectively;

[0036] For the fourth layer of the difference fusion module, that is, the difference fusion submodule 4, the feature map in the given step (1-3) is input and The pixel features on its feature map are recorded as and And its corresponding neighborhood feature map with radius r is recorded as and Among them A T is the neighborhood feature map of the Thermal channel, A R It is the neighborhood feature map of RGB channels;

[0037] Using pixel feature P R With P T The cosine similarity between them is used to calculate the feature difference score, that is:

[0038]

[0039] in represents the feature difference score, ||·||2 represents the feature L2 norm;

[0040] Using the neighborhood feature map A T With A R The L2 norm between the two neighborhoods is used to calculate the neighborhood difference score, namely:

[0041]

[0042] in represents the neighborhood difference score, A R [n] represents the nth feature in the RGB neighborhood feature map, A T [n] represents the nth feature in the Thermal neighborhood feature map;

[0043] Calculate feature dissimilarity and neighborhood dissimilarity scores Calculate the feature difference and neighborhood difference scores for each location one by one And fill in the matrix according to the corresponding position to get the divergence matrix It represents the semantic divergence degree of the corresponding position pixel, according to the divergence matrix W Div The first δ element values ​​with the largest difference scores are selected as the divergent regions, and the horizontal and vertical coordinates of their corresponding positions are recorded to form the divergent region position matrix, which is recorded as

[0044] (2-2) Construct a semantic enhancement submodule to fuse the semantically consistent regional features. The semantic enhancement submodule integrates the complete feature map and As input, it consists of two parallel branches, namely RGB semantic enhancement branch and Thermal semantic enhancement branch. Each branch consists of a channel expansion module, a channel semantic enhancement module, a spatial semantic enhancement module and a channel recovery module.

[0045] First, the channel expansion module is used to expand the number of feature channels to twice the original number of channels. The channel expansion module consists of a 1×1 convolution layer and a 7×7 depth-separable convolution layer. The RGB modal feature map and Thermal modal feature map after channel expansion are obtained. and Then, the channel semantic enhancement module is used to enhance the modal semantics. The semantic enhancement module performs maximum pooling and average pooling operations along the spatial dimension, and then adds and fuses them through the fully connected layer and passes through the Sigmoid function. Get channel attention weight and Then, the channel attention weight and Characteristics after channel expansion and Multiply and add residual connections to retain the feature information after channel expansion, that is:

[0046]

[0047] in represents the Hadamard product, and They represent the RGB modal feature map and Thermal modal feature map obtained after channel semantic enhancement respectively;

[0048] Use the spatial semantic enhancement module to enhance the spatial features. First, use maximum pooling and average pooling and 1×1 convolution along the channel dimension, concatenate the obtained features along the channel dimension, and use 1×1 convolution to obtain the spatial attention weights of the RGB channel and the Thermal channel respectively. and The spatial attention weights and Feature map after channel semantic enhancement and Multiply them together to enhance each other semantically in the spatial dimension; in order to retain the feature information after channel semantic enhancement, it is fused with the feature map after spatial semantic enhancement through residual connection, that is:

[0049]

[0050] in and They represent the RGB modal feature map and Thermal modal feature map after channel semantic enhancement and feature semantic enhancement respectively; finally, the channel recovery module uses 1×1 convolution to reduce the dimension of the feature channel to obtain the semantic fusion feature map and

[0051] (2-3) Construct a divergence coordination submodule to integrate the semantic divergence region features. First, the divergence region Pos obtained in step (2-1) div The corresponding position features are sampled to obtain the RGB mode divergence feature set and the Thermal mode divergence feature set.

[0052]

[0053] Among them, PR represents the feature point of RGB mode, PT represents the feature point of Thermal mode, and the feature sampling of the feature area with radius r is obtained, and the divergent feature neighborhood set is recorded as:

[0054]

[0055] Among them, AR represents the feature neighborhood of RGB mode, and AT represents the feature point of Thermal mode;

[0056] Pair Collection and All elements within and Splice along the channel dimension to obtain intermediate features And build an intermediate feature set Use multi-head attention mechanism to fuse features:

[0057] For each intermediate feature, the dot product attention mechanism is used to calculate the output of each attention head:

[0058]

[0059] Among them, h∈{1,2,...,head}, SoftMax() is the normalized exponential function, is the learnable affine transformation matrix, and head is the number of attention heads; where head = 6;

[0060] To aggregate the output of multi-head attention, each attention head outputs and Perform separate splicing, namely:

[0061]

[0062] Among them, MH(·) is multi-head attention, Concat(·) represents the concatenation operation, Represents the output of the attention head corresponding to the RGB channel, Represents the output of the attention head corresponding to the Thermal channel, and They are the learnable affine transformation matrices for the RGB and Thermal modes, respectively. The purpose of multiplying by the affine transformation matrix is ​​to reduce the channel dimension and mix the output of the attention head;

[0063] In the divergence coordination submodule, layer normalization and residual connection are added, and finally the relationship between channels is established through the feedforward neural network to obtain the divergence coordination feature set, namely:

[0064]

[0065] Among them, FFN(·) stands for Feed-Forward Network, which consists of two fully connected layers and one activation layer. LN(·) stands for Layer Normalization. and Coordinate feature sets for divergence;

[0066] (2-4) Construct a channel mixing submodule to fuse features. The module consists of two fusion branches, the channel attention branch and the spatial channel mixing branch. First, use the output of the divergence coordination module in step (2-3) to perform feature replacement operation on the output of the semantic enhancement module in step (2-2), that is:

[0067]

[0068] in, and Belong to the set and u,v∈Pos div ;

[0069] After replacement, the two modes and The features are spliced ​​along the channel dimension and fused in the spatial and channel dimensions respectively through a spatial channel mixing branch composed of multiple layers of large kernel convolution layers and 1×1 convolutions. The multiple layers of large kernel convolutions consist of 2 layers of depth-separable convolutions with a size of 7×7 and a hierarchical normalization layer. In order to better establish the relationship between feature channels, an additional channel attention branch is added, which consists of a channel attention module and a 1×1 convolution. Finally, the output of the channel attention branch and the output of the spatial channel mixing branch are mixed by numerical addition to obtain the fourth layer channel mixing feature map.

[0070] Preferably, the multispectral image semantic segmentation method based on modal divergence difference fusion described in 4 is characterized in that:

[0071] The step (3) specifically comprises the following steps:

[0072] Construct a fully connected layer foreground segmentation head, with the input being the fourth layer channel mixed feature map The foreground segmentation head consists of two fully connected layers and an upsampling module. First, the first fully connected layer reduces the feature map The channel dimension is then linearly interpolated and upsampled to restore the resolution to Then, the number of feature map channels is reduced to 1 through the second fully connected layer, and the Sigmoid function is used to normalize the feature map values ​​output by the second fully connected layer to the interval [0, 1], and we get When the value is greater than 0.5, it is considered as the foreground area. And get the foreground mask

[0073] Preferably, the step (4) specifically comprises the following steps:

[0074] (4-1) For the four-layer difference fusion module constructed in step (2), in order to further limit the scope of the semantic divergence detection module and better fuse the features, the foreground segmentation map obtained in step (3) is used. Limit the semantic divergence area, namely:

[0075]

[0076] in, represents the Hadamard product, is the divergence matrix obtained using the mask, according to the divergence matrix The first δ element values ​​with larger difference scores are selected as the divergent regions, and the horizontal and vertical coordinates of their corresponding positions are recorded to form the divergent region position matrix, which is recorded as Pos div ∈R (W×H×δ)×2 ;

[0077] (4-2) Construct a semantic enhancement submodule to fuse the semantically consistent region features. The specific module operation is consistent with step (2-2). The input of the semantic enhancement submodule is and The output is and where j∈{1,2,3};

[0078] (4-3) Construct a divergence coordination submodule to integrate the features of semantic divergence regions. The specific module operation is consistent with step (2-3). The input of the divergence coordination submodule is the divergence feature set. And the divergent feature neighborhood set Among them, the coordinates u, v∈Pos div , the output is a divergent and coordinated feature set and

[0079] (4-4) Construct a channel mixing submodule to fuse the features. The specific module operation is consistent with step (2-4). The input of the channel mixing submodule is the divergent coordination feature set of step (4-3). and And step (4-2) semantic fusion features and The output is the first to third layer channel mixed feature map

[0080]

[0081] Preferably, step (5) specifically comprises the following steps:

[0082] (5-1) First, four semantic weight generation modules are constructed to generate dynamic weights for the four-layer dynamic fully connected decoder. A single semantic weight generation module consists of five 1×1 convolution and pyramid pooling modules. The input of this module is the fourth layer channel mixed feature. First, 1×1 convolution is used to reduce the feature channel dimension, and then a multi-scale feature representation is obtained through a pyramid pooling module. The module consists of pooling layers with different window sizes of 3×3, 5×5, and 7×7, and three 1×1 convolutions are used to adjust the number of channels.

[0083] After obtaining the multi-scale feature representation, it is upsampled to the same scale and concatenated. Finally, a 1×1 convolution is used to reduce the number of channels again to generate the final decoder dynamic weights, which are output as the weight matrix of the four-layer fully connected feature decoder. Where l∈{1, 2, 3, 4} is the number of decoder feature layers, C d =128 is the number of decoder feature channels;

[0084] (5-2) Construct a dynamic fully connected decoder including a dynamic fully connected layer and an upsampling module, and decode the multi-layer fusion features; specifically: the dynamic fully connected decoder weights of (5-1) And the channel mixed feature map of (2-4) and (4-4) Perform matrix multiplication, where i∈{1, 2, 3, 4}; use the upsampling module to upsample the feature map size to the original image Output decoded feature map

[0085] (5-3) Construct a fully connected semantic segmentation head to generate semantic segmentation results. This module consists of a concatenation operation, a fully connected layer, and an upsampling module. The input is the decoded feature map. The output is the predicted segmentation label tensor

[0086] Preferably, step (6) specifically comprises the following steps:

[0087] (6-1) The predicted segmentation label tensor With the pixel-level semantic label tensor Y as input, the foreground segmentation loss is calculated using the cross entropy loss function, that is, Where h represents the vertical coordinate value of the pixel point, w represents the horizontal coordinate value of the pixel point, and k represents the kth semantic category;

[0088] (6-2) Combine the foreground mask M of step (3-1) with the pixel-level foreground label tensor of step (1-2) As input, the semantic segmentation loss is calculated using the binary cross entropy loss function, i.e.

[0089]

[0090] (6-3) The divergent coordination feature set of step (2-3) and step (4-3) and As input, the cosine similarity is used to calculate the feature consistency loss, that is, in

[0091] (6-4) Calculate the loss function of the semantic segmentation model Among them, λ1, λ2, λ3>0 are hyperparameters; the multi-spectral semantic segmentation model is optimized using stochastic gradient descent method.

[0092] Preferably, the value of δ is 30%, and the value range of radius r is 3-7.

[0093] The segmentation model proposed in the present invention is composed of a dual-stream feature extractor, a difference fusion module, a foreground segmentation head, a dynamic fully connected decoder and a semantic segmentation head; the present invention has the following advantages for the semantic divergence problem between RGB and Thermal modes: 1) Considering the contribution of different regions to the problem of asymmetry between modes, the semantic divergence detection submodule focuses on the fusion of divergent region pixels, thereby reducing the model reasoning overhead; 2) Considering the differences in fusion paradigms of different regions from the perspective of semantic divergence, a semantic enhancement submodule and a semantic sub-coordination module are proposed to achieve differentiation of fusion paradigms and solve the problem of poor fusion effect of multimodal features; 3) Using a semantic weight generation module, high-level semantic features are used to dynamically generate weights, introduce dynamics into the decoding of low-level features, and solve the problem of the model's weak ability to capture small objects and boundaries. This provides technical support for practical application scenarios such as film and television creation, service robots, and intelligent inspections. BRIEF DESCRIPTION OF THE DRAWINGS

[0094] In order to more clearly illustrate the specific implementation of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the specific implementation or the prior art description. Some specific embodiments of the present invention will be described in detail in an exemplary but not restrictive manner with reference to the drawings. The same reference numerals in the drawings indicate the same or similar components or parts. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:

[0095] Figure 1 Schematic diagram of foreground conversion in an embodiment of the present invention.

[0096] Figure 2 Schematic diagram of a multispectral semantic segmentation model used in an embodiment of the present invention.

[0097] Figure 3 Flow chart of main steps in an embodiment of the present invention.

[0098] Figure 4 It is a diagram showing qualitative results in an embodiment of the present invention.

[0099] Figure 5 RGB and Thermal image sample diagrams in an embodiment of the present invention. DETAILED DESCRIPTION

[0100] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0101] The method of the present invention uses the AdamW algorithm as the optimizer for the multispectral image data set, sets the initial learning rate to 0.0004, the weight decay coefficient to 0.001, the number of training epochs to 300, and uses Ploy as the learning rate decay strategy. The formula is:

[0102]

[0103] Among them lr init is the initial learning rate, epoch max is the maximum number of epochs, epoch current is the current epoch number. Use rotation and flipping as the image enhancement strategy. The image resolution during training is 640×480 and the following operations are performed in sequence:

[0104] Step (1) specifically includes:

[0105] (1-1) For multispectral RGB-T images 4 is the number of RGB-T channels. The image is split into two modes: RGB image and Thermal image. The Thermal image is copied three times along the channel to adapt to the feature extractor.

[0106] and Where W and H are the width and height of the image respectively, and 3 is the number of RGB channels.

[0107] (1-2) Convert the semantic region into the foreground region. Specifically, convert the pixel-level semantic label tensor Converted to pixel-level foreground label tensor Right now The value range of elements in Y is {1, 2, .., K}, K is the number of semantic categories, y u,vIndicates the pixel mark at the coordinate (u, v), where the subscripts u and v represent the coordinates of the height and width of the feature map respectively; if there are people, cars, buildings and other objects in the picture, semantic indexes are set as tags for people, cars, buildings and other objects respectively. For different pictures, one picture may have a person tag and a car tag, and another picture may have a person tag and a building tag. A picture may also have only a person tag, such as Figure 1 As shown, there is a person in the right picture, so the corresponding mark is the person, that is, the green mark, and the rest of the gray part is the background. The area except the background, that is, the pixel area of ​​all semantic marks, is regarded as the foreground area, that is, the white part of the right picture, and the rest is the background area, that is, the black part of the right picture.

[0108] (1-3) Four hybrid transformers MIT are used to construct the feature encoder to extract the feature representations of the two modal images respectively, namely and in i represents the i-th layer of the feature extractor, where is the feature map of RGB channels, It is the feature map of the Thermal channel, R is the abbreviation of RGB, T is the abbreviation of Thermal, C is the number of feature channels, C2=2C1, C3=4C1, C3=8C1, C4=16C1.

[0109] Furthermore, step (2) is specifically:

[0110] (2-1) Construct semantic divergence detection submodule, such as Figure 5 As shown in the figure, there is no person on the right in the RGB mode, but the Thermal mode shows a person. At this time, there is a semantic divergence between the two modes. The role of this module is to measure the semantic divergence from the feature difference and the neighborhood difference respectively, so as to find out the detection of the above divergence and divide the feature representation of the two modes into a semantic divergence area and a semantic consistency area; for the fourth layer input of the difference fusion module, the feature map in step (1-3) is given and The pixel features on its feature map are recorded as And its corresponding neighborhood feature map with radius r is recorded as:

[0111]

[0112] Among them A T is the neighborhood feature map of the Thermal channel, A R It is the neighborhood feature map of RGB channels;

[0113] Using pixel point P R With P T The cosine similarity between them is used to calculate the feature difference score, that is:

[0114]

[0115] in represents the feature difference score, ||·||2 represents the feature L2 norm;

[0116]

[0117] in represents the neighborhood difference score, A R [n] represents the nth feature in the RGB neighborhood feature map, A T [n] represents the nth feature in the Thermal neighborhood feature map;

[0118] Calculate feature dissimilarity and neighborhood dissimilarity scores Calculate the feature difference and neighborhood difference scores for each location one by one And fill in the matrix according to the corresponding position to get the divergence matrix It represents the semantic divergence degree of the corresponding position pixel, according to the divergence matrix W Div Filter the element values ​​with larger difference scores, specifically select the first δ, generally the first 30%, as the divergence area, and record the horizontal and vertical coordinates of their corresponding positions to form the divergence area position matrix recorded as

[0119] (2-2) Construct a semantic enhancement submodule to fuse the semantically consistent region features, such as Figure 5 As shown in Figure 1, the person on the left is clearly visible in both RGB and Thermal modes, and the role of this module is to promote the semantic expression in this semantically consistent situation. and As input, it is specifically composed of two parallel branches, namely, RGB semantic enhancement,branch and Thermal semantic enhancement branch. Each branch consists of a channel expansion module, a channel semantic enhancement,module, a spatial semantic enhancement module and a channel recovery module;

[0120] First, the channel expansion module is used to expand the number of feature channels to twice the original number of channels. The module consists of a 1×1 convolution layer and a 7×7 depth-separable convolution layer to obtain the RGB modal feature map and Thermal modal feature map after channel expansion. and The channel semantic enhancement module is then used to enhance the modal semantics. The module performs maximum pooling and average pooling operations along the spatial dimension, adds and fuses them through the fully connected layer, and then passes through the Sigmoid function. Get channel attention weight and Then, the channel attention weight and Characteristics after channel expansion and Multiply and add residual connections to retain the feature information after channel expansion, that is:

[0121]

[0122] in represents the Hadamard product, and Respectively represent the RGB modal feature map and Thermal modal feature map obtained after channel semantic enhancement;

[0123] Use the spatial semantic enhancement module to enhance the spatial features. First, use maximum pooling and average pooling and 1×1 convolution along the channel dimension, concatenate the obtained features along the channel dimension, and use 1×1 convolution to obtain the spatial attention weights of the RGB channel and the Thermal channel respectively. and The spatial attention weights and Feature map after channel semantic enhancement and Multiply them together to enhance each other semantically in the spatial dimension; in order to retain the feature information after channel semantic enhancement, it is fused with the feature map after spatial semantic enhancement through residual connection, that is:

[0124]

[0125] in and They represent the RGB modal feature map and Thermal modal feature map after channel semantic enhancement and feature semantic enhancement respectively; finally, the channel recovery module uses 1×1 convolution to reduce the dimension of the feature channel to obtain the semantic fusion feature map and

[0126] (2-3) Construct divergence coordination submodule to integrate semantic divergence region features, such as Figure 5 As shown in the figure, there is no person on the right in the RGB mode, but the Thermal mode shows a person. The purpose of the divergence coordination submodule is to handle semantic divergence by constructing intermediate semantics so that the divergent regions can obtain consistent semantic feature representations. First, the divergent region Pos div The corresponding position features are sampled to obtain the RGB mode divergence feature set and the Thermal mode divergence feature set.

[0127]

[0128] Among them, PR represents the feature point of RGB mode, PT represents the feature point of Thermal mode, and the feature sampling of the feature area with radius r (r = 3 to 7) is recorded as:

[0129]

[0130] Among them, AR represents the feature neighborhood of RGB modality, and AT represents the feature neighborhood of modality;

[0131] Pair Collection and All elements within and Splice along the channel dimension to obtain intermediate features And build an intermediate feature set Use multi-head attention mechanism to fuse features:

[0132] For each intermediate feature, the dot product attention mechanism is used to calculate the output of each attention head:

[0133]

[0134] Among them, h∈{1,2,...,head}, SoftMax() is the normalized exponential function, is the learnable affine transformation matrix, and head is the number of attention heads; where head = 6;

[0135] To aggregate the output of multi-head attention, each attention head outputs and Perform separate splicing, namely:

[0136]

[0137] MH(·) is the abbreviation of multi-head attention, Concat(·) represents the concatenation operation, Represents the output of the attention head corresponding to the RGB channel, Represents the output of the attention head corresponding to the Thermal channel, and They are learnable affine transformation matrices for the RGB and Thermal modes, respectively, which aim to reduce the channel dimension and mix the outputs of the attention heads;

[0138] Add layer normalization and residual connection to the model, and finally establish the relationship between channels through the feedforward neural network to obtain the divergent and coordinated feature set, namely:

[0139]

[0140] Among them, FFN(·) stands for Feed-Forward Network, which consists of two fully connected layers and one activation layer. LN(·) stands for Layer Normalization. and Coordinate feature sets for divergence;

[0141] (2-4) Construct a channel mixing submodule to fuse features. The module consists of two fusion branches, the channel attention branch and the spatial channel mixing branch. First, use the output of the divergence coordination module in step (2-3) to perform feature replacement operation on the output of the semantic enhancement module in step (2-2), that is:

[0142]

[0143] in, and Belong to the set and u,v∈Pos div ;

[0144] After replacement, the two modes and The features are spliced ​​along the channel dimension and fused in the spatial and channel dimensions respectively through a spatial channel mixing branch composed of multiple layers of large kernel convolution layers and 1×1 convolutions. The multiple layers of large kernel convolutions consist of 2 layers of depth-separable convolutions with a size of 7×7 and a hierarchical normalization layer. In order to better establish the relationship between feature channels, an additional channel attention branch is added, which consists of a channel attention module and a 1×1 convolution. Finally, the output of the channel attention branch and the output of the spatial channel mixing branch are mixed by numerical addition to obtain the fourth layer channel mixing feature map.

[0145] Furthermore, step (3) is specifically:

[0146] (3-1) Construct a fully connected layer foreground segmentation head, and input the fourth layer channel mixed feature map The foreground segmentation head consists of two fully connected layers and an upsampling module. First, the first fully connected layer reduces the feature map The channel dimension is then linearly interpolated and upsampled to restore the resolution to Then, the number of feature map channels is reduced to 1 through the second fully connected layer, and the Sigmoid function is used to normalize the feature map values ​​output by the second fully connected layer to the interval [0, 1], and we get When the value is greater than 0.5, it is considered as the foreground area. And get the foreground mask

[0147] Furthermore, step (4) is specifically:

[0148] (4-1) For the four-layer difference fusion module constructed in step (2-1), in order to further limit the scope of the semantic divergence detection module and better fuse the features, the foreground mask obtained in step (3) is used. Limit the semantic divergence area, namely:

[0149]

[0150] in, represents the Hadamard product, is the divergence matrix obtained using the mask, according to the divergence matrix The first δ element values ​​with the largest difference scores are selected as the divergent regions, and the value of δ is 30%. The horizontal and vertical coordinates of the corresponding positions are recorded to form the divergent region position matrix, which is recorded as

[0151] (4-2) Construct a semantic enhancement submodule to fuse the semantically consistent regional features. The specific module operation is consistent with step (2-2). The input of the semantic enhancement module is and The output is and where j∈{1,2,3};

[0152] (4-3) Construct a divergence coordination submodule to integrate the semantic divergence region features. The specific module operation is consistent with step (2-2). The input of the divergence coordination submodule is the divergence feature set

[0153] And the divergent feature neighborhood set

[0154] Among them, the coordinates u, v∈Pos div , the output is a divergent and coordinated feature set and

[0155] (4-4) Construct a channel mixing submodule to fuse the features. The specific module operation is consistent with step (2-4). The input of the channel mixing submodule is the divergent coordination feature set of step (4-3). and And step (4-2) semantic fusion features and The output is the first to third layer channel mixed feature map

[0156] Furthermore, step (5) is specifically:

[0157] (5-1) First, four semantic weight generation modules are constructed. The modules generate low-level feature decoder weights through high-level features and build the relationship between high-level and low-level features to enhance the decoder's segmentation ability at the boundary. Dynamic weights are generated for the four-layer dynamic fully connected decoder respectively; a single semantic weight generation module consists of 5 1×1 convolution and pyramid pooling modules, and the input of this module is the fourth-layer channel mixed feature First, 1×1 convolution is used to reduce the feature channel dimension, and then a multi-scale feature representation is obtained through a pyramid pooling module. The module consists of pooling layers with different window sizes of 3×3, 5×5, and 7×7, and three 1×1 convolutions are used to adjust the number of channels.

[0158] After obtaining the multi-scale feature representation, it is upsampled to the same scale and concatenated. Finally, a 1×1 convolution is used to reduce the number of channels again to generate the final decoder dynamic weights, which are output as the weight matrix of the four-layer fully connected feature decoder. Where l∈{1, 2, 3, 4} is the number of decoder feature layers, C d =128 is the number of decoder feature channels;

[0159] (5-2) Construct a dynamic fully connected decoder including a dynamic fully connected layer and an upsampling module, and decode the multi-layer fusion features; specifically: the dynamic fully connected decoder weights of (5-1) And the channel mixed feature map of (2-4) and (4-4) Perform matrix multiplication, where i∈{1, 2, 3, 4}; use the upsampling module to upsample the feature map size to the original image Output decoded feature map

[0160] (5-3) Construct a fully connected semantic segmentation head to generate semantic segmentation results. This module consists of a concatenation operation, a 3×3 convolutional layer, a fully connected layer, and an upsampling module. The input is the decoded feature map First, the decoded feature map is concatenated along the channel dimension using a concatenation operation, and then a 3×3 convolutional layer is used to mix the features. Then, a fully connected layer is used to reduce the number of feature channels to K and an upsampling module is used to restore the image size. Finally, a softmax operation is used for normalization, and the output is the predicted segmentation label tensor.

[0161] Furthermore, step (6) is specifically:

[0162] (6-1) The predicted segmentation label tensor With the pixel-level semantic label tensor Y as input, the foreground segmentation loss is calculated using the cross entropy loss function, that is, Where h represents the vertical coordinate value of the pixel point, w represents the horizontal coordinate value of the pixel point, and k represents the kth semantic category;

[0163] (6-2) Combine the foreground mask M of step (3-1) with the pixel-level foreground label tensor of step (1-2) As input, the semantic segmentation loss is calculated using the binary cross entropy loss function, i.e.

[0164]

[0165] (6-3) The divergent coordination feature set of steps (2-4) and (4-3) and As input, the cosine similarity is used to calculate the feature consistency loss, i.e. in

[0166] (6-4) Calculate the loss function of the semantic segmentation model Among them, λ1, λ2, λ3>0 are hyperparameters; the stochastic gradient descent method is used to optimize the multispectral semantic segmentation model consisting of a two-stream feature extractor, a difference fusion module, a foreground segmentation head, a dynamic fully connected decoder and a semantic segmentation head.

[0167] Furthermore, step (7) is specifically:

[0168] Step (7-1) inputs the new multispectral image into the trained model to obtain the predicted segmentation label tensor Select the class with the highest probability for each pixel in As the result of multispectral image semantic segmentation, argmax(·) is used to find the index of the maximum value.

[0169] The present invention proposes a multispectral image semantic segmentation method based on modality divergence difference fusion, which has the following characteristics: 1) utilizing the semantic divergence between modalities, using comprehensive similarity to measure the semantic difference between modalities and dividing the features into semantically consistent areas and semantically divergent areas, and proposing a difference fusion module for more effectively fusing multimodal features according to the contribution differences and fusion paradigm differences of different regions; 2) through a semantically guided dynamic fully connected decoder, the dynamic weights generated by high-level semantics are introduced to reflect the semantic association between high-level and low-level features, so that the decoded features take into account additional dynamic characteristics.

[0170] Figure 3The flowchart in the figure gives the main steps of the multispectral image semantic segmentation method based on modal divergence difference fusion. The method first preprocesses the data set, and uses the pixel area of ​​all categories of semantic labels as the foreground area to extract features of the multispectral image using a two-stream feature extractor, and uses the converter network to extract RGB image features and Thermal image features; constructs the fourth-layer feature region difference fusion module to obtain the image features after modal fusion; constructs the foreground segmentation head to obtain the foreground mask; uses the foreground mask to restrict the divergent area, and constructs one to three layers of feature region difference fusion modules, and uses the foreground mask to obtain the image features after modal fusion; establishes a semantically guided dynamic fully connected decoder and a fully connected semantic segmentation head to obtain the segmentation result map; uses the stochastic gradient descent method to optimize the multispectral semantic segmentation model composed of a two-stream feature extractor, a region difference fusion module, a foreground segmentation head, a dynamic fully connected decoder and a semantic segmentation head; uses the optimized model to generate the semantic segmentation map of the new multispectral image. This method uses the differentiated fusion method of semantic divergence to perform modal fusion through the semantic enhancement submodule and the divergence coordination submodule to achieve a balance between fusion effect and fusion efficiency. It also enhances the localization ability of small objects and boundaries through the semantically guided dynamic decoder, thereby generating a more accurate multispectral semantic segmentation map.

[0171] like Figure 4 As shown in the red box, the multispectral image semantic segmentation method based on modal divergence difference fusion proposed above has significant improvements in the segmentation ability of boundary positions and the discrimination ability of semantic features on MF Dataset compared with the existing classic multispectral fusion model RTFNet, and has achieved excellent segmentation performance.

[0172] The above descriptions are only some specific implementation methods of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any person familiar with the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.

Claims

1. A multispectral image semantic segmentation method based on modal divergence difference fusion, characterized in that: The following steps are involved: Step (1) constructing a multispectral image data set, wherein the image data in the multispectral image data set includes: RGB modality images and Thermal modality images; A feature encoder is constructed using four cascaded converter networks, and two feature encoders are used to extract feature representations of RGB modality images and Thermal modality images respectively; the feature encoder for extracting RGB modality images is denoted as R, and the feature encoder for extracting Thermal modality images is denoted as T; The four cascaded converter networks that make up R are denoted as R1, R2, R3, and R4 in order; The four cascaded converter networks that make up T are denoted as T1, T2, T3, and T4 in order; The two feature encoders form a dual-stream feature encoder; Step (2) constructing a difference fusion module considering modal divergence, wherein the difference fusion module is composed of four difference fusion submodules; each difference fusion submodule is composed of a semantic divergence detection submodule, a divergence coordination submodule, a semantic enhancement submodule, and a channel mixing submodule; The four difference fusion submodules are respectively difference fusion submodule 1, difference fusion submodule 2, difference fusion submodule 3, and difference fusion submodule 4; The features obtained by processing the RGB modality image by R1, R2, R3, and R4 in sequence, and the features obtained by processing the Thermal modality image by T1, T2, T3, and T4 in sequence, are input into the difference fusion submodule 4 to obtain the fourth layer of difference fusion features. Step (3) constructs a foreground segmentation head, which consists of two fully connected layers and an upsampling module. The input of the foreground segmentation head is The output is the foreground mask, denoted as M; Step (4) The features obtained after the RGB modal image is processed by R1 Features obtained after T1 processing of Thermal modality images Input the difference fusion submodule 1, and input M into the semantic divergence detection submodule to obtain the first layer of difference fusion features Features obtained after R2 processing and Features obtained after T2 processing Input the difference fusion submodule 2, and input M into the semantic divergence detection submodule to obtain the second layer of difference fusion features Features obtained after R3 processing and Features obtained after T3 processing Input the difference fusion submodule 3, and input M into the semantic divergence detection submodule to obtain the third layer of difference fusion features Step (5) constructs a fully connected decoder and a fully connected semantic segmentation head to obtain a multispectral semantic segmentation model consisting of a dual-stream feature encoder, a difference fusion module, a foreground segmentation head, a fully connected decoder and a semantic segmentation head; the input of the fully connected decoder is The output of the fully connected decoder is directly input into the fully connected semantic segmentation head to obtain a prediction mask; and the multispectral image is segmented based on the prediction mask; Step (6) constructing a loss function based on the cross entropy loss, and optimizing the multi-spectral semantic segmentation model using the stochastic gradient descent method until the model converges; The step (1) further includes preprocessing the data set, wherein the image data in the data set includes RGB modality images and Thermal modality images and their category semantic tags, and the category semantic tags are composed of a semantic category index of each pixel; All semantic category indexes except the background category are regarded as foreground areas to obtain foreground labels; In step (1), constructing a multispectral image data set includes: (1-1) For multispectral RGB-T images Split along the channel into two modes: RGB image and Thermal image, where 4 is the number of RGB-T channels; copy the Thermal image three times along the channel to adapt to the feature extractor, and get and Where W and H are the width and height of the image respectively, and 3 is the number of RGB channels; (1-2) Convert the semantic region into the foreground region. Specifically, convert the pixel-level semantic label tensor Converted to pixel-level foreground label tensor Right now The value range of elements in Y is {1, 2, .., K}, K is the number of semantic categories, y u,v Represents the pixel mark at the coordinate (u, v), where the subscripts u and v represent the coordinates of the height and width of the feature map respectively; In step (1), a feature encoder is constructed by using four cascaded transformer networks, and two feature encoders are used to extract feature representations of RGB modality images and Thermal modality images respectively, including: (1-3) Four hybrid transformers MIT are used to construct the feature encoder to extract the feature representations of the two modal images respectively, namely and in i represents the i-th layer of the feature extractor, where is the feature map of RGB channels, is the feature map of the Thermal channel, R is the abbreviation of RGB, T is the abbreviation of Thermal, C is the number of feature channels, C2=2C1, C3=4C1, C3=8C1, C4=16C1; In the step (2), the construction of the semantic divergence detection submodule, divergence coordination submodule, semantic enhancement submodule, and channel mixing submodule, and the The process includes the following steps: (2-1) Constructing a semantic divergence detection submodule, which divides the feature representations of the two modalities obtained in step (1) into semantic divergence areas and semantic consistency areas, and measures the semantic divergence from the feature difference and neighborhood difference respectively; for the fourth layer of the difference fusion module, i.e., the difference fusion submodule 4, input the feature map feature map in the given step (1-3) and The pixel feature on its feature map is denoted as p R =F R [u][v]∈R 1×C With p T =F T [u][v]∈R 1×C , and its corresponding neighborhood feature map with radius r is recorded as and Among them A T is the neighborhood feature map of the Thermal channel, A R It is the neighborhood feature map of RGB channels; Using pixel feature P R With P T The cosine similarity between them is used to calculate the feature difference score, that is: in represents the feature difference score, ||·||2 represents the feature L2 norm; Using the neighborhood feature map A T With A R The L2 norm between the two neighborhoods is used to calculate the neighborhood difference score, namely: in represents the neighborhood difference score, A R [n] represents the nth feature in the RGB neighborhood feature map, A T [n] represents the nth feature in the Thermal neighborhood feature map; Calculate feature dissimilarity and neighborhood dissimilarity scores Calculate the feature difference and neighborhood difference scores for each location one by one And fill in the matrix according to the corresponding position to get the divergence matrix It represents the semantic divergence degree of the corresponding position pixel, according to the divergence matrix W Div The first δ element values ​​with the largest difference scores are selected as the divergent regions, and the horizontal and vertical coordinates of their corresponding positions are recorded to form the divergent region position matrix, which is recorded as (2-2) Construct a semantic enhancement submodule to fuse the semantically consistent regional features. The semantic enhancement submodule integrates the complete feature map and As input, it consists of two parallel branches, namely RGB semantic enhancement branch and Thermal semantic enhancement branch. Each branch consists of a channel expansion module, a channel semantic enhancement module, a spatial semantic enhancement module and a channel recovery module. First, the channel expansion module is used to expand the number of feature channels to twice the original number of channels. The channel expansion module consists of a 1×1 convolution layer and a 7×7 depth-separable convolution layer. The RGB modal feature map and Thermal modal feature map after channel expansion are obtained. and Then, the channel semantic enhancement module is used to enhance the modal semantics. The semantic enhancement module performs maximum pooling and average pooling operations along the spatial dimension, and then adds and fuses them through the fully connected layer and passes through the Sigmoid function. Get channel attention weight and Then, the channel attention weight and Characteristics after channel expansion and Multiply and add residual connections to retain the feature information after channel expansion, that is: in represents the Hadamard product, and They respectively represent the RGB modal feature map and Thermal modal feature map obtained after channel semantic enhancement; Use the spatial semantic enhancement module to enhance the spatial features. First, use maximum pooling and average pooling and 1×1 convolution along the channel dimension, concatenate the obtained features along the channel dimension, and use 1×1 convolution to obtain the spatial attention weights of the RGB channel and the Thermal channel respectively. and The spatial attention weights and Feature map after channel semantic enhancement and Multiply them together to enhance each other semantically in the spatial dimension; in order to retain the feature information after channel semantic enhancement, it is fused with the feature map after spatial semantic enhancement through residual connection, that is: in and They represent the RGB modal feature map and Thermal modal feature map after channel semantic enhancement and feature semantic enhancement respectively; finally, the channel recovery module uses 1×1 convolution to reduce the dimension of the feature channel to obtain the semantic fusion feature map and (2-3) Construct a divergence coordination submodule to integrate the semantic divergence region features. First, the divergence region Pos obtained in step (2-1) div The corresponding position features are sampled to obtain the RGB mode divergence feature set and the Thermal mode divergence feature set. Among them, PR represents the feature point of RGB mode, PT represents the feature point of Thermal mode, and the feature sampling of the feature area with radius r is obtained, and the divergent feature neighborhood set is recorded as: Among them, AR represents the feature neighborhood of RGB mode, and AT represents the feature point of Thermal mode; Pair Collection and All elements within and Splice along the channel dimension to obtain intermediate features And build an intermediate feature set Use multi-head attention mechanism to fuse features: For each intermediate feature, the dot product attention mechanism is used to calculate the output of each attention head: Where, h∈{1,2,...,head}, SoftMax(·) is the normalized exponential function, is the learnable affine transformation matrix, and head is the number of attention heads; where head = 6; To aggregate the output of multi-head attention, each attention head outputs and Perform separate splicing, namely: Among them, MH(·) is multi-head attention, Concat(·) represents the concatenation operation, Represents the output of the attention head corresponding to the RGB channel, Represents the output of the attention head corresponding to the Thermal channel, and They are the learnable affine transformation matrices for the RGB and Thermal modes, respectively. The purpose of multiplying by the affine transformation matrix is ​​to reduce the channel dimension and mix the output of the attention head; In the divergence coordination submodule, layer normalization and residual connection are added, and finally the relationship between channels is established through the feedforward neural network to obtain the divergence coordination feature set, namely: Among them, FFN(·) stands for Feed-Forward Network, which consists of two fully connected layers and one activation layer. LN(·) stands for Layer Normalization. and Coordinate feature sets for divergence; (2-4) Construct a channel mixing submodule to fuse features. The module consists of two fusion branches, the channel attention branch and the spatial channel mixing branch. First, use the output of the divergence coordination module in step (2-3) to perform feature replacement operation on the output of the semantic enhancement module in step (2-2), that is: in, and Belong to the set and u,v∈Pos div ; After replacement, the two modes and The features are spliced ​​along the channel dimension and fused in the spatial and channel dimensions respectively through a spatial channel mixing branch composed of multiple layers of large kernel convolution layers and 1×1 convolutions. The multiple layers of large kernel convolutions consist of 2 layers of depth-separable convolutions with a size of 7×7 and a hierarchical normalization layer. In order to better establish the relationship between feature channels, an additional channel attention branch is added, which consists of a channel attention module and a 1×1 convolution. Finally, the output of the channel attention branch and the output of the spatial channel mixing branch are mixed by numerical addition to obtain the fourth layer channel mixing feature map.

2. The multispectral image semantic segmentation method based on modal divergence difference fusion as claimed in claim 1, characterized in that: In the step (5), the fully connected decoder is a semantically guided dynamic fully connected decoder; The dynamic fully connected decoder consists of 4 semantic weight generation modules and 4 fully connected decoders; The Input the 4 semantic weight generation modules respectively, and obtain Will As the weight parameters of 4 fully connected decoders; The The four fully connected decoders are input respectively, and the four outputs obtained are all input into the fully connected semantic segmentation head.

3. The multispectral image semantic segmentation method based on modal divergence difference fusion as claimed in claim 1, characterized in that: The step (3) specifically comprises the following steps: Construct a fully connected layer foreground segmentation head, with the input being the fourth layer channel mixed feature map The foreground segmentation head consists of two fully connected layers and an upsampling module. First, the first fully connected layer reduces the feature map The channel dimension is then linearly interpolated and upsampled to restore the resolution to Then, the number of feature map channels is reduced to 1 through the second fully connected layer, and the Sigmoid function is used to normalize the feature map values ​​output by the second fully connected layer to the interval [0, 1], and we get When the value is greater than 0.5, it is considered as the foreground area. And get the foreground mask 4. The multispectral image semantic segmentation method based on modal divergence difference fusion as claimed in claim 3, characterized in that: The step (4) specifically comprises the following steps: (4-1) For the four-layer difference fusion module constructed in step (2), in order to further limit the scope of the semantic divergence detection module and better fuse the features, the foreground mask obtained in step (3) is used. Limit the semantic divergence area, namely: in, represents the Hadamard product, is the divergence matrix obtained using the mask, according to the divergence matrix The first δ element values ​​with larger difference scores are selected as the divergent regions, and the horizontal and vertical coordinates of their corresponding positions are recorded to form the divergent region position matrix recorded as (4-2) Construct a semantic enhancement submodule to fuse the semantically consistent region features. The specific module operation is consistent with step (2-2). The input of the semantic enhancement submodule is and The output is and where j∈{1,2,3}; (4-3) Construct a divergence coordination submodule to integrate the features of semantic divergence regions. The specific module operation is consistent with step (2-3). The input of the divergence coordination submodule is the divergence feature set. And the divergent feature neighborhood set Among them, the coordinates u, v∈Pos div , the output is a divergent and coordinated feature set and (4-4) Construct a channel mixing submodule to fuse the features. The specific module operation is consistent with step (2-4). The input of the channel mixing submodule is the divergent coordination feature set of step (4-3). and And step (4-2) semantic fusion features and The output is the first to third layer channel mixed feature map 5. The multispectral image semantic segmentation method based on modal divergence difference fusion as claimed in claim 4, characterized in that: Step (5) specifically includes the following steps: (5-1) First, four semantic weight generation modules are constructed to generate dynamic weights for the four-layer dynamic fully connected decoder. A single semantic weight generation module consists of five 1×1 convolution and pyramid pooling modules. The input of this module is the fourth layer channel mixed feature. First, 1×1 convolution is used to reduce the feature channel dimension, and then a multi-scale feature representation is obtained through a pyramid pooling module. The module consists of pooling layers with different window sizes of 3×3, 5×5, and 7×7, and three 1×1 convolutions are used to adjust the number of channels. After obtaining the multi-scale feature representation, it is upsampled to the same scale and concatenated. Finally, a 1×1 convolution is used to reduce the number of channels again to generate the final decoder dynamic weights, which are output as the weight matrix of the four-layer fully connected feature decoder. Where l∈{1, 2, 3, 4} is the number of decoder feature layers, C d =128 is the number of decoder feature channels; (5-2) Construct a dynamic fully connected decoder including a dynamic fully connected layer and an upsampling module, and decode the multi-layer fusion features; specifically: the dynamic fully connected decoder weights of (5-1) And the channel mixed feature map of (2-4) and (4-4) Perform matrix multiplication, where l∈{1, 2, 3, 4}; use the upsampling module to upsample the feature map size to the original image Output decoded feature map (5-3) Construct a fully connected semantic segmentation head to generate semantic segmentation results. This module consists of a concatenation operation, a fully connected layer, and an upsampling module. The input is the decoded feature map. The output is the predicted segmentation label tensor 6. The multispectral image semantic segmentation method based on modal divergence difference fusion as claimed in claim 5, characterized in that: The step (6) comprises the following steps: (6-1) The predicted segmentation label tensor With the pixel-level semantic label tensor Y as input, the foreground segmentation loss is calculated using the cross entropy loss function, that is, Where h represents the vertical coordinate value of the pixel point, w represents the horizontal coordinate value of the pixel point, and k represents the kth semantic category; (6-2) Combine the foreground mask M of step (3-1) with the pixel-level foreground label tensor of step (1-2) As input, the semantic segmentation loss is calculated using the binary cross entropy loss function, i.e. (6-3) The divergent coordination feature sets of each layer obtained according to steps (2-3) and (4-3) and As input, the cosine similarity is used to calculate the feature consistency loss, i.e. in (6-4) Calculate the loss function of the semantic segmentation model Among them, λ1, λ2, λ3>0 are hyperparameters; the multi-spectral semantic segmentation model is optimized using stochastic gradient descent method.