A blood vessel segmentation method and electronic device for fundus images
By optimizing the vascular segmentation model of fundus images in combination with overall cross-entropy loss, vascular skeleton and local loss at the fracture, the problem of vascular fracture and tiny blood vessels in the prior art is solved, and more accurate vascular segmentation and disease diagnosis are achieved.
Patent Information
- Application Number
- CN202111156515.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-09-30
AI Technical Summary
The prior art has problems of vascular rupture and tiny blood vessels in fundus image segmentation, which affects the accuracy of disease diagnosis.
Using machine learning model training method, combining the overall cross entropy loss, local loss on the vascular skeleton and local loss at the fracture, the vascular segmentation model is optimized to reduce the loss of fracture and segmentation of tiny blood vessels through the U-shaped segmentation network and post-processing module.
It improves the accuracy of vascular segmentation, reduces the omission of fractures and tiny blood vessels, and improves the accuracy of disease diagnosis.
Smart Images

Figure CN113920078B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, specifically to the field of image segmentation, and more specifically to a blood vessel segmentation method and electronic equipment for fundus images. Background Art
[0002] At present, age-related eye diseases are increasing year by year, and cataracts, glaucoma, and retinal diseases have become common diseases affecting middle-aged and elderly people in my country.
[0003] The retina is a part of the human body where blood vessels can be observed non-invasively, thereby allowing for the assessment of certain physical conditions and disease risks. In order to analyze a patient's eye disease, it is necessary to obtain a retinal image (fundus image, such as Figure 1 (a) Retinal blood vessels are analyzed based on their appearance. Retinal blood vessel segmentation and the characterization of vascular morphological attributes, such as length, width, tortuosity, and angle, can be used for the diagnosis, screening, treatment, and evaluation of various ophthalmic diseases, such as glaucoma, hypertensive retinal arteriosclerosis, and diabetic fundus arteriosclerosis. Direct observation of fundus images is difficult, so accurately segmenting blood vessels in retinal images is often the first step in many disease analyses.
[0004] In recent years, with the development of artificial intelligence technology, a technology for segmenting blood vessels in fundus images using convolutional neural networks has emerged. By training the convolutional neural network with labeled images of blood vessels and then inputting new fundus images, a blood vessel segmentation map of the fundus image can be obtained (e.g. Figure 1 b). Figure 2 A schematic diagram of a local area of the fundus image ( Figure 2 a) and the segmentation results of the local area using existing technology ( Figure 2 b) As can be seen, the existing vascular segmentation images suffer from severe vascular rupture and difficulty segmenting small vessels. This can affect the accuracy of lesion diagnosis by doctors or classification models that use the vascular segmentation images as input during subsequent analysis. Summary of the Invention
[0005] Therefore, the object of the present invention is to overcome the above-mentioned defects of the prior art and provide a blood vessel segmentation method and electronic device for fundus images.
[0006] The purpose of the present invention is achieved through the following technical solutions:
[0007] According to a first aspect of the present invention, a method for blood vessel segmentation of a fundus image is provided, comprising: inputting the fundus image to be segmented into a machine learning model, the machine learning model including a trained first segmentation model; using the first segmentation model to segment the blood vessels and non-blood vessel pixels in the fundus image to obtain a first segmented image; wherein the model parameters of the first segmentation model are trained based on a total loss calculated based on an overall cross entropy loss, a first local loss on the skeleton of the blood vessel, and a second local loss at a break in the blood vessel.
[0008] In some embodiments of the present invention, the second local loss is a loss calculated for a fracture occurring at a skeleton of a blood vessel and the fracture belonging to an endpoint of a pre-marked skeleton.
[0009] In some embodiments of the present invention, the first segmentation model is trained in the following manner: obtaining training data, the training data including a plurality of fundus images and a first-category label for identifying whether each pixel is a blood vessel and a second-category label for the skeleton of whether each pixel is a blood vessel, corresponding to each fundus image; inputting the fundus image into the first segmentation model, and calculating the total loss based on its output and the corresponding first-category label and second-category label; performing gradient calculation and parameter update on the first segmentation model based on the total loss to obtain a trained first segmentation model.
[0010] In some embodiments of the present invention, the total loss is calculated as follows: in, Represents the overall cross entropy loss, L skeleton represents the first local loss, L break Represents the second local loss, C1 represents the weight corresponding to the first local loss, and C2 represents the weight corresponding to the second local loss.
[0011] In some embodiments of the present invention, the machine learning model also includes a post-processing module and a trained second segmentation model, the model parameters of the second segmentation model are different from the model parameters of the first segmentation model, and the method also includes: using the second segmentation model to segment the blood vessels and non-vascular pixels in the fundus image to obtain a second segmented image; and using the post-processing module to obtain a blood vessel segmentation map based on the first segmented image and the second segmented image.
[0012] In some embodiments of the present invention, the model parameters of the trained second segmentation model are obtained by training only based on the overall cross entropy loss.
[0013] In some embodiments of the present invention, the trained second segmentation model is trained in the following manner: based on the trained first segmentation model, the weights of the first local loss and the second local loss are increased, and the learning rate is reduced, and training is continued. After the training is completed, the trained second segmentation model is obtained.
[0014] In some embodiments of the present invention, the step of obtaining a blood vessel segmentation map based on the first segmented image and the second segmented image by the post-processing module includes: skeletonizing the second segmented image to retain only connected skeletons with an area greater than or equal to a preset size to obtain a skeleton image of the blood vessel; and dilating the skeleton image of the blood vessel and fusing it with the first segmented image to obtain the blood vessel segmentation map.
[0015] According to a second aspect of the present invention, a classification method is provided, comprising: using a first segmented image or a blood vessel segmentation map obtained by the blood vessel segmentation method for fundus images described in the first aspect as input to a classification model, and outputting a predicted classification.
[0016] According to a third aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a memory, wherein the memory is used to store executable instructions; the one or more processors are configured to execute the executable instructions to implement the method described in any one of the first aspect or the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The embodiments of the present invention are further described below with reference to the accompanying drawings, in which:
[0018] Figure 1 is a schematic diagram of a fundus image and the corresponding segmented image;
[0019] Figure 2 is a local schematic diagram of a fundus image and the corresponding segmented image;
[0020] Figure 3 Schematic diagram of the image before and after enhancement;
[0021] Figure 4 It is a structural diagram of the Unet network;
[0022] Figure 5 Schematic diagram of the comparison of the segmentation structure of the model. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0024] As mentioned in the background technology section, existing vascular segmentation maps severely hinder the accuracy of disease diagnosis by doctors or disease classification models that use vascular segmentation maps as input. The present invention trains the first segmentation model based on a total loss calculated from the overall cross-entropy loss, a first local loss on the vascular skeleton, and a second local loss at the vascular fracture site. This reduces the incidence of vascular fractures and difficulty in segmenting small vessels, resulting in higher-quality segmentation results.
[0025] Before describing the embodiments of the present invention in detail, some of the terms used therein are explained as follows:
[0026] The fundus refers to the area at the back of the eyeball, including anatomical structures such as the retina, optic disc, macula, and central retinal artery.
[0027] The vascular skeleton, also known as the vascular skeleton line or centerline, is the skeleton formed by the centerlines of each vessel. Typically, the image is constructed by removing the edge pixels of a vessel outline of a certain width, resulting in a skeleton with a width of only one pixel.
[0028] The rupture of a blood vessel refers to the location of the rupture of the blood vessel in the segmented image output by the model.
[0029] Example 1:
[0030] According to an embodiment of the present invention, a method for segmenting blood vessels in fundus images is provided, including steps S1 and S2. Each step is described below.
[0031] Step S1: Input the fundus image to be segmented into a machine learning model, where the machine learning model includes a trained first segmentation model.
[0032] To meet the input requirements of the model and achieve better segmentation results, the fundus photographs captured by the fundus camera can be preprocessed to obtain the fundus image to be segmented. Preferably, the image preprocessing includes: removing the black edges of the fundus photograph (removing the black background), adjusting the predetermined size, and sequentially performing Gaussian background subtraction and normalization operations.
[0033] Step S2: Segment the blood vessels and non-blood vessel pixels in the fundus image using the first segmentation model to obtain a first segmented image.
[0034] Preferably, the trained first segmentation model is trained in the following manner: obtaining training data, the training data including multiple fundus images and corresponding first-class labels for each fundus image for identifying whether each pixel is a blood vessel and second-class labels for the skeleton of whether each pixel is a blood vessel; inputting the fundus image into the first segmentation model, and calculating the total loss based on its output and the corresponding first-class labels and second-class labels; performing gradient calculation and parameter update on the first segmentation model based on the total loss to obtain the trained first segmentation model.
[0035] After the fundus image is input into the model, the output is a segmented image of the same size as the input, and the cross entropy between it and the label image (i.e., the first type of label) is calculated as the first part of the loss function. In order to deal with the problem of not being able to segment small blood vessels and broken blood vessels, the label image is skeletonized to obtain the skeleton label of the blood vessel (i.e., the second type of label). The cross entropy value at the skeleton position indicated by the second type of label is multiplied by a weight as the second part of the loss function to balance the weights of thick and thin blood vessels. The part of the output image below the output threshold and the part overlapping the label skeleton are selected to represent the missing blood vessels, and then the part of this part that can be connected to the adjacent blood vessels at both ends is selected as the broken blood vessel part. The cross entropy of the broken blood vessel part is multiplied by a weight as the third part of the loss function, and the three parts of the loss are added to obtain the total loss function. Preferably, the total loss is calculated as follows:
[0036] L all =L BCE +C1L skeleton +C2L break ;
[0037] in, Represents the overall cross entropy loss, L skeleton represents the first local loss, L break Represents the second local loss, C1 represents the weight corresponding to the first local loss, and C2 represents the weight corresponding to the second local loss.
[0038] Among them, the overall cross entropy loss is used to calculate the cross entropy between the fundus image and the corresponding first-class label. The calculation formula of the cross entropy loss of a single pixel is expressed as:
[0039]
[0040] Among them, y(x) represents the value of a single pixel x in the first category label, Represents the value of pixel x output by the model. The overall cross entropy loss is the sum of the cross entropy sub-losses of all pixels.
[0041] Among them, the first local loss (i.e., skeleton loss) is used to enhance the loss corresponding to the pixel point at the skeleton position indicated by the second type of label. The calculation formula of the first local sub-loss of a single pixel x is expressed as:
[0042]
[0043] Among them, the S(x) function indicates that when the pixel x is on the skeleton, it is 1, otherwise it is 0, and the first local loss is the sum of the first local sub-losses of all pixels.
[0044] The second local loss (break loss) is used to enhance the loss corresponding to the pixel points at the break of the blood vessel, and is expressed as:
[0045]
[0046] Here, B(x) represents a function for determining whether a pixel output by the model is a broken portion of a blood vessel, and the value of B(x) is 1 for yes and 0 for no.
[0047] Comparing the segmented image with the annotation, the vascular break is a false negative part (negative connected domain) where both ends can be connected to the blood vessel. For example, the B function represents the negative connected domain that does not contain the endpoint as the vascular break and assigns a value of 1. However, it is time-consuming to judge whether the blood vessels of different thicknesses are broken. For simplicity, it is judged whether the corresponding endpoints on the blood vessel skeleton are broken. If so, it is considered a blood vessel break, which can speed up the training process. The schematic function for judging the vascular break is:
[0048] Where x∈M i Indicates that pixel x belongs to the negative connected domain M i , E(x)=1 means that pixel x is an endpoint on the skeleton, represents the empty set, x∈M i , If the pixel belongs to the negative connected domain and is an endpoint on the skeleton, it is considered to be a broken blood vessel and the value is 1, otherwise it is 0.
[0049] The schematic method for determining the negative connected domain is:
[0050]
[0051] Among them, x∈(S(x)=1)∩(P(x)=0) means that the pixel x is on the skeleton and the predicted value of the pixel output by the model is less than the preset threshold (set to 0.5 here). At this time, the value of M(x) is 1, otherwise it is 0. The P function binarizes the model output, that is, if the predicted value output by the model is less than 0.5, it outputs 0, otherwise it outputs 1.
[0052] Assume that there are N independent negative connected domains, expressed as:
[0053]
[0054] The E function is used to mark the pixels at the endpoints of the skeleton, expressed as:
[0055]
[0056] Here, 1 indicates that pixel x is an endpoint on the skeleton, and 0 otherwise.
[0057] Example 2:
[0058] According to one embodiment of the present invention, a method for segmenting blood vessels in fundus images is provided, comprising steps S1, S2, S3, and S4, each of which is described below. The implementation details of steps S1 and S2 may be consistent with those of steps S1 and S2 in Example 1 and are not further described here. In this embodiment, the machine learning model further includes a post-processing module and a trained second segmentation model, wherein the model parameters of the second segmentation model are different from the model parameters of the first segmentation model.
[0059] Step S3: Segment the blood vessels and non-blood vessel pixels in the fundus image using the second segmentation model to obtain a second segmented image.
[0060] Preferably, the trained second segmentation model is obtained by training in the following manner: based on the trained first segmentation model, the weight C1 of the first local loss and the weight C2 of the second local loss are increased, while the learning rate is reduced, and the training is continued. After the training is completed, the trained second segmentation model is obtained. That is, the first learning rate is used when training the first segmentation model, and the second learning rate is used when subsequent training is performed based on the trained first segmentation model, wherein the second learning rate is smaller than the first learning rate. For example, the first learning rate is set to 10 -4 , the second learning rate is set to 10 -5 It should be understood that the learning rate represents the magnitude of each parameter update during training and is one of the model's hyperparameters. By strengthening the local loss at the fracture site and the second local loss on the vessel skeleton (since smaller vessels are closer to the skeleton, and larger vessels have more edge pixel losses that are ignored, the second local loss actually focuses on strengthening the loss of small vessels), the second segmentation model can be more focused on connecting broken vessels and segmenting small vessels, and the learning rate is reduced to avoid excessive noise in the segmented image.
[0061] Labeling fundus images at the pixel level requires significant time and labor. To increase the diversity of image samples, the present application preferably provides a training data processing method, comprising: performing image preprocessing and enhancement on training data to obtain enhanced training data. The preprocessing step involves performing image preprocessing on fundus images captured by a fundus camera to obtain a preprocessed image. The preprocessing step includes removing black edges from the fundus image, adjusting the image to a preset size, and sequentially performing Gaussian background subtraction and normalization. Normalization can be performed using the maximum and minimum values statistically calculated from the entire training data. In a further embodiment of the present invention, the preprocessing step includes removing black edges from the fundus image, adjusting the image to a preset size, and sequentially performing Gaussian background subtraction, normalization, contrast-constrained adaptive histogram equalization, and gamma correction. This increases image contrast and reduces grayscale value variance between images, thereby improving subsequent segmentation accuracy. The preprocessed image is then enhanced to obtain an enhanced fundus image. The enhancement step includes random angular rotation, random horizontal flipping, and / or random cropping. Random angle rotation refers to randomly rotating the image at an angle with the image center as the rotation center, random horizontal flipping refers to horizontally flipping the fundus image with a certain probability, and random cropping refers to cropping a certain size of image from a random position of the original image as the fundus image; for example, the cropping size is 576x576 pixels. Figure 3 , which shows an original fundus photograph ( Figure 3 a) and the enhanced fundus image obtained after the enhancement process ( Figure 3 b).
[0062] Preferably, the first segmentation model is a U-shaped segmentation network, such as a Unet model, a DenseUnet model, or a Unet++ model. The U-shaped segmentation network can extract the underlying semantic information through multiple downsampling, thereby obtaining a more accurate segmentation result. Figure 4 Taking the Unet model as an example, the model consists of a contraction part and an expansion part. The contraction part is a classic convolutional neural network structure. Each layer undergoes two 3x3 convolution operations (rightward black arrows, conv 3x3) using the ReLU activation function. Each downsampling operation (downward arrows, 2x2 max pool) reduces the feature map size by half and doubles the number of feature layers. Each layer of the expansion part consists of an upsampling 2x2 deconvolution (up-conv 2x2) and two 3x3 convolutions (conv 3x3). The deconvolution exponentially increases the feature map size and reduces the number of feature layers. The feature map of the corresponding layer in the contraction part is then cropped and concatenated with the contraction part (rightward gray arrows, copy and crop). Finally, a 1x1 convolution is used to map each 64-dimensional feature vector to the required number of dimensions, that is, the number of segmentation categories.
[0063] Step S4: The post-processing module obtains a blood vessel segmentation map based on the first segmented image and the second segmented image.
[0064] Since the model parameters of the first segmented image and the second segmented image are different from each other, and both are trained for broken blood vessels and small blood vessels, the segmented images of the two can be combined to obtain a better blood vessel segmentation map to reduce the situation where broken blood vessels and small blood vessels are difficult to segment. Preferably, the post-processing module is configured to directly fuse the first segmented image and the second segmented image or perform pixel-weighted summation to obtain a blood vessel segmentation map. The present invention uses two different segmentation models obtained through training to segment the same fundus image, which will obtain two segmented images with different segmentation effects. Then, the final blood vessel segmentation image is obtained based on the two segmented images to reduce the situation of broken blood vessels and segment more small blood vessels, thereby obtaining a more accurate blood vessel segmentation map to assist doctors or disease classification models that use the blood vessel segmentation map as input to make more accurate judgments.
[0065] Furthermore, in this embodiment, the output of the first segmentation model contains relatively more missing vessels and fractures than the output of the second segmentation model, but with relatively less noise. Therefore, it is possible to consider using the two segmented images in a targeted manner based on specific circumstances to obtain a higher-quality vascular segmentation map. Preferably, the post-processing module is configured to: skeletonize the second segmented image, retaining only connected skeletons with a predetermined area size or greater to obtain a vascular skeleton image; and dilate the vascular skeleton image and fuse it with the first segmented image to obtain a vascular segmentation map. The segmentation model output is a binary image (0 is black, representing non-vascular pixels, 1 is white, representing vascular pixels). The user can set the predetermined area size based on the image size or experience. For example, if the image size is 576x576 pixels, a predetermined area of 50 pixels can be used. The present invention first skeletonizes the binary image of the second segmentation model and selects connected skeletons larger than a certain area as the skeleton image of the blood vessels, thereby reducing the noise output by the second segmentation model. The skeleton image of the blood vessels is then appropriately expanded and superimposed on the binary image output by the first segmentation model. This can increase the connectivity of the output blood vessels with less or no noise added, thereby further reducing the noise in the output results and the occurrence of blood vessel breaks in the output results. Figure 5 , the local results of the first segmentation model for the segmentation of the two images are as follows Figure 5 a and Figure 5 As shown in Figure c, we can see that there are still some broken blood vessels. However, after the processing of the present invention, the final blood vessel segmentation map is as follows: Figure 5 b and Figure 5As shown in Figure d, it can be seen that in the final blood vessel segmentation map, there are fewer broken blood vessels, more small blood vessels are segmented, and there is less noise.
[0066] Example 3:
[0067] According to one embodiment of the present invention, a method for segmenting blood vessels in fundus images is provided, comprising steps S1, S2, S3, and S4, each of which is described below. In this embodiment, the machine learning model further comprises a post-processing module and a trained second segmentation model, wherein the model parameters of the second segmentation model are different from the model parameters of the first segmentation model.
[0068] Step S1: Input the fundus image to be segmented into a machine learning model, where the machine learning model includes a trained first segmentation model.
[0069] Step S2: Segment the blood vessels and non-blood vessel pixels in the fundus image using the first segmentation model to obtain a first segmented image.
[0070] In order to reduce the occurrence of breakage in segmented blood vessels and the difficulty in distinguishing small blood vessels, only the first segmentation model is selected for enhanced training, so that it focuses on the losses corresponding to the pixel positions of the breakage and the skeleton during segmentation. The first segmentation model can be selected from the first segmentation model used in Example 1 or the second segmentation model in Example 2, because both models are trained based on the total loss calculated based on the overall cross entropy loss, the first local loss on the blood vessel skeleton, and the second local loss at the breakage of the blood vessel. That is:
[0071] Optionally, the implementation details of steps S1 and S2 may be substantially the same as those of steps S1 and S2 in Example 1.
[0072] Alternatively, optionally, in step S1, the first segmentation model trained in this embodiment may adopt the second segmentation model trained in embodiment 2.
[0073] Step S3: Segment the blood vessels and non-blood vessel pixels in the fundus image using the second segmentation model to obtain a second segmented image.
[0074] Preferably, the trained second segmentation model is trained only based on the overall cross entropy loss.
[0075] Step S4: The post-processing module obtains a blood vessel segmentation map based on the first segmented image and the second segmented image.
[0076] Preferably, the post-processing module is configured to: directly fuse the first segmented image and the second segmented image or perform pixel weighted summation to obtain a blood vessel segmentation map.
[0077] Furthermore, because the second segmentation model in this embodiment is not trained for local loss, in contrast to Example 2, the output of the first segmentation model in this embodiment contains relatively more noise than the output of the second segmentation model, but with relatively fewer missing vessels and fractures. Therefore, considering specific circumstances, it is possible to consider using the two segmented images in a targeted manner to obtain a higher-quality vascular segmentation map. Therefore, in this embodiment, the post-processing module is configured to: skeletonize the first segmented image, retaining only connected skeletons with a predetermined area size or greater to obtain a vascular skeleton image; and dilate the vascular skeleton image and fuse it with the second segmented image to obtain a vascular segmentation map.
[0078] Example 4
[0079] The present invention also provides a classification method, comprising: using the first segmented image obtained by the fundus image blood vessel segmentation method of Example 1 or the blood vessel segmentation map of Example 2 or Example 3 as input to a classification model, and outputting a predicted classification. For example, the method predicts the presence of at least one of glaucoma, hypertensive retinal arteriosclerosis, and diabetic fundus arteriosclerosis.
[0080] In general, because existing convolutional neural network models focus only on local features and suffer from issues such as small data volumes, uneven brightness, and the presence of surrounding lesions, vascular segmentation maps may show broken vessels or make it difficult to segment small vessels, which can interfere with the diagnosis, screening, treatment, or assessment of related diseases. The above-mentioned embodiments provided by the present invention can improve these issues in different ways, thereby enhancing the model's vascular detection capabilities.
[0081] It should be noted that although the above describes the various steps in a specific order, it does not mean that the steps must be performed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order as long as the required functions can be achieved.
[0082] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.
[0083] Computer-readable storage media can be a tangible device that holds and stores the instructions used by an instruction execution device. Computer-readable storage media can, for example, include, but are not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, a punch card or a raised structure in a groove on which instructions are stored, for example, and any suitable combination thereof.
[0084] While various embodiments of the present invention have been described above, the above descriptions are intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A blood vessel segmentation method for fundus images, characterized in that: include: Inputting the fundus image to be segmented into a machine learning model, wherein the machine learning model includes a trained first segmentation model, a post-processing module, and a trained second segmentation model, wherein the model parameters of the second segmentation model are different from the model parameters of the first segmentation model; Segmenting blood vessels and non-blood vessel pixels in the fundus image using the first segmentation model to obtain a first segmented image, wherein model parameters of the first segmentation model are trained based on a total loss calculated based on an overall cross entropy loss, a first local loss on a blood vessel skeleton, and a second local loss at a blood vessel break; Segmenting blood vessels and non-blood vessel pixels in the fundus image using the second segmentation model to obtain a second segmented image; The post-processing module obtains a blood vessel segmentation map according to the first segmented image and the second segmented image.
2. The method according to claim 1, characterized in that The second local loss is a loss calculated when a fracture occurs at a skeleton of a blood vessel and the fracture belongs to an endpoint of a pre-marked skeleton.
3. The method according to claim 1, characterized in that The first segmentation model is trained in the following manner: Acquire training data, the training data including a plurality of fundus images and a first type of label corresponding to each fundus image for identifying whether each pixel is a blood vessel and a second type of label for identifying whether each pixel is a blood vessel skeleton; Input the fundus image into the first segmentation model, and calculate the total loss based on its output and the corresponding first and second class labels; Gradient calculation and parameter update are performed on the first segmentation model according to the total loss to obtain a trained first segmentation model.
4. The method according to claim 3, characterized in that The total loss is calculated as follows: ; in, represents the overall cross entropy loss, represents the first local loss, represents the second local loss, represents the weight corresponding to the first local loss, Represents the weight corresponding to the second local loss.
5. The method according to any one of claims 1 to 4, characterized in that The blood vessel segmentation image is obtained by directly fusing the first segmentation image and the second segmentation image or performing pixel weighted summation.
6. The method according to any one of claims 1 to 4, characterized in that The model parameters of the trained second segmentation model are obtained by training only based on the overall cross entropy loss.
7. The method according to any one of claims 1 to 4, characterized in that The trained second segmentation model is trained in the following manner: Based on the trained first segmentation model, increase the weights of the first local loss and the second local loss, reduce the learning rate, continue training, and obtain the trained second segmentation model after training is completed.
8. The method according to claim 7, characterized in that The step of obtaining a blood vessel segmentation map according to the first segmented image and the second segmented image by the post-processing module includes: performing skeletonization processing on the second segmented image, retaining only connected skeletons with an area greater than or equal to a preset size, to obtain a skeleton image of the blood vessel; The skeleton image of the blood vessel is expanded and then fused with the first segmented image to obtain the blood vessel segmentation map.
9. A classification method, characterized in that include: The first segmented image or the blood vessel segmentation map obtained by the blood vessel segmentation method for fundus images according to any one of claims 1 to 8 is used as an input of a classification model, and a predicted classification is output.
10. A computer-readable storage medium, characterized in that A computer program is included thereon, and the computer program can be executed by a processor to implement the steps of the method according to any one of claims 1 to 9.
11. An electronic device, characterized in that: include: one or more processors; as well as a memory, wherein the memory is used to store executable instructions; The one or more processors are configured to execute the executable instructions to implement the method of any one of claims 1 to 9.