Magnetic resonance image segmentation method based on artificial intelligence and linear attention
By combining CNN and linear attention module, using Taylor expanded linear multi-head self-attention module, the problem of poor performance of existing Transformer-CNN networks in high-resolution image segmentation is solved, and efficient and accurate magnetic resonance image segmentation is achieved.
Patent Information
- Application Number
- CN202411804821.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-12-10
AI Technical Summary
The existing Transformer-based magnetic resonance image segmentation method has poor performance when processing high-resolution images, and the model complexity and large parameters are high, which can easily lead to problems such as overfitting and insufficient computing resources.
A magnetic resonance image segmentation method based on artificial intelligence and linear attention is proposed, combining convolutional neural network (CNN) and linear attention module, and the linear multi-head self-attention module expanded by Taylor is reduced to achieve efficient and accurate segmentation.
The problem of poor performance of Transformer-CNN network in long sequence and high-resolution image segmentation tasks was successfully solved, reducing the amount of memory and parameters, improving the accuracy and efficiency of segmentation, and reducing the risk of overfitting.
Smart Images

Figure CN119625317A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of image analysis, recognition and segmentation, and more specifically, to a magnetic resonance image segmentation method based on artificial intelligence and linear attention. Background Art
[0002] Accurately segmenting the area to be tested in magnetic resonance (MR) images can locate, quantify and monitor the area to be tested, thereby performing precise analysis. The introduction of deep learning technology provides an end-to-end solution for MR image segmentation. As a representative of deep learning models, convolutional neural networks (CNNs) can achieve accurate segmentation through multi-level feature extraction and combination. However, methods based on convolutional neural networks essentially focus too much on local details, ignore meaningful global information, and lack the ability to model long-range dependencies. In recent years, as the Transformer model has made significant progress in natural language processing and computer vision, people have begun to explore its application in MR image segmentation tasks. As a deep learning model based on the self-attention mechanism, the Transformer model performs well in capturing long-range dependencies in sequence data, which makes it have great potential for MR image segmentation, especially for processing MR images with complex spatial structures.
[0003] However, the Transformer-based MRI segmentation method is still in its infancy and faces some challenges. First, the transformers designed for sequence-to-sequence prediction are not sensitive enough to low-level detail features and lack some of the inductive biases inherent in convolutional neural networks, so a large amount of data training is required to achieve better performance. Therefore, the Transformer and CNN can be combined to take advantage of the Transformer model in capturing long-range dependencies and global information, and the CNN in local feature extraction and spatial information capture, to achieve a more comprehensive and efficient MRI segmentation. But this approach still has challenges. Transformer-CNN hybrid models usually require a larger model size to handle the complexity and diversity of MRI data, and MRI images usually have high resolution and dimensions, which means that more computing resources are required in the data preprocessing and input processing stages to process these large-scale data. When it comes to more complex MRI images or insufficient computing resources, Transformer-CNN may not perform well, and due to the complexity of the model and the large number of parameters, it may increase the risk of overfitting the model on the training set and affect the generalization performance of the model. Summary of the invention
[0004] The purpose of the present invention is to address the above-mentioned problems existing in the prior art and to propose a magnetic resonance image segmentation method based on artificial intelligence and linear attention.
[0005] The above-mentioned object of the present invention is achieved by the following technical solutions:
[0006] The magnetic resonance image segmentation method based on artificial intelligence and linear attention comprises the following steps:
[0007] Step 1: Obtain magnetic resonance (MR) images and corresponding true labels, divide the MR images, and generate training sets and test sets;
[0008] Step 2: Construct a magnetic resonance image segmentation network model based on convolutional neural networks (CNN) and linear attention;
[0009] Step 3: Using the data set to train the magnetic resonance image segmentation network model, with the goal of minimizing the total loss function, to obtain the optimal weight of the magnetic resonance image segmentation network model;
[0010] Step 4: Use the magnetic resonance image segmentation network model with optimal weights to segment the magnetic resonance image to be segmented and output a segmentation map.
[0011] The magnetic resonance image in step 1 is a preprocessed magnetic resonance image, and the preprocessing includes: cropping the center of the magnetic resonance image to a set size, randomly enhancing the cropped magnetic resonance image and the true label, and normalizing each enhanced magnetic resonance image to zero mean and unit variance.
[0012] Random augmentation includes random rotation, random flipping, and random translation.
[0013] As mentioned above, the magnetic resonance image segmentation network model includes an encoder and a decoder.
[0014] The encoder includes a residual-based CNN basic downsampling network module and a linear attention module.
[0015] The decoder is a cascaded upsampling module.
[0016] The CNN basic downsampling network module includes three layers of residual blocks.
[0017] The linear attention module includes multiple layers of linear attention layers. Each linear attention layer includes: the first layer normalization module (Layer Norm), the linear multi-head self-attention module (T-MSA), the second layer normalization module (Layer Norm), and the multi-layer perceptron (MLP).
[0018] The cascade upsampling module includes multiple cascaded Conv2dReLU upsampling modules, and the number of Conv2dReLU upsampling modules is the number of residual blocks of the CNN basic downsampling network module + 1.
[0019] As described above, the CNN basic downsampling network module of the magnetic resonance image input encoder is used, and the feature map output by the CNN basic downsampling network module is serialized to obtain a two-dimensional feature map sequence. in is the one-dimensional vector representation of the nth slice, N is the total number of slices,
[0020] For the two-dimensional feature map sequence x p Perform linear projection to obtain the corresponding linear projection coding feature Z0, which is input into the linear attention module of the encoder. The coding feature Z0 output by the linear attention module is 12 The encoded features restored to the slice size are processed by each Conv2dReLU upsampling module of the cascade upsampling module in turn, and then undergo 1×1 convolution to generate a segmentation map. The Conv2dReLU upsampling module of the decoder is jump-connected with the residual block of the same size of the CNN basic downsampling network module of the encoder.
[0021] As mentioned above, the two-dimensional feature map sequence is based on the following steps:
[0022] Use slices with a length and width of P×P to segment the feature map finally output by the CNN basic downsampling network module. Each slice is converted into a two-dimensional sequence, and the two-dimensional sequence is flattened into a one-dimensional vector in row or column order. The one-dimensional vectors corresponding to each slice corresponding to the same feature map are recombined and connected to obtain a two-dimensional feature map sequence.
[0023] As mentioned above, linear projection is based on the following formula:
[0024]
[0025] Among them, Z0 is the two-dimensional feature map sequence x p The linear projection coding feature after linear projection, E is the slice embedding projection coding, E pos Represents positional encoding.
[0026] As mentioned above, the linear multi-head self-attention module is based on the following formula:
[0027]
[0028] LineAttention(Q n ,K j ,V j ) is the calculation result of the linear multi-head self-attention module,
[0029] Q n Represents the magnetic resonance image x output by the first layer normalization module i The query vector of the feature corresponding to the nth slice, K j and V j Represents the magnetic resonance image x output by the first layer normalization module i The key vector and value vector of the features corresponding to the j-th slice.
[0030] As mentioned above, the linear attention module is based on the following formula:
[0031] Z l ′=T-MSA(LN1(Z l-1 ))+Z l-1
[0032] Z l =MLP(LN2(Z l ′))+Z l '
[0033] Among them, LN1() represents the first layer normalization module, LN2() represents the second layer normalization module, T-MSA(·) represents the linear multi-head self-attention module, MLP(·) represents the multi-layer perceptron, and Z l ′ is the intermediate encoding feature of the l-th linear attention layer, Z l and Z l-1 They are the encoded features output by the lth linear attention layer and the l-1th linear attention layer of the linear attention module respectively.
[0034] As mentioned above, the total loss function Loss total Based on the following formula:
[0035] Loss total =L CE +αL Dice
[0036]
[0037] Among them, L CE is the cross entropy loss, L Dice is the Dice loss, α is the balance weight coefficient, and y represents the true label drawn manually. It represents the probability distribution of the segmentation map output by the MRI after each Conv2dReLU upsampling module of the MRI segmentation network model. Smooth represents the smoothing coefficient. “||” represents the number of elements that are 1.
[0038] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above segmentation method when executing the computer program.
[0039] Compared with the prior art, the present invention has the following advantages:
[0040] Based on the basic Transformer-CNN framework, this paper proposes a linear attention Transformer based on Taylor expansion, which reduces the quadratic computational complexity of softmax-attention to linear complexity, and successfully solves the problem that the Transformer-CNN network based on softmax-attention has poor performance or even cannot perform segmentation in long sequence, especially high-resolution image segmentation tasks;
[0041] The present invention proposes a linear multi-head self-attention module based on Taylor expansion, which retains the ability to model long-distance dependencies between data and can achieve efficient and accurate segmentation with less memory and parameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a structural schematic diagram of the magnetic resonance image segmentation network model of the present invention;
[0043] Figure 2 : is a comparison diagram of the visual segmentation results of the present invention, the magnetic resonance image segmentation method based on softmax-attention (Trans-Unet) and the present method, wherein (a) is the original magnetic resonance image Image, (b) is the true label GT, (c) is the segmentation map obtained by TransUnet, and (d) is the segmentation map obtained by the present method;
[0044] Table 1 is an evaluation comparison table of the magnetic resonance image segmentation method of the present invention and other methods. In the table: V-Net represents the basic segmentation baseline method; Trans-UNet represents a softmax-attention-based segmentation method that combines Transformer and Unet; Swin-UNet represents a magnetic resonance image segmentation method based on a pure Transformer structure. DETAILED DESCRIPTION
[0045] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is further described in detail below in conjunction with embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention and are not used to limit the present invention.
[0046] Embodiment 1:
[0047] like Figure 1As shown, the magnetic resonance image segmentation method based on artificial intelligence and linear attention specifically includes the following steps:
[0048] Step 1: Obtain magnetic resonance images and corresponding true labels used for magnetic resonance (MR) image segmentation, divide the magnetic resonance images, and generate training sets and test sets;
[0049] This example preprocesses the public left atrium segmentation challenge dataset as a magnetic resonance image set:
[0050] Step 1.1, a total of 100 magnetic resonance images were collected, and the magnetic resonance images and the corresponding true labels were preprocessed. The preprocessing was specifically as follows: center cropping to a set size of 256×256, and then randomly enhancing the cropped magnetic resonance images and true labels. The random enhancement included random rotation, random flipping, and random translation, and each enhanced magnetic resonance image was normalized to zero mean and unit variance.
[0051] Step 1.2: Divide the randomly enhanced magnetic resonance images into a training set and a test set in a ratio of 80:20. The training set is denoted as x i ∈R H×W×C , where x i represents the magnetic resonance images in the training set, y i Represents the magnetic resonance image x i Corresponding to the true label drawn manually, y i ∈{0,1} H×W M = 80 is the number of magnetic resonance images in the training set, and the image sequence i∈{1,2,3…,M}. H×W×C represents the dimension of the magnetic resonance image, C represents the number of channels of the magnetic resonance image, H is the length of the magnetic resonance image, and W is the width of the magnetic resonance image. In this example, x i For grayscale images, H = W = 256, C = 1;
[0052] Step 2: Build a magnetic resonance image segmentation network model based on convolutional neural networks (CNN) and linear attention, the magnetic resonance image segmentation network model includes: an encoder and a decoder, the encoder includes a residual-based CNN basic downsampling network module and a linear attention module, and the decoder is a cascade upsampling module;
[0053] Step 2.1, select the three-layer residual block of the ResNet-50 module as the CNN basic downsampling network module;
[0054] Step 2.2: Construct a linear attention module, including 12 linear attention layers (Transform Layer). Each linear attention layer includes the following structure: the first normalization module (Layer Norm), the linear multi-head self-attention module (T-MSA), the second normalization module (Layer Norm), and the multi-layer perceptron (MLP). Among them, the first normalization module, the second normalization module, and the multi-layer perceptron are directly built based on the conventional linear attention layer Transformer Layer structure.
[0055] Step 2.3, based on the conventional linear attention layer Transformer Layer's multi-head self-attention (MSA), a linear multi-head self-attention module (T-MSA) based on Taylor expansion is designed. In the basic multi-head self-attention MSA, the attention calculation formula is expressed as:
[0056]
[0057] Right now
[0058] Among them, Q, K, and V represent the query vector, key vector, and value vector, respectively. n , K n They represent the magnetic resonance image x output by the first layer normalization module. i The query vector and key vector of the feature corresponding to the nth slice, K j and V j Represents the magnetic resonance image x output by the first layer normalization module i The key vector and value vector of the features corresponding to the jth slice. N represents each magnetic resonance image x output by the first layer normalization module i Contains the number of slices, Attention(Q n ,K n ,V j ) represents the attention calculation result of the nth slice, and T is the transpose. In attention, f(x) = e x , from f(x) = e x The Taylor expansion of x ≈1+x can get the expression of linear multi-head self-attention:
[0059]
[0060] Furthermore, by using the associative law of matrix multiplication, we obtain the T-MSA calculation formula with linear computational complexity:
[0061]
[0062] Among them, LineAttention(Q n ,K j ,V j ) is the calculation result of the linear multi-head self-attention module. The linear multi-head self-attention module T-MSA and other structures in the above step 2.2 together constitute a linear attention layer, and the 12-layer linear attention layer further constitutes a linear attention module.
[0063] Step 2.4: Construct a cascaded upsampling module, including 4 cascaded Conv2dReLU upsampling modules, each of which includes a 2× upsampling operator, a 3×3 convolution layer, and a ReLU layer.
[0064] In the encoder:
[0065] Magnetic resonance imagingx i Input encoder’s CNN basic downsampling network module, a 256×256 MRI image x i The sizes (length × width) of the feature maps obtained after the three-layer residual blocks of the CNN basic downsampling network module are 128 × 128, 64 × 64, and 32 × 32, respectively.
[0066] The feature map output by the last residual block of the CNN basic downsampling network module is serialized. In this embodiment, a slice with a length × width of P × P (P = 16) is used to segment the feature map with a length × width of 32 × 32 that the CNN basic downsampling network module finally outputs. Each feature map is obtained The size of each slice is P×P×C, that is, 16×16×1. Each slice is converted into a two-dimensional sequence of (16×16)×1, and the two-dimensional sequence is flattened into a one-dimensional vector in row or column order. The one-dimensional vectors corresponding to the four slices are recombined and connected to obtain a two-dimensional feature map sequence of size 4×(16×16×C). in is the one-dimensional vector representation of the nth slice;
[0067] For the two-dimensional feature map sequence x p Perform linear projection and map it to the potential D-dimensional embedding space to obtain a two-dimensional feature map sequence x p The coded features (i.e., the encoded feature sequence) are as follows. In this embodiment, D=512. The two-dimensional feature map sequence x p The encoded features obtained by linear projection are expressed as:
[0068]
[0069] Among them, Z0 is the two-dimensional feature map sequence xp The linear projection encoding feature after linear projection, E∈R (P×P×C)×D is the slice embedding projection code, E pos ∈R N×D Represents positional encoding.
[0070] The linear projection encoding feature Z0 includes the magnetic resonance image x i The linear projection encoding features corresponding to the 1st slice to the Nth slice of .
[0071] Two-dimensional feature map sequence x p The linear projection encoding feature Z0 is input to the first layer of the linear attention module of the encoder, and then passes through 12 layers of linear attention layers. In each layer, the linear attention layer and the encoding feature Z output by the previous linear attention layer are l-1 After being encoded by the linear multi-head self-attention (T-MSA) module and the multi-layer perceptron (MLP) in the linear attention layer of the current layer, the encoded features output by the l-th layer (i.e., the 12-layer linear attention layer) can be expressed as:
[0072] Z l ′=T-MSA(LN1(Z l-1 ))+Z l-1
[0073] Z l =MLP(LN2(Z l ′))+Z l '
[0074] Where LN1() represents the first layer normalization module, LN2() represents the second layer normalization module, T-MSA(·) represents the linear multi-head self-attention module, MLP(·) represents the multi-layer perceptron, and Z l ′ is the intermediate encoding feature of the l-th linear attention layer, Z l and Z l-1 are the encoded features output by the lth and l-1th linear attention layers of the linear attention module, respectively, and Z l ,Z l ′∈R (16×16)×D , that is, the length of the encoded feature is 256.
[0075] In the decoder:
[0076] The encoded feature Z output by the linear attention module 12The images are upsampled to the input size through the cascade upsampling modules in sequence, and finally a 1×1 convolution is performed to generate a segmentation map of size 256×256. At the same time, the encoded features of each upsampling step are combined with the output features of the residual block of the same size corresponding to the CNN basic downsampling network module in the encoder through a jump connection (there are three jump connections in total) to ensure that the features are not lost and the performance of the network is guaranteed.
[0077] The encoding feature Z of the 12th linear attention layer at the end of the linear attention module has a sequence length of 256. 12 Recombination, that is, encoding feature Z 12 The encoded features are restored to a slice size of 16×16 (P×P).
[0078] The encoded features restored to a slice size of 16×16 in length and width are upsampled four times through four cascaded Conv2dReLU upsampling modules of the cascaded upsampling module, and the encoded features of the slice size of 16×16 are restored to the full resolution of H×W. In this embodiment, the input image size is 256×256, and the size after downsampling is 16×16. After four upsamplings, the sizes of the encoded features are restored to 32×32, 64×64, 128×128, and 256×256, respectively. The first three Conv2dReLU upsampling modules of the decoder are jump-connected with the three-layer residual blocks corresponding to the CNN basic downsampling network module of the encoder, that is, the first-layer residual block is connected to the third-layer Conv2dReLU upsampling module (at this time, the sizes of the magnetic resonance image and the corresponding coding features are both 128×128), the second-layer residual block is connected to the second-layer Conv2dReLU upsampling module (at this time, the sizes of the magnetic resonance image and the corresponding coding features are both 64×64), and the third-layer residual block is connected to the first-layer Conv2dReLU upsampling module (at this time, the sizes of the magnetic resonance image and the corresponding coding features are both 32×32) to achieve feature aggregation. The upsampled coding features output by the fourth-layer Conv2dReLU upsampling module (that is, the probability distribution of the segmentation map) are subjected to a 1×1 convolution to generate a segmentation map of size 256×256.
[0079] Step 3: Initialize the magnetic resonance image segmentation network model, use the preprocessed data set to train the magnetic resonance image segmentation network model, and obtain the optimal weight of the magnetic resonance image segmentation network model.
[0080] The magnetic resonance image segmentation network model built in step 2 is trained for multiple epochs using the training set. In this embodiment, epoch=10000, the classification loss and Dice loss are calculated, the total loss function value is obtained, and the model parameter weights are optimized. The classification loss adopts the cross entropy loss L CE :
[0081]
[0082] Among them, y represents the true label drawn manually. In the binary classification task, the target area to be segmented is represented as y=1, and other areas are y=0. It represents the probability distribution of the segmentation map output by the MRI after each Conv2dReLU upsampling module of the MRI segmentation network model. Dice loss L Dice It is expressed as:
[0083]
[0084] Among them, || is the number of elements that are 1, and smooth represents the smoothing coefficient. In this embodiment, smooth is 1 to prevent the denominator from being 0. The total loss function is expressed as:
[0085] Loss total =L CE +αL Dice
[0086] Where α is the balance weight coefficient, α=0.5.
[0087] Select the total loss function value Loss total The weight of the magnetic resonance image segmentation network model with the smallest value is taken as the optimal weight.
[0088] Step 4: Use the magnetic resonance image segmentation network model with optimal weights to segment the magnetic resonance image to be segmented and output a segmentation map.
[0089] In this embodiment, the test set is used to test the magnetic resonance image segmentation network model with the optimal weight to obtain the target segmentation result.
[0090] This embodiment uses the SGD optimizer to update the network parameters (weight decay = 0.0001). The initial learning rate is set to 0.01, and the learning rate is decayed by dividing it by 10 every 2500 iterations, and a total of 10000 iterations are trained.
[0091] Table 1 shows the performance of the method of the present invention. In the left atrium segmentation experiment, the present invention is the best in Dice (Dice similarity coefficient) and ASD (average surface distance) indicators. Compared with the basic transformer-CNN combination method (TransUnet) based on softmax-attention, the strategy of the present invention enhances Dice by about 1.36% and reduces ASD by about 30.10%. Compared with other methods, the performance is also improved to a certain extent. In addition to the most basic and simplest magnetic resonance image segmentation network V-Net, this method also greatly reduces the demand for parameter quantity, that is, memory consumption. The parameter quantity is only half of that of TransUnet based on softmax-attention, which greatly improves the efficiency and applicability of the network.
[0092] Table 1
[0093]
[0094] Figure 2 A comparison chart of the visualized segmentation results of the present invention, the magnetic resonance image segmentation method based on softmax-attention (Trans-Unet) and the present method is shown, where GT represents the artificial true segmentation label. It can be intuitively seen that the target area segmented by the method proposed in the present invention is closer to the true result than that by the TransUnet method.
[0095] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program. 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.
[0096] Embodiment 2:
[0097] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0098] Embodiment 3:
[0099] In one embodiment, a computer-readable 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-mentioned method embodiments are implemented.
[0100] Embodiment 4:
[0101] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0102] It should be noted that the specific embodiments described in the present invention are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the attached claims.
Claims
1. A magnetic resonance image segmentation method based on artificial intelligence and linear attention, characterized in that: The following steps are involved: Step 1: Obtain magnetic resonance (MR) images and corresponding true labels, divide the MR images, and generate training sets and test sets; Step 2: Construct a magnetic resonance image segmentation network model based on convolutional neural networks (CNN) and linear attention; Step 3: Use the data set to train the magnetic resonance image segmentation network model, with the goal of minimizing the total loss function, to obtain the optimal weight of the magnetic resonance image segmentation network model; Step 4: Use the magnetic resonance image segmentation network model with optimal weights to segment the magnetic resonance image to be segmented and output a segmentation map.
2. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 1, characterized in that: The magnetic resonance image in step 1 is a preprocessed magnetic resonance image, and the preprocessing includes: cropping the center of the magnetic resonance image to a set size, randomly enhancing the cropped magnetic resonance image and the true label, and normalizing each enhanced magnetic resonance image to zero mean and unit variance. Random augmentation includes random rotation, random flipping, and random translation.
3. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 1, characterized in that: The magnetic resonance image segmentation network model includes an encoder and a decoder. The encoder includes a residual-based CNN basic downsampling network module and a linear attention module. The decoder is a cascaded upsampling module. The CNN basic downsampling network module includes three layers of residual blocks. The linear attention module includes multiple layers of linear attention layers. Each linear attention layer includes: the first layer normalization module (Layer Norm), the linear multi-head self-attention module (T-MSA), the second layer normalization module (Layer Norm), and the multi-layer perceptron (MLP). The cascade upsampling module includes multiple cascaded Conv2dReLU upsampling modules, and the number of Conv2dReLU upsampling modules is the number of residual blocks of the CNN basic downsampling network module + 1.
4. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 3, characterized in that: The magnetic resonance image is input into the CNN basic downsampling network module of the encoder, and the feature map output by the CNN basic downsampling network module is serialized to obtain a two-dimensional feature map sequence in is the one-dimensional vector representation of the nth slice, N is the total number of slices, For the two-dimensional feature map sequence x p Perform linear projection to obtain the corresponding linear projection coding feature Z0, which is input into the linear attention module of the encoder. The coding feature Z0 output by the linear attention module is 12 The encoded features restored to the slice size are processed by each Conv2dReLU upsampling module of the cascade upsampling module in turn, and then undergo 1×1 convolution to generate a segmentation map. The Conv2dReLU upsampling module of the decoder is jump-connected with the residual block of the same size of the CNN basic downsampling network module of the encoder.
5. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 4, characterized in that: The two-dimensional feature map sequence is based on the following steps: Use slices with a length and width of P×P to segment the feature map finally output by the CNN basic downsampling network module. Each slice is converted into a two-dimensional sequence, and the two-dimensional sequence is flattened into a one-dimensional vector in row or column order. The one-dimensional vectors corresponding to each slice corresponding to the same feature map are recombined and connected to obtain a two-dimensional feature map sequence.
6. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 4, characterized in that: The linear projection is based on the following formula: Among them, Z0 is the two-dimensional feature map sequence x p The linear projection coding feature after linear projection, E is the slice embedding projection coding, E pos Represents positional encoding.
7. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 4, characterized in that: The linear multi-head self-attention module is based on the following formula: LineAttention(Q n ,K j ,V j ) is the calculation result of the linear multi-head self-attention module, Q n Represents the magnetic resonance image x output by the first layer normalization module i The query vector of the feature corresponding to the nth slice, K j and V j Represents the magnetic resonance image x output by the first layer normalization module i The key vector and value vector of the features corresponding to the j-th slice.
8. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 4, characterized in that: The linear attention module is based on the following formula: Z′ l =T-MSA(LN1(Z l-1 ))+Z l-1 WITH l =MLP(LN2(Z′ l ))+Z′ l Among them, LN1() represents the first layer normalization module, LN2() represents the second layer normalization module, T-MSA(·) represents the linear multi-head self-attention module, MLP(·) represents the multi-layer perceptron, and Z l ′ is the intermediate encoding feature of the l-th linear attention layer, Z l and Z l-1 They are the encoded features output by the lth linear attention layer and the l-1th linear attention layer of the linear attention module respectively.
9. The magnetic resonance image segmentation method based on artificial intelligence and linear attention according to claim 4, characterized in that: The total loss function Loss total Based on the following formula: Loss total =L CE +αL Dice Among them, L CE is the cross entropy loss, L Dice is the Dice loss, α is the balance weight coefficient, and y represents the true label drawn manually. It represents the probability distribution of the segmentation map output by the MRI after each Conv2dReLU upsampling module of the MRI segmentation network model. Smooth represents the smoothing coefficient. "||" represents the number of elements that are 1.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the segmentation method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Coding and decoding network glioma fusion segmentation system and method based on attention enhancement
CN115661165A
Lightweight unsupervised adaptive image semantic segmentation method and system
CN117635935A
Remote sensing image accurate segmentation method
CN118504427A
Systems, methods and techniques for learning and using sparse instance-dependent attention for efficient vision transformers
US20240362902A1
Multi-parameter breast magnetic resonance image segmentation method based on dynamic adaptive network
WO2023116585A1
Cited By
Multi-modal medical image space alignment method, electronic equipment and storage medium
CN120599005A