Method, device and equipment for measuring maximum depth of amniotic fluid ultrasonic image and medium
By using the YOLOv8 model to identify amniotic fluid sub-map, combined with segmentation model and edge detection technology, the problem of degradation of maximum depth measurement of amniotic fluid ultrasound images is solved, and a high-accurate maximum depth measurement of amniotic fluid is achieved.
Patent Information
- Application Number
- CN202510037878.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-01-10
AI Technical Summary
The prior art has the problem of degradation in measuring the maximum depth of amniotic fluid ultrasound images, especially in the automatic measurement process, the sectional data of single and double quadrants are prone to errors.
By obtaining the ultrasound image of amniotic fluid to be measured, inputting it into the preset YOLOv8 model to identify the number and position of the amniotic fluid sub-map, determining the segmentation model based on the recognition results, segmenting the amniotic fluid area, performing binarization, edge detection and strengthening, and finally obtaining the measurement value of the maximum depth of amniotic fluid.
Accurate measurement of the maximum depth of the amniotic fluid ultrasound image is achieved, reducing the subjectivity and uncertainty of manual judgments, and improving the accuracy and reliability of measurement results.
Smart Images

Figure CN119887726A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of medical image processing, and in particular to a method, device, computer equipment, storage medium and computer program product for measuring the maximum depth of an amniotic fluid ultrasound image. Background Art
[0002] In modern medical diagnosis, imaging examinations play a vital role, especially in the monitoring and evaluation of the fetus during pregnancy. Although traditional imaging technologies such as X-rays and CT scans can provide detailed anatomical information, their potential radiation risks pose a threat to the development of the fetus, so their application in fetal imaging examinations is strictly limited. Although intrauterine MRI (Magnetic Resonance Imaging) can overcome the radiation problem and provide high-resolution fetal images, its application is restricted by many factors, such as artifacts caused by fetal movement, safety considerations, high costs, and the availability of equipment. As a result, MRI is not the preferred method for prenatal examinations and is usually only used for further diagnosis when fetal structural abnormalities are found by ultrasound in the middle and late stages.
[0003] Ultrasound examination, as a non-invasive, radiation-free, economical and easily accessible imaging technology, has unique advantages in prenatal screening and diagnosis. It uses the principle of sound wave reflection, can penetrate a variety of opaque substances, and display the dynamic changes of the fetus and the surrounding environment in real time. It is the preferred method for prenatal screening of birth defects. In ultrasound examination, the assessment of amniotic fluid volume is of great significance for judging the fetal intrauterine environment, predicting potential complications and guiding clinical decision-making. Traditional ultrasound methods for measuring amniotic fluid mainly include measuring the maximum vertical depth and the amniotic fluid index. Measuring the maximum vertical depth is a simple and reproducible method that is suitable for early and mid-term pregnancy, but it may be affected by changes in fetal position in late pregnancy. The amniotic fluid index evaluates the amount of amniotic fluid by measuring the maximum vertical depth of the four quadrants and summing them. Although it is more comprehensive, in actual operation, due to measurement habits, machine limitations, and the noise and redundant information of the ultrasound image itself, the accurate measurement of the amniotic fluid index faces challenges. Especially in the automatic measurement process, single-quadrant and double-quadrant section data are prone to errors, resulting in a decrease in the accuracy of the diagnostic results.
[0004] Therefore, there is an urgent need for an accurate maximum depth measurement scheme for amniotic fluid ultrasound images. Summary of the invention
[0005] Based on this, it is necessary to provide an accurate method, device, computer equipment, computer-readable storage medium and computer program product for measuring the maximum depth of amniotic fluid ultrasound images in order to solve the above technical problems.
[0006] In a first aspect, the present application provides a method for measuring the maximum depth of an amniotic fluid ultrasound image. The method comprises:
[0007] Acquire an amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images;
[0008] Determining a segmentation model based on the number of the amniotic fluid sub-images, and segmenting the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask;
[0009] Binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain an adjusted amniotic fluid mask;
[0010] Performing edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and strengthening the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image;
[0011] The maximum depth measurement value of the amniotic fluid is obtained according to the target binary amniotic fluid mask image.
[0012] In one embodiment, obtaining the maximum depth measurement value of the amniotic fluid according to the target binary amniotic fluid mask image comprises:
[0013] Extracting the maximum vertical line segment in the target binary amniotic fluid mask image to obtain a measurement line of the maximum depth of the amniotic fluid;
[0014] The actual length corresponding to the measuring line of the maximum depth of the amniotic fluid is calculated to obtain the maximum depth measurement value of the amniotic fluid.
[0015] In one embodiment, extracting the maximum vertical line segment in the target binary amniotic fluid mask image to obtain the measurement line of the maximum depth of the amniotic fluid includes:
[0016] Converting the target binary amniotic fluid mask image into a two-dimensional matrix;
[0017] Traversing each column in the two-dimensional matrix and analyzing the white pixel area in each column;
[0018] Based on the white pixel area, the largest continuous vertical line segment is found to obtain the measurement line of the maximum depth of the amniotic fluid.
[0019] In one embodiment, binarizing the original amniotic fluid mask includes:
[0020] The original amniotic fluid mask is binarized and a threshold is dynamically selected to adapt to different image styles and light and dark differences, thereby obtaining a binarized amniotic fluid mask.
[0021] In one embodiment, the step of obtaining the to-be-measured amniotic fluid ultrasound image, inputting the to-be-measured amniotic fluid ultrasound image into a preset YOLOv8 model, and identifying the number and position of the amniotic fluid sub-images further includes:
[0022] Acquire annotation data of the amniotic fluid ultrasound image, wherein the annotation data includes a polygonal contour frame annotation of the amniotic fluid dark area and a target detection frame annotation of the amniotic fluid sub-image;
[0023] An initial YOLOv8 model is trained according to the labeled data to obtain a preset YOLOv8 model.
[0024] In one embodiment, the edge detection is performed on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and the target area in the adjusted amniotic fluid mask is enhanced according to the edge detection result to obtain the target binarized amniotic fluid mask image, which includes:
[0025] The Canny algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result;
[0026] The edge detection result is combined with the amniotic fluid mask after corrosion and expansion to obtain the enhanced edge information;
[0027] A target binary mask image is obtained according to the enhanced edge information and the adjusted amniotic fluid mask.
[0028] In one embodiment, the step of obtaining an amniotic fluid ultrasound image to be measured, inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identifying the number and position of the amniotic fluid sub-images includes:
[0029] Acquire the ultrasound image of the amniotic fluid to be measured;
[0030] Inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the initial number and position of the amniotic fluid sub-image;
[0031] The final number of amniotic fluid sub-images is determined according to the identified initial number combined with the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions.
[0032] In a second aspect, the present application also provides a device for measuring the maximum depth of an amniotic fluid ultrasound image. The device comprises:
[0033] An initial recognition module is used to obtain an amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images;
[0034] A mask segmentation module, used for determining a segmentation model based on the number of the amniotic fluid sub-images, and segmenting the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask;
[0035] An adjustment module, used for binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the amniotic fluid mask after the binarization of the original amniotic fluid mask, to obtain an adjusted amniotic fluid mask;
[0036] An edge detection module is used to perform edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and to strengthen the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image;
[0037] A measuring module is used to obtain a maximum depth measurement value of the amniotic fluid according to the target binary amniotic fluid mask image.
[0038] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0039] Acquire an amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images;
[0040] Determining a segmentation model based on the number of the amniotic fluid sub-images, and segmenting the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask;
[0041] Binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain an adjusted amniotic fluid mask;
[0042] Performing edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and strengthening the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image;
[0043] The maximum depth measurement value of the amniotic fluid is obtained according to the target binary amniotic fluid mask image.
[0044] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0045] Acquire an amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images;
[0046] Determining a segmentation model based on the number of the amniotic fluid sub-images, and segmenting the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask;
[0047] Binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain an adjusted amniotic fluid mask;
[0048] Performing edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and strengthening the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image;
[0049] The maximum depth measurement value of the amniotic fluid is obtained according to the target binary amniotic fluid mask image.
[0050] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0051] Acquire an amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images;
[0052] Determining a segmentation model based on the number of the amniotic fluid sub-images, and segmenting the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask;
[0053] Binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain an adjusted amniotic fluid mask;
[0054] Performing edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and strengthening the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image;
[0055] The maximum depth measurement value of the amniotic fluid is obtained according to the target binary amniotic fluid mask image.
[0056] The above-mentioned maximum depth measurement method, device, computer equipment, storage medium and computer program product of amniotic fluid ultrasound image obtain the amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-image; determine the segmentation model based on the number of amniotic fluid sub-images, and use the determined segmentation model to segment the amniotic fluid area to obtain the original amniotic fluid mask; binarize the original amniotic fluid mask, and perform AND processing on the black area in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain an adjusted amniotic fluid mask; use an edge detection algorithm to perform edge detection on the binarized amniotic fluid mask to obtain an edge detection result, and strengthen the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image; obtain the maximum depth measurement value of the amniotic fluid according to the target binarized amniotic fluid mask image. During the whole process, based on the preset YOLOv8 model, the number and position of the amniotic fluid sub-images are first identified, and then the appropriate segmentation model is selected based on the amniotic fluid sub-image data to process the amniotic fluid and amniotic membrane images. After binarization, edge detection, edge enhancement and other processing, the target area in the amniotic fluid mask can be highlighted, thereby achieving accurate measurement of the maximum depth of the amniotic fluid. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A diagram showing an application environment of a method for measuring the maximum depth of an amniotic fluid ultrasound image in an embodiment;
[0058] Figure 2 It is a schematic diagram of a flow chart of a method for measuring the maximum depth of an amniotic fluid ultrasound image in one embodiment;
[0059] Figure 3 It is a schematic flow chart of a method for measuring the maximum depth of an amniotic fluid ultrasound image in another embodiment;
[0060] Figure 4 It is a flowchart of a method for measuring the maximum depth of an amniotic fluid ultrasound image in another embodiment;
[0061] Figure 5 is the amniotic fluid mask image after binarization;
[0062] Figure 6 Schematic diagram of edge detection results;
[0063] Figure 7 is the target binary mask image;
[0064] Figure 8 is a structural block diagram of a device for measuring the maximum depth of an amniotic fluid ultrasound image in one embodiment;
[0065] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0067] The maximum depth measurement method of amniotic fluid ultrasound image provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. Terminal 102 sends a request for measuring the maximum depth of an amniotic fluid ultrasound image to server 104. Server 104 responds to the request, extracts the amniotic fluid ultrasound image to be measured carried in the request, inputs the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identifies the number and position of the amniotic fluid sub-images; determines a segmentation model based on the number of amniotic fluid sub-images, and uses the determined segmentation model to segment the amniotic fluid area to obtain an original amniotic fluid mask; binarizes the original amniotic fluid mask, and performs AND processing on the black area in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain an adjusted amniotic fluid mask; uses an edge detection algorithm to perform edge detection on the binarized amniotic fluid mask to obtain an edge detection result, and strengthens the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image; obtains the maximum depth measurement value of the amniotic fluid according to the target binarized amniotic fluid mask image. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0068] In one embodiment, Figure 2 As shown, a method for measuring the maximum depth of amniotic fluid ultrasound images is provided, and the method is applied to Figure 1 Taking the server 104 in the example as an example, the following steps are included:
[0069] S100: Acquire the amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images.
[0070] The acquired amniotic fluid ultrasound image is input into the preset YOLOv8 model. YOLOv8 is an advanced object detection model that can efficiently and accurately identify specific objects in an image. In this step, the YOLOv8 model is used to identify the number and location of amniotic fluid sub-images (i.e., image regions containing amniotic fluid), and the recognition results will be used as input for the subsequent segmentation model.
[0071] Specifically, the preset YOLOv8 model here can identify the number and location of the amniotic fluid sub-images to prepare for subsequent data processing. Specifically, the amniotic fluid ultrasound image to be measured can be input into the YOLOv8 model and the target area detection can be performed. The output is the coordinates of the bounding box of the current amniotic fluid measurement area, which accurately locates the measurement area and provides more accurate and concentrated image feature information for the subsequent measurement module. At the same time, in view of the different equipment models in different hospitals and the measurement habits of doctors, the amniotic fluid data includes not only the most common measurement images of the four sub-images, but also double-images and single-images. In order to give correct measurement results in the case of different numbers of sub-images, the preset YOLOv8 model here is further optimized to add the function of detecting the number of amniotic fluid sub-images, and can also give correct measurement results when processing single, double and four-image multi-region amniotic fluid dark areas.
[0072] S200: Determine a segmentation model based on the number of amniotic fluid sub-images, and use the determined segmentation model to segment the amniotic fluid region to obtain an original amniotic fluid mask.
[0073] According to the number of identified amniotic fluid sub-images, an appropriate segmentation model is selected or determined. The segmentation model can be a semantic segmentation model based on deep learning. The identified amniotic fluid sub-images are input into the segmentation model, and the amniotic fluid area is accurately segmented to obtain an original amniotic fluid mask. The original amniotic fluid mask is a two-dimensional image in which the amniotic fluid area is marked as white or a specific color, and other areas are marked as black or another color.
[0074] S300: binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the binarized original amniotic fluid mask to obtain an adjusted amniotic fluid mask.
[0075] The original amniotic fluid mask is binarized to ensure that the mask contains only black and white colors. Then, the binarized amniotic fluid mask is ANDed, that is, all black areas (non-amniotic fluid areas) are merged to obtain the adjusted amniotic fluid mask. The purpose of this step is to further purify the mask and reduce noise and interference.
[0076] S400: performing edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and strengthening the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image.
[0077] The edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result. The edge detection result will highlight the boundary of the amniotic fluid area. According to the edge detection result, the target area (i.e., the amniotic fluid area) in the adjusted amniotic fluid mask is enhanced to obtain the target binary amniotic fluid mask image. The enhancement process can be performed by morphological operations such as dilation and corrosion to enhance the boundary and internal features of the amniotic fluid area.
[0078] S500: Obtaining a maximum depth measurement value of the amniotic fluid according to the target binary amniotic fluid mask image.
[0079] According to the target binary amniotic fluid mask image, an appropriate measurement algorithm (such as a pixel-based depth measurement algorithm) is used to calculate the maximum depth of the amniotic fluid. The measurement algorithm can take into account factors such as image resolution and scale to ensure the accuracy of the measurement results.
[0080] The above-mentioned maximum depth measurement method of amniotic fluid ultrasound image obtains the amniotic fluid ultrasound image to be measured, inputs the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identifies the number and position of the amniotic fluid sub-images; determines the segmentation model based on the number of amniotic fluid sub-images, and uses the determined segmentation model to segment the amniotic fluid area to obtain the original amniotic fluid mask; binarizes the original amniotic fluid mask, and performs AND processing on the black area in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain the adjusted amniotic fluid mask; uses the edge detection algorithm to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result, and strengthens the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain the target binarized amniotic fluid mask image; obtains the maximum depth measurement value of the amniotic fluid according to the target binarized amniotic fluid mask image. During the whole process, based on the preset YOLOv8 model, the number and position of the amniotic fluid sub-images are first identified, and then the appropriate segmentation model is selected based on the amniotic fluid sub-image data to process the amniotic fluid and amniotic membrane images. After binarization, edge detection, edge enhancement and other processing, the target area in the amniotic fluid mask can be highlighted, thereby achieving accurate measurement of the maximum depth of the amniotic fluid.
[0081] In one embodiment, if Figure 3 As shown, S500 includes:
[0082] S520: extracting the maximum vertical line segment in the target binary amniotic fluid mask image to obtain a measurement line of the maximum depth of the amniotic fluid.
[0083] In the target binary amniotic fluid mask image, the amniotic fluid area usually appears as a continuous white or specific color area. In order to measure the maximum depth of the amniotic fluid, it is necessary to find the longest vertical line segment in the area (that is, the line segment parallel to the vertical direction of the image), which represents the maximum depth direction of the amniotic fluid in the ultrasound image. This can be achieved by scanning the image, calculating the length of continuous white pixels in each vertical direction, and finding the longest line segment. This longest vertical line segment is regarded as the measurement line of the maximum depth of the amniotic fluid.
[0084] S540: Calculate the actual length of the measurement line corresponding to the maximum depth of the amniotic fluid to obtain the maximum depth measurement value of the amniotic fluid.
[0085] After obtaining the measurement line of the maximum depth of the amniotic fluid, its corresponding pixel length needs to be converted into the actual length. This usually involves the resolution and scale information of the image. According to the resolution of the image (that is, the number of pixels per inch or per centimeter), the pixel length of the measurement line can be multiplied by the corresponding conversion coefficient to obtain its length in the real world. This length is the maximum depth measurement of the amniotic fluid.
[0086] The maximum depth of amniotic fluid can be calculated by extracting the maximum vertical line segment in the target binary amniotic fluid mask image, which can ensure the accuracy of the measurement results. This is because this method directly measures the shape and size of the amniotic fluid area in the image, avoiding the subjectivity and uncertainty of manual judgment.
[0087] Furthermore, due to the characteristics of ultrasound images such as high noise, the segmentation effect of the segmentation model on the boundary of the target area is often not very accurate. Therefore, when calculating the maximum depth measurement line of the amniotic fluid, the original image is binarized, and after many experiments, the threshold is finally set to 10. The position of the endpoint of the measurement line is appropriately adjusted up and down according to the black or white pixel value of a small area near the endpoint, so as to achieve the problem of inaccurate segmentation boundary of the optimization model.
[0088] In practical applications, since the maximum depth at the pixel level is not easy to intuitively reflect the actual fetal growth, it needs to be converted into actual length. The specific method is to map the maximum depth at the pixel level to the actual length through a standard scale. Different models of ultrasound equipment have different pixel-to-actual length ratios. After conversion, the maximum vertical depth of fetal amniotic fluid measurement can be obtained. For the measurement of the amniotic fluid section in the four quadrants, the average of the maximum vertical depths in the four quadrants is taken as the final vertical depth of the section, and the sum of the measured values of the four quadrants is the amniotic fluid index. Finally, connect the pixel points representing the start and end coordinates of the maximum depth segment to display the corresponding actual measurement value.
[0089] In one embodiment, extracting the maximum vertical line segment in the target binary amniotic fluid mask image to obtain the measurement line of the maximum depth of the amniotic fluid includes:
[0090] Step 1: Convert the target binary amniotic fluid mask image into a two-dimensional matrix.
[0091] The target binary amniotic fluid mask image is converted into a two-dimensional matrix form, in which each element represents a pixel in the image, white pixels are represented by a specific value (such as 1), and black pixels are represented by another value (such as 0).
[0092] Step 2: Traverse each column in the two-dimensional matrix and analyze the white pixel area in each column.
[0093] Traverse each column of the two-dimensional matrix and analyze the continuous distribution of white pixels in each column. Record the starting and ending positions of the white pixel area in each column, as well as the length of the area (i.e., the number of continuous white pixels).
[0094] Step 3: Based on the white pixel area, find the largest continuous vertical line segment to obtain the measurement line of the maximum depth of the amniotic fluid.
[0095] Compare the lengths of the white pixel areas in all columns and find the longest area, that is, the largest continuous vertical line segment. This line segment represents the maximum depth direction of the amniotic fluid in the ultrasound image and is regarded as the measurement line of the maximum depth of the amniotic fluid.
[0096] In one embodiment, binarization of the original amniotic fluid mask includes:
[0097] The original amniotic fluid mask is binarized and the threshold is dynamically selected to adapt to different image styles and brightness differences to obtain the binarized amniotic fluid mask.
[0098] The optimized amniotic fluid mask is binarized, that is, the pixel values in the image are converted into values containing only black and white colors. In this process, in order to adapt to different image styles and light and dark differences, the present invention adopts a dynamic threshold selection method. Specifically, a suitable threshold can be automatically calculated according to the statistical characteristics of the image such as the grayscale histogram, mean, standard deviation, etc., and the pixel values in the image greater than the threshold are set to white (representing the amniotic fluid area), and those less than the threshold are set to black (representing the non-amniotic fluid area). This method can ensure that the binarized amniotic fluid mask can accurately reflect the amniotic fluid area under different lighting conditions and image quality. Specifically, the threshold can be set to the pixel value + 75. That is, due to different image styles, light and dark, etc., there will be large differences, so the binarization threshold needs to be dynamically selected. After multiple experiments, it is determined that the threshold is the average pixel value of the amniotic fluid area + 75. At the same time, the mask is "anded" with the black area after binarization to obtain an adjusted mask to avoid the line of the maximum measurement depth passing through the internal limbs of the amniotic fluid.
[0099] In one embodiment, before obtaining the to-be-measured amniotic fluid ultrasound image and inputting the to-be-measured amniotic fluid ultrasound image into a preset YOLOv8 model and identifying the number and position of the amniotic fluid sub-images, the method further includes:
[0100] Step 1: Obtain the annotation data of the amniotic fluid ultrasound image, which includes the polygonal contour box annotation of the dark area of the amniotic fluid and the target detection box annotation of the amniotic fluid sub-image.
[0101] The annotation information of the dataset consists of two parts: ① The fine annotation of the dark area of amniotic fluid, i.e., the polygonal contour box; ② The target detection box of the amniotic fluid sub-image, i.e., the rectangular box.
[0102] Step 2: Train the initial YOLOv8 model based on the labeled data to obtain the preset YOLOv8 model.
[0103] A new segmentation model was trained based on YOLOv8 using a large amount of annotated data in the above format. The detection function of amniotic fluid sub-images was added. According to the number of sub-images detected by the model, the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions was used for auxiliary judgment to obtain the final number of amniotic fluid sub-images, which facilitated the subsequent determination of the correct number of amniotic fluid depth measurement lines and avoided the problem of failure in measuring amniotic fluid dark areas in multiple regions of single and double images.
[0104] In one embodiment, if Figure 4 As shown, S400 includes:
[0105] S420: Using the Canny algorithm to perform edge detection on the binarized amniotic fluid mask to obtain an edge detection result.
[0106] The amniotic fluid mask after binarization is as follows Figure 5 As shown. The Canny algorithm is used to detect the edge of the binarized amniotic fluid mask. The Canny algorithm is a classic and efficient edge detection algorithm that can effectively identify edge features in images. By inputting the binarized amniotic fluid mask into the Canny algorithm, an edge detection result containing the boundary information of the amniotic fluid area can be obtained. The result is represented in the form of a series of edge points that accurately depict the outline of the amniotic fluid area. The edge detection results are shown in the following figure. Figure 6 shown.
[0107] S440: combining the edge detection result with the corroded and expanded amniotic fluid mask to obtain enhanced edge information.
[0108] In order to enhance the accuracy and completeness of edge information, the edge detection results obtained by the Canny algorithm are combined with the amniotic fluid mask after erosion and dilation. The erosion operation can remove small noise and irregular edges in the mask, while the dilation operation can fill small holes and gaps in the mask to make the mask more complete and continuous. By combining the edge detection results with the morphologically processed mask, enhanced edge information can be obtained, which more accurately and clearly represents the boundary of the amniotic fluid area.
[0109] S460: Obtain a target binary mask image according to the enhanced edge information and the adjusted amniotic fluid mask.
[0110] Finally, a target binary mask image is generated based on the enhanced edge information and the adjusted amniotic fluid mask. Specifically, the adjusted amniotic fluid mask is further optimized and adjusted based on the enhanced edge information. For example, the mask can be cropped, filled, or smoothed according to the outline of the edge information to ensure that the amniotic fluid area in the mask fully matches the edge information. After these processes, the final target binary mask image will clearly show the boundaries and internal features of the amniotic fluid area, providing an accurate basis for subsequent maximum depth measurement. The target binary mask image is as follows: Figure 7 shown.
[0111] Specifically, in this embodiment, for the amniotic fluid contour obtained above, the edge information obtained by the Canny algorithm edge detection is combined with the original mask after the corrosion and dilation operations, and the bitwise "OR" operation is used to strengthen the boundary, remove noise and enhance the target area, so that the boundary of the mask can be better adjusted to match the target area more accurately, thereby improving the accuracy of the maximum depth measurement of the amniotic fluid.
[0112] In one embodiment, obtaining an amniotic fluid ultrasound image to be measured, inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identifying the number and position of the amniotic fluid sub-images includes:
[0113] Step 1: Obtain the ultrasound image of the amniotic fluid to be measured.
[0114] Step 2: Input the amniotic fluid ultrasound image to be measured into the preset YOLOv8 model to identify the initial number and position of the amniotic fluid sub-image.
[0115] Step 3: Determine the final number of amniotic fluid sub-images based on the identified initial number combined with the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions.
[0116] In order to obtain a more accurate number of amniotic fluid sub-images, the final number of amniotic fluid sub-images is determined based on the identified initial number and the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions. Horizontal mapping logic: In the horizontal direction, check whether adjacent amniotic fluid sub-images overlap or are continuous. If there is overlap, they are regarded as the same amniotic fluid sub-image and their regions are merged; if there is continuous but non-overlapping, their relative positions and sizes are used to determine whether they should be regarded as a larger amniotic fluid sub-image. Vertical mapping logic: In the vertical direction, the focus is on whether the amniotic fluid sub-image spans multiple slices or layers of the image. Since amniotic fluid is usually continuous in the uterus, if the amniotic fluid sub-images on adjacent slices correspond to each other and are continuous in the vertical direction, they are regarded as different parts of the same amniotic fluid region, and the number of amniotic fluid sub-images is adjusted accordingly. Comprehensive judgment: Combined with the mapping logic in the horizontal and vertical directions, the final number of amniotic fluid sub-images is comprehensively judged and determined, which should accurately reflect the number of independent amniotic fluid regions that actually exist in the image.
[0117] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0118] Based on the same inventive concept, the embodiment of the present application also provides an amniotic fluid ultrasound image maximum depth measurement device for implementing the above-mentioned amniotic fluid ultrasound image maximum depth measurement method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more embodiments of the amniotic fluid ultrasound image maximum depth measurement device provided below can refer to the limitations of the amniotic fluid ultrasound image maximum depth measurement method above, and will not be repeated here.
[0119] In one embodiment, Figure 8 As shown, a device for measuring the maximum depth of an amniotic fluid ultrasound image is provided, comprising:
[0120] The initial recognition module 100 is used to obtain the amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-image;
[0121] The mask segmentation module 200 is used to determine the segmentation model based on the number of amniotic fluid sub-images, and segment the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask;
[0122] The adjustment module 300 is used to perform binarization processing on the original amniotic fluid mask, and perform an AND processing on the black area in the amniotic fluid mask after the binarization of the original amniotic fluid mask to obtain an adjusted amniotic fluid mask;
[0123] The edge detection module 400 is used to perform edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and to strengthen the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image;
[0124] The measurement module 500 is used to obtain the maximum depth measurement value of the amniotic fluid according to the target binary amniotic fluid mask image.
[0125] In one embodiment, the measurement module 500 is also used to extract the maximum vertical line segment in the target binary amniotic fluid mask image to obtain the measurement line of the maximum depth of the amniotic fluid; calculate the actual length corresponding to the measurement line of the maximum depth of the amniotic fluid to obtain the maximum depth measurement value of the amniotic fluid.
[0126] In one embodiment, the measurement module 500 is also used to convert the target binary amniotic fluid mask image into a two-dimensional matrix; traverse each column in the two-dimensional matrix and analyze the white pixel area in each column; based on the white pixel area, find the largest continuous vertical line segment to obtain the measurement line of the maximum depth of the amniotic fluid.
[0127] In one embodiment, the adjustment module 300 is further used to perform binarization processing on the original amniotic fluid mask and dynamically select a threshold value to adapt to different image styles and brightness differences, so as to obtain a binarized amniotic fluid mask.
[0128] In one embodiment, the initial recognition module 100 is also used to obtain the annotation data of the amniotic fluid ultrasound image, the annotation data including the polygonal contour box annotation of the amniotic fluid dark area and the target detection box annotation of the amniotic fluid sub-image; and train the initial YOLOv8 model according to the annotation data to obtain the preset YOLOv8 model.
[0129] In one embodiment, the edge detection module 400 is also used to perform edge detection on the binarized amniotic fluid mask using the Canny algorithm to obtain an edge detection result; combine the edge detection result with the corroded and expanded amniotic fluid mask to obtain enhanced edge information; and obtain a target binary mask image based on the enhanced edge information and the adjusted amniotic fluid mask.
[0130] In one of the embodiments, the initial identification module 100 is also used to obtain the amniotic fluid ultrasound image to be measured; input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the initial number and position of the amniotic fluid sub-image; determine the final number of amniotic fluid sub-images based on the identified initial number combined with the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions.
[0131] Each module in the above-mentioned device for measuring the maximum depth of amniotic fluid ultrasound images can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0132] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store preset data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for measuring the maximum depth of an amniotic fluid ultrasound image is implemented.
[0133] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0134] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above-mentioned maximum depth measurement method of amniotic fluid ultrasound image when executing the computer program.
[0135] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned maximum depth measurement method of amniotic fluid ultrasound image is implemented.
[0136] In one embodiment, a computer program product is provided, comprising a computer program, which implements the above-mentioned maximum depth measurement method of amniotic fluid ultrasound image when executed by a processor.
[0137] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.
[0138] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for measuring the maximum depth of an amniotic fluid ultrasound image, characterized in that: The method comprises: Acquire an amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images; Determining a segmentation model based on the number of the amniotic fluid sub-images, and segmenting the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask; Binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the amniotic fluid mask after the original amniotic fluid mask is binarized to obtain an adjusted amniotic fluid mask; Performing edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and strengthening the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image; The maximum depth measurement value of the amniotic fluid is obtained according to the target binary amniotic fluid mask image.
2. The method according to claim 1, characterized in that The step of obtaining the maximum depth measurement value of the amniotic fluid according to the target binary amniotic fluid mask image comprises: Extracting the maximum vertical line segment in the target binary amniotic fluid mask image to obtain a measurement line of the maximum depth of the amniotic fluid; The actual length corresponding to the measuring line of the maximum depth of the amniotic fluid is calculated to obtain the maximum depth measurement value of the amniotic fluid.
3. The method according to claim 2, characterized in that The step of extracting the maximum vertical line segment in the target binary amniotic fluid mask image to obtain the measurement line of the maximum depth of the amniotic fluid comprises: Converting the target binary amniotic fluid mask image into a two-dimensional matrix; Traversing each column in the two-dimensional matrix and analyzing the white pixel area in each column; Based on the white pixel area, the largest continuous vertical line segment is found to obtain the measurement line of the maximum depth of the amniotic fluid.
4. The method according to claim 1, characterized in that: The binarization process of the original amniotic fluid mask includes: The original amniotic fluid mask is binarized and a threshold is dynamically selected to adapt to different image styles and light and dark differences, thereby obtaining a binarized amniotic fluid mask.
5. The method according to claim 1, characterized in that The step of obtaining the to-be-measured amniotic fluid ultrasound image, inputting the to-be-measured amniotic fluid ultrasound image into a preset YOLOv8 model, and identifying the number and position of the amniotic fluid sub-images further includes: Acquire annotation data of the amniotic fluid ultrasound image, wherein the annotation data includes a polygonal contour frame annotation of the amniotic fluid dark area and a target detection frame annotation of the amniotic fluid sub-image; An initial YOLOv8 model is trained according to the labeled data to obtain a preset YOLOv8 model.
6. The method according to claim 1, characterized in that The edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain an edge detection result, and the target area in the adjusted amniotic fluid mask is strengthened according to the edge detection result to obtain a target binarized amniotic fluid mask image, which includes: The Canny algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result; The edge detection result is combined with the amniotic fluid mask after corrosion and expansion to obtain the enhanced edge information; A target binary mask image is obtained according to the enhanced edge information and the adjusted amniotic fluid mask.
7. The method according to claim 1, characterized in that The step of obtaining the to-be-measured amniotic fluid ultrasound image, inputting the to-be-measured amniotic fluid ultrasound image into a preset YOLOv8 model, and identifying the number and position of the amniotic fluid sub-images comprises: Acquire an ultrasound image of the amniotic fluid to be measured; Inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the initial number and position of the amniotic fluid sub-image; The final number of amniotic fluid sub-images is determined according to the identified initial number combined with the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions.
8. A device for measuring the maximum depth of an amniotic fluid ultrasound image, characterized in that: The device comprises: An initial recognition module is used to obtain an amniotic fluid ultrasound image to be measured, input the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model, and identify the number and position of the amniotic fluid sub-images; A mask segmentation module, used for determining a segmentation model based on the number of the amniotic fluid sub-images, and segmenting the amniotic fluid region using the determined segmentation model to obtain an original amniotic fluid mask; An adjustment module, used for binarizing the original amniotic fluid mask, and performing an AND process on the black areas in the amniotic fluid mask after the binarization of the original amniotic fluid mask, to obtain an adjusted amniotic fluid mask; An edge detection module is used to perform edge detection on the binarized amniotic fluid mask using an edge detection algorithm to obtain an edge detection result, and to strengthen the target area in the adjusted amniotic fluid mask according to the edge detection result to obtain a target binarized amniotic fluid mask image; A measuring module is used to obtain a maximum depth measurement value of the amniotic fluid according to the target binary amniotic fluid mask image.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Ultrasound image processing method and device, ultrasonic diagnosis device and storage medium
CN107518920A
Amniotic fluid information determination method based on ultrasonic image and ultrasonic equipment
CN114847999A
Amniotic fluid depth measurement method and device, computer equipment and storage medium
CN117653206A
Amniotic fluid region segmentation model construction method, amniotic fluid index measurement method and amniotic fluid index measurement device
CN118172352A
Method and apparatus for analyzing amniotic fluid
EP1658484A2
Cited By
DSA-based left atrial appendage automatic segmentation and measurement method
CN120852457A
Dsa-based left atrial appendage automatic segmentation and measurement method
CN120852457B