Semantic segmentation method in automatic driving scene, storage medium and electronic equipment
By using a hybrid transformer and multi-scale hypergraph method in autonomous driving scenarios to extract and fuse semantic features at different scales, the problem of insufficient semantic information and low accuracy in semantic segmentation is solved, and the training accuracy and accuracy of the model are improved. Computational efficiency.
Patent Information
- Application Number
- CN202410359071.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-27
- Publication Date
- 2024-09-10
AI Technical Summary
Existing semantic segmentation methods in autonomous driving scenarios have problems such as insufficient semantic information, low accuracy, and low computational efficiency.
Using a method based on hybrid transformer and multi-scale hypergraph, preprocessing is performed by obtaining road color images from the car's perspective, using a hybrid transformer encoder to extract semantic features of different scales, and combining the concepts of graph convolution and hypergraph to achieve different scale information interaction and fusion, and finally obtain the segmentation result through the hybrid decoder.
It improves the accuracy and computational efficiency of model training, can more effectively utilize semantic features at different scales, and enhances the performance and generalization capabilities of the network model.
Smart Images

Figure CN118628728A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a semantic segmentation method, storage medium and electronic device in an autonomous driving scenario. Background Art
[0002] Semantic segmentation plays a vital role in autonomous driving. Deep learning has made significant progress in the field of semantic segmentation, but existing methods still have some problems. For example, semantic information is not rich enough, accuracy is not high, and computational efficiency is low. Therefore, the research of new technologies and methods is of great significance to improve these problems. Summary of the invention
[0003] Based on this, it is necessary to provide a semantic segmentation method, storage medium and electronic device in an autonomous driving scenario based on a hybrid transformer and a multi-scale hypergraph to address the above technical issues. This method is conducive to model training and improves model accuracy.
[0004] In a first aspect, the present invention provides a semantic segmentation method in an autonomous driving scenario, the method comprising:
[0005] Obtain a color image of the road from the perspective of the car, and perform preprocessing to obtain image X;
[0006] Based on the hybrid transformer encoder, the semantic features of image X at different scales are obtained;
[0007] Graph convolution is used to extract the spatial information of semantic features of image X at different scales, and spatial semantic features of each scale are obtained through node message passing;
[0008] Using the concept of hypergraph, the graph structure of each scale is regarded as a hypergraph, and its hyperedge representation is obtained. The hyperedge is used to realize the interaction of information at different scales, and the multi-scale spatial mixed semantic information is obtained.
[0009] Through the hybrid decoder, multi-scale spatial semantic information is integrated to obtain the segmentation result.
[0010] Through the above design, we can effectively utilize semantic features of different scales and adopt a multi-scale feature interaction approach, which is more conducive to the training of the network model and improves the training accuracy.
[0011] In one embodiment, the preprocessing includes normalizing each acquired road color image, unifying its pixel values to [0, 1], and then setting the width and height of all images to W and H to obtain the image X.
[0012] In one embodiment, the encoder of the hybrid transformer includes four repeatedly stacked transformer encoding blocks, the input of the transformer encoding block of the first scale comes from the image X, and the input of the transformer encoding block of the next scale is the output of the transformer encoding block of the previous scale. The use of four repeatedly stacked encoding blocks can increase the depth of the model, enable the model to learn complex features, and perform feature extraction and representation learning on the input data multiple times, so that the model has better performance and generalization capabilities.
[0013] In one embodiment, the transformer encoding block includes a convolution block, a window multi-head self-attention layer, a sliding window multi-head self-attention layer, four layer normalization layers and two multi-layer perceptrons. The convolution block can help the model capture the spatial information and local patterns of the input data. It performs preliminary feature extraction on the input data so that the subsequent self-attention layer can better focus on the features at different positions. The window multi-head self-attention layer can help the model capture global information, help the model understand the global patterns and associated information in the input data, thereby improving the model's ability to understand the overall context. The sliding window multi-head self-attention layer can handle larger inputs while reducing computational complexity and capturing more contextual information. The layer normalization layer can help the model converge faster during training, and help alleviate the problems of gradient vanishing and gradient exploding, thereby improving the training stability of the model. The multi-layer perceptron can perform nonlinear transformations and combinations on features to increase the representation capabilities of the model.
[0014] In one embodiment, obtaining semantic features of image X at different scales includes:
[0015] S21: Perform three different convolution operations on the image X to obtain X q , X k , X v , X q , X k After interacting to obtain the global attention weight feature, v Weighted, get the global attention weighted feature X S1 :
[0016]
[0017] Among them, a represents the learnable parameter, T represents the matrix transpose, + represents the addition of corresponding elements, and f relu (·) represents the relu activation function, f soft (·) represents the softmax function, Represents matrix multiplication;
[0018] X S1 Serialize to get X' S1 , and input the transformer encoding block of the first scale to obtain a scale semantic feature F S1 ,
[0019] X' l1 =W-MSA(LN(Conv(X' S1 ))
[0020] X l1 =MLP(LN(X' l1 +X' S1 ))+X' l1
[0021] X' l2 =SW-MSA(LN(X l1 ))
[0022] F S1 =MLP(LN(X l '2+X l1 ))+X l '2
[0023] Among them, Conv(·) represents the convolution operation, W-MSA(·) represents the window-based multi-head self-attention mechanism, SW-MSA(·) represents the sliding window-based multi-head self-attention mechanism, LN(·) represents the layer normalization operation, and MLP(·) represents the multi-layer perceptron;
[0024] S22: The first-order semantic feature F S1 The downsampling operation is performed through the PatchMerging module, and the number of channels is adjusted, and then step S21 is repeated to obtain the two-scale semantic feature F S2 ;
[0025] S23: Using two-scale semantic features F S2 Repeat step S22 to obtain the three-scale semantic feature F S3 , and then use the three-scale semantic feature F S3 , repeat step S22 to obtain the four-scale feature F S4 .
[0026] In one of the embodiments, the convolution kernels of the three different convolution operations performed on the image X are 3*3, the step size is 1, the padding is 1, and the initialization weights are randomly generated.
[0027] In one embodiment, graph convolution is used to extract spatial information of semantic features of image X at different scales, and spatial semantic features of each scale are obtained through node message passing, including:
[0028] Based on FS1 、F S2 、F S3 Construct graph structures to obtain graph structures of various scales Through three graph convolution operations respectively, the formula is expressed as follows:
[0029]
[0030] Among them, GCN(·) represents the graph convolution method and σ(·) is the activation function.
[0031] In one embodiment, the concept of hypergraph is used to regard the graph structure of each scale as a hypergraph, and its hyperedge representation is obtained. The hyperedge is used to realize the interaction of information at different scales, and the multi-scale spatial mixed semantic information is obtained, including:
[0032] S41: Using the concept of hypergraph, the F S1 、F S2 、F S3 The constructed graph structure is associated with a hyperedge, and the hyperedge is as follows:
[0033]
[0034] Among them, m∈(1,2,3), H m represents the hyperedge of the mth scale, represents the feature of the nth node at the mth scale, ⊙ represents the corresponding multiplication of each element of the matrix;
[0035] The dimensions of the obtained hyperedges H1, H2, and H3 are (d1, 1), (d2, 1), and (d3, 1), respectively;
[0036] S42: Interact each hyperedge with the other two, specifically including: performing matrix multiplication of H1 with H2 and H3 to obtain the hyperedge feature matrix F 1-2 、F 1-3 ,
[0037]
[0038] Among them, F 1-2 、F 1-3 The dimensions are (d1, d2) and (d1, d3) respectively;
[0039] F 1-2 、F 1-3 Perform 1×d2 and 1×d3 convolution operations respectively to obtain the hyperedge feature H after mixed interaction. 1-2 , H 1-3 , using H 1-2 , H 1-3 Weighted processing is performed on the original hyperedge H1 to obtain H' 1-2, H' 1-3 ,
[0040]
[0041] S43: To H' 1-2 Perform 3 different convolution operations and get To H' 1-3 Perform two different convolution operations to obtain
[0042] use Perform attention interaction operations and obtain Reuse Perform attention interaction operations to obtain a new hyperedge H'1.
[0043]
[0044] Among them, a represents the learnable parameter, f relu (·) represents the relu activation function, f soft (·) represents the softmax function, represents matrix multiplication, T represents matrix transpose;
[0045] S44: According to steps S42 and S43, H2 is mixed with H1 and H3 to obtain H'2, and H3 is mixed with H1 and H2 to obtain H3', and the information of the new hyperedge is assigned to the graph structure of the corresponding scale. The formula is expressed as follows:
[0046]
[0047]
[0048]
[0049] in, represents broadcast addition, and the obtained graph structures of each scale are reconstructed to obtain multi-scale spatial mixed semantic information;
[0050] In one embodiment, H' 1-2 The convolution kernel for three different convolution operations is 3*3, the step size is 1, the padding is 1, and the initialization weights are randomly generated;
[0051] and / or, H' 1-3 The convolution kernel for two different convolution operations is 3*3, the step size is 1, the padding is 1, and the initialization weights are randomly generated.
[0052] In one embodiment, the hybrid decoder includes three repeatedly stacked decoders, preferably, the decoder includes an upsampling layer, a convolution layer, a normalization layer, and an activation layer. One of the main purposes of repeatedly stacking decoders is to gradually reconstruct the features extracted in the encoder, and gradually convert the abstract feature representation into semantic features in the input image space. The decoder can promote information transfer between low-level features and high-level features through operations such as upsampling and jump connections, thereby helping the model integrate multi-scale feature information and help the model restore detail information in the input image while maintaining the consistency of semantic information. Thereby improving the performance of the model on semantic segmentation tasks.
[0053] In one embodiment, obtaining a segmentation result by fusing multi-scale spatial semantic information through a hybrid decoder includes:
[0054] S51: The four-scale feature F S4 Upsample and then combine it with G S3 After concatenation, convolution, normalization, and activation operations are performed in sequence to obtain the output of decoder 1, which is expressed as follows:
[0055] F' U1 =Concat(UpSample(F S4 ), G S3 )
[0056] F U1 =f relu (LN(Conv(F' U1 )))
[0057] Where UpSample(·) represents upsampling operation, and Concat(·) represents channel concatenation;
[0058] S52: Upsample the output of decoder 1 and combine it with G S2 The concatenation is performed as the input of decoder 2, and convolution, normalization, and activation operations are performed in sequence to obtain the output of decoder 2;
[0059] S53: Upsample the output of decoder 2 and G S1 The concatenation is performed as the input of decoder 3, and convolution, normalization, and activation operations are performed in sequence to obtain the segmentation result.
[0060] In a second aspect, the present invention further provides a storage medium having a computer program stored thereon, wherein the program, when executed, implements the method described in the first aspect of the present invention.
[0061] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0062] one or more processors;
[0063] a storage device having one or more programs stored thereon;
[0064] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in the first aspect of the present invention.
[0065] The present invention proposes a semantic segmentation method based on a hybrid transformer and a multi-scale hypergraph in an autonomous driving scenario, which can more effectively extract local and global features of an image and obtain multi-scale image semantic features. By utilizing the interaction of semantic features of different scales, the model can learn the attention relationship between different scales, which is more conducive to model training and improving model accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 is a flow chart of the method of the present invention;
[0067] Figure 2 It is a network model diagram of the present invention;
[0068] Figure 3 Schematic diagram of the hybrid transformer encoder;
[0069] Figure 4 Schematic diagram of the graph convolution process;
[0070] Figure 5 It is a schematic diagram of the multi-scale hyperedge interaction process;
[0071] Figure 6 A color image of the road from the car's perspective;
[0072] Figure 7 The segmented image is obtained by using the method provided by the present invention. DETAILED DESCRIPTION
[0073] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention.
[0074] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0075] When implementing it, Figure 1-5 As shown, in this embodiment, a semantic segmentation method in an autonomous driving scenario based on a hybrid transformer and a multi-scale hypergraph uses a road color image from a car's perspective as a target image dataset, and specifically includes the following steps:
[0076] S1: Obtain a color image of the road from the perspective of the car and perform preprocessing to obtain image X. The specific operations are as follows:
[0077] S11: normalize each acquired road color image, unify its pixel values to [0, 1], and then unify the width and height of all images to W and H to obtain the image X.
[0078] In this embodiment, we need to preprocess the color image from the vehicle's perspective, normalize it to the interval [0, 1], and set its size to 256×256.
[0079] S2: Based on the hybrid transformer encoder, semantic features of image X at different scales are obtained, wherein the hybrid transformer encoder includes four repeatedly stacked transformer encoding blocks, the input of the transformer encoding block of the first scale comes from the image X, and the input of the transformer encoding block of the next scale is the output of the transformer encoding block of the previous scale. Furthermore, the transformer encoding block includes a convolution block, a window multi-head self-attention layer, a sliding window multi-head self-attention layer, four layer normalization layers and two multi-layer perceptrons. The specific operations are as follows:
[0080] S21: Perform three different convolution operations on the image X to obtain X q , X k , X v , X q , X k After interacting to obtain the global attention weight feature, v Weighted, get the global attention weighted feature X S1 :
[0081]
[0082] Among them, a represents the learnable parameter, T represents the matrix transpose, + represents the addition of corresponding elements, and f relu (·) represents the relu activation function, f soft (·) represents the softmax function, Represents matrix multiplication;
[0083] The convolution kernels of the three different convolution operations performed on the image X are 3*3, the step size is 1, the padding is 1, and the initialization weights are randomly generated;
[0084] X S1 Serialize to get X' S1 , and input the transformer encoding block of the first scale to obtain a scale semantic feature F S1 ,
[0085] X' l1 =W-MSA(LN(Conv(X' S1 ))
[0086] X l1 =MLP(LN(X l '1+X' S1 ))+X' l1
[0087] X' l2 =SW-MSA(LN(X l1 ))
[0088] F S1 =MLP(LN(X' l2 +X l1 ))+X' l2
[0089] Among them, Conv(·) represents the convolution operation, W-MSA(·) represents the window-based multi-head self-attention mechanism, SW-MSA(·) represents the sliding window-based multi-head self-attention mechanism, LN(·) represents the layer normalization operation, and MLP(·) represents the multi-layer perceptron;
[0090] S22: The first-order semantic feature F S1 The downsampling operation is performed through the PatchMerging module, and the number of channels is adjusted. Then, step S21 is repeated instead of X to obtain the two-scale semantic feature F S2 , where adjusting the number of channels is done as follows: through convolution, set the number of channels of the convolution kernel of the convolution operation to the size you want to adjust, the size is 3x3, the step size is 1, the padding is 1, and the initialization weights are randomly generated;
[0091] S23: Using two-scale semantic features F S2 Instead of F in step S22 S1 Repeat step S22 to obtain the three-scale semantic feature F S3 , and then use the three-scale semantic feature F S3 , repeat the above operation again to obtain the four-scale feature F S4 .
[0092] S3: Use graph convolution to extract the spatial information of semantic features of image X at different scales, and obtain the spatial semantic features of each scale through node message passing. The specific operations are as follows:
[0093] Based on F S1 、F S2 、F S3 Construct graph structures to obtain graph structures of various scales Through three graph convolution operations respectively, the formula is expressed as follows:
[0094]
[0095] Among them, GCN(·) represents the graph convolution method and σ(·) is the activation function.
[0096] In this embodiment, the graph convolution operation is as follows: Figure 4 shown.
[0097] S4: Using the concept of hypergraph, the graph structure of each scale is regarded as a hypergraph, and its hyperedge representation is obtained. The hyperedge is used to realize the interaction of information at different scales, and the multi-scale spatial mixed semantic information is obtained. The specific operations are as follows:
[0098] S41: Using the concept of hypergraph, the F S1 、F S2 、F S3 The constructed graph structure is associated with a hyperedge, and the hyperedge is as follows:
[0099]
[0100] Among them, m∈(1,2,3), H m represents the hyperedge of the mth scale, represents the feature of the nth node at the mth scale, ⊙ represents the corresponding multiplication of each element of the matrix;
[0101] The dimensions of the obtained hyperedges H1, H2, and H3 are (d1, 1), (d2, 1), and (d3, 1), respectively;
[0102] S42: Interact each hyperedge with the other two, specifically including: performing matrix multiplication of H1 with H2 and H3 to obtain the hyperedge feature matrix F 1-2 、F 1-3 ,
[0103]
[0104] Among them, F 1-2 、F 1-3 The dimensions are (d1, d2) and (d1, d3) respectively;
[0105] F 1-2、F 1-3 Perform 1×d2 and 1×d3 convolution operations respectively to obtain the hyperedge feature H after mixed interaction. 1-2 , H 1-3 , using H 1-2 , H 1-3 Weighted processing is performed on the original hyperedge H1 to obtain H' 1-2 , H' 1-3 ,
[0106]
[0107] S43: To H' 1-2 Perform 3 different convolution operations and get To H' 1-3 Perform two different convolution operations to obtain Among them, H' 1-2 The convolution kernel is 3*3, the step size is 1, the padding is 1, and the initialization weights are randomly generated. The q, k, and v are only used to distinguish different convolution operation results;
[0108] H' 1-3 The convolution kernel for two different convolution operations is 3*3, the step size is 1, the padding is 1, and the initialization weights are randomly generated;
[0109] use Perform attention interaction operations and obtain Reuse Perform attention interaction operations to obtain a new hyperedge H'1.
[0110]
[0111] Among them, a represents the learnable parameter, f relu (·) represents the relu activation function, f soft (·) represents the softmax function, represents matrix multiplication, T represents matrix transpose;
[0112] S44: According to steps S42 and S43, H2 is mixed with H1 and H3 to obtain H'2, and H3 is mixed with H1 and H2 to obtain H'3, and the information of the new hyperedge is assigned to the graph structure of the corresponding scale. The formula is expressed as follows:
[0113]
[0114]
[0115] in, It represents broadcast addition, and the obtained graph structures of each scale are reconstructed to obtain multi-scale spatial mixed semantic information.
[0116] In this example, multi-scale information is interactively fused through a multi-scale hyper-edge mixing module. Figure 5 The process of how a hyperedge at one scale interacts with the other two scales is shown.
[0117] S5: The segmentation result is obtained by fusing multi-scale spatial semantic information through a hybrid decoder, wherein the hybrid decoder includes three repeatedly stacked decoders, each of which includes an upsampling layer, a convolution layer, a normalization layer, and an activation layer. The specific operations are as follows:
[0118] S51: The four-scale feature F S4 Upsample and then combine it with G S3 After concatenation, convolution, normalization, and activation operations are performed in sequence to obtain the output of decoder 1, which is expressed as follows:
[0119] F' U1 =Concat(UpSample(F S4 ), G S3 )
[0120] F U1 =f relu (LN(Conv(F' U1 )))
[0121] Where UpSample(·) represents upsampling operation, and Concat(·) represents channel concatenation;
[0122] S52: Perform the same upsampling on the output of decoder 1 and combine it with G S2 The concatenation is performed as the input of decoder 2, and the same convolution, normalization, and activation operations are performed in sequence to obtain the output of decoder 2;
[0123] S53: Perform the same upsampling on the output of decoder 2 and G S1 The concatenation is performed as the input of decoder 3, and the same convolution, normalization, and activation operations are performed in sequence to obtain the segmentation result.
[0124] like Figure 6 Where ac is three surrounding environment images from the perspective of the car, and the results obtained after processing by the method provided by the present invention are as follows Figure 7 As shown, ac corresponds to Figure 6 Segmentation results of the ac image.
[0125] It should be understood that, for the aforementioned various method embodiments, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flow chart of the method embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0126] In one embodiment, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0127] In one embodiment, an electronic device is provided, comprising:
[0128] one or more processors;
[0129] a storage device having one or more programs stored thereon;
[0130] When the one or more programs are executed by the one or more processors, the one or more processors implement the steps in the above method embodiments.
[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present invention may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided by the present invention may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.
[0132] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0133] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A semantic segmentation method in an autonomous driving scenario, characterized in that: The method comprises: Obtain a color image of the road from the perspective of the car, and perform preprocessing to obtain image X; Based on the hybrid transformer encoder, the semantic features of image X at different scales are obtained; Graph convolution is used to extract the spatial information of semantic features of image X at different scales, and spatial semantic features of each scale are obtained through node message passing; Using the concept of hypergraph, the graph structure of each scale is regarded as a hypergraph, and its hyperedge representation is obtained. The hyperedge is used to realize the interaction of information at different scales, and the multi-scale spatial mixed semantic information is obtained. Through the hybrid decoder, multi-scale spatial semantic information is integrated to obtain the segmentation result.
2. The method according to claim 1, wherein: The preprocessing includes normalizing each acquired road color image, unifying its pixel values to [0, 1], and then setting the width and height of all images to W and H to obtain the image X.
3. The method according to claim 1 or 2, wherein: The hybrid transformer encoder includes four repeatedly stacked transformer encoding blocks, the input of the transformer encoding block of the first scale comes from the image X, and the input of the transformer encoding block of the next scale is the output of the transformer encoding block of the previous scale; Preferably, the transformer encoding block includes a convolution block, a window multi-head self-attention layer, a sliding window multi-head self-attention layer, four layer normalization layers and two multi-layer perceptrons.
4. The method according to claim 3, wherein: The semantic features of image X at different scales are obtained: S21: Perform three different convolution operations on the image X to obtain X q , X k , X v , X q , X k After interacting to obtain the global attention weight feature, v Weighted, get the global attention weighted feature X S1 : Among them, a represents the learnable parameter, T represents the matrix transpose, + represents the addition of corresponding elements, and f relu (·) represents the relu activation function, f soft (·) represents the softmax function, Represents matrix multiplication; X S1 Serialize to get X' S1 , and input the transformer encoding block of the first scale to obtain a scale semantic feature F S1 , X’ l1 =W-MSA(LN(Conv(X' S1 )) X l1 =MLP(LN(X’ l1 +X' S1 ))+X’ l1 X’ l2 =SW-MSA(LN(X l1 )) F S1 =MLP(LN(X’ l2 +X l1 ))+X’ l2 Among them, Conv(·) represents the convolution operation, W-MSA(·) represents the window-based multi-head self-attention mechanism, SW-MSA(·) represents the sliding window-based multi-head self-attention mechanism, LN(·) represents the layer normalization operation, and MLP(·) represents the multi-layer perceptron; S22: The first-degree semantic feature F S1 The downsampling operation is performed through the PatchMerging module, and the number of channels is adjusted, and then step S21 is repeated to obtain the two-scale semantic feature F S2 ; S23: Using two-scale semantic features F S2 Repeat step S22 to obtain the three-scale semantic feature F S3 , and then use the three-scale semantic feature F S3 , repeat step S22 to obtain the four-scale feature F S4 ; Preferably, the convolution kernels of the three different convolution operations performed on the image X are 3*3, the step size is 1, and the padding is 1.
5. The method according to claim 4, wherein: Graph convolution is used to extract the spatial information of semantic features of image X at different scales. The spatial semantic features of each scale are obtained through node message passing, including: Based on F S1 、F S2 、F S3 Construct graph structures to obtain graph structures of various scales Through three graph convolution operations respectively, the formula is expressed as follows: Among them, GCN(·) represents the graph convolution method and σ(·) represents the activation function.
6. The method according to claim 5, wherein: Using the concept of hypergraph, the graph structure of each scale is regarded as a hypergraph, and its hyperedge representation is obtained. The hyperedge is used to realize the interaction of information at different scales, and the multi-scale spatial mixed semantic information is obtained, including: S41: Using the concept of hypergraph, the F S1 、F S2 、F S3 The constructed graph structure is associated with a hyperedge, and the hyperedge is as follows: Among them, m∈(1,2,3), H m represents the hyperedge of the mth scale, represents the feature of the nth node at the mth scale, ⊙ represents the corresponding multiplication of each element of the matrix; The dimensions of the obtained hyperedges H1, H2, and H3 are (d1, 1), (d2, 1), and (d3, 1), respectively; S42: Interact each hyperedge with the other two, specifically including: performing matrix multiplication of H1 with H2 and H3 to obtain the hyperedge feature matrix F 1-2 、F 1-3 , Among them, F 1-2 、F 1-3 The dimensions are (d1, d2) and (d1, d3) respectively; F 1-2 、F 1-3 Perform 1×d2 and 1×d3 convolution operations respectively to obtain the hyperedge feature H after mixed interaction. 1-2 , H 1-3 , using H 1-2 , H 1-3 Weighted processing is performed on the original hyperedge H1 to obtain H' 1-2 , H' 1-3 , H’ 1-2 =f soft (Conv 1×d2 (F 1-2 ))+H1 H’ 1-3 =f soft (Conv 1×d3 (F 1-3 ))+H1 S43: To H' 1-2 Perform 3 different convolution operations and get To H' 1-3 Perform two different convolution operations to obtain use Perform attention interaction operations and obtain Reuse Perform attention interaction operations to obtain a new hyperedge H'1. Among them, a represents the learnable parameter, f relu (·) represents the relu activation function, f soft (·) represents the softmax function, represents matrix multiplication, T represents matrix transpose; S44: According to steps S42 and S43, H2 is mixed with H1 and H3 to obtain H'2, and H3 is mixed with H1 and H2 to obtain H'3, and the information of the new hyperedge is assigned to the graph structure of the corresponding scale. The formula is expressed as follows: in, represents broadcast addition, and the obtained graph structures of each scale are reconstructed to obtain multi-scale spatial mixed semantic information; Preferably, H1' -2 The convolution kernel for three different convolution operations is 3*3, the stride is 1, and the padding is 1; and / or, H1' -3 The convolution kernel for two different convolution operations is 3*3, the stride is 1, and the padding is 1.
7. The method according to any one of claim 6, wherein: The hybrid decoder includes three repeatedly stacked decoders; Preferably, the decoder comprises an upsampling layer, a convolution layer, a normalization layer, and an activation layer.
8. The method according to claim 7, wherein: Through the hybrid decoder, multi-scale spatial semantic information is integrated to obtain the segmentation results including: S51: The four-scale feature F S4 Upsample and then combine it with G S3 After concatenation, convolution, normalization, and activation operations are performed in sequence to obtain the output of decoder 1, which is expressed as follows: F’ U1 =Concat(UpSample(F S4 ),G S3 ) F U1 =f relu (LN(Conv(F’ U1 ))) Where UpSample(·) represents upsampling operation, and Concat(·) represents channel concatenation; S52: Upsample the output of decoder 1 and combine it with G S2 The concatenation is performed as the input of decoder 2, and convolution, normalization, and activation operations are performed in sequence to obtain the output of decoder 2; S53: Upsample the output of decoder 2 and G S1 The concatenation is performed as the input of decoder 3, and convolution, normalization, and activation operations are performed in sequence to obtain the segmentation result.
9. A storage medium having a computer program stored thereon, wherein: When the program is executed, the method according to any one of claims 1 to 8 is implemented.
10. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 8.
