Medical image segmentation methods, devices, equipment and media

By introducing a lightweight dynamic fusion module, a local edge guidance module, and an attention module into the medical image segmentation model, the problem of limited computing resources on mobile and portable devices is solved, achieving efficient skin lesion image segmentation and improving real-time performance and segmentation accuracy.

CN120747135BActive Publication Date: 2026-03-13HUAIBEI NORMAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In existing technologies, UNet++ and VM-UNet models suffer from limited computational resources when performing skin lesion image segmentation on mobile and portable devices, resulting in poor real-time performance.

Method used

A medical image segmentation model employing a lightweight dynamic fusion module (LDF), a local edge guidance module (LEG), and an attention module extracts global feature information from boundary maps and skin lesion images in parallel, dynamically adjusting the attention weights of each channel dimension and spatial dimension within the model to reduce the number of parameters and improve feature extraction capabilities.

Benefits of technology

While ensuring feature extraction capabilities, the number of model parameters is significantly reduced, enhancing sensitivity to lesion edges and fine structures, improving the real-time performance of image segmentation processing, and facilitating deployment on mobile and portable devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005463926060000051
    Figure BDA0005463926060000051
  • Figure BDA0005463926060000091
    Figure BDA0005463926060000091
  • Figure BDA0005463926060000121
    Figure BDA0005463926060000121
Patent Text Reader

Abstract

This application discloses a medical image segmentation method, apparatus, device, and medium, relating to the field of medical image segmentation technology. The method includes: acquiring a population data to be processed; the population data includes multiple sets of skin lesion images, each skin lesion image including a set of candidate keypoints, each set of candidate keypoints representing the boundary region of the skin lesion image; preprocessing each set of candidate keypoints to obtain a boundary map containing the boundary region; processing the boundary map and the corresponding skin lesion image using a trained image segmentation model to output the image segmentation result; the image segmentation model includes an encoder, a fusion module, and a decoder; the encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected sequentially. This application reduces the number of parameters while ensuring model segmentation accuracy, making it easy to deploy on edge devices such as mobile and portable devices, and improving the real-time performance of image segmentation processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of medical image segmentation technology, and in particular to a medical image segmentation method, apparatus, device and medium. Background Technology

[0002] With the rapid development of medical information technology, dermoscopy, as an imaging technique for the examination and diagnosis of skin diseases, is increasingly being used in routine clinical medical procedures. In the context of the rapid development of artificial intelligence technology, its characteristics of rapidly processing large-scale medical image data, supporting multimodal and multi-task learning, and fusing multi-source data are gradually being applied to medical image segmentation tasks. Therefore, research on image segmentation for skin lesions is particularly important for better analysis.

[0003] Currently, UNet++ and VM-UNet models are used to segment skin lesion images. However, due to the large number of parameters, this approach suffers from limited computing resources when deployed on edge devices such as mobile and portable devices, resulting in poor real-time performance of image segmentation processing. Summary of the Invention

[0004] The purpose of this application is to provide a medical image segmentation method, apparatus, device, and medium.

[0005] To achieve the above objectives, this application provides the following solution:

[0006] In a first aspect, this application provides a medical image segmentation method, comprising:

[0007] Acquire population data to be processed; the population data to be processed includes multiple sets of skin lesion images, each skin lesion image includes a set of candidate key points, and each set of candidate key points is used to characterize the boundary region of the skin lesion image;

[0008] Preprocess each set of candidate key points to obtain a boundary map containing the boundary region;

[0009] The boundary map and the corresponding skin lesion image are processed by a trained image segmentation model to output the image segmentation result. The image segmentation model includes an encoder, a fusion module, and a decoder. The encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected in sequence. The lightweight dynamic fusion module is used to extract global feature information of the boundary map and the corresponding skin lesion image in parallel. The local edge guidance module is used to extract local detail information of the boundary map and the corresponding skin lesion image. The attention module is used to dynamically adjust the attention weights of each channel dimension and spatial dimension within the model based on the global feature information and the local detail information.

[0010] Secondly, this application provides a medical image segmentation apparatus, the apparatus comprising:

[0011] The acquisition module is used to acquire population data to be processed; the population data to be processed includes multiple sets of skin lesion images, each skin lesion image includes a set of candidate key points, and each set of candidate key points is used to characterize the boundary region of the skin lesion image;

[0012] The preprocessing module is used to preprocess each set of candidate key points to obtain a boundary map containing the boundary region;

[0013] The segmentation module processes the boundary map and the corresponding skin lesion image using a trained image segmentation model to output the image segmentation result. The image segmentation model includes an encoder, a fusion module, and a decoder. The encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected in sequence. The lightweight dynamic fusion module is used to extract global feature information from the boundary map and the corresponding skin lesion image in parallel. The local edge guidance module is used to extract local detail information from the boundary map and the corresponding skin lesion image. The attention module is used to dynamically adjust the attention weights of each channel dimension and spatial dimension within the model based on the global feature information and the local detail information.

[0014] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the medical image segmentation method described in any one of the above.

[0015] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the medical image segmentation method described in any one of the above.

[0016] According to the specific embodiments provided in this application, the following technical effects are disclosed:

[0017] This application provides a medical image segmentation method, apparatus, device, and medium. The method includes: acquiring population data to be processed; the population data to be processed includes multiple sets of skin lesion images, each skin lesion image including a set of candidate keypoints, each set of candidate keypoints representing the boundary region of the skin lesion image; preprocessing each set of candidate keypoints to obtain a boundary map containing the boundary region; processing the boundary map and the corresponding skin lesion image through a trained image segmentation model to output the image segmentation result; the image segmentation model includes an encoder, a fusion module, and a decoder; the encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected in sequence; the lightweight dynamic fusion module is used to extract global feature information of the boundary map and the corresponding skin lesion image in parallel, the local edge guidance module is used to extract local detail information of the boundary map and the corresponding skin lesion image; the attention module is used to dynamically adjust the attention weights of each channel dimension and spatial dimension within the model based on the global feature information and the local detail information.

[0018] Compared with existing technologies, this solution acquires multiple sets of skin lesion images to be processed and preprocesses the candidate keypoint set in the skin lesion images to obtain a boundary map containing the boundary regions. This reduces the number of parameters and computational complexity while preserving the key information of the skin lesion images, making the model more adaptable to the computing resources of edge devices such as mobile and portable devices. Furthermore, the boundary map and the corresponding skin lesion images are processed by a trained image segmentation model. Because a lightweight dynamic fusion module (LDF), a local edge guidance module (LEG), and an attention module are set in the image segmentation model, the boundary map and the global features of the skin lesion images can be extracted in parallel using LDF. This significantly reduces redundant parameters, effectively lowering the number of model parameters while maintaining feature extraction capabilities. Furthermore, LEG accurately extracts local detail information, significantly enhancing sensitivity to lesion edges and fine structures. The attention module dynamically adjusts channel and spatial feature weights, enhancing the model's adaptability to complex features and making it focus more on key features (such as the core channel of the lesion and the spatial location of the lesion area). Feature fusion is performed through the fusion module in the image segmentation model, and the feature dimensions are restored through the decoder, thereby accurately obtaining image segmentation results. This makes it easy to deploy on edge devices such as mobile and portable devices, improving the real-time performance of image segmentation processing. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram of the structural environment of an application environment for a medical image segmentation method according to an embodiment of this application;

[0021] Figure 2 A schematic flowchart of a medical image segmentation method provided in an embodiment of this application;

[0022] Figure 3 This is a schematic diagram of the structure of an image segmentation model provided in an embodiment of this application;

[0023] Figure 4 A flowchart illustrating a method for processing boundary maps and corresponding skin lesion images using a trained image segmentation model to output image segmentation results, according to an embodiment of this application;

[0024] Figure 5 This is a schematic diagram of the internal structure of an LDF provided in an embodiment of this application;

[0025] Figure 6 This is a schematic diagram of the internal structure of a LEG provided in an embodiment of this application;

[0026] Figure 7 This is a schematic diagram of the internal structure of a DCSA provided in an embodiment of this application;

[0027] Figure 8 This is a schematic diagram illustrating the performance comparison results of various different models provided in an embodiment of this application;

[0028] Figure 9 A schematic diagram illustrating the visualization effects of various models provided in one embodiment of this application;

[0029] Figure 10 A schematic diagram of the functional modules of a medical image segmentation device provided in an embodiment of this application;

[0030] Figure 11 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0031] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0032] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0033] Related technologies use UNet++ and VM-UNet models to segment skin lesion images. However, due to the large number of parameters, this approach suffers from limited computing resources when deployed on edge devices such as mobile and portable devices, resulting in poor real-time performance of image segmentation processing.

[0034] To address the aforementioned shortcomings, this application provides a medical image segmentation method. Compared to existing technologies, this method acquires multiple sets of skin lesion images to be processed and preprocesses the candidate keypoint set in the skin lesion images to obtain a boundary map containing the boundary regions. This reduces the number of parameters and computational complexity while preserving key information of the skin lesion images, making the model more adaptable to the computing resources of mobile devices, portable devices, and other edge devices. Furthermore, the boundary map and the corresponding skin lesion images are processed using a pre-trained image segmentation model. Because a lightweight dynamic fusion module (LDF), a local edge guidance module (LEG), and an attention module are incorporated into the image segmentation model, the LDF can be used to extract global features of the boundary map and the skin lesion images in parallel. This significantly reduces redundant parameters, effectively lowering the number of model parameters while maintaining feature extraction capabilities. Furthermore, LEG accurately extracts local detail information, significantly enhancing sensitivity to lesion edges and fine structures. The attention module dynamically adjusts channel and spatial feature weights, enhancing the model's adaptability to complex features and making it focus more on key features (such as the core channel of the lesion and the spatial location of the lesion area). Feature fusion is performed through the fusion module in the image segmentation model, and the feature dimensions are restored through the decoder, thereby accurately obtaining image segmentation results. This makes it easy to deploy on edge devices such as mobile and portable devices, improving the real-time performance of image segmentation processing.

[0035] This application provides a medical image segmentation method that can be applied to, for example... Figure 1 The application environment of the medical image segmentation method shown includes a terminal 102, a server 104, and a data storage system. The terminal 102 communicates with the server 104 via a network. The data storage system stores the data that the server 104 needs to process. The data storage system can be set up independently, integrated into the server 104, or placed in the cloud or on another server. The terminal 102 can send the acquired population data to be processed to the server 104. After receiving the population data, the server 104 processes it using a trained image segmentation model to obtain the image segmentation result. Furthermore, in some embodiments, the medical image segmentation method can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly process the image using the image segmentation model to obtain the image segmentation result. The terminal 102 can pre-store a trained image segmentation model.

[0036] The terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster composed of multiple servers, or it can be a cloud server.

[0037] In one exemplary embodiment, such as Figure 2 As shown, a medical image segmentation method is provided. This method is executed by a computer device, specifically, it can be executed by a computer device such as a terminal or a server alone, or it can be executed by both a terminal and a server. In this embodiment, the method is applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps S201 to S203. Wherein:

[0038] Step S201: Obtain the population data to be processed; the population data to be processed includes multiple sets of skin lesion images, each skin lesion image includes a set of candidate key points, and each set of candidate key points is used to characterize the boundary region of the skin lesion image.

[0039] It should be noted that the skin lesion images in the above-mentioned population data to be processed can be images containing lesion areas, images that need to be processed by image segmentation, including multiple sets of candidate key feature points. Each set of candidate key points can form the boundary region of the skin lesion image. There can be multiple boundary regions. When there are multiple boundary regions, their size and shape can be the same or different.

[0040] Optionally, the above-mentioned skin lesion images can be obtained through a dermoscopy, a high-resolution camera, or imaging techniques such as CT or MRI to capture images of some deep and complex lesions, and after format conversion, form skin lesion images containing the lesion area.

[0041] Step S202: Preprocess each set of candidate key points to obtain a boundary map containing the boundary region.

[0042] It should be noted that the above preprocessing process can be based on the optimization mechanism of the Genetic Algorithm (GA). By simulating the selection, crossover and mutation operations in biological evolution, the set of key points of the lesion boundary is iteratively optimized, and finally a contour that closely matches the real boundary is generated.

[0043] In one embodiment, preprocessing each set of candidate keypoints to obtain a boundary map containing the boundary region includes: calculating the intersection-union ratio (IU) between the boundary region and the actual boundary region corresponding to each set of candidate keypoints; using the IU as a fitness function to calculate the fitness score of each set of candidate keypoints; selecting parent data from the population data to be processed based on the fitness score; performing probabilistic crossover and mutation operations on the parent data to obtain the optimal set of keypoints; and converting the optimal set of keypoints into a continuous boundary curve to generate a boundary map containing the boundary region.

[0044] For example, taking a population of 300 as an example, Np = 300 represents the population size, and 300 sets of candidate keypoints are randomly generated. Each set of keypoints is used to characterize the boundary contour of the skin lesion, and its spatial distribution directly affects the accuracy of subsequent boundary fitting. Keypoints serve as control vertices of the boundary, outlining the lesion contour through coordinate combinations. Initialization follows a uniform random distribution principle to ensure coverage of the possible boundary range of the lesion, providing sufficient search space for subsequent optimization.

[0045] After obtaining the population data to be processed, the Intersection over Union (IoU) ratio can be used as the fitness function. The calculation formula can be expressed as follows:

[0046]

[0047] Where A represents the boundary region generated from candidate keypoints, and B represents the boundary region of the actual lesion. The closer the IoU value is to 1, the higher the overlap between the candidate boundary and the actual boundary.

[0048] For each candidate keypoint region generated in the population data, the Intersection over Union (IoU) value between it and the true boundary is calculated. The IoU is used as a fitness function to evaluate the degree of matching between the IoU and the true boundary, which is then used as the fitness score of the individual, providing a quantitative basis for subsequent selection operations. Then, based on the fitness score, a roulette wheel algorithm is used to select parent individuals. The proportion of an individual's fitness to the total fitness of the population corresponds to its probability of being selected. This mechanism ensures that individuals with high fitness (i.e., high boundary matching) have a greater probability of participating in the next generation of evolution, reflecting the "survival of the fittest" principle. A high-probability crossover operation is then performed, randomly pairing selected parents with a set probability (usually 0.6-0.9). By exchanging some coordinate information in the parent keypoint combinations, offspring individuals with parental characteristics are generated. For the crossover-generated offspring, their keypoint coordinates are randomly perturbed with a low probability (e.g., 0.01-0.05), introducing random changes to escape local optima. The mutation operation, by introducing new feature combinations, can prevent the algorithm from getting stuck in local high-fitness regions during the iteration process, ensuring global search capability. The crossover operation enhances population diversity by exchanging key point combinations of the parent generation.

[0049] Optionally, a two-stage iterative process can be performed. For example, a pre-iteration stage (T1 = 2000 iterations) is performed first: through 2000 random iterations without genetic operations, the search range of key points is quickly narrowed down, and candidate solutions close to the true boundary are initially screened, reducing the computational complexity of subsequent genetic iterations. Then, a genetic iteration stage (T2 = 100 iterations) is performed: based on the pre-iteration, 100 complete genetic operations (selection-crossover-mutation) are performed, and the positions of key points are finely adjusted through the evolutionary mechanism. After multiple rounds of iterative optimization, the optimal set of key points with the highest IoU value is finally output. The optimal set of key points is then converted into a continuous boundary curve, generating a boundary map containing the boundary region.

[0050] In this embodiment, by processing the candidate keypoint set in the skin lesion image, the image quality and model input effectiveness are significantly improved. A boundary map is generated based on the candidate keypoint set, making the image features of the input model purer. The boundary map enhances the distinction between the lesion area and the background, enabling subsequent lightweight dynamic fusion modules to extract global and local features more efficiently, effectively improving segmentation accuracy and model robustness, and providing basic information for edge device deployment.

[0051] Step S203: The boundary map and the corresponding skin lesion image are processed by the trained image segmentation model to output the image segmentation result. The image segmentation model includes an encoder, a fusion module, and a decoder. The encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected in sequence. The lightweight dynamic fusion module is used to extract global feature information of the boundary map and the corresponding skin lesion image in parallel. The local edge guidance module is used to extract local detail information of the boundary map and the corresponding skin lesion image. The attention module is used to dynamically adjust the attention weights of each channel dimension and spatial dimension in the model according to the global feature information and the local detail information.

[0052] It should be noted that the aforementioned fusion module can be a Prediction Information Fusion module (PIF). This module integrates and optimizes multi-source prediction information to improve the model's decision-making accuracy. Both the encoder and decoder can contain five layers, for example, with the number of channels in each layer being {8, 16, 24, 32, 48}. The first three layers of the encoder can be configured with a Lightweight Dynamic Fusion (LDF) module to extract features from the boundary map and skin lesion image. This module significantly reduces the number of parameters and computational complexity while maintaining efficient feature representation. The third layer of the encoder can embed a Local Edge Guidance (LEG) module, which significantly enhances the ability to capture local detail information in a lightweight manner, thereby improving the model's sensitivity to edges and fine structures. The last two layers of the encoder employ a Group Shuffle Attention (GSA) module to further capture global contextual information. Following deep feature extraction in the third and fourth layers of the encoder, an innovative Dynamic Channel-Spatial Attention (DCSA) module is deployed. This module effectively enhances the model's adaptability to complex features by dynamically adjusting attention weights in the channel and spatial dimensions, and achieves efficient integration with the overall architecture. This modular design not only optimizes the feature extraction process but also further improves the model's performance in complex medical image segmentation tasks.

[0053] Specifically, please see Figure 3 As shown, Figure 3This is a schematic diagram of the image segmentation model provided in an embodiment of this application. The left side of the diagram represents the encoder, the right side the decoder, and the middle the fusion module. The encoder includes at least one feature extraction module, a first attention module, a second attention module, and a group shuffling attention module connected in sequence. The feature extraction module, first attention module, second attention module, and group shuffling attention module are connected sequentially. At least one feature extraction module may include two modules, each including a sequentially connected LDF and a downsampling unit (Down). The first attention module includes a sequentially connected LDF, LEG, and DCSA. The second attention module includes a sequentially connected GSA, DCSA, and pooling MP. The group shuffling attention module includes a sequentially connected GSA and MP. The decoder includes five layers; the first two layers include a sequentially connected GSA and BI, and the last three layers include a sequentially connected LDF and BI.

[0054] After preprocessing the population data (skin lesion images) to obtain the boundary map, the boundary map and skin lesion images can be input in parallel into the first and second feature extraction modules of the image segmentation model for feature extraction. This yields downsampled features, which are then processed by the first attention module for local feature extraction and channel-space weight allocation to obtain attention features. The second attention module then performs grouping and shuffling processing and channel-space weight allocation to obtain pooled features. These pooled features are then further processed by the grouping and shuffling attention module to obtain the final processing result. The output of each layer is processed by the fusion module PIF and output to the corresponding layer of the decoder. The extracted features are then processed by the decoder. In the decoder, shallow feature recovery is first performed using GSA and bilinear interpolation (BI), followed by deeper feature image recovery using LDF. This operation only restores the image of the predicted lesion region, thus obtaining the image segmentation result. This image segmentation result includes the lesion region, which may include one, two, or more.

[0055] This application provides a medical image segmentation method. Compared with existing technologies, this method acquires multiple sets of skin lesion images to be processed and preprocesses the candidate keypoint set in the skin lesion images to obtain a boundary map containing the boundary region. This reduces the number of parameters and computational complexity while preserving the key information of the skin lesion images, making the model more adaptable to the computing resources of edge devices such as mobile and portable devices. Furthermore, the boundary map and the corresponding skin lesion images are processed by a trained image segmentation model. Because a lightweight dynamic fusion module (LDF), a local edge guidance module (LEG), and an attention module are set in the image segmentation model, the boundary map and the skin lesion images can be extracted in parallel using LDF. The global features of lesion images significantly reduce redundant parameters, effectively reducing the number of model parameters while ensuring feature extraction capabilities. Furthermore, LEG accurately extracts local detail information, significantly enhancing sensitivity to lesion edges and fine structures. The attention module dynamically adjusts channel and spatial feature weights, enhancing the model's adaptability to complex features and making it focus more on key features (such as the core lesion channel and the spatial location of the lesion area). Feature fusion is performed through the fusion module in the image segmentation model, and the feature dimensions are restored through the decoder, thereby accurately obtaining image segmentation results. This makes it easy to deploy on edge devices such as mobile and portable devices, improving the real-time performance of image segmentation processing.

[0056] In one embodiment of this application, please refer to Figure 4 As shown in the embodiment of this application, a specific implementation method is provided for processing boundary maps and corresponding skin lesion images using a trained image segmentation model to output image segmentation results. The method includes:

[0057] Step S301: The boundary map and the corresponding skin lesion image are processed by the first lightweight dynamic fusion module and the downsampling module in the feature extraction module to obtain the downsampled features.

[0058] Step S302: The downsampled features are processed by the second lightweight dynamic fusion module, the local edge guidance module and the first attention unit in the first attention module to obtain attention features.

[0059] Step S303: The attention features are processed by the first grouping shuffling attention unit, the second attention unit and the first pooling unit in the second attention module to obtain the first pooled features.

[0060] Step S304: The pooled features are processed by the second group shuffle attention unit and the second pooling unit in the group shuffle attention module to obtain the second pooled features.

[0061] Step S305: At least one downsampled feature, attention feature, first pooled feature, and second pooled feature are processed by the fusion module and then decoded by the decoder to obtain the image segmentation result.

[0062] Specifically, the aforementioned first lightweight dynamic fusion module includes a dual-branch structure, which processes the boundary map and the corresponding skin lesion image through the first lightweight dynamic fusion module and the downsampling module in the feature extraction module to obtain downsampled features, including:

[0063] A dynamic convolutional kernel in a dual-branch structure is used to extract features from the boundary map and the corresponding skin lesion image, obtaining skin boundary features and global skin features. Each branch of the dual-branch structure includes a pooling layer, a linear layer, an activation function layer, and a conditional convolutional layer connected in sequence. The pooling layer is used to obtain contextual information from the boundary map and the skin lesion image, the linear layer is used to learn the dependencies between channels through nonlinear transformation, the activation function layer is used to generate spatial attention weights based on the dependencies, and the conditional convolutional layer is used to dynamically combine convolutional kernel parameters based on the spatial attention weights to obtain skin boundary conditions and global skin features. The skin boundary features and global skin features from each branch structure are fused to obtain fused features. The fused features are then subjected to convolution, normalization, and activation function processing in sequence to obtain key skin features. Finally, the key skin features are downsampled using a downsampling module to obtain downsampled features.

[0064] The encoder in the image segmentation model described above can include two feature extraction modules, with both the first and second layers being feature extraction modules. Each feature extraction module includes a first lightweight dynamic fusion module (LDF) and a downsampling module (Down). The processing flow of each feature extraction module is the same.

[0065] Please see Figure 5As shown in the figure, this application embodiment provides a schematic diagram of the internal structure of a first lightweight dynamic fusion module. This first lightweight dynamic fusion module includes a dual-branch structure, each branch comprising a pooling layer, a linear layer, an activation function layer, and a conditional convolutional layer connected sequentially. The pooling layer can be an average pooling layer. The boundary map and the corresponding skin lesion image are processed by average pooling to capture global contextual information, extracting skin boundary features and global skin features. The linear layer learns the dependencies between channels through nonlinear transformation, and the activation function layer generates spatial attention weights based on these dependencies. The conditional convolutional layer dynamically combines convolutional kernel parameters based on these spatial attention weights. Different convolutional kernels are used to capture different types of feature patterns, thereby dynamically acquiring different feature maps. The skin boundary features and global skin features obtained from the dual-branch structure are then element-wise added to obtain fused features. The fused features are connected through 1×1 convolutional residuals to effectively alleviate the gradient vanishing problem. A normalization layer and a ReLU activation function are used to optimize the feature distribution, obtaining key skin features. These key skin features include edge information and internal feature information in the skin lesion image.

[0066] The convolutional residual processing described above can be achieved through CondConv2d to dynamically fuse multiple convolutional kernels. Each sample will be weighted and combined according to num_experts convolutional kernels to obtain key skin features, as shown in the formula:

[0067]

[0068] x out =ReLU(Conv 1×1 ([f1(x),f2(x)])+x res (2)

[0069] Where [f1(x), f2(x)] represent the skin boundary features and global skin features of the dual-branch output, respectively, and x res This represents a residual connection, ωi represents the kernel weight corresponding to the i-th convolutional kernel, and α i Let ω represent the i-th convolutional kernel. dynamic This indicates key features of the skin.

[0070] After obtaining the key skin features, the key skin features are downsampled using the Down sampling module to obtain the downsampled features.

[0071] In this embodiment, the first lightweight dynamic fusion module and the downsampling module work together to extract global feature information of skin lesion images and their boundary maps in parallel and efficiently through dynamic convolution adaptive combination of convolution kernels. This significantly reduces the number of model parameters while ensuring feature extraction accuracy. Furthermore, the downsampling module reduces the resolution of the feature map, lowers computational complexity, and expands the receptive field to capture the global morphology of lesions in the image, suppressing image noise and enhancing key features. The combination of these two approaches results in downsampled features that retain key information and structural details of the image while achieving lightweight processing. This reduces the computational burden on subsequent network layers, effectively improving the model's operating efficiency and real-time performance on mobile and other edge devices. It also enhances the ability to express complex skin lesion features, contributing to improved segmentation accuracy.

[0072] In one embodiment, the third layer of the encoder is a first attention module, which includes: a second lightweight dynamic fusion module (LDF), a local edge guidance module (LEG), and a first attention unit (DCSA).

[0073] The downsampled features are processed by the second lightweight dynamic fusion module, the local edge guidance module, and the first attention unit in the first attention module to obtain attention features, including:

[0074] The downsampled features are processed by the second lightweight dynamic fusion module in the first attention module to obtain skin feature information.

[0075] Skin feature information is processed through a local edge guidance module to obtain local feature information. The local edge guidance module includes: a Sobel convolutional layer, a feature processing layer, a feature fusion layer, a segmentation layer, and a partial convolutional layer. The Sobel convolutional layer is used to perform Sobel convolution operations on the downsampled features to obtain an edge feature map. The feature processing layer is used to extract features from the downsampled features to obtain an attention feature map. The feature fusion layer is used to fuse the edge feature map and the attention feature map to obtain a fused feature map. The segmentation layer is used to segment the fused feature map. The partial convolutional layer is used to use the processed feature map as prior information to selectively calculate the input channels to obtain the local feature information after edge guidance enhancement.

[0076] The local feature information is processed sequentially through the lightweight channel attention layer and the lightweight spatial attention layer in the first attention unit to obtain the feature after the first spatial attention processing; the lightweight channel attention layer is used to process the local feature information and construct the channel attention weights to obtain the feature after the channel attention processing; the lightweight spatial attention layer is used to process the feature after the channel attention processing into a spatial weight map, and the spatial weight map is processed to obtain the feature after the first spatial attention processing.

[0077] The features processed by the first spatial attention are then subjected to dynamic convolution to obtain attention features.

[0078] Understandably, for skin lesion areas, the most important part is their boundary region, and accurate prediction of local edge information is extremely important. Therefore, this application proposes a Local Edge Guidance Module (LEG) for image segmentation models. Its core lies in partial convolution, using the attention map generated from the unfused portion as prior information to guide the partial convolution feature selection process. Essentially, it selectively uses input channels to achieve efficient computation, significantly reducing computational resources. Through the LEG, the model can enhance feature learning in edge-sensitive regions while preserving the original feature representation capabilities.

[0079] Specifically, please see Figure 6 As shown, Figure 6 This is a schematic diagram of the local edge guidance module provided in an embodiment of this application. The local edge guidance module includes: a Sobel convolutional layer, a feature processing layer, a feature fusion layer, a segmentation layer, and a partially convolutional layer. The feature extraction layer includes a pooling layer, a linear layer, and an activation function layer. The pooling layer can be average pooling, and the activation function layer can include the ReLU activation function.

[0080] The downsampled features are processed by the second lightweight dynamic fusion module (LDF) in the first attention module to obtain skin feature information. Then, a Sobel convolution operation is performed on the downsampled features to obtain an edge feature map. This Sobel convolution operation on the input downsampled features aims to extract edge information from the image and generate an edge feature map. This edge feature map focuses on areas with significant pixel gradient changes in the image, i.e., potential lesion edges, etc. The downsampled features are then average-pooled through a pooling layer in the feature processing layer to compress the spatial dimension of the feature map, reduce computation, and obtain global information. Next, a linear layer transformation is applied, and a ReLU activation function is used to introduce non-linearity. An attention feature map is generated through linear layer and ReLU activation function operations. Finally, the edge feature map obtained from the Sobel convolution is multiplied element-wise with the attention weight feature map obtained from the feature processing layer to obtain a fused feature map. This approach utilizes attention weights to strengthen edge information related to important channels in the edge feature map and suppress unimportant parts, achieving enhanced selection of features in edge-sensitive regions.

[0081] The fused feature map is segmented and processed, and the processed feature map is used as prior information through some convolutional layers to guide feature selection in some convolutions. The input channels are selectively calculated, which greatly reduces the consumption of computing resources while preserving effective feature expression. The final output is a feature map enhanced by edge guidance. This feature map includes local feature information enhanced by edge guidance, which is used for subsequent feature processing and lesion segmentation of the model, making the model more accurate in segmenting detailed areas such as skin image edges.

[0082] In this embodiment, a local edge guidance module processes skin feature information, effectively enhancing the model's ability to capture the edges and local details of skin lesions. This module utilizes Sobel convolution to extract image edge information and combines it with a feature processing layer to obtain attention features. Through feature fusion, features related to edge-sensitive areas are selectively enhanced while suppressing irrelevant noise. Subsequent partial convolution operations selectively compute based on the fused prior information, achieving efficient extraction and optimization of local detail features of skin images while significantly reducing computational load. This makes the obtained local feature information more focused on key details such as lesion edges and textures, providing accurate and lightweight feature support for subsequent precise segmentation and significantly improving the model's segmentation accuracy for complex and varied skin lesion boundaries.

[0083] Understandably, to overcome the secondary computational complexity problem of traditional models, this application proposes adding a Dynamic Spatial-Channel Attention Unit (DCSA) to the image segmentation model, which can be understood as a Dynamic Spatial-Channel Attention Unit. The first attention unit, DCSA, includes a lightweight channel attention layer and a lightweight spatial attention layer. The lightweight channel attention layer is used to filter important feature channels, and the lightweight spatial attention layer is used to calculate channel weights based on the filtered important feature channels. These weights are then multiplied by normalization, activated by a sigmoid function, and connected to the original residual. The mean is then calculated based on the channel dimension to generate a spatial weight map beta with shape [B,1,H,W]. The beta is then normalized pixel-by-pixel to generate normalized weights beta_norm, followed by activation fusion. Finally, dynamic parameterized convolution enhances local feature adaptability.

[0084] Please see Figure 7 As shown, Figure 7This is a schematic diagram of the internal structure of the DCSA provided in this application. After obtaining local feature information, the local feature information is processed through the lightweight channel attention layer in the first attention unit DCSA to construct channel attention weights. The lightweight channel attention layer includes normalization, weighting, and a sigmoid function. Through the normalization operation, scaling parameters are learned to initially adjust the feature distribution, preparing for the calculation of channel attention weights. Based on the normalized features, the channel weights are calculated, then weighted with the normalized features, and finally processed through the sigmoid activation function to obtain the channel attention weights, thus obtaining the features after channel attention processing. These channel attention weights are used to filter important feature channels, highlight key channel information, and suppress irrelevant channels.

[0085] The lightweight spatial attention layer can include mean calculation, normalization, and weighting operations. The features processed by channel attention are meand along the channel dimension to generate a shape-specific spatial weight map `beta`, focusing on the importance of different spatial locations. The spatial weight map is then normalized pixel-by-pixel to obtain normalized weights `beta_norm`, which are then fused using activation functions to further refine key spatial regions, allowing the model to focus more on important areas such as lesions, thus obtaining the features processed by the first spatial attention layer. These features are then subjected to dynamic convolution, which can be achieved by decomposing the weight matrix. This decomposition consists of the basis moments `D_base` and the diagonally initialized `D_diag`, and a dynamic convolution kernel is generated through a linear combination. In this way, the dynamic parameters only grow linearly with the number of basis matrices. During inference, the dynamic convolution can be folded into a regular convolution, maintaining the same computational complexity and effectively controlling the parameter size. The generated dynamic convolution kernels are used to convolve the features processed by channel and spatial attention, enhancing the adaptability of local features. This allows the model to better represent the complex and varied lesion features in skin images (such as lesions of different shapes and boundaries). The final output is the DCSA-enhanced features, i.e., the attention features, which enhance feature representation and are used in subsequent segmentation processes to improve segmentation accuracy. The dynamic weight calculation method for DCSA during dynamic convolution can be represented as follows:

[0086]

[0087] Where D_base represents the base parameter matrix and D_diag represents the diagonal parameter matrix.

[0088] This application normalizes, weights, and activates local feature information through a lightweight channel attention layer, and generates spatial weights through a lightweight spatial attention layer, then fuses them with normalization and activation. Dynamic convolution generates dynamic kernels and enhanced features, outputting enhanced attention features. Through an adaptive fusion of channel and spatial dimension attention mechanisms, the response intensity of key feature channels in skin lesion images can be specifically enhanced, and the spatial location information of lesion areas can be accurately located. While suppressing background noise and irrelevant texture interference, it dynamically captures multi-scale detailed features such as lesion edges and textures. Its lightweight design, through parameter sharing and dynamic weight generation strategies, achieves cross-dimensional information interaction and optimization of feature maps while significantly reducing computational complexity. This effectively improves the model's ability to represent complex lesion morphologies, providing more discriminative feature representations for subsequent segmentation or classification tasks, and contributing to improved accuracy and real-time performance in medical image analysis.

[0089] In one embodiment, the fourth layer of the encoder is a second attention module, which includes: a first group shuffle attention module (GSA), a second attention unit DCSA, and a first pooling unit MP.

[0090] The attention features are grouped and shuffled by the first grouping and shuffling attention unit to obtain cross-region feature interaction information. Global feature extraction is then performed on the cross-region feature interaction information to obtain all feature information. All feature information is then processed by the lightweight channel attention layer and the lightweight spatial attention layer in the second attention unit to obtain the features after second spatial attention processing. The features after second spatial attention processing are then pooled by the first pooling unit to obtain the features after first pooling.

[0091] It is understandable that GSA actually uses a shared memory constructed with linear complexity HPA to perform retrieval and obtain cross-region feature interaction information.

[0092] Specifically, attention features are grouped and shuffled through the first grouping and shuffling attention unit (GSA). This grouping and shuffling enables feature interaction, obtaining cross-regional feature interaction information and capturing global contextual information, enhancing feature correlation, and obtaining all feature information. This helps improve the understanding of the relationship between lesions and overall tissue in dermatological image segmentation and improves segmentation accuracy. Then, all feature information is processed sequentially through the lightweight channel attention layer and lightweight spatial attention layer in the second attention unit to obtain the features after second spatial attention processing. These features are then pooled through the first pooling unit to obtain the features after first pooling, achieving dimensionality reduction and information compression of features. This reduces the number of model parameters and computational complexity while preserving key features such as translation invariance. Its core functions include reducing the feature map size through downsampling to reduce computational burden, enhancing feature robustness (e.g., resisting slight image displacement or deformation) through local aggregation, and improving model generalization ability by suppressing noise and highlighting salient features (e.g., edges and textures). Simultaneously, it expands the receptive field to capture more global contextual information, making it an important component for balancing model expressive power and efficiency.

[0093] In this embodiment, GSA serves as a grouping and shuffling attention mechanism. By grouping and shuffling feature maps, it constructs cross-regional feature interactions, accurately capturing global contextual information to enhance multi-scale feature correlation and global feature correlation, enabling the model to more accurately capture the spatial relationship between skin lesions and surrounding tissues. DCSA adaptively fuses channel and spatial dimension attention, strengthens key feature responses, suppresses background interference, and focuses on lesion details and edge features. MP reduces the feature map size to reduce computational burden. By combining these three, it improves image segmentation accuracy and robustness through a dual attention mechanism and accelerates the inference process through model parallelism, effectively solving the problem of difficulty in balancing accuracy and efficiency in traditional solutions, and is more suitable for edge device deployment and real-time application scenarios.

[0094] The fifth layer of the encoder includes: a second group shuffle attention unit (GSA) and a second pooling unit (MP).

[0095] After obtaining the features after the first pooling, the features after the first pooling are grouped and shuffled by the second grouping and shuffling attention unit GSA to obtain all the corresponding feature information; then they are pooled by the second pooling unit MP to obtain the features after the second pooling.

[0096] In this step, pooling operations can expand the receptive field and enhance the model's robustness to transformations such as translation and rotation.

[0097] In another exemplary embodiment of this application, the decoder includes: a first group decoding module, a second group decoding module, a first fusion decoding module, a second fusion decoding unit, and a third fusion decoding module. At least one downsampled feature, attention feature, first pooled feature, and second pooled feature are processed by the fusion module and then decoded by the decoder to obtain an image segmentation result, including:

[0098] At least one downsampled feature, attention feature, first pooled feature, and second pooled feature are processed by a fusion module to obtain at least one first connection feature, a second connection feature, a third connection feature, and a fourth connection feature. The fourth connection feature is processed by a first group decoding module for shallow feature recovery to obtain first upsampled information. The third connection feature and the first upsampled information are input into a second group decoding module for processing to obtain second upsampled information. Based on the second upsampled information, the second connection feature, and the first connection feature, deep feature reconstruction is performed by a first fusion decoding module, a second fusion decoding module, and a third fusion decoding module to obtain the image segmentation result.

[0099] Specifically, the first and second group decoding modules each include GSA and BI, and the first, second, and third fusion decoding modules each include LDF and BI. After obtaining the corresponding features from each of the five layers of the encoder, these features can be processed through the Prediction Information Fusion module (PIF). The PIF can be understood as a skip connection layer. The skip connection layer and the decoder are two core components in the encoder-decoder architecture, working together to achieve efficient feature transfer and reconstruction. The skip connection layer directly transfers shallow features (such as edges, textures, and other low-level information) from the encoder to the decoder, compensating for the spatial details lost due to downsampling, while also promoting the fusion of multi-scale features.

[0100] The decoder progressively upsamples the abstract features extracted from each layer of the encoder, reconstructs high-resolution feature maps using the detailed information provided by the skip connection layers, and generates the final image segmentation result. Features extracted from each layer of the encoder are fused with the decoder through skip connection operations to prevent the loss of some feature information. PIF (Picture Image Fraction) fuses boundary feature maps with specific weights into the encoder features to aid in detail representation and is the main operation of our skip connections. In the decoder, shallow feature recovery is first performed using the same GSA (Geometric Array Subtraction) and bilinear interpolation (BI), followed by deeper feature image recovery using the same LDF (Latent Rendering). This operation only restores the image of the predicted lesion region.

[0101] Specifically, at least one downsampled feature, attention feature, first pooled feature, and second pooled feature are processed by the fusion module PIF to obtain at least one first connection feature, a second connection feature, a third connection feature, and a fourth connection feature. The first connection feature is the feature output by the fusion module PIF after processing each of the first two layers of the encoder; the second connection feature is the feature output by the fusion module PIF after processing the third layer of the encoder; the third connection feature is the feature output by the fusion module PIF after processing the fourth layer of the encoder; and the fourth connection feature is the feature output by the fusion module PIF after processing the fifth layer of the encoder.

[0102] The fourth connectivity feature is upsampled and its spatial resolution is restored using GSA and bilinear interpolation BI in the first group decoding module, performing shallow feature restoration processing to obtain the first upsampled information. The third connectivity feature and the first upsampled information are then input into GSA and bilinear interpolation BI in the second group decoding module for processing, progressively restoring dimensionality and optimizing feature representation to obtain the second upsampled information. Bilinear interpolation BI is used to progressively upscale the downsampled feature map from the encoder side to the corresponding resolution (counteracting the dimensionality reduction of the down operation), compensating for spatial details for accurate segmentation. The second upsampled information, the second connectivity feature, and the first connectivity feature are then processed by the first fusion decoding module to obtain the corresponding result. Similarly, this result, along with the first connectivity feature, is processed by the second and third fusion decoding modules for deep feature reconstruction to obtain the image segmentation result.

[0103] In the shallow feature recovery process, Global Semantic Association (GSA) is used to enhance global semantic relevance. Leveraging GSA's global attention, the recovered features are integrated with the context, avoiding the loss of overall lesion information while only restoring details. Bilinear Interpolation (BI) is used to perform shallow spatial resolution recovery, completing the feature map size and reverting image spatial details. For the deep feature recovery process, the dynamic feature extraction capability of LDF is utilized to further process the shallow recovered features, mining finer-grained lesion features (such as boundaries and textures) to focus on the lesion region. The high-dimensional abstract features output by the encoder are converted back to a spatial dimension aligned with the input image, outputting an interpretable lesion segmentation map and obtaining the corresponding image segmentation result. The decoder revolves entirely around the lesion segmentation goal, ensuring that feature recovery consistently serves accurate lesion localization, distinguishing it from the encoder's general feature extraction.

[0104] In this embodiment, the amplified features processed by the encoder and fusion module are used to extract dynamic features again in the decoder via LDF or GSA to strengthen global correlation and compensate for possible information loss during upsampling. Furthermore, the features processed by each layer of the decoder correspond to the features at the same level of the encoder. Cross-level feature fusion is achieved through module processing, allowing the segmentation to obtain both global information and capture image details, thereby accurately determining the image segmentation result.

[0105] In one embodiment, this application also provides a method for training an image segmentation model. The method includes: acquiring historical population data, which includes multiple sets of sample skin lesion images, each sample skin lesion image including annotation results and a set of candidate keypoints; preprocessing the set of candidate keypoints to obtain a sample boundary map containing boundary regions; subsequently setting training parameters for an initial image segmentation model; after setting the training parameters, inputting the sample boundary map and sample skin lesion images into the initial image segmentation model to obtain an output result. The annotation results can be manually annotated lesion regions in the sample skin lesion images. Then, a loss function is constructed based on the output result and annotation results. The initial image segmentation model is trained by minimizing the loss function, and the model parameters are updated via backpropagation using optimization algorithms such as stochastic gradient descent. This allows for continuous adjustment of the weights of each module in the initial image segmentation model, improving the segmentation accuracy and generalization ability of the model for skin lesion images during iterative training, thereby obtaining the image segmentation model.

[0106] The initial image segmentation model includes an encoder, a fusion module, and a decoder. The encoder's lightweight dynamic fusion module, local edge guidance module, and attention module (such as GSA or DCSA) collaboratively extract global, local, and key features, and perform channel-spatial attention allocation. These features are then integrated by the initial fusion module and processed by the decoder to obtain the output. When updating model parameters, the parameters of the lightweight dynamic fusion module, local edge guidance module, attention module, or other modules within the model can be updated.

[0107] For example, to better evaluate the image segmentation model provided in this embodiment, two commonly used skin lesion segmentation datasets can be obtained: ISIC2017 and ISIC2018. ISIC2017 contains 2150 skin lesion images, while ISIC2018 contains 2694 skin lesion images. Based on the baseline, the datasets are randomly divided into training and test sets in a 7:3 ratio, and all images are normalized and resized to 256×256. For the training set, image enhancement techniques such as horizontal flipping, vertical flipping, and random rotation are used to enhance the diversity of the samples.

[0108] In this experiment, LDB-Net was implemented based on the PyTorch deep learning architecture and trained on the ISIC2017 and ISIC2018 datasets. The AdamW optimizer was used during training with a learning rate of 0.001, 300 training iterations, and a weight decay of 0.01. To ensure the validity of the comparison, all experimental parameters were kept consistent across trials, and all experiments were performed on an NVIDIA A6000 GPU. Furthermore, the number of parameters and computational complexity were evaluated using Params and GFLOPs, respectively.

[0109] Please see Figure 8 As shown, Figure 8 This diagram illustrates the performance comparison results of different models provided in an embodiment of this application, including scatter plots (a) and (b). These two scatter plots (a) and (b) are used to compare the performance of different skin lesion segmentation models. The horizontal axis represents the number of model parameters (Params(M), in millions), reflecting the lightweight nature of the model; the vertical axis represents segmentation accuracy indicators (such as mIoU, Dice, etc.), measuring the quality of segmentation; the color axis corresponds to the computational cost (GFLOPs), with darker colors indicating greater computational cost. In the figure, "Ours" represents the image segmentation model proposed in this application. Compared with other methods such as LB-UNet and EGE-UNet, it can be seen that "Ours" achieves significantly higher segmentation accuracy and lower computational cost with a much smaller number of parameters than traditional large models (such as UNet) and some lightweight models (such as Mobilenetv3). This overcomes the dilemma of "difficulty in balancing lightweight and high accuracy," verifying the technical advantages of the new framework and modules in resource-constrained scenarios, achieving better skin lesion segmentation with lightweight efficiency, and adapting to mobile and other edge device applications.

[0110] Please see Figure 9 As shown, Figure 9 The diagram illustrates the visualization of various models provided in one embodiment of this application, from left to right: Image, GT, Ours, LB-UNet, EGE-UNet, and MALUNet. Image represents a skin lesion image, such as a mole or rash; GT represents the ground truth label, which can be an manually labeled lesion area (white for lesions, black for normal skin); Ours is the image segmentation model provided in this application; LB-UNet, EGE-UNet, and MALUNet are other models.

[0111] On the ISIC2017 and ISIC2018 datasets, the performance of LDB-Net was compared with that of state-of-the-art lightweight skin lesion segmentation models. The comparison results are shown in Table 1 below (the bolded results represent the best performance):

[0112] Table 1

[0113]

[0114] As shown in Table 1 above, compared with the existing model LDB-Net, the image segmentation model proposed in this application not only shows superior skin lesion segmentation performance, but also shows higher efficiency.

[0115] Table 2 shows the comparison results of the model in this application with other models at ISIC2016. The results are shown in Table 2 below (the bolded results are the best results):

[0116] Table 2

[0117]

[0118] Furthermore, to verify the effectiveness of the proposed modules, ablation experiments were conducted on the ISIC2018 dataset. The baseline model was based on LB-UNet. Table 3 shows the ablation experiments performed on each individual module, including LDF, LEG, and DCSA modules, with the best results indicated in bold.

[0119] Rows 2-4 of Table 3 demonstrate the lightweight and efficient nature of the modules in this application. Compared to the baseline, the image segmentation modules proposed in this application have improvements in all aspects. The combination of the three methods in row 5 shows the best results.

[0120] Table 3

[0121]

[0122] Table 4 shows the ablation experiment results for the two modules. In rows 1 and 2 of Table 4, we can conclude that the dual-branch feature extraction method can extract features better. In rows 3 and 4 of Table 4, we can also conclude that paralleling a Sobel residual can improve the delineation of edge details. The bolded values ​​in the table represent the optimal results. Table 4 can be seen as follows (the bolded values ​​represent the optimal results):

[0123] Table 4

[0124]

[0125] Ablation experiments were conducted for different batch sizes. Table 5 shows the ablation study of the effects of the Sobel operator on the LDF single and double branches and LEG modules. As can be seen from Table 5, the best results are achieved when the batch size is 8. Table 5 can be seen below (the bolded results are the optimal results):

[0126] Table 5

[0127]

[0128] This application focuses on the challenge of skin lesion segmentation in resource-constrained scenarios. Addressing the pain points of variable lesion morphology, the tendency of traditional methods to lose local detail features, and the limited computing resources of edge devices, it innovatively designs a novel network framework and functional modules. Through core components such as the Lightweight Dynamic Fusion Module (LDF), the Local Edge Guidance Module (LEG), and the Group Shuffle Attention Module (GSA), it achieves accurate capture of both the global morphology and local fine structures of skin lesions while significantly reducing the number of model parameters (strictly controlling the parameter count to 16KB) and computational complexity (limiting gigabyte operations per second to 0.05). Compared to existing advanced segmentation methods, this solution not only effectively overcomes the bottleneck of resource constraints, improving segmentation accuracy in a highly efficient and lightweight manner, but also achieves significant performance superiority, becoming the first skin lesion segmentation model that can still guarantee high accuracy under stringent parameter and computational constraints. This facilitates deployment in real-time clinical diagnosis and application scenarios on edge devices such as mobile and portable devices.

[0129] Based on the same inventive concept, this application also provides a medical image segmentation apparatus for implementing the aforementioned medical image segmentation method. The solution provided by this apparatus is similar to the solution described in the above method; therefore, the specific limitations in one or more medical image segmentation apparatus embodiments provided below can be found in the limitations of the medical image segmentation method described above, and will not be repeated here.

[0130] In one exemplary embodiment, such as Figure 10 As shown, a medical image segmentation apparatus is provided, comprising:

[0131] The acquisition module 510 is used to acquire population data to be processed; the population data to be processed includes multiple sets of skin lesion images, each skin lesion image includes a set of candidate key points, and each set of candidate key points is used to characterize the boundary region of the skin lesion image;

[0132] Preprocessing module 520 is used to preprocess each set of candidate key points to obtain a boundary map containing the boundary region;

[0133] The segmentation module 530 is used to process the boundary map and the corresponding skin lesion image through a trained image segmentation model and output the image segmentation result. The image segmentation model includes an encoder, a fusion module, and a decoder. The encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected in sequence. The lightweight dynamic fusion module is used to extract global feature information of the boundary map and the corresponding skin lesion image in parallel. The local edge guidance module is used to extract local detail information of the boundary map and the corresponding skin lesion image. The attention module is used to dynamically adjust the attention weights of each channel dimension and spatial dimension in the model according to the global feature information and the local detail information.

[0134] As an optional implementation, the preprocessing module 520 is specifically used for:

[0135] Calculate the intersection-union ratio (IU / U) of the boundary region and the actual boundary region corresponding to each set of candidate keypoints;

[0136] The crossover-union ratio (CUIR) is used as the fitness function to calculate the fitness score of each candidate keypoint set.

[0137] Based on fitness scores, parental individual data are selected from the population data to be processed;

[0138] By performing probabilistic crossover and mutation operations on the parent generation individual data, the optimal set of key points is obtained;

[0139] The optimal set of key points is converted into a continuous boundary curve, generating a boundary map containing the boundary region.

[0140] As an optional implementation, the segmentation module 530 is specifically used for:

[0141] The boundary map and the corresponding skin lesion image are processed by the first lightweight dynamic fusion module and the downsampling module in the feature extraction module to obtain the downsampled features;

[0142] The downsampled features are processed by the second lightweight dynamic fusion module, the local edge guidance module, and the first attention unit in the first attention module to obtain attention features;

[0143] The attention features are processed by the first grouping shuffling attention unit, the second attention unit, and the first pooling unit in the second attention module to obtain the features after the first pooling.

[0144] The features after the first pooling are processed by the second grouping shuffle attention unit and the second pooling unit in the grouping shuffle attention module to obtain the features after the second pooling.

[0145] The image segmentation result is obtained by processing at least one downsampled feature, attention feature, first pooled feature, and second pooled feature through a fusion module and then through a decoder.

[0146] As an optional implementation, the segmentation module 530 is also used for:

[0147] A dynamic convolutional kernel in a dual-branch structure is used to extract features from the boundary map and the corresponding skin lesion image, obtaining skin boundary features and global skin features. Each branch in the dual-branch structure includes: a pooling layer, a linear layer, an activation function layer, and a conditional convolutional layer connected in sequence. The pooling layer is used to obtain contextual information from the boundary map and the skin lesion image, the linear layer is used to learn the dependencies between channels through nonlinear transformation, the activation function layer is used to generate spatial attention weights based on the dependencies, and the conditional convolutional layer is used to dynamically combine convolutional kernel parameters based on the spatial attention weights to obtain skin boundary features and global skin features.

[0148] The skin boundary features and global skin features in each branch structure are added together to obtain the fused features;

[0149] The fused features are sequentially processed by convolution, normalization, and activation functions to obtain key skin features;

[0150] The key skin features are downsampled using a downsampling module to obtain the downsampled features.

[0151] As an optional implementation, the segmentation module 530 is also used for:

[0152] The downsampled features are processed by the second lightweight dynamic fusion module in the first attention module to obtain skin feature information;

[0153] Skin feature information is processed through a local edge guidance module to obtain local feature information. This module includes: a Sobel convolutional layer, a feature processing layer, a feature fusion layer, a segmentation layer, and a partial convolutional layer. The Sobel convolutional layer performs Sobel convolution on the downsampled features to obtain an edge feature map. The feature processing layer extracts features from the downsampled features to obtain an attention feature map. The feature fusion layer fuses the edge and attention feature maps to obtain a fused feature map. The segmentation layer segments the fused feature map. The partial convolutional layer uses the processed feature map as prior information to selectively compute on the input channels, obtaining the enhanced local feature information after edge guidance.

[0154] The local feature information is processed sequentially through the lightweight channel attention layer and the lightweight spatial attention layer in the first attention unit to obtain the feature after the first spatial attention processing; the lightweight channel attention layer is used to process the local feature information and construct channel attention weights to obtain the feature after the channel attention processing; the lightweight spatial attention layer is used to process the feature after the channel attention processing into a spatial weight map, and then to process the spatial weight map to obtain the feature after the first spatial attention processing.

[0155] The features processed by the first spatial attention are then subjected to dynamic convolution to obtain attention features.

[0156] As an optional implementation, the segmentation module 530 is also used for:

[0157] Attention features are grouped and shuffled through the first group shuffle attention unit to obtain cross-region feature interaction information, and global feature extraction processing is performed on the cross-region feature interaction information to obtain all feature information.

[0158] All feature information is processed through the lightweight channel attention layer and the lightweight spatial attention layer in the second attention unit to obtain the features after the second spatial attention processing;

[0159] The features processed by the second spatial attention are pooled through the first pooling unit to obtain the first pooled features.

[0160] As an optional implementation, the segmentation module 530 is also used for:

[0161] At least one downsampled feature, attention feature, first pooled feature, and second pooled feature are processed by the fusion module to obtain at least one first connection feature, second connection feature, third connection feature, and fourth connection feature;

[0162] The fourth connection feature is processed by the first group decoding module to perform shallow feature recovery processing to obtain the first upsampled information;

[0163] The third connection feature and the first upsampled information are input into the second block decoding module for processing to obtain the second upsampled information.

[0164] Based on the second upsampling information, the second connection feature, and the first connection feature, deep feature reconstruction processing is performed through the first fusion decoding module, the second fusion decoding module, and the third fusion decoding module to obtain the image segmentation result.

[0165] The medical image segmentation device provided in this application acquires multiple sets of skin lesion images to be processed and preprocesses the candidate key point set in the skin lesion images to obtain a boundary map containing the boundary region. This reduces the number of parameters and computational complexity while preserving the key information of the skin lesion images, making the model more adaptable to the computing resources of edge devices such as mobile and portable devices. Furthermore, the boundary map and the corresponding skin lesion images are processed by a trained image segmentation model. Because a lightweight dynamic fusion module (LDF), a local edge guidance module (LEG), and an attention module are set in the image segmentation model, the boundary map and skin lesion images can be extracted in parallel using LDF. Global image features are used, significantly reducing redundant parameters. While maintaining feature extraction capabilities, the number of model parameters is effectively reduced. Furthermore, LEG accurately extracts local detail information, significantly enhancing sensitivity to lesion edges and fine structures. The attention module dynamically adjusts channel and spatial feature weights, enhancing the model's adaptability to complex features. This allows the model to focus more on key features (such as the core channel of the lesion and the spatial location of the lesion area). Feature fusion is performed through the fusion module in the image segmentation model, and the feature dimensions are restored through the decoder, thereby accurately obtaining image segmentation results. This makes it easy to deploy on edge devices such as mobile and portable devices, improving the real-time performance of image segmentation processing.

[0166] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 11 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores video tag processing data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a medical image segmentation method.

[0167] Those skilled in the art will understand that Figure 11The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0168] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0169] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0170] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0171] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0172] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0173] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0174] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0175] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A medical image segmentation method, characterized in that, The medical image segmentation method includes: Acquire population data to be processed; the population data to be processed includes multiple sets of skin lesion images, each skin lesion image includes a set of candidate key points, and each set of candidate key points is used to characterize the boundary region of the skin lesion image; Preprocess each set of candidate key points to obtain a boundary map containing the boundary region; The boundary map and the corresponding skin lesion image are processed by a trained image segmentation model to output the image segmentation result. The image segmentation model includes an encoder, a fusion module, and a decoder. The encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected in sequence. The lightweight dynamic fusion module is used to extract global feature information of the boundary map and the corresponding skin lesion image in parallel. The local edge guidance module is used to extract local detail information of the boundary map and the corresponding skin lesion image. The attention module is used to dynamically adjust the attention weights of each channel dimension and spatial dimension within the model based on the global feature information and the local detail information. The encoder includes at least one feature extraction module, a first attention module, a second attention module, and a group shuffling attention module, which are connected in sequence. The boundary map and the corresponding skin lesion image are processed using a trained image segmentation model to output the image segmentation result, including: The boundary map and the corresponding skin lesion image are processed by the first lightweight dynamic fusion module and the downsampling module in the feature extraction module to obtain the downsampled features; The downsampled features are processed by the second lightweight dynamic fusion module, the local edge guidance module and the first attention unit in the first attention module to obtain attention features; The attention features are processed by the first grouping shuffling attention unit, the second attention unit, and the first pooling unit in the second attention module to obtain the features after the first pooling. The first pooled feature is processed by the second group shuffle attention unit and the second pooling unit in the group shuffle attention module to obtain the second pooled feature; The image segmentation result is obtained by processing at least one downsampled feature, the attention feature, the first pooled feature, and the second pooled feature through the fusion module and then through the decoder.

2. The medical image segmentation method according to claim 1, characterized in that, Each set of candidate key points is preprocessed to obtain a boundary map containing the boundary region, including: Calculate the intersection-union ratio (IU / U) of the boundary region and the actual boundary region corresponding to each set of candidate key points; The crossover-union ratio is used as the fitness function to calculate the fitness score of each candidate keypoint set; Based on the fitness score, parental individual data are selected from the population data to be processed; Probabilistic crossover and mutation operations are performed on the parent individual data to obtain the optimal set of key points; The optimal set of key points is converted into a continuous boundary curve to generate the boundary map containing the boundary region.

3. The medical image segmentation method according to claim 1, characterized in that, The first lightweight dynamic fusion module includes a dual-branch structure; the boundary map and the corresponding skin lesion image are processed by the first lightweight dynamic fusion module and the downsampling module in the feature extraction module to obtain downsampled features, including: A dynamic convolutional kernel in a dual-branch structure is used to extract features from the boundary map and the corresponding skin lesion image to obtain skin boundary features and global skin features. Each branch of the dual-branch structure includes a pooling layer, a linear layer, an activation function layer, and a conditional convolutional layer connected in sequence. The pooling layer is used to obtain contextual information of the boundary map and the skin lesion image. The linear layer is used to learn the dependencies between channels through nonlinear transformation. The activation function layer is used to generate spatial attention weights based on the dependencies. The conditional convolutional layer is used to dynamically combine convolutional kernel parameters based on the spatial attention weights to obtain the skin boundary features and global skin features. The skin boundary features and global skin features in each branch structure are added together to obtain the fused features; The fused features are sequentially processed by convolution, normalization, and activation functions to obtain key skin features; The key skin features are downsampled using the downsampling module to obtain the downsampled features.

4. The medical image segmentation method according to claim 1, characterized in that, The downsampled features are processed by the second lightweight dynamic fusion module, the local edge guidance module, and the first attention unit in the first attention module to obtain attention features, including: The downsampled features are processed by the second lightweight dynamic fusion module in the first attention module to obtain skin feature information; The skin feature information is processed by the local edge guidance module to obtain local feature information. The local edge guidance module includes: a Sobel convolutional layer, a feature processing layer, a feature fusion layer, a segmentation layer, and a partial convolutional layer. The Sobel convolutional layer is used to perform Sobel convolution on the downsampled features to obtain an edge feature map. The feature processing layer is used to extract features from the downsampled features to obtain an attention feature map. The feature fusion layer is used to fuse the edge feature map and the attention feature map to obtain a fused feature map. The segmentation layer is used to segment the fused feature map. The partial convolutional layer uses the processed feature map as prior information to selectively calculate the input channels to obtain the edge-guided enhanced local feature information. The local feature information is processed sequentially through the lightweight channel attention layer and the lightweight spatial attention layer in the first attention unit to obtain the feature after first spatial attention processing; the lightweight channel attention layer is used to process the local feature information to construct channel attention weights to obtain the feature after channel attention processing; the lightweight spatial attention layer is used to process the feature after channel attention processing into a spatial weight map, and then process the spatial weight map to obtain the feature after first spatial attention processing. The features processed by the first spatial attention are subjected to dynamic convolution to obtain the attention features.

5. The medical image segmentation method according to claim 1, characterized in that, The attention features are processed by the first grouping shuffling attention unit, the second attention unit, and the first pooling unit in the second attention module to obtain the features after the first pooling, including: The attention features are grouped and shuffled by the first grouping shuffling attention unit to obtain cross-region feature interaction information, and global feature extraction processing is performed on the cross-region feature interaction information to obtain all feature information. All the feature information is processed through the lightweight channel attention layer and the lightweight spatial attention layer in the second attention unit to obtain the features after the second spatial attention processing; The features processed by the second spatial attention are pooled through the first pooling unit to obtain the first pooled features.

6. The medical image segmentation method according to claim 1, characterized in that, The decoder includes: a first block decoding module, a second block decoding module, a first fusion decoding module, a second fusion decoding unit, and a third fusion decoding module connected in sequence; The image segmentation result is obtained by processing at least one downsampled feature, the attention feature, the first pooled feature, and the second pooled feature through a fusion module and then through a decoder, including: The at least one downsampled feature, the attention feature, the first pooled feature, and the second pooled feature are processed by the fusion module to obtain at least one first connection feature, a second connection feature, a third connection feature, and a fourth connection feature; The fourth connection feature is processed by the first group decoding module to perform shallow feature recovery processing to obtain the first upsampled information; The third connection feature and the first upsampled information are input into the second block decoding module for processing to obtain the second upsampled information; Based on the second upsampling information, the second connection feature, and the first connection feature, deep feature reconstruction processing is performed through the first fusion decoding module, the second fusion decoding module, and the third fusion decoding module to obtain the image segmentation result.

7. A medical image segmentation device, characterized in that, The medical image segmentation device includes: The acquisition module is used to acquire population data to be processed; the population data to be processed includes multiple sets of skin lesion images, each skin lesion image includes a set of candidate key points, and each set of candidate key points is used to characterize the boundary region of the skin lesion image; The preprocessing module is used to preprocess each set of candidate key points to obtain a boundary map containing the boundary region; A segmentation module is used to process the boundary map and the corresponding skin lesion image through a trained image segmentation model and output the image segmentation result. The image segmentation model includes an encoder, a fusion module, and a decoder. The encoder includes a lightweight dynamic fusion module, a local edge guidance module, and an attention module connected in sequence. The lightweight dynamic fusion module is used to extract global feature information of the boundary map and the corresponding skin lesion image in parallel. The local edge guidance module is used to extract local detail information of the boundary map and the corresponding skin lesion image. The attention module is used to dynamically adjust the attention weights of each channel dimension and spatial dimension within the model based on the global feature information and the local detail information. The encoder includes at least one feature extraction module, a first attention module, a second attention module, and a group shuffling attention module, which are connected in sequence. The segmentation module is specifically used for: The boundary map and the corresponding skin lesion image are processed by the first lightweight dynamic fusion module and the downsampling module in the feature extraction module to obtain the downsampled features; The downsampled features are processed by the second lightweight dynamic fusion module, the local edge guidance module and the first attention unit in the first attention module to obtain attention features; The attention features are processed by the first grouping shuffling attention unit, the second attention unit, and the first pooling unit in the second attention module to obtain the features after the first pooling. The first pooled feature is processed by the second group shuffle attention unit and the second pooling unit in the group shuffle attention module to obtain the second pooled feature; The image segmentation result is obtained by processing at least one downsampled feature, the attention feature, the first pooled feature, and the second pooled feature through the fusion module and then through the decoder.

8. A computer device, comprising: The memory and processor contain a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the medical image segmentation method according to any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the medical image segmentation method according to any one of claims 1-6.