A chest radiograph lesion segmentation method based on multi-scale dynamic convolution attention fusion
Patent Information
- Application Number
- CN202610705444.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-21
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2046-05-21
AI Technical Summary
[0005]本发明的目的在于提供一种基于多尺度动态卷积注意力融合的胸片病灶分割方法,以解决背景技术中现有方案在胸片分割中因病变尺度跨度大、轮廓不规则导致边界模糊与特征提取不佳的问题
1、本发明设有多尺度动态卷积块,该多尺度动态卷积块协同多膨胀率卷积和可变形卷积,便于自适应调整感受野范围,在覆盖从微小结节到大范围弥漫性病灶的同时,贴合不规则解剖轮廓,解决了边界模糊问题;
Smart Images

Figure CN122244454B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision and medical image analysis technology, specifically a method for segmenting lesions on chest X-rays based on multi-scale dynamic convolutional attention fusion. Background Technology
[0002] Chest X-ray imaging (CXR), with its advantages of rapid imaging and widespread availability, has become the most widely used imaging method for screening, diagnosing, and evaluating the treatment efficacy of common chest diseases such as pneumonia and COVID-19. In the diagnostic system for chest diseases, accurate segmentation of the lesion area is a core element for achieving quantitative analysis of lesions, measurement of lesion volume, grading of disease severity, and optimization of treatment plans, directly determining the reliability and clinical usability of computer-aided diagnostic systems.
[0003] In recent years, medical image segmentation technology based on deep learning has developed rapidly. Segmentation models based on encoder-decoder architecture (such as U-Net and its various improved variants) have become the mainstream technical route for lesion segmentation on chest X-rays, and can achieve a certain accuracy in lesion region extraction under normal scenarios. However, existing technologies have some shortcomings in real clinical chest X-ray data: 1. Chest X-ray lesions have a large scale range and naturally blurred boundaries. The regular grid-like sampling points of traditional standard convolution cannot flexibly adapt to the highly irregular geometric shapes of lesions, resulting in coarse boundary segmentation; 2. Insufficient adaptability to cross-level feature fusion. For example, UNet and its variants use simple feature stitching for cross-level fusion. Simple feature stitching operations cannot dynamically distinguish and weight features from different semantics, making it impossible for the model to effectively filter details beneficial to the segmentation task when facing blurred tissue boundaries, and also unable to suppress the interference of background noise and irrelevant anatomical structures; 3. Limited global context modeling effect. For example, Transformer-type methods model global context through self-attention mechanisms, but the computational cost is high and it is difficult to adapt to equipment with limited clinical resources; 4. The sampling modes of standard convolution and fixed dilation rate convolution are fixed and cannot adapt to the irregular lesion contours in chest X-rays. When facing real clinical scenarios such as image noise and uneven contrast, it is impossible to establish accurate global correlations and it is difficult to stably distinguish lesions from tissues with similar anatomical structures, resulting in a decrease in the model's generalization ability.
[0004] Based on this, we now present a method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion, which can eliminate the drawbacks of existing technical solutions. Summary of the Invention
[0005] The purpose of this invention is to provide a method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion, so as to solve the problems of blurred boundaries and poor feature extraction caused by the large scale span and irregular contours of lesions in the prior art during chest radiograph segmentation.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A method for lesion segmentation on chest radiographs based on multi-scale dynamic convolutional attention fusion is implemented using the MSDAF-Net network. The MSDAF-Net network consists of an input layer, an encoder, a memory module, a decoder, and an output layer connected sequentially. The input end of the encoder is connected to the input layer, the output end of the encoder is connected to the memory module, the output end of the memory module is connected to the decoder, the decoder is connected to the encoder via a gated attention mechanism, and the output end of the decoder is connected to the output layer. The decoder contains multi-scale dynamic convolutional blocks to adjust the receptive field and capture irregular lesion boundaries. The method for segmenting lesions on chest X-rays specifically includes: Step S1: Obtain the chest X-ray image to be processed and input it into the pre-trained encoder. Extract the multi-scale hierarchical feature map of the chest X-ray image by progressive downsampling to obtain shallow feature maps of multiple encoding stages and the deepest global semantic feature map. Step S2: Input the deepest global semantic feature map into the memory module. By constructing a learnable global memory, use the memory key and the query key generated by the input features to perform similarity matching, and weight the stored value with the matching result to extract the global context enhancement feature map as the initial input of the decoder. Step S3: In the decoding stage, the feature map output by the previous level decoder is upsampled and input together with the shallow feature map of the corresponding spatial resolution into the gated attention mechanism. The gated weight map is generated by transformation fusion. The gated weight map is used to dynamically filter and weight the encoder features and decoder features to obtain the cross-level fused feature map. Step S4: Input the cross-level fused feature map into a multi-scale dynamic convolutional block, and use at least two convolutional branches with different dilation rates in parallel to extract multi-scale contextual features. Guide the deformable convolution to adaptively adjust the spatial sampling position through the offset prediction network to extract the local deformation features of irregular lesions. Then, combine the spatial attention mechanism and the channel attention mechanism to adaptively weight and fuse the local deformation features to output a refined feature map. Step S5: Repeat steps S3 and S4 step by step to gradually restore the spatial resolution of the refined feature map. Input the highest resolution refined feature map into the output layer. After dimensionality reduction of the convolution channel and mapping of the nonlinear activation function, finally output a binarized lesion segmentation result that is adapted to the size of the chest X-ray image.
[0007] Furthermore, step S1 also includes data input and preprocessing operations: acquiring the chest X-ray image to be processed and performing standardization processing in the input layer, and inputting the standardized chest X-ray image into the pre-trained encoder.
[0008] Furthermore, the encoder adopts a pre-trained MobileNetV3 architecture, which is composed of multiple coding blocks and coding modules stacked together. The spatial resolution of the output feature map is gradually reduced to 1 / 2, 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the input image. The shallow feature map retains the edge of the lesion and texture details, and the deepest global semantic feature map carries global semantic information.
[0009] Furthermore, in step S2, the memory module includes a capacity of Feature dimension is memory key and stored value ; Step S2 specifically includes: performing a 1×1 convolution on the input features. That is, the deepest layer of global semantic feature map transformation generates the query key. The query key after flattening the spatial dimensions With memory key Perform matrix multiplication and calculate attention weights using the Softmax function. ; Attention weight For stored values After performing weighted summation and restoring the spatial structure, the residual connections are used to connect with the input features. Add them together to output global context-enhanced features. , is represented as: ,in, This represents a 1×1 convolution.
[0010] Furthermore, step S3 specifically includes: Upsampled features of the decoder output and the skip connection features of the encoder output After performing 1×1 convolution and batch normalization alignment, the resulting graphs are fused and transformed using a nonlinear method, and then a gated weight map is generated using the Sigmoid activation function. ,in, For height, For width, Number of channels; The output cross-level fusion features are obtained through element-wise multiplication: , To achieve cross-level feature fusion, a gating weight graph is used. The value dynamically balances the contributions of features at different levels.
[0011] Furthermore, the decoder consists of multiple enhanced decoding blocks and multiple decoding blocks. The feature map resolution is gradually restored through upsampling. The enhanced decoding block consists of two CBR blocks and a multi-scale dynamic convolutional block connected in series. The CBR block contains a 3×3 convolutional block, batch normalization, and ReLU activation function in sequence. The enhanced decoding block is used to enhance lesion feature extraction. The decoding block is used to combine encoder features after upsampling and gating attention filtering to achieve cross-level feature fusion.
[0012] Furthermore, the multi-scale dynamic convolutional block includes a multi-scale feature extraction unit, an offset prediction network, a spatial attention unit, a channel attention unit, and a residual output unit. The multi-scale feature extraction unit splits the input feature map into four paths along the channel dimension, extracts multi-scale lesion features through 3×3 convolutions with different receptive fields, and then convolves and fuses them to obtain a multi-scale feature map. The offset prediction network generates a two-dimensional offset based on the multi-scale feature map, guiding the deformable convolution to adaptively focus on the lesion edge and irregular regions. The spatial attention unit and the channel attention unit generate spatial weights and channel weights through global pooling, respectively, to recalibrate the output features of the deformable convolution. The residual output unit adds the attention-recalibrated feature map to the multi-scale feature map element by element, and outputs a refined feature map through convolution and activation functions.
[0013] Further, step S4 specifically includes: The multi-scale dynamic convolutional block employs four parallel dilated convolutional branches to construct a multi-scale feature extraction unit, with its dilation rate set to... The input feature map is split into four paths along the channel dimension, and the outputs of each branch are concatenated along the channel dimension to obtain the fused multi-scale feature map. ; The offset prediction network uses multi-scale features Perform dimensionality reduction convolution operations to obtain intermediate features. Using 3×3 convolution to extract intermediate features The predicted output corresponds to the two-dimensional offset. and the two-dimensional offset The input is fed into a deformable convolution to adjust the spatial sampling position, and the output is local deformation features. ; For local deformation features Perform global average pooling and global max pooling, then compress the channels through a 1×1 convolution, and finally obtain the spatial attention weights after sigmoid activation. Spatial attention weights Local deformation features of the input Element-wise multiplication yields spatial attention-enhanced features. , for features Perform global average pooling to obtain the feature vectors along the channel dimension. Input it into the fully connected layer to generate channel attention weights. Feature enhancement is then performed to obtain features that are simultaneously enhanced by both spatial and channel attention; Features enhanced with dual spatial and channel attention and multi-scale features The features are then spliced together to obtain the spliced features. Features after splicing Perform 3×3 convolution, batch normalization, and ReLU activation, then add element-wise with the original input feature map to finally output a refined feature map. .
[0014] Furthermore, step S5 specifically includes: In the output layer, the number of refined feature channels with the highest resolution is linearly mapped to the number of target categories through 1×1 convolution, and then normalized to a confidence probability map in the [0,1] interval using the Sigmoid function; A bilinear interpolation algorithm is used to resample the confidence probability map to the input resolution of the chest X-ray image, generating a pixel-by-pixel binary segmentation mask.
[0015] Furthermore, the MSDAF-Net network uses a weighted combination of binary cross-entropy loss and Dice loss as the total training loss function during the training phase to alleviate the class imbalance problem caused by the small pixel proportion in the lesion region.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. The present invention features a multi-scale dynamic convolution block, which, in conjunction with multi-rate convolution and deformable convolution, facilitates adaptive adjustment of the receptive field range. While covering everything from tiny nodules to large-scale diffuse lesions, it conforms to irregular anatomical contours, thus solving the problem of blurred boundaries. 2. The present invention is equipped with a memory module to build a compact global memory bank with learnable key-value pairs, and achieves long-distance dependency modeling with a computational cost far lower than that of traditional self-attention mechanisms, thereby enhancing the robustness of the network in the face of uneven contrast and individual differences in anatomical structure. 3. This invention uses a gated attention mechanism to replace the traditional static stitching, which facilitates the balance between high-level semantic features and shallow detail features, effectively enhances the response of the lesion area and suppresses background interference, and improves the recognition sensitivity of blurred boundaries and weak lesions. Attached Figure Description
[0017] Figure 1This is a schematic diagram of the method flow of the present invention.
[0018] Figure 2 This is a schematic diagram of the method steps of the present invention.
[0019] Figure 3 This is a schematic diagram of the structure of the MSDAF-Net network of the present invention.
[0020] Figure 4 This is a flowchart illustrating the memory module of the present invention.
[0021] Figure 5 This is a flowchart illustrating the gating attention mechanism of the present invention.
[0022] Figure 6 This is a schematic diagram of the multi-scale dynamic convolution block of the present invention.
[0023] Figure 7 This is a schematic diagram of the structure of the multi-scale dynamic convolution block of the present invention.
[0024] Figure 8 This is a schematic diagram of the system structure of the present invention.
[0025] Figure label annotations: Input layer 10, encoder 20, memory module 30, decoder 40, output layer 50, data acquisition module 100, multi-scale feature encoding module 200, global context memory module 300, dynamic feature decoding module 400, visualization and output module 500. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0027] To address the challenges of traditional methods in processing chest X-rays, such as large lesion scales, blurred boundaries, overlapping anatomical structures, and high computational costs for global modeling, this invention utilizes the lightweight MobileNetV3 architecture for multi-scale feature extraction. A memory module 30 is introduced at the bottleneck layer to establish global contextual relationships with low computational cost through learnable key-value pairs. During the decoding stage, a gated attention mechanism is employed to dynamically filter cross-level features and suppress background noise. Finally, a multi-scale dynamic convolutional block (MSDA) is constructed, fusing multi-dilation rate convolutions and deformable convolutions to adaptively adjust the receptive field and accurately capture irregular lesion boundaries. This effectively solves the problem of insufficient segmentation accuracy in complex clinical scenarios and improves the network's robustness in recognizing multi-scale lesions and blurred boundaries. The specific technical solution is shown below.
[0028] Example 1
[0029] In this embodiment, as Figures 1-7As shown, this invention provides a method for lesion segmentation on chest radiographs based on multi-scale dynamic convolutional attention fusion, implemented using the MSDAF-Net network. The MSDAF-Net network consists of an input layer 10, an encoder 20, a memory module 30, a decoder 40, and an output layer 50 connected sequentially. The input of the encoder 20 is connected to the input layer 10, the output of the encoder 20 is connected to the memory module 30, the output of the memory module 30 is connected to the decoder 40, the decoder 40 is connected to the encoder 20 via a gated attention mechanism, and the output of the decoder 40 is connected to the output layer 50. The decoder 40 contains multi-scale dynamic convolutional blocks to adjust the receptive field and capture irregular lesion boundaries. During the training phase, the MSDAF-Net network uses a weighted combination of binary cross-entropy loss and Dice loss as the total training loss function to alleviate the class imbalance problem caused by the small pixel proportion of the lesion region. The total training loss function is expressed as: ,in, Let be the total training loss function. For binary cross-entropy loss, For Dice's loss, The weights are the values for the binary cross-entropy loss. The weights are the values for the Dice loss, and the weight values range from [0,1]. The specific methods for segmenting lesions on chest X-rays include: Step S1: Obtain the chest X-ray image to be processed and input it into the pre-trained encoder 20. Extract the multi-scale hierarchical feature map of the chest X-ray image by progressive downsampling to obtain shallow feature maps of multiple encoding stages and the deepest global semantic feature map. Step S2: Input the deepest global semantic feature map into the memory module 30. By constructing a learnable global memory, use the memory key and the query key generated by the input features to perform similarity matching, and weight the matching results to the stored value. Extract the global context enhancement feature map as the initial input of the decoder 40. Replace the Transformer self-attention with a lightweight memory module to model global context association with extremely low computational cost. Step S3: In the decoding stage, the feature map output by the previous level decoder 40 is upsampled and input together with the shallow feature map of the corresponding spatial resolution into the gated attention mechanism. The gated weight map is generated by transformation fusion. The gated weight map is used to dynamically filter and weight the features of encoder 20 and decoder 40 to obtain the cross-level fused feature map. Step S4: Input the cross-level fused feature map into the multi-scale dynamic convolution block, and use at least two convolution branches with different dilation rates in parallel to extract multi-scale context features. Guide the deformable convolution to adaptively adjust the spatial sampling position through the offset prediction network to extract the local deformation features of irregular lesions. Then, combine the spatial attention mechanism and the channel attention mechanism to adaptively weight and fuse the local deformation features to output a refined feature map. Step S5: Repeat steps S3 and S4 step by step to gradually restore the spatial resolution of the refined feature map. Input the highest resolution refined feature map into the output layer 50. After dimensionality reduction of the convolution channel and mapping of the nonlinear activation function, the final output is a binarized lesion segmentation result that is adapted to the size of the chest X-ray image. In this embodiment, through the above steps S1~S5, the MSDAF-Net network can make full use of the multi-scale features extracted by the lightweight encoder 20, establish a global context with the help of the memory module 30, dynamically fuse cross-level features using the gating attention mechanism, and finally depict the boundaries of irregular lesions through multi-scale dynamic convolutional blocks, thereby achieving efficient and accurate segmentation of lesions on chest X-rays.
[0030] Among them, such as Figure 1 As shown, step S1 also includes data input and preprocessing operations: acquiring the chest X-ray image to be processed and performing normalization processing (Maximization is represented as image enhancement / normalization) in the input layer 10 (Input), and inputting the normalized chest X-ray image into the pre-trained encoder 20; Among them, such as Figure 1 As shown, encoder 20 adopts a pre-trained MobileNetV3 architecture, which is composed of multiple coding blocks and coding modules stacked together. The spatial resolution of the output feature map is gradually reduced to 1 / 2, 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the input image. The shallow feature map retains the edge of the lesion and texture details, while the deepest global semantic feature map carries global semantic information. Among them, such as Figure 2 and Figure 4 As shown, in step S2, the memory module 30 contains a capacity of Feature dimension is memory key and stored value ; Step S2 specifically includes: converting the input features into a 1×1 convolution. That is, the deepest layer of global semantic feature map transformation generates the query key. The query key after flattening the spatial dimensions With memory key Perform matrix multiplication and calculate attention weights using the Softmax function. This attention weight It reflects the strength of the connection between each spatial location and the global prototype; Attention weight For stored values After performing weighted summation and restoring the spatial structure, the residual connections are used to connect with the input features. Add them together to output global context-enhanced features. This enables long-distance dependency modeling that extends the global receptive field, represented as: ,in, Represents a 1×1 convolution; Among them, such as Figure 2 and Figure 5 As shown, step S3 specifically includes: The decoding process involves four progressive upsampling steps. In each step, the upsampled features of the decoder's output are processed. and the skip connection features output by encoder 20 After performing 1×1 convolution and batch normalization (BN) alignment, and then combining and transforming the results, a gated weight map is generated using the Sigmoid activation function. ,in, For height, For width, Number of channels; The output cross-level fusion features are obtained through element-wise multiplication: , To achieve cross-level feature fusion, a gating weight graph is used. The value dynamically balances the contribution of features at different levels, filters out unwanted details, and suppresses background noise; Among them, such as Figure 1 As shown, the decoder 40 consists of multiple enhanced decoding blocks and multiple decoding blocks. The feature map resolution is gradually restored through upsampling. The enhanced decoding block consists of two CBR (Conv-BN-ReLU) blocks and a multi-scale dynamic convolution block connected in series. The CBR block contains a 3×3 convolution block, batch normalization and ReLU activation function in sequence. The enhanced decoding block is used to enhance the extraction of lesion features. The decoding block is used to combine the features of the encoder 20 after upsampling and gating attention filtering to achieve cross-level feature fusion. Among them, such as Figure 6 and Figure 7As shown, the multi-scale dynamic convolutional block includes a multi-scale feature extraction unit, an offset prediction network, a spatial attention unit, a channel attention unit, and a residual output unit. The multi-scale feature extraction unit splits the input feature map into four paths along the channel dimension, extracts multi-scale lesion features through 3×3 convolutions with different receptive fields, and then convolves them to obtain a multi-scale feature map. The offset prediction network generates two-dimensional offsets based on the multi-scale feature map, guiding the deformable convolution to adaptively focus on lesion edges and irregular regions. The spatial attention unit and the channel attention unit generate spatial weights and channel weights through global pooling, respectively, and recalibrate the output features of the deformable convolution. The residual output unit adds the attention-recalibrated feature map to the multi-scale feature map element by element, and outputs a refined feature map through convolution and activation functions. Among them, such as Figure 2 and Figure 6 As shown, step S4 specifically includes: The multi-scale dynamic convolutional block uses four parallel dilated convolutional branches to construct a multi-scale feature extraction unit, with its dilation rate set to... The dilation rates of the four parallel dilated convolution branches are 1, 2, 3, and 4, respectively. The input feature map is split into four paths along the channel dimension, and the outputs of each branch are concatenated along the channel dimension to obtain the fused multi-scale feature. Multi-scale dynamic convolutional blocks receive a block of size 1. Using the feature map as input, the number of input feature channels is reduced to The data is fed into four parallel 3×3 convolutional layers. These four convolutions employ different dilation strategies to obtain feature maps with receptive fields ranging from small to large. , , , These four multi-scale features are concatenated and then processed by a 3×3 convolution to obtain the fused multi-scale features. ; The offset prediction network (composed of dimensionality-reduced 1×1 convolutions and 3×3 convolutions) works by analyzing multi-scale features. Perform dimensionality reduction convolution operations (3×3 convolution, batch normalization (BN), ReLU activation) to obtain intermediate features. Using 3×3 convolution to extract intermediate features The predicted output corresponds to the two-dimensional offset. and the two-dimensional offset Input to deformable convolution for spatial sampling position adjustment, 2D offset The sampling grid points of the Deformable Convolution (DeformConv2d) are guided to shift towards the lesion edge and core region, thereby adaptively extracting features from irregular targets and outputting local deformation features. ; For local deformation features Global average pooling (GAP) and global max pooling (GMP, 7×7) are performed, followed by channel compression via 1×1 convolution, and spatial attention weights are obtained after sigmoid activation. Spatial attention weights Local deformation features of the input Element-wise multiplication yields spatial attention-enhanced features. , for features Perform global average pooling (GAP) to obtain the feature vectors in the channel dimension. Input it into the fully connected layer to generate channel attention weights. Feature enhancement is then performed to obtain features that are simultaneously enhanced by both spatial and channel attention; Features enhanced with dual spatial and channel attention and multi-scale features The features are then spliced together to obtain the spliced features. Features after splicing Perform 3×3 convolution, batch normalization, and ReLU activation, then add element-wise with the original input feature map to finally output a refined feature map. ; Among them, such as Figure 1 and Figure 2 As shown, step S5 specifically includes: After decoding, in output layer 50, the number of refined feature channels with the highest resolution is linearly mapped to the number of target categories through 1×1 convolution, and then normalized to a confidence probability map in the [0,1] interval using the Sigmoid function. A bilinear interpolation algorithm is used to resample the confidence probability map to the input resolution of the chest X-ray image, generating a pixel-by-pixel binary segmentation mask.
[0031] Example 2
[0032] The difference from Example 1 is that, as in Example 2, Figure 8 As shown, the present invention provides a chest X-ray lesion segmentation system, applied to the above-mentioned chest X-ray lesion segmentation method, specifically including: The data acquisition module 100 is used to acquire and standardize the chest X-ray image to be segmented; The multi-scale feature encoding module 200, based on the encoder 20, transforms the input image into a hierarchical multi-scale feature pyramid; A global context memory module 300, deployed at the end of encoder 20, is used to compute similarity through a learnable global memory to capture long-distance feature dependencies; The dynamic feature decoding module 400 integrates a gated attention mechanism and a multi-scale dynamic convolutional block, dynamically fuses features from encoder 20 and decoder 40, and adaptively fits irregular lesion boundaries. The visualization and output module 500 is used to map the high-dimensional features output by the decoder 40 into a binary lesion segmentation mask, providing pixel-level disease recognition results. In this embodiment, the working logic and data interaction process of each of the above modules correspond one-to-one with steps S1 to S5 of the method in the above embodiment.
[0033] To further verify the application value of the chest X-ray lesion segmentation method based on multi-scale dynamic convolutional attention fusion in this invention, experiments were conducted using the QaTa-COV19 dataset (a publicly available clinical dataset) and its derived small lesion dataset. The network advantages were verified using quantitative indicators and qualitative performance dimensions. The mainstream segmentation models UNet and DeepLabV3+ were set as the control benchmark models, and the training strategy and hardware environment were unified. The Dice similarity coefficient (Dice), intersection-over-union ratio (IoU), precision, and recall were used as core quantitative indicators for evaluation. The Dice similarity coefficient is used to measure the degree of overlap between the segmented region and the labeled gold standard, with a value ranging from 0 to 1. A higher value indicates higher segmentation accuracy. The intersection-over-union ratio is used to reflect the degree of overlap between the predicted region and the real region. Precision is used to measure the proportion of real lesions in the lesion region predicted by the network model. Recall is used to measure the proportion of real lesions that are successfully detected. The QaTa-COV19 dataset is a public dataset for segmenting lesions on chest X-rays of pneumonia. It contains a large number of pneumonia lesion areas annotated by clinicians, covering a variety of typical lesions such as ground-glass opacities, pulmonary consolidation, and linear opacities. The lesions have a wide scale distribution and high degree of boundary ambiguity, which can comprehensively test the segmentation ability of network models in real clinical scenarios. In the experiment, two subset datasets, QaTa-COV19-v1 and QaTa-COV19-v2, were used for independent testing. The derived small lesion dataset is constructed based on local lesion samples with low lesion proportion, small diameter, and weak gray-level difference selected by QaTa-COV19. The dataset focuses on evaluating the network model's ability to identify early, mild, and occult lesions. The method of this invention achieves a Dice similarity coefficient of 0.8544 on the QaTa-COV19-v1 dataset and 0.8755 on the QaTa-COV19-v2 dataset. Core quantization metrics such as IoU are higher than those of UNet and DeepLabV3+ models, thus demonstrating that the method of this invention exhibits strong effectiveness and stability in the task of segmenting small local lesions with slight gray-level differences.
[0034] In summary, the chest X-ray lesion segmentation method based on multi-scale dynamic convolutional attention fusion proposed in this invention effectively solves the problems faced by existing technologies in chest X-ray lesion segmentation, such as large lesion scale span, blurred boundaries, high global modeling cost, and insufficient cross-level feature fusion capability, by designing a memory module 30, a gated attention mechanism, and a multi-scale dynamic convolutional block. It has good prospects for promotion.
[0035] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion, characterized in that, Based on the MSDAF-Net network, the MSDAF-Net network consists of an input layer, an encoder, a memory module, a decoder, and an output layer connected in sequence. The input end of the encoder is connected to the input layer, the output end of the encoder is connected to the memory module, the output end of the memory module is connected to the decoder, the decoder is connected to the encoder via a gated attention mechanism, and the output end of the decoder is connected to the output layer. The decoder contains multi-scale dynamic convolutional blocks to adjust the receptive field and capture irregular lesion boundaries. The method for segmenting lesions on chest X-rays specifically includes: Step S1: Obtain the chest X-ray image to be processed and input it into the pre-trained encoder. Extract the multi-scale hierarchical feature map of the chest X-ray image by progressive downsampling to obtain shallow feature maps of multiple encoding stages and the deepest global semantic feature map. Step S2: Input the deepest global semantic feature map into the memory module. By constructing a learnable global memory, use the memory key and the query key generated by the input features to perform similarity matching, and weight the stored value with the matching result to extract the global context enhancement feature map as the initial input of the decoder. Step S3: In the decoding stage, the feature map output by the previous level decoder is upsampled and input together with the shallow feature map of the corresponding spatial resolution into the gated attention mechanism. The gated weight map is generated by transformation fusion. The gated weight map is used to dynamically filter and weight the encoder features and decoder features to obtain the cross-level fused feature map. Step S4: Input the cross-level fused feature map into a multi-scale dynamic convolutional block, and use at least two convolutional branches with different dilation rates in parallel to extract multi-scale contextual features. Guide the deformable convolution to adaptively adjust the spatial sampling position through the offset prediction network to extract the local deformation features of irregular lesions. Then, combine the spatial attention mechanism and the channel attention mechanism to adaptively weight and fuse the local deformation features to output a refined feature map. Step S5: Repeat steps S3 and S4 step by step to gradually restore the spatial resolution of the refined feature map. Input the highest resolution refined feature map into the output layer. After dimensionality reduction of the convolution channel and mapping of the nonlinear activation function, finally output a binarized lesion segmentation result that is adapted to the size of the chest X-ray image. The memory module in step S2 has a capacity of Feature dimension is memory key and stored value ; Step S2 specifically includes: performing a 1×1 convolution on the input features. That is, the deepest layer of global semantic feature map transformation generates the query key. The query key after flattening the spatial dimensions With memory key Perform matrix multiplication and calculate attention weights using the Softmax function. ; Attention weight For stored values After performing weighted summation and restoring the spatial structure, the residual connections are used to connect with the input features. Add them together to output global context-enhanced features. , is represented as: ,in, This represents a 1×1 convolution.
2. The method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion according to claim 1, characterized in that, Step S1 further includes data input and preprocessing operations: acquiring the chest X-ray image to be processed and performing standardization processing in the input layer, and inputting the standardized chest X-ray image into the pre-trained encoder.
3. The method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion according to claim 1, characterized in that, The encoder adopts a pre-trained MobileNetV3 architecture, which is composed of multiple coding blocks and coding modules stacked together. The spatial resolution of the output feature map is gradually reduced to 1 / 2, 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the input image. The shallow feature map retains the edge of the lesion and texture details, and the deepest global semantic feature map carries global semantic information.
4. The method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion according to claim 1, characterized in that, Step S3 specifically includes: Upsampled features of the decoder output and the skip connection features of the encoder output After performing 1×1 convolution and batch normalization alignment, the resulting graphs are fused and transformed using a nonlinear method, and then a gated weight map is generated using the Sigmoid activation function. ,in, For height, For width, Number of channels; The output cross-level fusion features are obtained through element-wise multiplication: , To achieve cross-level feature fusion, a gating weight graph is used. The value dynamically balances the contributions of features at different levels.
5. The method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion according to claim 1, characterized in that, The decoder consists of multiple enhanced decoding blocks and multiple decoding blocks. It gradually restores the feature map resolution through upsampling. The enhanced decoding block is composed of two CBR blocks and a multi-scale dynamic convolutional block connected in series. The CBR block contains a 3×3 convolutional block, batch normalization and ReLU activation function in sequence. The enhanced decoding block is used to enhance the extraction of lesion features. The decoding block is used to combine the encoder features after upsampling and gating attention filtering to achieve cross-level feature fusion.
6. The method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion according to claim 5, characterized in that, The multi-scale dynamic convolutional block includes a multi-scale feature extraction unit, an offset prediction network, a spatial attention unit, a channel attention unit, and a residual output unit. The multi-scale feature extraction unit splits the input feature map into four paths along the channel dimension, extracts multi-scale lesion features through 3×3 convolutions with different receptive fields, and then convolves and fuses them to obtain a multi-scale feature map. The offset prediction network generates a two-dimensional offset based on the multi-scale feature map, guiding the deformable convolution to adaptively focus on the lesion edge and irregular regions. The spatial attention unit and the channel attention unit generate spatial weights and channel weights through global pooling, respectively, to recalibrate the output features of the deformable convolution. The residual output unit adds the attention-recalibrated feature map to the multi-scale feature map element by element, and outputs a refined feature map through convolution and activation functions.
7. The method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion according to claim 5, characterized in that, Step S4 specifically includes: The multi-scale dynamic convolutional block employs four parallel dilated convolutional branches to construct a multi-scale feature extraction unit, with its dilation rate set to... The input feature map is split into four paths along the channel dimension, and the outputs of each branch are concatenated along the channel dimension to obtain the fused multi-scale feature map. ; The offset prediction network uses multi-scale features Perform dimensionality reduction convolution operations to obtain intermediate features. Using 3×3 convolution to extract intermediate features The predicted output corresponds to the two-dimensional offset. and the two-dimensional offset The input is fed into a deformable convolution to adjust the spatial sampling position, and the output is local deformation features. ; For local deformation features Perform global average pooling and global max pooling, then compress the channels through a 1×1 convolution, and finally obtain the spatial attention weights after sigmoid activation. Spatial attention weights Local deformation features of the input Element-wise multiplication yields spatial attention-enhanced features. , for features Perform global average pooling to obtain the feature vectors along the channel dimension. Input it into the fully connected layer to generate channel attention weights. Feature enhancement is then performed to obtain features that are simultaneously enhanced by both spatial and channel attention; Features enhanced with dual spatial and channel attention and multi-scale features The features are then spliced together to obtain the spliced features. Features after splicing Perform 3×3 convolution, batch normalization, and ReLU activation, then add element-wise with the original input feature map to finally output a refined feature map. .
8. The method for segmenting chest lesions based on multi-scale dynamic convolutional attention fusion according to claim 1, characterized in that, Step S5 specifically includes: In the output layer, the number of refined feature channels with the highest resolution is linearly mapped to the number of target categories through 1×1 convolution, and then normalized to a confidence probability map in the [0,1] interval using the Sigmoid function; A bilinear interpolation algorithm is used to resample the confidence probability map to the input resolution of the chest X-ray image, generating a pixel-by-pixel binary segmentation mask.
9. A method for segmenting chest radiograph lesions based on multi-scale dynamic convolutional attention fusion according to claim 1, characterized in that, The MSDAF-Net network uses a weighted combination of binary cross-entropy loss and Dice loss as the total training loss function during the training phase to alleviate the class imbalance problem caused by the small pixel proportion of lesion areas.