Method and device for calculating fundus hemorrhage area and electronic equipment
By segmenting and feature extraction of fundus images using deep learning models, automatically identifying the optic disk and bleeding areas, and calculating the pixel length scale, the subjectivity and accuracy of traditional fundus bleeding detection methods are solved, and higher automation, accuracy and stability are achieved.
Patent Information
- Application Number
- CN202510268511.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-20
AI Technical Summary
Traditional fundus bleeding detection methods rely on manual measurement by doctors, with subjectivity and measurement errors, and existing computer vision methods have low accuracy when processing fundus images with complex morphology and light changes.
The fundus image is segmented using a pre-trained deep learning model, automatically identify the visual disk area and bleeding area, and calculate the pixel length scale by the visual disk diameter to calculate the true bleeding area.
It improves the degree of automation, accuracy and stability of fundus bleeding area measurement, reduces artificial errors, and is suitable for different types of fundus images.
Smart Images

Figure CN120182356A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technologies, and in particular, to a method, apparatus, and electronic device for calculating the area of fundus hemorrhage. Background Art
[0002] Fundus hemorrhage is an important clinical manifestation of various eye diseases, such as diabetic retinopathy, hypertensive retinopathy, and retinal vein occlusion. Timely and accurate assessment of the bleeding condition is of great significance for disease diagnosis, treatment plan formulation, and condition monitoring. Traditional fundus hemorrhage detection methods mainly rely on doctors to observe and manually measure the bleeding area through a fundus microscope or fundus photography equipment. However, there may be significant differences in the identification and measurement of the bleeding area by different doctors, resulting in strong subjectivity of the measurement results. Affected by doctors' experience, image resolution, and measurement tools, measurement errors may occur.
[0003] In recent years, computer vision and deep learning technologies have made remarkable progress in the field of medical image analysis. Such methods usually rely on techniques such as region growing and K-means clustering. However, due to the complex morphology of the bleeding area, large variations in illumination and contrast, the applicability of traditional methods is limited, and they are easily affected by noise, resulting in low accuracy. By using a combination of feature extraction and classifier, such as models like SVM and random forest, classification is performed by extracting color, texture, and shape features. Such methods have improved the segmentation accuracy to a certain extent, but they rely on feature selection and have limited generalization ability, making it difficult to apply to different types of fundus images. Summary of the Invention
[0004] At least one embodiment of the present disclosure provides a method, apparatus, and electronic device for calculating the area of fundus hemorrhage. First, a pre-trained deep learning model is used to segment the fundus image, automatically identify the optic disc area and the bleeding area, and calculate the pixel length scale based on the optic disc diameter, and then convert the real bleeding area, improving the automation degree, accuracy, and stability of the measurement.
[0005] An embodiment of the present disclosure provides a method for calculating the area of fundus hemorrhage, including:
[0006] Obtain a fundus image, input the fundus image into a pre-trained semantic segmentation model, and determine the pixel marking information of the optic disc area and the bleeding area;
[0007] According to the pixel marking information corresponding to the optic disc area, determine the pixel distance of the diameter of the optic disc, and determine the pixel length scale corresponding to the fundus image according to a preset average actual diameter;
[0008] Determine the number of pixels in the bleeding area according to the pixel marking information corresponding to the bleeding area, and determine the actual bleeding area according to the number of pixels and the pixel length scale.
[0009] In an alternative implementation, the semantic segmentation model is trained based on the following steps:
[0010] Collect sample fundus images. For each sample fundus image, label the area type to which each pixel in the sample fundus image belongs. The area types include the optic disc area, the bleeding area, and the background area.
[0011] Use the sample fundus image as sample data and the area type as data labels, and input them into the pre-constructed semantic segmentation model for training until the model has the ability to identify that pixels belong to the optic disc area, the bleeding area, and the background area.
[0012] In an alternative implementation, the method further includes:
[0013] Determine the maximum and minimum values of the pixel coordinates included in the bleeding area in the horizontal and vertical directions according to the pixel marking information corresponding to the bleeding area.
[0014] Mark the sampling contour points corresponding to the bleeding area according to the maximum and minimum values of the pixel coordinates in the horizontal and vertical directions.
[0015] In an alternative implementation, the method for determining the actual bleeding area further includes:
[0016] Calculate the pixel area corresponding to the bleeding area by the triangle segmentation method according to the coordinates corresponding to the sampling contour points.
[0017] Determine the actual bleeding area according to the pixel area and the pixel length scale.
[0018] In an alternative implementation, the method for determining the actual bleeding area further includes:
[0019] Determine the geometric center corresponding to the sampling contour points.
[0020] For each sampling contour point, determine the polar angle of the sampling contour point to the geometric center.
[0021] Sort the sampling contour points according to the magnitude of the polar angle to determine the ordered set corresponding to the sampling contour points.
[0022] Calculate the pixel area corresponding to the bleeding area by the discrete Green's formula according to the coordinates corresponding to the sampling contour points in the ordered set.
[0023] Determine the actual bleeding area according to the pixel area and the pixel length scale. In an alternative embodiment, the actual bleeding area is determined based on the following formula:
[0024] S real = count × k 2
[0025] where S real represents the actual bleeding area; count represents the number of pixels in the bleeding area; k represents the pixel length scale.
[0026] In an alternative embodiment, determining the pixel distance of the diameter of the optic disc specifically includes:
[0027] Determine the pixel coordinates corresponding to the optic disc area according to the pixel marking information corresponding to the optic disc area;
[0028] Determine, among the pixel coordinates, the difference between the maximum horizontal axis coordinate value and the minimum horizontal axis coordinate value corresponding to each vertical axis coordinate value between the minimum vertical axis coordinate value and the maximum vertical axis coordinate value;
[0029] Determine the maximum value of the difference as the diameter pixel distance.
[0030] The embodiments of the present disclosure further provide a device for calculating the fundus bleeding area, including:
[0031] A pixel marking module, configured to obtain a fundus image, input the fundus image into a pre-trained semantic segmentation model, and determine the pixel marking information of the optic disc area and the bleeding area;
[0032] A ratio determination module, configured to determine the pixel distance of the diameter of the optic disc according to the pixel marking information corresponding to the optic disc area, and determine the pixel length scale corresponding to the fundus image according to a preset average actual diameter;
[0033] A bleeding area calculation module, configured to determine the number of pixels in the bleeding area according to the pixel marking information corresponding to the bleeding area, and determine the actual bleeding area according to the number of pixels and the pixel length scale.
[0034] The embodiments of the present disclosure further provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the memory through the bus. When the machine-readable instructions are executed by the processor, the above-mentioned method for calculating the fundus bleeding area, or the steps in any possible implementation manner of the above-mentioned method for calculating the fundus bleeding area are executed.
[0035] An embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the above-mentioned method for calculating the area of fundus hemorrhage, or the steps in any possible implementation manner of the above-mentioned method for calculating the area of fundus hemorrhage.
[0036] An embodiment of the present disclosure also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, they implement the above-mentioned method for calculating the area of fundus hemorrhage, or the steps in any possible implementation manner of the above-mentioned method for calculating the area of fundus hemorrhage.
[0037] A method, device and electronic device for calculating the area of fundus hemorrhage provided by an embodiment of the present disclosure. Obtain a fundus image, input the fundus image into a pre-trained semantic segmentation model, and determine the pixel marking information of the optic disc area and the hemorrhage area; according to the pixel marking information corresponding to the optic disc area, determine the pixel distance of the diameter of the optic disc, and determine the pixel length scale corresponding to the fundus image according to a preset average actual diameter; according to the pixel marking information corresponding to the hemorrhage area, determine the number of pixels in the hemorrhage area, and determine the actual hemorrhage area according to the number of pixels and the pixel length scale. The present disclosure first uses a pre-trained deep learning model to segment the fundus image, automatically identify the optic disc area and the hemorrhage area, calculate the pixel length scale based on the optic disc diameter, and then convert the true hemorrhage area, improving the automation, accuracy and stability of the measurement.
[0038] To make the above objects, features and advantages of the present disclosure more obvious and understandable, the following specific preferred embodiments are given in conjunction with the accompanying drawings and are described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] To more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the accompanying drawings required for the embodiments. The accompanying drawings are incorporated into the specification and constitute a part of the specification. These drawings show embodiments that conform to the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0040] Figure 1 Shows a flowchart of a method for calculating the area of fundus hemorrhage provided by an embodiment of the present disclosure;
[0041] Figure 2 Shows a flowchart of another method for calculating the area of fundus hemorrhage provided by an embodiment of the present disclosure;
[0042] Figure 3 Shows a schematic diagram of a device for calculating the area of fundus hemorrhage provided by an embodiment of the present disclosure;
[0043] Figure 4 Shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners
[0044] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are only some of the embodiments of the present disclosure, rather than all of the embodiments. Usually, the components of the embodiments of the present disclosure described and illustrated herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed present disclosure, but merely represents selected embodiments of the present disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative efforts fall within the scope of protection of the present disclosure.
[0045] It should be noted that: similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0046] The term "and / or" in this article merely describes an associated relationship and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" in this article means any one of multiple or any combination of at least two of multiple. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set composed of A, B, and C.
[0047] Through research, it is found that traditional fundus hemorrhage detection methods mainly rely on doctors to observe and manually measure the hemorrhage area through a fundus microscope or fundus photography equipment, which may lead to measurement errors. Computer vision and deep learning technologies usually rely on techniques such as region growing and K-means clustering. However, due to the complex morphology of the hemorrhage area, large changes in illumination and contrast, the applicability of traditional methods is limited, vulnerable to noise interference, and the accuracy is low. And the method of combining feature extraction and classifier, such as models like SVM and random forest, classifies by extracting color, texture, and shape features. Such methods improve the segmentation accuracy to a certain extent, but rely on feature selection, have limited generalization ability, and are difficult to apply to different types of fundus images.
[0048] Based on the above research, the present disclosure provides a method, apparatus, and electronic device for calculating the area of fundus hemorrhage. The method includes obtaining a fundus image, inputting the fundus image into a pre-trained semantic segmentation model to determine pixel marking information of the optic disc region and the hemorrhage region; determining the pixel distance of the diameter of the optic disc according to the pixel marking information corresponding to the optic disc region, and determining the pixel length scale corresponding to the fundus image according to a preset average actual diameter; determining the number of pixels in the hemorrhage region according to the pixel marking information corresponding to the hemorrhage region, and determining the actual hemorrhage area according to the number of pixels and the pixel length scale. The present disclosure first uses a pre-trained deep learning model to segment the fundus image, automatically identify the optic disc region and the hemorrhage region, calculate the pixel length scale based on the optic disc diameter, and then convert the true hemorrhage area, thereby improving the automation, accuracy, and stability of the measurement.
[0049] For ease of understanding of this embodiment, a method for calculating the area of fundus hemorrhage disclosed in the embodiments of the present disclosure will be introduced in detail first. The execution subject of the method for calculating the area of fundus hemorrhage provided in the embodiments of the present disclosure is generally a computer device with certain computing capabilities. Such a computer device includes, for example: a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementation manners, the method for calculating the area of fundus hemorrhage may be implemented by a processor invoking computer-readable instructions stored in a memory.
[0050] See Figure 1 As shown in the figure, a flowchart of a method for calculating the area of fundus hemorrhage provided in the embodiments of the present disclosure is shown. The method includes steps S101 to S103, where:
[0051] S101. Obtain a fundus image, input the fundus image into a pre-trained semantic segmentation model, and determine pixel marking information of the optic disc region and the hemorrhage region.
[0052] In a specific implementation, a fundus image is captured using a fundus camera or other imaging devices (such as OCT, fundus camera, etc.). The fundus image is important data used by ophthalmologists in diagnosing eye diseases. The image contains detailed information of the retina, including the optic disc, retinal blood vessels, hemorrhage regions, etc.
[0053] It should be noted that the fundus image needs to have high resolution and clarity for detailed region segmentation, and standard image formats such as JPEG, PNG, or TIFF can be used.
[0054] Here, semantic segmentation is a deep learning task whose goal is to classify each pixel in the input image into specific categories. In fundus hemorrhage detection, the semantic segmentation models adopted can include: UNet, ResUNet, SegNet, etc. These models can be trained according to the characteristics of image pixels to learn how to distinguish different regions (such as optic disc, hemorrhage area, background, etc.).
[0055] As a possible implementation, the semantic segmentation model is trained based on the following steps 1 - 2:
[0056] Step 1: Collect sample fundus images. For each of the sample fundus images, label the region type to which each pixel in the sample fundus image belongs. The region types include the optic disc region, the hemorrhage region, and the background region.
[0057] Step 2: Use the sample fundus images as sample data and the region types as data labels, and input them into the pre - constructed semantic segmentation model for training until the model has the ability to recognize that pixels belong to the optic disc region, the hemorrhage region, and the background region.
[0058] In a specific implementation, a large number of labeled fundus images are used for learning. During the training process, each pixel will be labeled as its belonging category (optic disc, hemorrhage region, or background), and the model can recognize these regions through a large amount of training data. The trained model can automatically perform pixel - level classification on new fundus images.
[0059] Here, the input fundus images are subjected to pre - processing operations. For example, the pixel values are normalized to a certain range (such as between 0 - 1) so that the neural network can be better trained; enhancement operations such as flipping, rotating, and cropping are performed on the input images to improve the generalization ability of the model.
[0060] Furthermore, after being processed by the trained semantic segmentation model, the model will assign a category label to each pixel. The model identifies and marks the region where the optic nerve disc is located in the fundus image. Usually, the optic disc is a circular region and can be marked as category 1; the model will also identify the hemorrhage region in the fundus image, which usually appears as blood spots or blood clots, and mark it as category 2; the remaining parts of the fundus image (non - optic disc and non - hemorrhage regions) will be marked as the background region (category 0). This marking information is generated based on the classification results of each pixel and can be represented by pixel - level label mapping. For example, each pixel in the image is marked with a corresponding numerical value (such as 1, 2, 0) according to its belonging category (optic disc, hemorrhage, background).
[0061] Preferably, the output of the model can be a label map with the same size as the input image, where each pixel value represents the category to which the pixel belongs. With this marking information, the model can accurately provide the precise pixel positions for the optic disc area and the hemorrhage area.
[0062] S102. Determine the pixel distance of the diameter of the optic disc according to the pixel marking information corresponding to the optic disc area, and determine the pixel length scale corresponding to the fundus image according to the preset average actual diameter.
[0063] In a specific implementation, in the first step, through a pre-trained semantic segmentation model, the optic disc area in the fundus image has been marked. Now, it is necessary to extract the pixel coordinates of the optic disc from this marking information and further calculate the distance of the diameter of the optic disc in the pixel space.
[0064] Here, the pixel coordinates of all pixels marked as the optic disc area (category 1) can be extracted from the pixel label map (mask) output by the semantic segmentation model. Suppose these pixel coordinates are {P = (i, j)|mask(i, j) = 1}, that is, all pixel coordinate pairs belonging to the optic disc area. To calculate the pixel distance of the diameter of the optic disc in the image, these marked pixel coordinates can be used to find the upper, lower, left, and right boundaries of the optic disc. Determine the pixel coordinates corresponding to the optic disc area according to the pixel marking information corresponding to the optic disc area; determine, among the pixel coordinates, the difference between the maximum horizontal coordinate value and the minimum horizontal coordinate value corresponding to each vertical coordinate value between the minimum vertical coordinate value and the maximum vertical coordinate value; determine the maximum value of the difference as the pixel distance of the diameter.
[0065] Specifically, calculate the pixel distance of the diameter through the following formula:
[0066]
[0067] where d px represents the pixel distance of the diameter; x and y respectively represent the horizontal and vertical coordinates of the pixel; a is the minimum y coordinate of the pixel position of the hemorrhage area marked as 1, and b is the maximum y coordinate of the pixel position of the hemorrhage area marked as 1.
[0068] Furthermore, based on the known actual diameter of the optic disc and its pixel diameter in the image, the scale between the pixels and the actual length of the image can be calculated. Usually, the average actual diameter of the optic disc is 1.5 millimeters, and this known actual diameter can be used to calculate the pixel length scale. The pixel length scale is the proportional relationship between the pixels of the fundus image and the actual length, and can be calculated through the following formula:
[0069]
[0070] where k represents the pixel length scale; dreal represents the preset average actual diameter of the optic disc; d px represents the pixel distance of the diameter.
[0071] Here, the scale k can be used in subsequent steps to convert the pixel area in the image into the actual area. For example, if the number of pixels occupied by the bleeding area in the pixel space is known, then the actual bleeding area can be calculated through the scale k.
[0072] S103. Determine the number of pixels in the bleeding area according to the pixel marking information corresponding to the bleeding area, and determine the actual bleeding area according to the number of pixels and the pixel length scale.
[0073] In a specific implementation, in the previous steps, through a pre-trained semantic segmentation model, different regions in the fundus image have been able to be marked, including the optic disc region, the bleeding region, and the background region. Specifically, the semantic segmentation model marks each pixel as a specific category. From the marked image, the pixel coordinates of all pixels marked as the bleeding region (category 2) are extracted. Suppose these pixel coordinates are {Q=(m,n)|mask(m,n)=2}, that is, all pixel coordinate pairs belonging to the bleeding region. By counting the number of pixel coordinates in the bleeding region, the number of pixels occupied by the bleeding region is determined. Simply put, it is to calculate the number of all pixel points that meet the condition of mask(m,n)=2. Suppose this number is count, that is:
[0074] count = |{(m,n)|mask(m,n)=2}|
[0075] where count is the number of pixels in the bleeding area, representing the number of pixels occupied by the bleeding area in the fundus image.
[0076] Furthermore, once the number of pixels count in the bleeding area is obtained, the previously calculated pixel length scale k can be used to convert the number of pixels in the image into the actual area. In the previous steps, the scale k between pixels and actual length has been calculated through the actual diameter of the optic disc and the pixel diameter of the optic disc. The unit of this scale is millimeters / pixel, representing the actual physical length (unit: millimeters) represented by one pixel in the image.
[0077] Here, according to the scale k, we can convert the number of pixels in the bleeding area into the actual bleeding area. The actual area represented by each pixel is k 2 , (that is, the actual area represented by each pixel is k millimeters × k millimeters), therefore, the actual bleeding area can be calculated by the following formula:
[0078] S real = count × k2
[0079] Among them, S real represents the actual bleeding area; count represents the number of pixels; k represents the pixel length scale.
[0080] Exemplarily, the bleeding area extracted by the semantic segmentation model contains 500 pixels (i.e., count = 500). After calculation, the pixel length scale k = 0.1 mm / pixel is obtained, and then the calculation of the actual bleeding area is 5 mm 2 .
[0081] As a possible implementation manner, refer to Figure 2 shown in the flowchart of another method for calculating the fundus bleeding area provided by the embodiments of the present disclosure. The method includes steps S201 to S204, where:
[0082] S201. Determine the maximum and minimum values of the pixel coordinates included in the bleeding area in the horizontal and vertical directions according to the pixel marking information corresponding to the bleeding area.
[0083] S202. Mark the sampling contour points corresponding to the bleeding area according to the maximum and minimum values of the pixel coordinates in the horizontal and vertical directions.
[0084] S203. Calculate the pixel area corresponding to the bleeding area by the triangle segmentation method according to the coordinates corresponding to the sampling contour points.
[0085] S204. Determine the actual bleeding area according to the pixel area and the pixel length scale.
[0086] In a specific implementation, when calculating the pixel area of an irregular bleeding range in a fundus image, on the basis of obtaining the bleeding area contour points, a polygon area calculation method can also be used to approximate the area of an irregular graph in the fundus image. Among them, the bleeding area contour points can be obtained through manual marking, or can be sampled after using methods such as semantic segmentation or Canny edge detection for segmentation.
[0087] In practical applications, the bleeding area is usually an irregular shape. Therefore, by extracting the outer contour points of the bleeding area (i.e., the pixel points intersecting the boundary of the bleeding area), the shape of the bleeding area can be described more accurately. For all pixel coordinates {Q = (r, s)|mask(r, s) = 2} of the bleeding area, let the minimum value of the y coordinate of the bleeding area pixel point position be c, the maximum value be d, {Q = (r, s)|mask(r, s) = 2, s ∈ [c, d]}, and several contour points C of the bleeding area are marked according to the following formula k :
[0088] C k ={ (x min , k), (x max , k)}, for k = c, c + 1, …, d
[0089] Here, whenever a pixel position belongs to the bleeding area and is on the boundary, this position is selected as a sampling contour point. Specifically, the left and right boundary points of each row of the bleeding area can be marked from top to bottom along the vertical axis (y - direction), thereby obtaining contour points. These sampling contour points will serve as the basis for subsequent geometric calculations to determine the specific shape of the bleeding area.
[0090] Furthermore, through the contour points obtained by sampling (i.e., a series of (x, y) coordinate points), the entire contour area can be divided into multiple triangles, and the area of each triangle can be calculated by the vector cross - multiplication method. Suppose the contour points are C1, C2, ..., CN, and these points are connected in sequence to form a polygon. Select a fixed point (usually a point of the polygon, such as C1), and then divide the polygon into multiple triangles. For example, points C1 can be selected to form multiple triangles with adjacent contour points C2, C3, ..., CN, and the area of each triangle can be calculated.
[0091] Here, for a polygon, the polygon can be divided into several triangles, and then the area of each triangle is calculated and summed up. The triangle area calculation uses the vector cross - multiplication calculation method, and the specific formula is as follows:
[0092]
[0093] Among them, S px represents the area of the polygon.
[0094] As another possible implementation, the method for determining the actual bleeding area further includes: determining the geometric center corresponding to the sampling contour points; for each sampling contour point, determining the polar angle of the sampling contour point to the geometric center; sorting the sampling contour points according to the magnitude of the polar angle to determine the ordered set corresponding to the sampling contour points; calculating the pixel area corresponding to the bleeding area through the discrete Green's formula according to the coordinates corresponding to the sampling contour points in the ordered set; and determining the actual bleeding area according to the pixel area and the pixel length scale.
[0095] Here, first, find the geometric center C i , y i ) of the contour sampling points (x o , and the calculation formula is as follows:
[0096]
[0097] After that, calculate the polar angle θ of each point to the geometric center i , θ i = atan2(y i - y o , x i - x o ); Sort all the contour sampling points in ascending order according to θ i to obtain an ordered set: P sorted = {P1,..., P N}, and the calculation formula for the further bleeding area S px is as follows:
[0098]
[0099] where (x k , y k ) are the coordinates of the element P k in the ordered set.
[0100] A method for calculating the fundus hemorrhage area provided by an embodiment of the present disclosure includes obtaining a fundus image, inputting the fundus image into a pre-trained semantic segmentation model to determine pixel marking information of the optic disc area and the hemorrhage area; determining the pixel distance of the diameter of the optic disc according to the pixel marking information corresponding to the optic disc area, and determining the pixel length scale corresponding to the fundus image according to a preset average actual diameter; determining the number of pixels in the hemorrhage area according to the pixel marking information corresponding to the hemorrhage area, and determining the actual hemorrhage area according to the number of pixels and the pixel length scale. The present disclosure first uses a pre-trained deep learning model to segment the fundus image, automatically identify the optic disc area and the hemorrhage area, calculate the pixel length scale based on the optic disc diameter, and then convert the true hemorrhage area, improving the automation, accuracy and stability of the measurement.
[0101] Those skilled in the art can understand that in the above method of the specific embodiment, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0102] Based on the same inventive concept, an embodiment of the present disclosure also provides a calculation device for the fundus hemorrhage area corresponding to the method for calculating the fundus hemorrhage area. Since the principle of solving problems by the device in the embodiment of the present disclosure is similar to the above method for calculating the fundus hemorrhage area in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0103] Please refer to Figure 3 , Figure 3 which is a schematic diagram of a calculation device for the fundus hemorrhage area provided by an embodiment of the present disclosure. AsFigure 3 As shown in Figure 3 , the fundus hemorrhage area calculation device 300 provided by the embodiments of the present disclosure includes:
[0104] A pixel marking module 310, configured to obtain a fundus image, input the fundus image into a pre-trained semantic segmentation model, and determine pixel marking information of the optic disc area and the hemorrhage area.
[0105] A ratio determination module 320, configured to determine the pixel distance of the diameter of the optic disc according to the pixel marking information corresponding to the optic disc area, and determine the pixel length scale corresponding to the fundus image according to a preset average actual diameter.
[0106] A hemorrhage area calculation module 330, configured to determine the number of pixels in the hemorrhage area according to the pixel marking information corresponding to the hemorrhage area, and determine the actual hemorrhage area according to the number of pixels and the pixel length scale.
[0107] For the processing flow of each module in the device and the interaction flow between the modules, reference may be made to the relevant descriptions in the above method embodiments, which will not be elaborated here.
[0108] A fundus hemorrhage area calculation device provided by the embodiments of the present disclosure obtains a fundus image, inputs the fundus image into a pre-trained semantic segmentation model, and determines pixel marking information of the optic disc area and the hemorrhage area; determines the pixel distance of the diameter of the optic disc according to the pixel marking information corresponding to the optic disc area, and determines the pixel length scale corresponding to the fundus image according to a preset average actual diameter; determines the number of pixels in the hemorrhage area according to the pixel marking information corresponding to the hemorrhage area, and determines the actual hemorrhage area according to the number of pixels and the pixel length scale. The present disclosure first uses a pre-trained deep learning model to segment the fundus image, automatically identifies the optic disc area and the hemorrhage area, calculates the pixel length scale based on the optic disc diameter, and then converts the real hemorrhage area, improving the automation degree, accuracy, and stability of the measurement.
[0109] Corresponding to Figure 1 the fundus hemorrhage area calculation method in Figure 1 , the embodiments of the present disclosure further provide an electronic device 400, as Figure 4 shown, which is a schematic structural diagram of the electronic device 400 provided by the embodiments of the present disclosure, including:
[0110] a processor 41, a memory 42, and a bus 43; the memory 42 is used to store execution instructions, including an internal memory 421 and an external memory 422; the internal memory 421 here is also called the main memory, which is used to temporarily store the operation data in the processor 41 and the data exchanged with the external memory 422 such as a hard disk. The processor 41 exchanges data with the external memory 422 through the internal memory 421. When the electronic device 400 runs, the processor 41 communicates with the memory 42 through the bus 43, so that the processor 41 executes Figure 1 and Figure 2 the steps of the method for calculating the fundus hemorrhage area in
[0111] Embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the method for calculating the fundus hemorrhage area described in the above method embodiments. Among them, the storage medium may be a volatile or non-volatile computer-readable storage medium.
[0112] Embodiments of the present disclosure also provide a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, they can execute the steps of the method for calculating the fundus hemorrhage area described in the above method embodiments. For details, please refer to the above method embodiments and will not be elaborated here.
[0113] Among them, the above computer program product can be specifically implemented in a way of hardware, software or a combination thereof. In an optional embodiment, the computer program product is specifically embodied as a computer storage medium. In another optional embodiment, the computer program product is specifically embodied as a software product, such as a Software Development Kit (SDK), etc.
[0114] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working process of the above-described device can refer to the corresponding process in the foregoing method embodiments and will not be elaborated here. In several embodiments provided by the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, and the indirect coupling or communication connection of the device or unit may be in an electrical, mechanical or other form.
[0115] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0116] In addition, in each embodiment of the present disclosure, each functional unit may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit.
[0117] If the above function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0118] Finally, it should be noted that the above-described embodiments are only specific implementation manners of the present disclosure, used to illustrate the technical solutions of the present disclosure, and are not intended to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions described in the foregoing embodiments, or can easily think of changes, or make equivalent replacements for some of the technical features; and these modifications, changes, or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A method for calculating the area of fundus hemorrhage, characterized in that: include: Acquire a fundus image, input the fundus image into a pre-trained semantic segmentation model, and determine pixel labeling information of an optic disc area and a hemorrhage area; Determine the diameter pixel distance of the optic disc according to the pixel marking information corresponding to the optic disc area, and determine the pixel length scale corresponding to the fundus image according to a preset average actual diameter; The number of pixels in the bleeding area is determined according to the pixel marking information corresponding to the bleeding area, and the actual bleeding area is determined according to the number of pixels and the pixel length scale.
2. The method according to claim 1, characterized in that The semantic segmentation model is trained based on the following steps: Collecting sample fundus images, and for each of the sample fundus images, marking the corresponding region type for each pixel in the sample fundus image, wherein the region types include the optic disc region, the hemorrhage region, and the background region; The sample fundus image is used as sample data, and the region type is used as a data label, which is input into the pre-built semantic segmentation model for training until the model has the ability to identify pixels belonging to the optic disc area, the hemorrhage area, and the background area.
3. The method according to claim 1, characterized in that The method further comprises: Determining the maximum and minimum values of pixel coordinates included in the bleeding area in the horizontal and vertical directions according to the pixel label information corresponding to the bleeding area; According to the maximum and minimum values of the pixel coordinates in the horizontal and vertical directions, the sampling contour points corresponding to the bleeding area are marked.
4. The method according to claim 3, characterized in that The method for determining the actual bleeding area further comprises: Calculating the pixel area corresponding to the bleeding area by a triangle segmentation method according to the coordinates corresponding to the sampling contour points; The actual bleeding area is determined according to the pixel area and the pixel length ratio.
5. The method according to claim 3, characterized in that: The method for determining the actual bleeding area further comprises: Determine the geometric center corresponding to the sampling contour point; For each of the sampling contour points, determining the polar angle from the sampling contour point to the geometric center; Sort the sampling contour points according to the size of the polar angle to determine an ordered set corresponding to the sampling contour points; Calculating the pixel area corresponding to the bleeding region by discrete Green's formula according to the coordinates corresponding to the sampling contour points in the ordered set; The actual bleeding area is determined according to the pixel area and the pixel length ratio.
6. The method according to claim 1, characterized in that The actual bleeding area was determined based on the following formula: S real =count×k 2 Among them, S real represents the actual bleeding area; count represents the number of pixels; k represents the pixel length scale.
7. The method according to claim 1, characterized in that Determine the diameter pixel distance of the optic disc, including: Determining pixel coordinates corresponding to the optic disc area according to the pixel label information corresponding to the optic disc area; Determine the difference between the maximum horizontal axis coordinate value and the minimum horizontal axis coordinate value corresponding to each vertical axis coordinate value between the minimum vertical axis coordinate value and the maximum vertical axis coordinate value in the pixel coordinates; The maximum value of the difference is determined as the diameter pixel distance.
8. A device for calculating the area of fundus hemorrhage, characterized in that: include: A pixel labeling module is used to obtain a fundus image, input the fundus image into a pre-trained semantic segmentation model, and determine pixel labeling information of an optic disc area and a hemorrhage area; A ratio determination module, used to determine the diameter pixel distance of the optic disc according to the pixel marking information corresponding to the optic disc area, and determine the pixel length scale corresponding to the fundus image according to a preset average actual diameter; The bleeding area calculation module is used to determine the number of pixels in the bleeding area according to the pixel marking information corresponding to the bleeding area, and determine the actual bleeding area according to the pixel number and the pixel length ratio.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for calculating the area of fundus hemorrhage as described in any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for calculating the area of fundus hemorrhage according to any one of claims 1 to 7 are executed.