A colonoscopy polyp segmentation method based on cascaded global-to-local cross-scale fusion
By employing a two-stage cascaded encoding and decoding structure and a cross-spatial scale feature aggregation and reconstruction module, combined with a dynamic attention edge-guided decoder, the problem of accurate modeling and cross-domain generalization at small scales and fuzzy boundaries in existing polyp segmentation methods is solved, achieving higher segmentation accuracy and real-time performance, and making it suitable for the field of medical image segmentation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2026-01-13
- Publication Date
- 2026-05-29
AI Technical Summary
Existing polyp segmentation methods struggle to simultaneously meet the requirements of accurate modeling of small-scale and fuzzy boundaries, as well as robust generalization and real-time performance across cross-domain data. In particular, when dealing with polyps with drastic scale changes or fuzzy boundaries, they suffer from incomplete structures or inaccurate details.
A two-stage cascaded encoding and decoding structure is adopted, combining the global modeling capability of Swin Transformer and the local detail capability of ResNet. Information fusion is performed through the Cross-Spatial Scale Feature Aggregation and Reconstruction Module (CSSAR), the edge localization accuracy is enhanced by the Dynamic Attention Edge Guided Decoder (E-DAD), and the deep fusion of global semantics and local details is achieved through the Cross-Spatial Scale Feature Aggregation and Reconstruction Module (CSSAR).
It significantly improves the accuracy and generalization of polyp segmentation, especially the boundary accuracy and real-time performance on cross-domain data, and has high clinical application value.
Smart Images

Figure CN122115847A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical image segmentation, and studies a polyp segmentation method based on two-stage cross-spatial scale feature fusion. Background Technology
[0002] Automatic segmentation of colorectal polyps has significant clinical value in endoscopic image analysis, assisting physicians in screening and intraoperative lesion localization, reducing missed diagnoses, and improving diagnostic efficiency. However, polyp segmentation presents several challenges: polyps vary greatly in shape, size, and color (significant scale changes); the boundaries between polyps and surrounding mucosa are often blurred with low contrast; endoscopic images frequently contain artifacts such as reflections, blurring, and occlusion; and there are inter-domain differences between acquisition equipment and hospitals, all of which complicate the model's generalization ability. Recent research has focused on improving multi-scale representation, boundary localization, and robustness to address these challenges.
[0003] Early methods, represented by U-Net, utilized an encoder-decoder structure and skip connections to simultaneously preserve semantic information and spatial details, becoming the baseline paradigm for medical image segmentation. Subsequent research introduced multi-scale fusion, attention mechanisms, and edge / boundary supervision to enhance the perception of small-scale structures and blurred boundaries. For example, to address the issues of blurred polyp boundaries and varying scales, PraNet proposed parallel reverse attention and parallel partial decoders to jointly model regions and boundaries, thereby significantly improving segmentation accuracy and generalization ability, becoming a milestone in the field of polyp segmentation.
[0004] With the rise of Transformers in computer vision, researchers have begun to explore the introduction of global self-attention mechanisms into medical image segmentation tasks to enhance long-range dependency modeling capabilities. Representative works include TransUNet, which combines Transformers with a U-Net architecture (using the Transformer as a strong encoder to capture global context while preserving local details provided by CNNs), and Swin-Unet, based on the Swin Transformer (emphasizing hierarchical windowed self-attention to balance efficiency and localization capabilities). These methods demonstrate significant advantages in improving global semantic understanding and cross-scale information integration, especially in providing more robust semantic representations when images have complex backgrounds and low contrast.
[0005] In terms of data and evaluation, the establishment of public datasets has greatly promoted the standardization and comparability of polyp segmentation research. Kvasir-SEG is one of the commonly used open-source polyp segmentation datasets, providing manually annotated pixel-level segmentation masks, and is widely used for method evaluation and comparison (often tested in conjunction with datasets such as CVC-ClinicDB and ETIS-LaribPolypDB to evaluate cross-domain generalization ability). Evaluation metrics typically include Dice / IoU, precision, recall, F-measure, and structured metrics (such as S-measure). Researchers also often focus on the transfer performance and real-time performance (inference speed) of methods across different datasets to meet the needs of real-time clinical applications.
[0006] Recent reviews and trends indicate that two main directions in polyp segmentation research are: (1) designing more effective multi-scale fusion and edge guidance mechanisms to enable models to capture both global context and recover fine-grained boundary information; and (2) combining the global modeling capabilities of Transformers with the local detail extraction capabilities of CNNs, and further improving robustness to scale changes and blurred boundaries through cross-stage or cross-branch fusion (e.g., dual encoders, multi-stage refinement, cross-scale bridging). Furthermore, domain adaptation, weakly supervised annotation, and data augmentation strategies more suited to clinical scenarios are also considered key directions for improving clinical usability in the future. Recent reviews provide a systematic summary of these trends and challenges, and emphasize the importance of fair comparisons in multi-dataset, cross-domain settings.
[0007] In summary, existing work has made significant progress in multi-scale fusion, boundary guidance, and global semantic modeling. However, there are still trade-offs and challenges in simultaneously meeting the requirements of (1) accurate modeling of small-scale and fuzzy boundaries, and (2) maintaining robust generalization and real-time performance on cross-domain data. This is precisely the starting point for this paper's proposed Staged Global-to-Local Cross-Scale Fusion Network for Colonoscopic Polyp Segmentation (SGLF-Net): by linking the global modeling capabilities of the Swin Transformer with the local detail capabilities of ResNet and efficiently fusing them through the Cross-Spatial Scale Feature Aggregation and Reconstruction (CSSAR) module, the aim is to achieve a better balance between semantic representation and texture details, thereby improving the accuracy and generalization of polyp segmentation. Summary of the Invention
[0008] The purpose of this invention is to provide a method for polyp segmentation. With the application of deep learning in polyp segmentation, significant progress has been made in detection accuracy. However, existing methods still struggle to extract more valuable information from images and cannot fully utilize feature information from different stages of the network. Therefore, this invention proposes a two-stage cross-spatial-scale fusion network to extract more useful information and fully utilize information obtained from different stages of the network. Its core consists of the following three parts:
[0009] 1. Dual-stream fusion structure
[0010] Traditional single-stage U-shaped structures are widely used in medical image segmentation. However, convolutional networks struggle to capture global context, while Transformers are inadequate in boundary delineation. Consequently, when dealing with polyps exhibiting drastic scale changes or blurred boundaries, the results often appear as incomplete structures or imprecise details. To address this issue, we propose a two-stage concatenated encoding / decoding structure: the first stage utilizes a Transformer to acquire global semantics for coarse segmentation; the second stage combines local modeling and edge guidance mechanisms from CNNs for refinement. This strategy balances global and local features, effectively improving the boundary accuracy and detail completeness of the segmentation results.
[0011] The first stage, global feature modeling: In the first stage, we use the Swin Transformer as the encoder, whose powerful global modeling capabilities can effectively capture long-range dependencies. Let the input image be... The multi-layer features extracted by the encoder can then be represented as:
[0012] ;
[0013] in Indicates the first For layer features, at the decoding end, we designed a Dynamic Attentive Decoder (DAD) to obtain preliminary segmentation results through step-by-step upsampling and feature fusion:
[0014] ;
[0015] in This represents the segmentation result of the first stage, which includes a relatively complete global semantic structure.
[0016] The second stage focuses on local detailing and edge refinement: In this stage, we use ResNet34 as the encoder. Its powerful local modeling capabilities help capture the texture and boundary features of the polyp. Unlike conventional methods, each layer of the ResNet encoder receives not only local features from the image but also the output features of the first-stage decoder at the same scale in parallel, enabling depth information interaction between stages. The layer output is: ResNet in the 19th century The input of a layer in a regular process is denoted as Subsequently in The layer fuses the two feature sets and feeds them into the residual block of that layer:
[0017] ;
[0018] ;
[0019] in Used for channel alignment. The final result is... This involves layer-by-layer fusion, integrating the semantic information from the first stage with the local representations from the second stage. Based on this, the second-stage decoder E-DAD receives the fused ResNet features. First stage coarse segmentation output and edge guidance features Generate the final refined prediction:
[0020] ;
[0021] 2. Dynamic Attention Edge-Guided Decoder
[0022] In the field of colorectal polyp segmentation, accurate segmentation results are of great significance for clinical diagnosis and treatment planning. However, this task faces two key challenges: first, polyps vary significantly in size, shape, and location, requiring models to be able to handle multi-scale targets; second, accurate boundary segmentation is crucial for endoscopic lesion assessment, but deep networks are prone to losing details during feature extraction, leading to blurred boundaries.
[0023] To address the aforementioned issues, this paper proposes a novel Dynamic Edge-Guided Decoder (E-DAD) and its simplified version, Dynamic Attention Decoder (DAD). This decoder integrates multi-source feature inputs, including multi-level skip connection features from the ResNet34 encoder, features generated in the previous stage, and output features from the previous decoding stage. Through upsampling, concatenation, and fusion of these features, a rich multi-scale contextual representation is constructed. The core of the decoder adopts a dual-branch architecture: the Dynamic Receptive Field Convolutional Module (DRC module) enhances the model's robustness to scale changes through adaptive receptive field adjustment; the Edge Detection Module (EDM) explicitly improves the representational ability of boundary features through a multi-level supervision mechanism. The two modules work collaboratively, significantly improving boundary localization accuracy while maintaining the integrity of the semantic context.
[0024] DRC (Dynamic Receptive Field Convolutional Module) adaptively adjusts the receptive field based on input features, effectively extracting features from targets at different scales. Its core mechanism involves rapidly estimating the scale of the foreground region in the feature map and adaptively selecting convolutional kernel combinations accordingly. This method avoids complex attention weight calculations, enhancing the model's multi-scale adaptability while maintaining high computational efficiency.
[0025] This convolution mainly consists of three steps, for the input features Where B is the batch size, C is the number of channels, and H and W are the spatial dimensions. First, a lightweight 1×1 convolutional layer projects the data onto a single-channel feature map. Then, a sigmoid activation function is applied to normalize the values of this feature map to the 0-1 range, generating a spatial probability map. Each pixel value in this probability map represents the confidence level that its corresponding location belongs to the foreground target. This process can be represented by the following formula:
[0026] ;
[0027] Define threshold For probability graphs Binarization is performed to obtain the foreground mask. The number of foreground pixels is obtained by counting the number of 1 pixels in M. .according to The range of values determines the allocation of different convolutional kernels to the current image, with the specific correspondence as follows:
[0028] ;
[0029] The second step is to segment the features along the 0th dimension to obtain the feature combination for each sample image. The module maintains a static library containing convolution kernels of various sizes (e.g., 3×3, 5×5, 7×7). The module selects the appropriate convolution kernel according to the correspondence in formula (2). Each sample image is convolved separately, so that for each sample in the entire batch of different images, a computation path is independently selected and executed based on its own content, thus achieving instance-level dynamic computation.
[0030] Edge Detection Module (EDM): This module receives feature maps from two adjacent layers of the decoder as input: a shallower, higher-resolution feature map. and a deeper, low-resolution feature map. .right Perform strip convolutions in both the horizontal and vertical directions, sum them, and then apply channel attention before combining with... Residual connection obtained Strip convolution can effectively capture gradient changes in both the horizontal and vertical directions, thus highlighting edge features. Channel attention can adaptively assign higher weights to channels with significant edges, thereby suppressing interference from background or noisy channels. Perform the same operation as follows:
[0031] ;
[0032] ;
[0033] in It is a bar convolution with a 3×1 kernel. It is a bar convolution with a kernel of 1×3. For channel attention.
[0034] The core mechanism of EDM lies in using the information differences between feature maps at different levels to locate edges, and deep feature maps Upsampling via bilinear interpolation makes its spatial resolution equal to Alignment obtained The difference between the two feature layers is obtained. This difference map characterizes the inconsistencies between hierarchical features and can effectively indicate object boundaries or fine-grained structures. Next, we will... , and After concatenation along the channel dimension, the feature map is obtained by convolution and sigmoid activation. The process is as follows:
[0035] ;
[0036] in It's a convolution with a 1×1 kernel, the purpose of which is to change the number of channels. Bilinear interpolation upsampling It is the sigmoid activation function. It is Conv-Bn-ReLU. Finally, the generated prediction graph... By supervising the processed edge map labels, more explicit constraints are imposed on the edge information at each level.
[0037] 3. Cross-Spatial Scale Feature Aggregation and Reconstruction (CSSAR)
[0038] In the two-stage polyp segmentation framework, the first stage (Swin Transformer) excels at capturing global semantic context, generating coarse segmentation results with complete structure but coarse boundaries; the second stage (ResNet) focuses on refining local texture and edge details. However, if the two stages interact only through simple feature transfer or result concatenation, it often leads to a disconnect between semantic and detailed information, failing to fully realize the potential of the two-stage design. The high-level semantics of the first stage fail to adequately guide the local feature extraction of the second stage, while the detailed information of the second stage fails to effectively feed back into global structural optimization. To address this, we innovatively introduce a Cross-Spatial Scale Feature Aggregation and Reconstruction (CSSAR) module between the two stages. This module acts as a powerful "bridge," with its core mission being to achieve deep fusion and bidirectional collaboration between global semantics and local details. It does not simply transfer features, but rather structurally reorganizes and intelligently aggregates the multi-scale features output by the first-stage encoder, generating a fused feature representation rich in multi-scale context and possessing both semantic globality and spatial accuracy. This fused feature representation is then injected as crucial contextual prior information into the second-stage encoding process, thus laying a solid information foundation for the final refined segmentation.
[0039] First, deform the four layers of features that enter. This yields a four-layer sequence. Then, the other three layers are pruned and spliced based on the length of the deepest layer sequence. In this feature, the 0th dimension contains the feature's location information, the first dimension contains spatial information, and the second dimension contains channel information. The features obtained after cropping and concatenating the four layers are then concatenated along the first dimension to obtain a... Shape fusion features This feature aggregates features at different scales, including cross-scale and cross-spatial features in the row and column directions, respectively.
[0040] Therefore, we used axial attention to model features in both the horizontal and vertical directions, obtaining cross-scale and cross-spatial features, respectively. Horizontal axial attention yields full-scale aggregated features with cross-scale interaction, while vertical axial attention yields features with cross-spatial interaction. Furthermore, a Swintransformer Block was employed to obtain features at different locations and scales. These features were then fused through summation to generate a fused feature across spatial scales. The entire process is defined as follows:
[0041] ;
[0042] in It is the Swing Transformer Block. It is horizontal axis attention. It is vertical axis attention.
[0043] Then, the features are restored to their original shape through channel splitting and reshaping operations, resulting in... With input feature map Alignment Finally, a channel attention mechanism constructed using Globalmaxpool + Conv1D + Sigmoid is used to obtain the output Bi, which is then used to adjust the channel response intensity after fusing multi-scale features, thereby improving the features of each layer. The expressiveness of this process is defined as:
[0044] ;
[0045] in These are the features of each layer after splitting and reshaping. It is the Sigmoid activation function. It is a one-dimensional convolution with a kernel of 3. It uses global max pooling. By introducing this module, the network can effectively integrate features at different scales while preserving the feature maps. This enables deep fusion of polyp texture details and semantic information. Therefore, this model provides comprehensive and accurate polyp structure features for the next stage. Attached Figure Description
[0046] Figure 1 A cascaded global-to-local cross-scale fusion network for colonoscopy polyp segmentation;
[0047] Figure 2 A schematic diagram of the dual-stream fusion structure in the model of the invention;
[0048] Figure 3A schematic diagram of a dynamic attention edge-guided decoder;
[0049] Figure 4 This is a schematic diagram of a dynamic attention decoder;
[0050] Figure 5 A schematic diagram of the cross-spatial scale feature aggregation and reconstruction module; Detailed Implementation
[0051] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0052] This invention proposes a two-stage cross-spatial-scale fusion network (SRCF-Net), whose processing flow mainly includes the following steps:
[0053] Step 1: Data Preprocessing
[0054] Step 2: Global Feature Extraction with SwinTransFormer
[0055] Step 3: Cross-Spatial Scale Feature Aggregation and Reconstruction (CSSAR)
[0056] Step 4: ResNet34 Local Feature Refinement and Enhancement
[0057] Step 4: Dynamic Edge-Guided Decoding and Fusion
[0058] Step 6: Multi-scale fusion and prediction
[0059] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. This embodiment proposes a two-stage cross-spatial-scale fusion network, and the specific processing flow is as follows:
[0060] Step 1: Data Preprocessing
[0061] Step 1-1: First, the endoscopic image data used is standardized and preprocessed. Considering the differences in the original image sizes in colorectal polyp segmentation datasets (such as Kvasir-SEG, CVC-ClinicDB, etc.), to ensure the consistency of model input, improve computational efficiency and memory utilization, this embodiment uniformly scales all endoscopic images to [size not specified]. Pixels. For images that are too small, zero-padding is used to fill the gaps.
[0062] Steps 1-2: Normalize the image, adjusting its pixel value range from [0, 255] to [0, 1]. Further data augmentation strategies are employed to improve the model's generalization ability, including: random horizontal or vertical flipping, and random rotation (rotation angle range is...). to Brightness and contrast adjustment, as well as Gaussian blur processing.
[0063] Step 2: Global Feature Extraction with SwinTransFormer
[0064] Step 2-1: Input the preprocessed image into the first-stage Swin Transformer encoder. Its hierarchical Transformer structure is used to capture long-range dependencies and global semantic information in the image.
[0065] Step 2-2: The Swing Transformer encoder outputs four feature maps at different scales, denoted as:
[0066] ;
[0067] in Indicates the input image. This represents the hierarchical index. These feature maps, after being processed by the first-stage decoder, generate the first-stage coarse segmentation features. .
[0068] Step 3: Cross-Spatial Scale Feature Aggregation and Reconstruction (CSSAR)
[0069] Step 3-1: To bridge the gap between global semantics and local details, the multi-scale features output from the first stage are input into the Cross-Spatial Scale Feature Aggregation and Reconstruction (CSSAR) module. The input four-layer features... The process involves first mapping features at different scales to a unified sequence form through downsampling or flattening operations, and then concatenating these sequences to obtain a fused feature sequence.
[0070] Axial attention is used to model features in both horizontal and vertical directions, obtaining cross-scale and cross-spatial features, respectively. Horizontal axial attention yields full-scale aggregated features with cross-scale interaction, while vertical axial attention yields features with cross-spatial interaction. Furthermore, a Swintransformer Block is employed to obtain features at different locations and scales. These features are then fused through summation operations to ultimately generate fused features across spatial scales. The entire process is defined as follows:
[0071] ;
[0072] in It is the Swing Transformer Block. It is horizontal axis attention. It is vertical axis attention.
[0073] Step 3-3: The sequence features are restored to the original four-layer feature map size through channel splitting and shaping operations, and the feature response intensity is adjusted through a channel attention mechanism to obtain the reconstructed features. :
[0074] ;
[0075] in These are the features of each layer after splitting and reshaping. It is the Sigmoid activation function. It is a one-dimensional convolution with a kernel of 3. It is global max pooling.
[0076] Step 4: ResNet34 Local Feature Refinement and Enhancement
[0077] Step 4-1: The second stage uses ResNet34 as an encoder to extract high-resolution local texture details, and in the process, the semantic information from the first stage is introduced for feature enhancement.
[0078] Step 4-2: After obtaining the cross-spatial scale fusion and reconstruction module, The ResNet encoder in the first... The regular input of the layer is denoted as This embodiment splices and fuses these two features, and then feeds them into the residual block of the layer after adjusting the channels through a convolutional layer:
[0079] ;
[0080] ;
[0081] in, Used for feature fusion and channel alignment. The final result is... This refers to the encoding features that integrate the semantic priors of the first stage with the local details of the second stage.
[0082] Step 5: Dynamic Edge-Guided Decoding Fusion
[0083] Step 5-1: The second-stage decoder E-DAD receives the fused ResNet features described above. First stage coarse segmentation output and edge guidance features Generate the final refined prediction:
[0084] ;
[0085] Step 5-2: Adaptively adjust the receptive field using the Dynamic Receptive Field Convolutional Module (DRC). This is based on the number of foreground pixels in the feature map. Dynamically select the kernel size to adapt to changes in the scale of the polyp:
[0086] ;
[0087] ;
[0088] ;
[0089] in For binarization threshold, Foreground mask. The model is based on... The size is within a set of preset convolution kernels (such as...) Choose the best matching size for convolution operation.
[0090] Step 5-3: Enhance boundary representation using the Edge Detection Module (EDM). The EDM receives shallow features. and deep features We perform horizontal and vertical strip convolutions respectively to extract gradient information:
[0091] ;
[0092] ;
[0093] Where CA represents channel attention operation.
[0094] Edges are located by utilizing the information differences between feature maps at different levels, and deep feature maps are used to... Upsampling via bilinear interpolation makes its spatial resolution equal to Alignment obtained The difference between the two feature layers is obtained. This difference map characterizes the inconsistencies between hierarchical features and can effectively indicate object boundaries or fine-grained structures. Next, we will... , and After concatenation along the channel dimension, the feature map is obtained by convolution and sigmoid activation. The process is as follows:
[0095] ;
[0096] in It's a convolution with a 1×1 kernel, the purpose of which is to change the number of channels. Bilinear interpolation upsampling It is the sigmoid activation function. It is Conv-Bn-ReLU. Finally, the generated prediction graph... By supervising the processed edge map labels, more explicit constraints are imposed on the edge information at each level.
[0097] Step 6: Multi-scale fusion and prediction
[0098] Step 6-1: Fuse the outputs at different scales to obtain the final prediction map. Specifically, upsample the features of the second-stage decoder outputs at different scales to a uniform resolution. ), splicing is performed at the channel dimension.
[0099] Step 6-2: The spliced features are passed through The convolutional layer reduces the number of channels to 1, and finally, a refined polyp prediction map is generated using the sigmoid activation function. .
[0100] Experimental verification:
[0101] We validated the effectiveness of our proposed method using publicly available polyp segmentation datasets such as Kvasir-SEG, CVC-ClinicDB, and ETIS-LaribPolypDB. Comparisons were made with methods like U-Net, PraNet, and TransUNet, using metrics such as Dice coefficient, IoU, F-measure, and S-measure for evaluation. Quantitative results are shown in Tables 1 and 2. Our proposed method outperforms the comparative methods in all metrics, particularly in cross-domain generalization ability and boundary accuracy, validating the superiority and practicality of our proposed method.
[0102] Table 1: Comparison of quantitative results of different methods on the Kvasir-SEG dataset
[0103]
[0104] Table 2: Comparison of quantitative results of different methods on the CVC-ClinicDB dataset
[0105]
[0106] The results show that the method of the present invention significantly improves the accuracy and robustness of polyp segmentation while maintaining high inference efficiency, and has high clinical application value.
Claims
1. A cascaded global-to-local cross-scale fusion method for colonoscopic polyp segmentation, characterized in that, Includes the following steps: S1. Preprocess the input medical image and input the processed image into the two-stage network; S2. Use the first-stage Swin Transformer encoder-decoder structure to extract global semantic features from the input image and generate coarse segmentation results. S3. The multi-scale features extracted in the first stage are fused and reconstructed through the Cross-Spatial Scale Feature Aggregation and Reconstruction Module (CSSAR) to generate fused features rich in multi-scale contextual information. S4. The second-stage ResNet encoder receives the fused features and the original image features, and combines them with the dynamic attention edge-guided decoder (E-DAD) to refine local details and edges, generating the final refined segmentation result. S5. Construct a multi-scale feature fusion module to fuse outputs from different scales to obtain the final prediction map.
2. The polyp segmentation method of the two-stage cross-spatial scale fusion network according to claim 1, characterized in that: Step S1 includes the following steps: S1.1 scales or crops the input medical images to a uniform size of 352×352 pixels, and pads images with insufficient size with zeros. ; S1.2 Normalizes the image: ; Where μ and σ are the mean and standard deviation of the dataset; S1.3 employs data augmentation strategies, including random horizontal flipping, random vertical flipping, random rotation, brightness adjustment, and Gaussian blurring.
3. The polyp segmentation method for a two-stage cross-spatial-scale fusion network according to claim 1, characterized in that: Step S2 includes the following steps: S2.1 uses the Swing Transformer as the encoder to extract multi-layer features: ; S2.2 fuses multi-scale features through a Dynamic Attention Decoder (DAD) to output a coarse segmentation result: ; The polyp segmentation method of the two-stage cross-spatial scale fusion network according to claim 5 is characterized in that: the dynamic convolutional unit (DRC) is implemented in the following way: the input features are projected into a spatial probability map by 1×1 convolution and Sigmoid function, the number of foreground pixels is counted after binarization, and the convolution kernel size is independently selected for each image according to a preset range and convolution is performed.
4. The polyp segmentation method for a two-stage cross-spatial-scale fusion network according to claim 1, characterized in that: Step S3 includes the following steps: S3.1 Sequencing and concatenating the four-layer features into a fused feature: First, deforming the incoming four-layer features. This yields a four-layer sequence. Then, the other three layers are pruned and spliced based on the length of the deepest layer sequence. In this feature, the 0th dimension contains the feature's location information, the first dimension contains spatial information, and the second dimension contains channel information. The features obtained after cropping and concatenating the four layers are then concatenated along the first dimension to obtain a... Shape fusion features This feature enables the aggregation of features at different scales, including cross-scale and cross-spatial features in the row and column directions, respectively. S3.2 uses an axial attention mechanism and the swintransformer module for modeling: ; in It is the Swing Transformer Block. It is horizontal axis attention. It is vertical axis attention.
5. S3.3 Feature calibration via channel attention: ; in These are the features of each layer after splitting and reshaping. It is the Sigmoid activation function. It is a one-dimensional convolution with a kernel of 3. It is global max pooling.
6. The polyp segmentation method for a two-stage cross-spatial-scale fusion network according to claim 1, characterized in that: Step S4 includes the following steps: S4.1 is obtained through cross-spatial scale fusion and reconstruction modules. The ResNet encoder in the first... The regular input of the layer is denoted as This embodiment splices and fuses these two features, and then feeds them into the residual block of the layer after adjusting the channels through a convolutional layer: ; ; in, Used for feature fusion and channel alignment. The final result is... That is, the encoded features that integrate the semantic priors of the first stage and the local details of the second stage; The S4.2 Dynamic Attention Edge Guided Decoder (E-DAD) receives three inputs:
7. S4.3 Edge features are generated by the EDM module: A shallow, high-resolution feature map and a deeper, low-resolution feature map. .right Perform strip convolutions in both the horizontal and vertical directions, sum them, and then apply channel attention before combining with... Residual connection obtained Strip convolution can effectively capture gradient changes in both the horizontal and vertical directions, thus highlighting edge features. Channel attention can adaptively assign higher weights to channels with significant edges, thereby suppressing interference from background or noisy channels; ; The core mechanism of EDM lies in using the information differences between feature maps of different levels to locate edges. Deep feature maps are upsampled using bilinear interpolation to align their spatial resolution. The difference between two layers of features is used to obtain a difference map, which characterizes the inconsistencies between layer features and can effectively indicate object boundaries or fine-grained structures. Next, the difference map is concatenated along the channel dimension and then subjected to convolution and a sigmoid activation function to obtain the feature map. The process is as follows: 。 8. The infrared small target detection method based on a dual-encoder multi-stage feature fusion network according to claim 1, characterized in that: Step S4 is as follows. The obtained features are upsampled and unified to the same size as the original image, and then used to apply the resulting feature map. The convolutional layer performs channel transformation to obtain a feature map with 3 channels. The global robust feature map G is calculated using the following formula:
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1-7.