Medical image edge detection method based on structural consistency modeling mechanism

An edge detection method based on a structural consistency modeling mechanism, utilizing the Unet encoder and structural saliency graph construction module, solves the accuracy problem of medical image edge detection under complex geometric deformation, achieving improved topological stability and edge detection accuracy in complex deformation scenarios.

CN121582282APending Publication Date: 2026-02-27HUNAN INST OF INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511799910.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing medical image edge detection methods lack synergistic constraints on structural consistency and topological stability when faced with complex geometric deformations, resulting in low edge detection accuracy.

Method used

An edge detection method based on structural consistency modeling mechanism is adopted. Through the Unet encoder, structural saliency map construction module, feature compression module and structural reconstruction and jump fusion module, a loss function is constructed by combining learnable local affine perturbation and structural alignment to improve the topological stability of the model in complex deformation scenarios.

Benefits of technology

It effectively overcomes the impact of non-rigid deformations such as rotation and affine stretching on edge prediction results, improves the topological stability and accuracy of the edge detection model in complex deformation scenarios, and ensures that the edge prediction details have detail clarity and structural consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582282A_ABST
    Figure CN121582282A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of medical image analysis, and provides a medical image edge detection method based on a structural consistency modeling mechanism, and the method comprises the steps: obtaining a to-be-detected medical image; image edge detection is carried out on a to-be-detected medical image by using the trained edge detection model to obtain an edge image of the to-be-detected medical image, and a loss function in the training process of the edge detection model is constructed based on learnable local affine disturbance and structure alignment; the edge detection model comprises a Unet encoder, a structure saliency map construction module, a feature compression module, a structure reconstruction and jump fusion module based on structure consistency guidance, and a Unet decoder. According to the invention, the cooperative constraint of the structure consistency and the topological stability can be realized, and the medical image edge detection accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of medical image analysis, and particularly relates to a medical image edge detection method based on a structure consistency modeling mechanism. BACKGROUND

[0002] With the wide application of deep learning technology, the medical image structured modeling method based on convolutional neural network (CNN) has become the mainstream. Among them, U-Net as a typical encoder-decoder structure, through the feature down-sampling and up-sampling process and the skip connection mechanism, effectively fuses the shallow spatial details and deep semantic information, realizes the end-to-end pixel-level prediction. This structure has shown high precision and robustness in retinal blood vessel segmentation, lesion area detection and other tasks. However, the convolution kernel of the original U-Net has a fixed receptive field, lacks the adaptive ability to geometric deformation, and when facing the complex scenes such as the bending of blood vessels in the fundus image and the non-rigid deformation of the lesion area, the edge response is easy to be blurred and the structure is easy to be misplaced.

[0003] On this basis, the Holistically-Nested Edge Detection (HED) model introduces a multi-scale deep supervision mechanism, so that edge detection can perform feature fusion at different semantic levels, thereby improving the detection accuracy and convergence stability. The EGNet model (EGNet model is a convolutional neural network for salient object detection) further introduces an edge guiding module and a saliency fusion mechanism in the encoding-decoding framework, by modeling the edge structure and salient region at the same time, the edge continuity and overall consistency of complex tissue structure are improved. However, these methods still have certain limitations when dealing with deformation in medical images (such as geometric distortion of retinal imaging, local magnification, illumination change, etc.). At the same time, the medical image data annotation cost is high, the sample size is limited, and the existing deep edge detection model generally relies on large-scale labeled samples to learn stable edge features, so the detection performance obviously decreases under the condition of small sample, which shows the problems of edge fracture, false response and discontinuous blood vessel topology.

[0004] To cope with the target deformation problem, a deep cross network (DCN, Deformable Convolutional Networks) proposes the idea of adjusting the convolution sampling position through a learnable offset, thereby enhancing the model's ability to model deformation. The transformer model (Transformer) architecture is also introduced into medical image tasks due to its global dependency modeling characteristics, to capture cross-regional semantic correlation. However, these methods, although they have improved representation ability, lack explicit modeling mechanisms for structural consistency and topological stability. When the input image is rotated, affinely or light disturbed, the geometric coherence of the edge structure is still difficult to guarantee.

[0005] In summary, although the existing technology has made significant progress in the field of medical image edge detection, it lacks a coordinated constraint on structural consistency and topological stability when dealing with images with complex geometric deformations such as retinal images and lesion areas, resulting in low edge detection accuracy. SUMMARY

[0006] The embodiments of the present application provide a medical image edge detection method based on a structural consistency modeling mechanism, which can solve the problem of low accuracy of medical image edge detection.

[0007] The embodiments of the present application provide a medical image edge detection method based on a structural consistency modeling mechanism, which can solve the problem of low accuracy of medical image edge detection.

[0008] Obtaining a medical image to be detected;

[0009] Using the trained edge detection model to perform image edge detection on the medical image to be detected to obtain an edge map of the medical image to be detected; the loss function in the training process of the edge detection model is constructed based on a learnable local affine disturbance and structure alignment;

[0010] The edge detection model comprises: a Unet encoder, a structure saliency map construction module, a feature compression module, a structure reconstruction and jump fusion module based on structure consistency guidance, and a Unet decoder.

[0011] The Unet encoder extracts shallow feature maps from the medical image to be detected. The structure saliency map construction module constructs a structure saliency map based on the shallow feature maps. The feature compression module defines a structure-aware compressed feature map based on the structure saliency map. The structure reconstruction and skip fusion module reconstructs the structure from the structure-aware compressed feature map and fuses the reconstructed feature map with the shallow feature map to obtain the final structure-enhanced feature map. The Unet decoder processes the final structure-enhanced feature map and outputs the edge map of the medical image to be detected. The structure saliency map measures the structure centrality of each pixel in the shallow feature map. The structure-aware compressed feature map is used to reweight the shallow feature map using the structure saliency map to compress features based on structure dominance.

[0012] Optionally, the structural saliency graph construction module is specifically used to perform the following steps:

[0013] Construct a structural saliency map using the following formula:

[0014] ;

[0015] in, Represents the first layer in the shallow feature map. The salience of each pixel, and The first in the structural saliency graph 1 pixel , Represents the first layer in the shallow feature map. The pixel and the The adjacency relationship between pixels. This indicates the number of pixels in the shallow feature map;

[0016] ;

[0017] Represents the first layer in the shallow feature map. The feature vector of each pixel in the channel dimension The first layer of shallow feature map The feature vector of each pixel in the channel dimension This represents the Gaussian kernel scaling function.

[0018] Optionally, the feature compression module is specifically used to perform the following steps:

[0019] The structure-aware compressed feature map is defined by the following formula. :

[0020] ;

[0021] ;

[0022] in, express The structure guides the weights.

[0023] Optionally, the structure reconstruction and jump fusion module is specifically used to perform the following steps:

[0024] The structure-aware compressed feature map is reconstructed using the following formula, and the reconstructed feature map is then fused with the shallow feature map to obtain the final structure-enhanced feature map:

[0025] ;

[0026] in, This represents the final structure-enhanced feature map. This indicates convolutional layer processing. Indicates an upsampling operation. This represents the feature map obtained from structural reconstruction. This represents a shallow feature map. .

[0027] Optionally, the loss function during the training process of the edge detection model is:

[0028] ;

[0029] in, This represents the value of the loss function. This represents the value of the basic edge detection loss. and All represent preset balance weights. This represents the value of the loss due to the structural sparsity regularization term. The value representing the structural consistency loss. This represents the value of the topology consistency loss.

[0030] Optionally, the value of the basic edge detection loss is calculated using the binary cross-entropy loss function.

[0031] Optionally, the formula for calculating the value of the structural sparsity regularization term loss is as follows:

[0032] ;

[0033] in, This represents the total number of channels in the edge map output by the edge detection model after processing the training image samples. This indicates that the edge map output by the edge detection model after processing the training image samples is at the 1st... Feature map of each channel express Norm.

[0034] Optionally, the formula for calculating the structural consistency loss is as follows:

[0035] ;

[0036] in, Indicates the training image sample at the th Predicted edge probabilities at pixel locations This indicates that the training image sample, after being subjected to affine perturbation, is at the th... Predicted edge probabilities at pixel locations This represents the total number of pixels in the shallow feature map of the training image sample.

[0037] Optionally, the formula for calculating the topology consistency loss is as follows:

[0038] ;

[0039] ;

[0040] ;

[0041] in, The preset scale represents the soft topological barcode function; This represents the soft topological barcode function value corresponding to the training image sample; This represents the soft topological barcode function value corresponding to the training image sample after affine perturbation; This represents the number of topological events obtained after topological encoding of the edge map, which is the output of the edge detection model after processing training image samples; Indicates the smoothing coefficient; The edge graph obtained after topological encoding is represented as the first... The birth scale of each topological event; this edge map is the output of the edge detection model after processing training image samples. The edge graph obtained after topological encoding is represented as the first... The death scale of a topological event, which is the output of the edge map edge detection model after processing training image samples; This indicates the number of topological events obtained after topological encoding of the edge map, which is the output of the edge detection model after processing the training image samples after affine perturbation. The edge graph obtained after topological encoding is represented as the first... The birth scale of a topological event, the edge map is the output of the edge detection model after processing the training image samples after affine perturbation; The edge graph obtained after topological encoding is represented as the first... The death scale of a topological event, the edge map is the output of the edge detection model after processing the training image samples after affine perturbation.

[0042] Optionally, medical image edge detection methods also include:

[0043] The final structure-enhanced feature map of the training image samples is obtained using an edge detection model. Then, the final structure feature map is enhanced using the following formula. Affine perturbation is performed to obtain the final structure-enhanced feature map after affine perturbation. :

[0044] ;

[0045]

[0046] in, Let denote the affine transformation matrix, and For the first Learnable parameters of each local unit, , Represents the final structure-enhanced feature map medium pixel x-coordinate Represents the final structure-enhanced feature map medium pixel The vertical coordinate of the pixel. To utilize For pixels The transformed pixels;

[0047] The edge detection model's processing of training image samples after affine perturbation refers to using the Unet decoder of the edge detection model to enhance the final structural feature map after affine perturbation. Process it.

[0048] The above-mentioned solution in this application has the following beneficial effects:

[0049] In the embodiments of this application, during the training process of the edge detection model, a loss function is constructed based on learnable local affine perturbations and structural alignment. This enables the trained edge detection model to effectively overcome the drift or breakage effects of non-rigid deformations such as rotation and affine stretching on the edge prediction results when performing image edge detection on medical images, thereby improving the topological stability of the edge detection model in complex deformation scenarios. Simultaneously, during the feature extraction stage, the edge detection model constructs a structural saliency map based on shallow feature maps and introduces a compression and fusion mechanism guided by the structural saliency map. This allows the edge detection model to effectively extract local structural saliency, achieving a unified expression from shallow edges to high-level abstract structures, ensuring that edge prediction details possess both detail clarity and structural consistency. Therefore, the collaborative optimization framework of this application, consisting of a saliency-guided structural compression mechanism, learnable local affine perturbations, and structural alignment, can achieve synergistic constraints on structural consistency and topological stability, improving the accuracy of medical image edge detection.

[0050] Other beneficial effects of this application will be described in detail in the following detailed description section. Attached Figure Description

[0051] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art 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.

[0052] Figure 1 A flowchart of a medical image edge detection method based on structural consistency modeling mechanism provided in an embodiment of this application;

[0053] Figure 2 This is a schematic diagram of a local affine transformation in an experiment of this application. Detailed Implementation

[0054] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0055] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0056] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0057] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0058] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0059] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0060] To address the issue of low accuracy in current edge detection methods, this application provides a medical image edge detection method based on a structural consistency modeling mechanism. During the training process of the edge detection model, this method constructs a loss function based on learnable local affine perturbations and structural alignment. This allows the trained edge detection model to effectively overcome the drift or breakage effects of non-rigid deformations such as rotation and affine stretching on the edge prediction results when performing edge detection on medical images, thus improving the topological stability of the edge detection model in complex deformation scenarios. Simultaneously, in the feature extraction stage, the edge detection model constructs a structural saliency map based on shallow feature maps and introduces a compression and fusion mechanism guided by the structural saliency map. This enables the edge detection model to effectively extract local structural saliency, achieving a unified expression from shallow edges to high-level abstract structures, ensuring that edge prediction details possess both detail clarity and structural consistency. Therefore, the collaborative optimization framework of this application, consisting of a saliency-guided structural compression mechanism, learnable local affine perturbations, and structural alignment, can achieve synergistic constraints on structural consistency and topological stability, improving the accuracy of medical image edge detection.

[0061] The medical image edge detection method based on structural consistency modeling mechanism provided in this application will be illustrated below with specific embodiments.

[0062] like Figure 1 As shown, the medical image edge detection method based on structural consistency modeling mechanism provided in this application includes the following steps:

[0063] Step 11: Obtain the medical image to be detected.

[0064] The aforementioned medical image to be detected is a medical image requiring edge detection. This medical image can be specifically acquired using medical equipment. It is understood that the medical image to be detected can be obtained from medical equipment during edge detection. For example, the aforementioned medical image to be detected can be a retinal color image, which can be specifically acquired using medical equipment such as a fundus camera or a digital fundus angiography system. During edge detection, this retinal color image can be obtained from these medical devices.

[0065] Step 12: Use the trained edge detection model to perform image edge detection on the medical image to be detected, and obtain the edge map of the medical image to be detected; the loss function in the training process of the edge detection model is constructed based on learnable local affine perturbation and structural alignment.

[0066] The aforementioned edge detection model includes: a Unet encoder, a structural saliency map construction module, a feature compression module, a structural reconstruction and jump fusion module guided by structural consistency, and a Unet decoder.

[0067] The Unet encoder is used to extract shallow feature maps from the medical image to be detected. The structure saliency map construction module is used to construct a structure saliency map based on the shallow feature maps. The feature compression module is used to define a structure-aware compressed feature map based on the structure saliency map. The structure reconstruction and skip fusion module is used to reconstruct the structure of the structure-aware compressed feature map and fuse the feature map obtained from the structure reconstruction with the shallow feature map to obtain the final structure-enhanced feature map. The Unet decoder is used to process the final structure-enhanced feature map and output the edge map of the medical image to be detected.

[0068] The structural saliency map is used to measure the structural centrality of each pixel in the shallow feature map, and the structure-aware compressed feature map is used to reweight the shallow feature map using the structural saliency map in order to compress features based on structural dominance.

[0069] The following provides an exemplary description of how each part of the edge detection model processes the input data.

[0070] In some embodiments of this application, after the medical image to be detected is input into the Unet encoder, the Unet encoder extracts features from it and outputs a shallow feature map. This shallow feature map contains both edge texture and structural semantics, providing a basic representation for subsequent structural saliency modeling. For ease of description, the shallow feature map is referred to as... , , Shallow feature map The number of channels, These are shallow feature maps. Height and width, , The specific value is determined according to the Unet encoder type. In order to preserve rich texture and edge information, shallow features in the range of layers 1-3 are usually selected.

[0071] To facilitate subsequent module processing, after obtaining the shallow feature map Then, the shallow feature map can be... Flattened into a set of vectors , , Represents the first layer in the shallow feature map. The feature vector of each pixel in the channel dimension This indicates the number of pixels in the shallow feature map. .

[0072] Based on this, the first layer of shallow feature maps can be constructed. The pixel and the The adjacency relationship between pixels , , , Adjacency It reflects the structural similarity between pixel pairs. It generates adjacency weights by combining the Euclidean distance between pixel features with Gaussian kernel mapping, which reflects the connection strength of pixels in the structural space and provides a basis for the calculation of the structural saliency map.

[0073] ;

[0074] Represents the first layer in the shallow feature map. The feature vector of each pixel in the channel dimension; The first layer of shallow feature map The feature vector of each pixel in the channel dimension; This represents the Gaussian kernel scaling function, used to control the influence of feature differences on adjacency strength.

[0075] In some embodiments of this application, the above-described structural saliency map construction module is specifically used to perform the following steps:

[0076] Construct a structural saliency map using the following formula:

[0077] ;

[0078] in, Represents the first layer in the shallow feature map. The salience of each pixel, and Structural saliency plot The first in 1 pixel , Represents the first layer in the shallow feature map. The pixel and the The adjacency relationship between pixels. This indicates the number of pixels in the shallow feature map. That is, the saliency of each pixel is determined by the sum of its structural similarity to its neighboring pixels, and is used to measure the structural centrality of that pixel. (Structural saliency map) Calculated based on adjacency relationships, the structural saliency map measures the importance of each pixel within the global structure. It highlights regions with coherent edges, providing guidance for attention weight allocation.

[0079] In some embodiments of this application, the feature compression module described above is specifically used to perform the following steps:

[0080] The structure-aware compressed feature map is defined by the following formula. :

[0081] ;

[0082] ;

[0083] In the above formula, express The structure guides the weights.

[0084] The structure-guided weights are obtained by normalizing the structure saliency map and reflect the relative importance of each pixel in the structure space. These weights are used to weight and focus features, thereby suppressing unstructured regions and enhancing key edge features.

[0085] It is worth mentioning that the structural saliency map is normalized and used as channel attention guide, so that the compression operation can effectively preserve the representation ability of structurally salient regions and form a bottleneck-type compressed representation in the channel dimension. This helps to suppress redundant background features in small sample environments and focus on salient edge structures.

[0086] In some embodiments of this application, the above-mentioned structural reconstruction and skip fusion module guided by structural consistency is specifically used to perform the following steps:

[0087] The structure-aware compressed feature map is reconstructed using the following formula, and the reconstructed feature map is then fused with the shallow feature map to obtain the final structure-enhanced feature map:

[0088] ;

[0089] in, This represents the final structure-enhanced feature map. This indicates convolutional layer processing. Indicates an upsampling operation. The feature map obtained from structural reconstruction is called the structure-aware compressed feature map. The original resolution is restored through upsampling and convolution operations. This represents a shallow feature map. , This indicates multiple operations, multiple upsampling, and repeated calculations according to this formula.

[0090] It is worth mentioning that the skip connections in the structure reconstruction and skip fusion module fuse local details with abstract structural representations, improving the continuity of structural information and the ability to preserve details. The final structure-focused representation obtained by attention-weighting and feature compression of the structure-enhanced feature map retains significant edge information and removes background redundancy. This feature is both structurally sensitive and maintains high reconstructability.

[0091] In some embodiments of this application, the Unet decoder described above is mainly used to upsample and fuse the final structure enhancement feature map to output the edge map of the medical image to be detected.

[0092] It should be noted that the edge detection model described above can be trained using common training methods, such as gradient descent. The difference lies in the fact that the loss function in this application is constructed based on the basic edge detection loss, structural sparsity regularization, and structural consistency loss.

[0093] The following provides an example of the loss function used in the training process of an edge detection model.

[0094] In some embodiments of this application, the loss function during the training process of the edge detection model is:

[0095] ;

[0096] in, This represents the value of the loss function. This represents the value of the basic edge detection loss. and All represent preset balance weights. This represents the value of the loss due to the structural sparsity regularization term. The value representing the structural consistency loss. This represents the value of the topology consistency loss.

[0097] In some embodiments of this application, the value of the basic edge detection loss is calculated using a binary cross-entropy loss function. Specifically, the binary cross-entropy loss function can be used to calculate the predicted output before perturbation. (That is, the edge map output by using an edge detection model to perform image edge detection on training image samples) and the true edge map. (i.e., supervised learning using the true edge maps of the training image samples)

[0098] ;

[0099] in, This represents the number of pixels in the shallow feature map of a training image sample (which can be a medical image, such as a retinal color image with a known true edge map). The shallow feature map representing the training image sample is the first... The true edge label of each pixel, The shallow feature map representing the training image sample is the first... The edge prediction value of each pixel, and for The first in Each pixel.

[0100] In some embodiments of this application, the formula for calculating the value of the above-mentioned structural sparsity regularization term loss is as follows:

[0101] ;

[0102] in, This represents the total number of channels in the edge map output by the edge detection model after processing the training image samples. , This indicates that the edge map output by the edge detection model after processing the training image samples is at the 1st... Feature map of each channel express Norm.

[0103] It is worth mentioning that the structural sparsity regularization loss can guide the model to focus on highly significant regions and suppress spurious edge responses.

[0104] In some embodiments of this application, the formula for calculating the value of the above-mentioned structural consistency loss is as follows:

[0105] ;

[0106] in, Indicates the training image sample at the th The predicted edge probability at the nth pixel position (i.e., the nth pixel in the shallow feature map of the training image samples). (edge ​​prediction value of each pixel) This indicates that the training image sample, after being subjected to affine perturbation, is at the th... Predicted edge probabilities at pixel locations This represents the total number of pixels in the shallow feature map of the training image sample.

[0107] It should be noted that, for The first in 1 pixel This refers to the perturbed feature map (i.e., the final structure enhancement feature map after affine perturbation) The final structure-enhanced feature map obtained after affine perturbation, obtained by processing the input into the Unet decoder. It is obtained by perturbing the final structure enhancement feature map of the training image samples.

[0108] In some embodiments of this application, a learnable local affine perturbation module may be introduced to generate structural perturbation feature pairs, thereby constructing a consistency constraint mechanism during training. For ease of description, the final structural enhancement feature map of the training image samples is denoted as... , The final structure-enhanced feature map of the training image samples is obtained using an edge detection model. Then, the final structural enhancement feature map of the training image samples. The middle position is pixels The pixel points are obtained using the following formula. Transformed pixels :

[0109] ;

[0110] ;

[0111] ;

[0112] in, Let denote the affine transformation matrix, and For the first Learnable parameters of each local unit, , Represents the final structure-enhanced feature map medium pixel x-coordinate Represents the final structure-enhanced feature map medium pixel The vertical coordinate of the pixel. To utilize For pixels The transformed pixels, Represents pixels x-coordinate Represents pixels The ordinate. By combining all local units, continuous local affine deformation of the entire image can be achieved.

[0113] Final structure enhancement feature map after perturbation Through the Transformed coordinates The feature map is obtained by bilinear interpolation sampling. Specifically, the final structure-enhanced feature map is obtained using the following formula. Affine perturbation is performed to obtain the final structure-enhanced feature map after affine perturbation. :

[0114] .

[0115] It should be noted that in edge prediction maps, "topology" refers to all connected regions formed by foreground edge pixels and the hierarchical relationships they create. Specifically, the edge map can be viewed as a 2D binary topological space, whose topology consists of three basic elements: first, the connected components of the foreground edge pixels, which are sets of pixels connected to each other by 4-connectivity or 8-connectivity, each set corresponding to one or a set of continuous boundaries; second, the void structures enclosed by closed boundaries, which are essentially "topological loops" within the connected components, used to characterize holes or internal depressions within the region; and third, the relative hierarchical relationships between connected components, i.e., the nested structures formed by the outer contour wrapping the inner contour. These topological structures collectively determine the global geometry of the edge map, and their changes directly reflect changes in the target shape, boundary connectivity, and the number of voids.

[0116] To measure the geometrical changes in edge predictions before and after perturbation, this application introduces a continuously differentiable topological description function—the soft topological barcode function. This approximates the occurrence and disappearance of topological events (such as connected components and holes) in persistent cohomology. The function is applied to the prediction results before and after perturbation as an abstract representation of the deformation-sensitive structure, and further used for subsequent structural alignment constraints.

[0117] Based on this, in order to maintain the consistency of the above topological properties before and after deformation perturbation, this application improves the edge prediction map. (i.e., the output of the edge detection model) Apply different scales Gaussian smoothing yields scale-space... and in scale sequence The topological events are tracked as the smoothness changes. When a connected component changes at a certain scale... When it first appears independently from the background noise (e.g., after noise points are smoothed out, the small region truly becomes a distinguishable structure), then... Defined as the birth scale of this topology; when the structure is at the scale If it disappears completely due to smoothing or merges with other structures, then... Its death scale. From this, the set of topological events before and after the perturbation can be obtained. and .

[0118] Specifically, the formula for calculating the value of the topology consistency loss is as follows:

[0119] ;

[0120] ;

[0121] ;

[0122] in, The preset scale represents the soft topological barcode function, used to scan the existence of topological events (connected components or holes) at different scales; This represents the soft topological barcode function value corresponding to the training image sample; This represents the soft topological barcode function value corresponding to the training image sample after affine perturbation; This represents the number of topological events obtained after topological encoding of the edge map, which is the output of the edge detection model after processing training image samples; This represents the smoothing coefficient, used to control the scale response width of topological events, ensuring that the soft topological barcode function is continuously differentiable with respect to input edge features. It can be set according to the actual situation, for example, to 0.02. The edge graph obtained after topological encoding is represented as the first... The birth scale of each topological event; this edge map is the output of the edge detection model after processing training image samples. The edge graph obtained after topological encoding is represented as the first... The death scale of a topological event, which is the output of the edge map edge detection model after processing training image samples; This indicates the number of topological events obtained after topological encoding of the edge map, which is the output of the edge detection model after processing the training image samples after affine perturbation. The edge graph obtained after topological encoding is represented as the first... The birth scale of a topological event, the edge map is the output of the edge detection model after processing the training image samples after affine perturbation; The edge graph obtained after topological encoding is represented as the first... The death scale of a topological event, the edge map is the output of the edge detection model after processing the training image samples after affine perturbation.

[0123] The aforementioned edge detection model processes the affine perturbation-perturbed training image samples by using the Unet decoder of the edge detection model to enhance the final structural feature map after affine perturbation. Processing is performed. The Unet decoder of the edge detection model is used to enhance the feature map of the final structure after affine perturbation. The edge graph output after processing is denoted as The final structure-enhanced feature maps before and after the perturbation are used as common inputs and share a decoding path during training for learning structure consistency constraints, thereby improving training performance.

[0124] It is worth mentioning that the topology consistency loss constrains the preservation of the topology of the prediction results before and after the perturbation in a functional distance manner, thereby enhancing the model's structural robustness to image geometric transformations.

[0125] In summary, this application aims to improve the model's ability to represent structural information and its stability under geometric perturbations by introducing a structural contrast mechanism during the training phase, and constructing a joint optimization objective function accordingly. This mechanism introduces a learnable local affine perturbation into the compressed structural representation, and then passes the images before and after the perturbation through a shared-parameter backbone network to obtain the predicted output pair. Topological and pixel-level consistency constraints are applied to the structural control sample pairs to form a complete loss system. These losses work together on the multi-scale decoding output, achieving synergistic optimization from three levels: saliency compression, perturbation alignment, and basic recognition, effectively alleviating overfitting, edge breakage, and structural drift problems under small sample conditions.

[0126] The method of this application will be illustrated below with specific experimental data.

[0127] In this experiment, the publicly available (DRIVE, Digital Retinal Images for Vessel Extraction) dataset was selected as the experimental subject. This dataset contains 20 color retinal images and corresponding blood vessel annotations, each image with a resolution of 565×584 pixels. In the experiment, 15 images were selected from the training set as training samples, and the remaining 5 images were used as the first test sample set. To simulate the robustness of geometric transformations to the model's structural consistency, as shown in Figure 2, the first test sample set was further subjected to local affine deformation to generate the second sample set. Figure 2 In the image, (a) is the original image of the first test sample set, (b) is the image of the second sample set, (c) is the edge image corresponding to the original image, and (d) is the edge image corresponding to the image of the second sample set.

[0128] The backbone network used in the experiment was UNet, and tests were conducted to compare the ordinary UNet with the UNet with embedded structural consistency modeling module (i.e. the edge detection model of this application).

[0129] To comprehensively evaluate the model's performance in the vascular structure detection task, this experiment used the following metrics:

[0130] Pixel-level metrics: Accuracy (ACC), Sensitivity (SE), and Specificity (SP) are used to evaluate the pixel-level matching degree between the prediction results and the ground truth.

[0131] Structural consistency metric: The topological consistency loss is calculated using a continuously differentiable soft topological barcode function. By comparing predicted angiography with ground truth (GT) at different thresholds... The changes in topological events under (100 equally spaced discrete points) are used to quantitatively measure vascular connectivity and topological stability.

[0132] Experimental parameter settings:

[0133] Gradient optimizer: Adam, learning rate 1e-4;

[0134] Batch size: 2;

[0135] Training epochs: 150;

[0136] The threshold parameter t of the barcode function is set to Given 100 equally spaced discrete points, the value of the k-th point... for:

[0137] ;

[0138] Smoothing coefficient Set it to 0.02.

[0139] Table 1. Experimental results of the two methods on the first test sample set.

[0140]

[0141] Table 2 shows the experimental results of the two methods in the second test sample set.

[0142]

[0143] The experimental results show that the edge detection model of this application exhibits improved performance on both test sample sets. As shown in Table 1, on the first test sample set, the edge detection model of this application shows a slight improvement in ACC, SE, and SP compared to the ordinary UNet, while the topology consistency loss is significantly reduced, indicating that this module enhances structural stability while maintaining the original prediction accuracy. As shown in Table 2, on the second test sample set, the edge detection model of this application shows even more significant improvements in ACC and SE, a slight improvement in SP, and a further reduction in topology consistency loss, fully demonstrating that the edge detection model of this application can significantly enhance the model's ability to capture vascular structures and improve topology consistency even under complex sample conditions or sparse vascular structures. Overall, the edge detection model of this application effectively improves the pixel-level prediction performance and structural consistency of the model, showing robust advantages on different test sample sets.

[0144] This method exhibits strong versatility and scalability. Besides retinal vessel segmentation, it is also applicable to other structured edge detection problems, such as organ contour detection in medical imaging, cell edge recognition in microscopic images, or material crack localization in industrial inspection. In these scenarios, the target object typically possesses a well-defined topological structure or continuous edge characteristics. Applying the edge detection model of this application can effectively maintain edge connectivity and topological consistency while ensuring pixel-level prediction accuracy, thereby improving overall structural modeling capabilities and robustness. This characteristic makes the edge detection model of this application not only applicable to specific datasets but also provides a theoretical and practical foundation for a wide range of structured image analysis.

[0145] In summary, the "edge detection model of structural consistency modeling mechanism" proposed in this application achieves a high degree of synergy between structure-aware modeling and deformation robustness constraints, and has the following significant advantages:

[0146] First, this application significantly enhances the model's ability to perceive and represent key structural regions. By constructing a structural graph based on neighborhood feature similarity and introducing a graph-guided bottleneck attention mechanism, the model can effectively extract local structural saliency, achieve channel compression and selective enhancement of shallow features, and maintain a stable response to salient edge regions, especially under conditions of scarce samples, thereby effectively suppressing background noise and false edges.

[0147] Secondly, this application demonstrates superior robustness under image geometric perturbations. The proposed learnable local affine perturbation module, combined with a structure alignment loss design, introduces soft topological consistency constraints while generating deformed image pairs, ensuring that the edge structure before and after perturbation remains consistent in the topological space. This effectively overcomes the drift or breakage effects of non-rigid deformations such as rotation and affine stretching on edge prediction results, thereby improving the stability of the model in complex deformation scenarios.

[0148] Furthermore, this application emphasizes a collaborative optimization mechanism between structural modeling and topological alignment. A consistency modeling module is introduced during the feature extraction stage to integrate multi-level structural and semantic information across scales, achieving a unified expression from shallow edges to high-level abstract structures, ensuring that edge prediction possesses both detail clarity and global consistency. This design effectively solves the problem of balancing structure awareness and global stability in existing methods.

[0149] Finally, this application demonstrates good scalability and training stability. All proposed modules are end-to-end trainable structures, supporting compatible integration with various backbone networks (including CNN and Transformer), exhibiting excellent engineering adaptability and deployment flexibility. The graph structure guidance and topology consistency mechanism not only improves optimization convergence during the training phase but also enhances the model's adaptability to complex image scenes and diverse deformation conditions.

[0150] In summary, this application effectively integrates two major technical approaches—structural saliency modeling and geometric topology constraints—through a unified structural consistency modeling framework. While maintaining the overall network simplicity, it significantly improves edge detection accuracy, deformation robustness, and cross-scenario generalization ability, demonstrating clear technological innovation advantages and broad application and promotion value.

[0151] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles described in this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A medical image edge detection method based on structural consistency modeling mechanism, characterized in that, include: Acquire the medical image to be tested; The trained edge detection model is used to perform image edge detection on the medical image to be detected, and the edge map of the medical image to be detected is obtained. The loss function in the training process of the edge detection model is constructed based on learnable local affine perturbations and structural alignment. The edge detection model includes: a Unet encoder, a structural saliency map construction module, a feature compression module, a structural reconstruction and jump fusion module guided by structural consistency, and a Unet decoder; The Unet encoder is used to extract shallow feature maps from the medical image to be detected. The structure saliency map construction module is used to construct a structure saliency map based on the shallow feature maps. The feature compression module is used to define a structure-aware compressed feature map based on the structure saliency map. The structure reconstruction and skip fusion module is used to reconstruct the structure of the structure-aware compressed feature map and fuse the reconstructed feature map with the shallow feature map to obtain a final structure-enhanced feature map. The Unet decoder is used to process the final structure-enhanced feature map and output the edge map of the medical image to be detected. The structure saliency map is used to measure the structure centrality of each pixel in the shallow feature map. The structure-aware compressed feature map is used to reweight the shallow feature map using the structure saliency map to compress features based on structure dominance.

2. The medical image edge detection method according to claim 1, characterized in that, The structural saliency map construction module is specifically used to perform the following steps: Construct a structural saliency map using the following formula: ; in, Represents the first layer in the shallow feature map. The salience of each pixel, and The first in the structural saliency graph 1 pixel , Represents the first layer in the shallow feature map. The pixel and the The adjacency relationship between pixels. This indicates the number of pixels in the shallow feature map; ; Represents the first layer in the shallow feature map. The feature vector of each pixel in the channel dimension The first layer of shallow feature map The feature vector of each pixel in the channel dimension This represents the Gaussian kernel scaling function.

3. The medical image edge detection method according to claim 2, characterized in that, The feature compression module is specifically used to perform the following steps: The structure-aware compressed feature map is defined by the following formula. : ; ; in, express The structure guides the weights.

4. The medical image edge detection method according to claim 3, characterized in that, The structure reconstruction and jump fusion module is specifically used to perform the following steps: The structure-aware compressed feature map is reconstructed using the following formula, and the reconstructed feature map is fused with the shallow feature map to obtain the final structure-enhanced feature map: ; in, This represents the final structure-enhanced feature map. This indicates convolutional layer processing. Indicates an upsampling operation. This represents the feature map obtained from structural reconstruction. This represents the shallow feature map. .

5. The medical image edge detection method according to claim 1, characterized in that, The loss function during the training process of the edge detection model is: ; in, This represents the value of the loss function. This represents the value of the basic edge detection loss. and All represent preset balance weights. This represents the value of the loss due to the structural sparsity regularization term. The value representing the structural consistency loss. This represents the value of the topology consistency loss.

6. The medical image edge detection method according to claim 5, characterized in that, The value of the basic edge detection loss is calculated using the binary cross-entropy loss function.

7. The medical image edge detection method according to claim 5, characterized in that, The formula for calculating the value of the structural sparsity regularization term loss is as follows: ; in, This represents the total number of channels in the edge map output by the edge detection model after processing the training image samples. This indicates that the edge map output by the edge detection model after processing the training image samples is at the 1st... Feature map of each channel express Norm.

8. The medical image edge detection method according to claim 5, characterized in that, The formula for calculating the structural consistency loss is as follows: ; in, Indicates the training image sample at the th Predicted edge probabilities at pixel locations This indicates that the training image sample, after being subjected to affine perturbation, is at the th... Predicted edge probabilities at pixel locations This represents the total number of pixels in the shallow feature map of the training image sample.

9. The medical image edge detection method according to claim 5, characterized in that, The formula for calculating the topology consistency loss is as follows: ; ; ; in, The preset scale represents the soft topological barcode function; This represents the soft topological barcode function value corresponding to the training image sample; This represents the soft topological barcode function value corresponding to the training image sample after affine perturbation; This represents the number of topological events obtained after topological encoding of the edge map, which is the output of the edge detection model after processing training image samples; Indicates the smoothing coefficient; The edge graph obtained after topological encoding is represented as the first... The birth scale of each topological event; this edge map is the output of the edge detection model after processing training image samples. The edge graph obtained after topological encoding is represented as the first... The death scale of a topological event, which is the output of the edge map edge detection model after processing training image samples; This indicates the number of topological events obtained after topological encoding of the edge map, which is the output of the edge detection model after processing the training image samples after affine perturbation. The edge graph obtained after topological encoding is represented as the first... The birth scale of a topological event, the edge map is the output of the edge detection model after processing the training image samples after affine perturbation; The edge graph obtained after topological encoding is represented as the first... The death scale of a topological event, the edge map is the output of the edge detection model after processing the training image samples after affine perturbation.

10. The medical image edge detection method according to claim 9, characterized in that, The medical image edge detection method further includes: The final structure-enhanced feature map of the training image samples is obtained using an edge detection model. Then, the final structure feature map is enhanced using the following formula. Affine perturbation is performed to obtain the final structure-enhanced feature map after affine perturbation. : ; in, Let denote the affine transformation matrix, and For the first Learnable parameters of each local unit, , Represents the final structure-enhanced feature map medium pixel x-coordinate Represents the final structure-enhanced feature map medium pixel The vertical coordinate of the pixel. To utilize For pixels The transformed pixels; The edge detection model's processing of training image samples after affine perturbation refers to using the Unet decoder of the edge detection model to enhance the final structural feature map after affine perturbation. Process it.