Methods, devices, equipment and media for measuring maximum depth of amniotic fluid ultrasound images
By using the YOLOv8 model and deep learning segmentation algorithm to identify amniotic fluid sub-images, and combining binarization and edge detection, the problem of large errors in traditional ultrasound measurement of amniotic fluid depth is solved, and high-precision measurement of maximum amniotic fluid depth is achieved.
Patent Information
- Application Number
- CN202510037878.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-01-10
AI Technical Summary
Traditional ultrasound methods for measuring amniotic fluid depth are prone to errors during automated measurement, leading to decreased diagnostic accuracy, especially when fetal position changes or image noise affects accurate measurement.
The YOLOv8 model was used to identify the number and location of amniotic fluid sub-images. A deep learning segmentation model was used for segmentation. The amniotic fluid mask was enhanced by binarization and edge detection algorithms. The maximum depth of the amniotic fluid was calculated by extracting the maximum vertical line segment.
It enables accurate measurement of the maximum amniotic fluid depth under different image conditions, reduces the subjectivity of human judgment, and improves the accuracy and consistency of measurement.
Smart Images

Figure CN119887726B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of medical image processing technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for measuring the maximum depth of amniotic fluid ultrasound images. Background Technology
[0002] In modern medical diagnosis, imaging examinations play a crucial role, especially in the monitoring and assessment of the fetus during pregnancy. While traditional imaging techniques such as X-rays and CT scans provide detailed anatomical information, their application is strictly limited due to the potential radiation risks that threaten fetal development. Intrauterine MRI (Magnetic Resonance Imaging), although overcoming radiation concerns and providing high-resolution fetal images, is constrained by various factors, such as artifacts caused by fetal movement, safety considerations, high cost, and equipment availability. Therefore, MRI is not the first-line method for prenatal examination and is typically used only for further diagnosis when fetal structural abnormalities are detected by ultrasound in the mid-to-late stages of pregnancy.
[0003] Ultrasound examination, as a non-invasive, radiation-free, economical, and readily available imaging technique, has unique advantages in prenatal screening and diagnosis. Utilizing the principle of sound wave reflection, it can penetrate various opaque materials, displaying real-time dynamic changes in the fetus and its surrounding environment, making it the preferred method for prenatal screening of birth defects. In ultrasound examinations, the assessment of amniotic fluid volume is crucial for determining the fetal intrauterine environment, predicting potential complications, and guiding clinical decisions. Traditional methods for measuring amniotic fluid primarily include measuring maximum vertical depth and the amniotic fluid index (AFI). Measuring maximum vertical depth is a simple and reproducible method suitable for early and mid-pregnancy, but it may be affected by fetal position changes in late pregnancy. The AFI assesses amniotic fluid volume by measuring and summing the maximum vertical depths in the four quadrants. While more comprehensive, accurate measurement of the AFI faces challenges in practice due to measurement habits, machine limitations, and noise and redundancy in the ultrasound images themselves. Especially during automated measurement, single-quadrant and double-quadrant section data are prone to errors, leading to decreased diagnostic accuracy.
[0004] Therefore, there is an urgent need for an accurate method for measuring the maximum depth of amniotic fluid ultrasound images. Summary of the Invention
[0005] Therefore, it is necessary to provide an accurate method, apparatus, computer equipment, computer-readable storage medium, and computer program product for measuring the maximum depth of amniotic fluid ultrasound images, addressing the aforementioned technical problems.
[0006] In a first aspect, this application provides a method for measuring the maximum depth of amniotic fluid ultrasound images. The method includes:
[0007] Acquire an ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into a preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images;
[0008] Based on the number of amniotic fluid sub-images, a segmentation model is determined, and the determined segmentation model is used to segment the amniotic fluid region to obtain the original amniotic fluid mask.
[0009] The original amniotic fluid mask is binarized, and the black areas in the binarized amniotic fluid mask are ANDed to obtain the adjusted amniotic fluid mask.
[0010] An edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result. The target region in the adjusted amniotic fluid mask is then enhanced based on the edge detection result to obtain the target binarized amniotic fluid mask image.
[0011] The maximum depth of amniotic fluid is measured based on the target binarized amniotic fluid mask image.
[0012] In one embodiment, obtaining the maximum amniotic fluid depth measurement value based on the target binarized amniotic fluid mask image includes:
[0013] Extract the maximum vertical line segment from the target binarized amniotic fluid mask image to obtain the measurement line of the maximum amniotic fluid depth;
[0014] Calculate the actual length corresponding to the measurement line of the maximum amniotic fluid depth to obtain the measurement value of the maximum amniotic fluid depth.
[0015] In one embodiment, extracting the maximum vertical line segment from the target binarized amniotic fluid mask image to obtain the measurement line for the maximum amniotic fluid depth includes:
[0016] The target binarized amniotic fluid mask image is converted into a two-dimensional matrix;
[0017] Traverse each column of the two-dimensional matrix and analyze the white pixel region 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 amniotic fluid depth.
[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 brightness differences, resulting in a binarized amniotic fluid mask.
[0021] In one embodiment, before acquiring the amniotic fluid ultrasound image to be measured and inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the number and location of the amniotic fluid sub-images, the method further includes:
[0022] Obtain annotation data for amniotic fluid ultrasound images, the annotation data including polygonal outline annotations of the amniotic fluid dark area and target detection box annotations of the amniotic fluid sub-image;
[0023] An initial YOLOv8 model is trained based on the labeled data to obtain a preset YOLOv8 model.
[0024] In one embodiment, the step of using an edge detection algorithm to perform edge detection on the binarized amniotic fluid mask, obtaining edge detection results, and enhancing the target region in the adjusted amniotic fluid mask based on the edge detection results to obtain a target binarized amniotic fluid mask image includes:
[0025] The Canny algorithm was used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection results.
[0026] The edge detection results are combined with the eroded and expanded amniotic fluid mask to obtain enhanced edge information;
[0027] Based on the enhanced edge information and the adjusted amniotic fluid mask, a target binarized mask image is obtained.
[0028] In one embodiment, acquiring the amniotic fluid ultrasound image to be measured, and inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the number and location of amniotic fluid sub-images, includes:
[0029] Acquire ultrasound images of the amniotic fluid to be measured;
[0030] The ultrasound image of the amniotic fluid to be measured is input into a preset YOLOv8 model to identify the initial number and location of the amniotic fluid sub-images;
[0031] Based on the identified initial number and the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions, the final number of amniotic fluid sub-maps is determined.
[0032] Secondly, this application also provides a device for measuring the maximum depth of amniotic fluid ultrasound images. The device includes:
[0033] The initial identification module is used to acquire the ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into the preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images;
[0034] The mask segmentation module is used to determine the segmentation model based on the number of amniotic fluid sub-images, and to segment the amniotic fluid region using the determined segmentation model to obtain the original amniotic fluid mask.
[0035] The adjustment module is used to perform binarization on the original amniotic fluid mask and perform AND operation on the black areas in the binarized amniotic fluid mask to obtain the adjusted amniotic fluid mask.
[0036] The edge detection module is used to perform edge detection on the binarized amniotic fluid mask using an edge detection algorithm, obtain the edge detection result, and enhance the target region in the adjusted amniotic fluid mask based on the edge detection result to obtain the target binarized amniotic fluid mask image.
[0037] The measurement module is used to obtain the maximum depth measurement value of amniotic fluid based on the target binarized amniotic fluid mask image.
[0038] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0039] Acquire an ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into a preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images;
[0040] Based on the number of amniotic fluid sub-images, a segmentation model is determined, and the determined segmentation model is used to segment the amniotic fluid region to obtain the original amniotic fluid mask.
[0041] The original amniotic fluid mask is binarized, and the black areas in the binarized amniotic fluid mask are ANDed to obtain the adjusted amniotic fluid mask.
[0042] An edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result. The target region in the adjusted amniotic fluid mask is then enhanced based on the edge detection result to obtain the target binarized amniotic fluid mask image.
[0043] The maximum depth of amniotic fluid is measured based on the target binarized amniotic fluid mask image.
[0044] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0045] Acquire an ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into a preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images;
[0046] Based on the number of amniotic fluid sub-images, a segmentation model is determined, and the determined segmentation model is used to segment the amniotic fluid region to obtain the original amniotic fluid mask.
[0047] The original amniotic fluid mask is binarized, and the black areas in the binarized amniotic fluid mask are ANDed to obtain the adjusted amniotic fluid mask.
[0048] An edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result. The target region in the adjusted amniotic fluid mask is then enhanced based on the edge detection result to obtain the target binarized amniotic fluid mask image.
[0049] The maximum depth of amniotic fluid is measured based on the target binarized amniotic fluid mask image.
[0050] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0051] Acquire an ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into a preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images;
[0052] Based on the number of amniotic fluid sub-images, a segmentation model is determined, and the determined segmentation model is used to segment the amniotic fluid region to obtain the original amniotic fluid mask.
[0053] The original amniotic fluid mask is binarized, and the black areas in the binarized amniotic fluid mask are ANDed to obtain the adjusted amniotic fluid mask.
[0054] An edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result. The target region in the adjusted amniotic fluid mask is then enhanced based on the edge detection result to obtain the target binarized amniotic fluid mask image.
[0055] The maximum depth of amniotic fluid is measured based on the target binarized amniotic fluid mask image.
[0056] The aforementioned method, apparatus, computer equipment, storage medium, and computer program product for measuring the maximum depth of amniotic fluid ultrasound images acquire an amniotic fluid ultrasound image to be measured. The image is then input into a preset YOLOv8 model to identify the number and location of amniotic fluid sub-images. Based on the number of amniotic fluid sub-images, a segmentation model is determined, and the amniotic fluid region is segmented using this model to obtain an original amniotic fluid mask. The original amniotic fluid mask is binarized, and the black regions within the binarized mask are ANDed to obtain an adjusted mask. An edge detection algorithm is used to perform edge detection on the binarized mask, yielding edge detection results. The target region within the adjusted mask is then enhanced based on these results to obtain a target binarized amniotic fluid mask image. Finally, the maximum depth of the amniotic fluid is measured based on the target binarized amniotic fluid mask image. Throughout the process, based on the preset YOLOv8 model, the number and location of amniotic fluid sub-images are first identified. Then, based on the amniotic fluid sub-image data, an appropriate segmentation model is selected to process the amniotic fluid and amniotic membrane images. After processing such as binarization, edge detection, and edge enhancement, the target area in the amniotic fluid mask can be highlighted, thereby achieving accurate measurement of the maximum depth of amniotic fluid. Attached Figure Description
[0057] Figure 1 This is an application environment diagram of the method for measuring the maximum depth of amniotic fluid ultrasound images in one embodiment;
[0058] Figure 2 This is a flowchart illustrating a method for measuring the maximum depth of amniotic fluid ultrasound images in one embodiment;
[0059] Figure 3 This is a flowchart illustrating the method for measuring the maximum depth of amniotic fluid ultrasound images in another embodiment;
[0060] Figure 4 This is a flowchart illustrating the method for measuring the maximum depth of amniotic fluid ultrasound images in yet another embodiment;
[0061] Figure 5 This is the binarized amniotic fluid mask image;
[0062] Figure 6 This is a schematic diagram of the edge detection results;
[0063] Figure 7 Binarize the target image into a mask;
[0064] Figure 8 This is a structural block diagram of a device for measuring the maximum depth of amniotic fluid ultrasound images in one embodiment;
[0065] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0067] The method for measuring the maximum depth of amniotic fluid ultrasound images provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on another network server. Terminal 102 sends a request to the server 104 to measure the maximum depth of the amniotic fluid ultrasound image. The 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, identifies the number and location of the amniotic fluid sub-images, determines a segmentation model based on the number of amniotic fluid sub-images, and segments the amniotic fluid region using the determined segmentation model to obtain the original amniotic fluid mask, performs binarization processing on the original amniotic fluid mask, and performs AND processing on the black areas in the binarized amniotic fluid mask to obtain the adjusted amniotic fluid mask, performs edge detection on the binarized amniotic fluid mask using an edge detection algorithm, obtains the edge detection results, and enhances the target region in the adjusted amniotic fluid mask based on the edge detection results to obtain the target binarized amniotic fluid mask image, and obtains the maximum depth measurement value of the amniotic fluid based on the target binarized amniotic fluid mask image. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0068] In one embodiment, such as Figure 2 As shown, a method for measuring the maximum depth of amniotic fluid ultrasound images is provided, and this method is applied to... Figure 1 Taking server 104 as an example, the following steps are included:
[0069] S100: Acquire the ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into the preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images.
[0070] The acquired amniotic fluid ultrasound images are input into a pre-defined YOLOv8 model. YOLOv8 is an advanced object detection model capable of efficiently and accurately identifying 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 identification results will serve as input for subsequent segmentation models.
[0071] Specifically, the preset YOLOv8 model here can identify the number and location of amniotic fluid sub-images to prepare for subsequent data processing. The amniotic fluid ultrasound image to be measured can be input into the YOLOv8 model for target region detection. Its output is the bounding box coordinates of the current amniotic fluid measurement area, accurately locating the measurement region and providing more precise and focused image feature information for subsequent measurement modules. Furthermore, considering different hospitals, equipment models, and doctors' measurement habits, amniotic fluid data includes not only the most common four sub-images but also dual-image and single-image images. To provide correct measurement results under different numbers of sub-images, the preset YOLOv8 model here is further optimized, adding the function of detecting the number of amniotic fluid sub-images, enabling correct measurement results even when dealing with multiple regions of dark amniotic fluid in single, dual, and four-image sets.
[0072] S200: Determine the segmentation model based on the number of amniotic fluid subgraphs, and use the determined segmentation model to segment the amniotic fluid region to obtain the original amniotic fluid mask.
[0073] Based on 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 to accurately segment the amniotic fluid region, resulting in the original amniotic fluid mask. The original amniotic fluid mask is a two-dimensional image where the amniotic fluid region is marked white or a specific color, while other regions are marked black or another color.
[0074] S300: The original amniotic fluid mask is binarized, and the black areas in the binarized amniotic fluid mask are ANDed to obtain the adjusted amniotic fluid mask.
[0075] The original amniotic fluid mask is binarized to ensure it contains only black and white colors. Then, a bitwise AND operation is performed on the binarized mask to merge all black areas (non-amniotic fluid areas), resulting in an adjusted amniotic fluid mask. This step aims to further refine the mask and reduce noise and interference.
[0076] S400: An edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection results. Based on the edge detection results, the target region in the enhanced and adjusted amniotic fluid mask is obtained to obtain the target binarized amniotic fluid mask image.
[0077] Edge detection algorithms are used to perform edge detection on the binarized amniotic fluid mask, yielding edge detection results. These results highlight the boundaries of the amniotic fluid region. Based on the edge detection results, the target region (i.e., the amniotic fluid region) within the adjusted amniotic fluid mask is enhanced to obtain a target binarized amniotic fluid mask image. Enhancement processing can involve morphological operations such as dilation and erosion to enhance the boundary and internal features of the amniotic fluid region.
[0078] S500: The maximum depth measurement of amniotic fluid is obtained based on the target binarized amniotic fluid mask image.
[0079] Based on the target binarized 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-described method for measuring the maximum depth of amniotic fluid ultrasound images involves acquiring an amniotic fluid ultrasound image to be measured, inputting the image into a preset YOLOv8 model to identify the number and location of amniotic fluid sub-images, determining a segmentation model based on the number of sub-images, and using this model to segment the amniotic fluid region to obtain an original amniotic fluid mask. The original amniotic fluid mask is then binarized, and the black regions within the binarized mask are ANDed to obtain an adjusted mask. An edge detection algorithm is used to perform edge detection on the binarized mask, and the target region within the adjusted mask is enhanced based on the edge detection results to obtain a target binarized amniotic fluid mask image. Finally, the maximum depth of the amniotic fluid is measured based on the target binarized amniotic fluid mask image. Throughout the process, based on the preset YOLOv8 model, the number and location of amniotic fluid sub-images are first identified. Then, based on the amniotic fluid sub-image data, an appropriate segmentation model is selected to process the amniotic fluid and amniotic membrane images. After processing such as binarization, edge detection, and edge enhancement, the target area in the amniotic fluid mask can be highlighted, thereby achieving accurate measurement of the maximum depth of amniotic fluid.
[0081] In one embodiment, such as Figure 3 As shown, S500 includes:
[0082] S520: Extract the maximum vertical line segment from the target binarized amniotic fluid mask image to obtain the measurement line of the maximum amniotic fluid depth.
[0083] In a target binarized amniotic fluid mask image, the amniotic fluid region typically appears as a continuous white or a specific color area. To measure the maximum depth of the amniotic fluid, it is necessary to find the longest vertical line segment (i.e., the line segment parallel to the vertical direction of the image) within this region. This line segment represents the direction of maximum depth 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 considered the measurement line for the maximum depth of the amniotic fluid.
[0084] S540: Calculate the actual length corresponding to the measurement line of the maximum amniotic fluid depth to obtain the measurement value of the maximum amniotic fluid depth.
[0085] After obtaining the measurement line for the maximum amniotic fluid depth, its corresponding pixel length needs to be converted to its actual length. This typically involves image resolution and scale information. Based on the image resolution (i.e., pixels per inch or centimeter), the pixel length of the measurement line can be multiplied by a corresponding conversion factor to obtain its length in the real world. This length is the measured value of the maximum amniotic fluid depth.
[0086] The maximum depth of amniotic fluid can be calculated by extracting the largest vertical line segment from the binarized amniotic fluid mask image, ensuring the accuracy of the measurement results. This method directly measures based on the shape and size of the amniotic fluid region in the image, avoiding the subjectivity and uncertainty of human judgment.
[0087] Furthermore, due to the high noise level in ultrasound images, the segmentation model often fails to accurately segment the boundaries of the target region. Therefore, when calculating the maximum amniotic fluid depth measurement line, the original image is binarized. After multiple experiments, the threshold is finally set to 10. The position of the measurement line endpoint is then finely adjusted based on whether the pixel value of a small area near the endpoint is too dark or too white. This optimizes the problem of inaccurate segmentation boundaries in the model.
[0088] In practical applications, since the maximum depth at the pixel level does not readily reflect the actual fetal growth, it needs to be converted to actual length. Specifically, the maximum depth at the pixel level is mapped to actual length using a standard scale. Different ultrasound devices have different pixel-to-actual-length ratios; after conversion, the maximum vertical depth for measuring amniotic fluid can be obtained. For amniotic fluid cross-section measurements in the four quadrants, the average of the maximum vertical depths in the four quadrants is taken as the final vertical depth of the cross-section. The sum of the measurements in the four quadrants is the amniotic fluid index. Finally, connecting the pixels representing the start and end coordinates of the line segment representing the maximum depth displays the corresponding actual measurement value.
[0089] In one embodiment, extracting the maximum vertical line segment from the target binarized amniotic fluid mask image to obtain the measurement line for the maximum amniotic fluid depth includes:
[0090] Step 1: Convert the target binarized amniotic fluid mask image into a two-dimensional matrix.
[0091] The target binarized amniotic fluid mask image is converted into a two-dimensional matrix form, where 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 of the two-dimensional matrix and analyze the white pixel region in each column.
[0093] Traverse each column of the 2D matrix and analyze the continuous distribution of white pixels in each column. Record the start and end positions of the white pixel region in each column, as well as the length of the region (i.e., the number of consecutive 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 amniotic fluid depth.
[0095] Compare the lengths of the white pixel regions in all columns and find the longest region, which is the largest continuous vertical line segment. This line segment represents the direction of maximum depth of amniotic fluid in the ultrasound image and is considered the measurement line for the maximum depth of amniotic fluid.
[0096] In one embodiment, binarizing the original amniotic fluid mask includes:
[0097] The original amniotic fluid mask was binarized, and the threshold was dynamically selected to adapt to different image styles and brightness differences, resulting in a binarized amniotic fluid mask.
[0098] The optimized amniotic fluid mask undergoes binarization, converting pixel values in the image into values containing only black and white. To adapt to different image styles and brightness variations, this invention employs a dynamic threshold selection method. Specifically, a suitable threshold is automatically calculated based on the image's grayscale histogram, mean, standard deviation, and other statistical characteristics. Pixel values greater than this 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 ensures that the binarized amniotic fluid mask accurately reflects the amniotic fluid area under different lighting conditions and image quality. Specifically, the threshold can be set to pixel value + 75. Since different image styles and brightness variations can lead to significant differences, the binarization threshold needs to be dynamically selected. After multiple experiments, the threshold was determined to be the average pixel value of the amniotic fluid area + 75. Simultaneously, an adjusted mask is obtained by ANDing the mask with the binarized black area to avoid the maximum measurement depth line passing through the amniotic fluid limbs.
[0099] In one embodiment, before acquiring the ultrasound image of the amniotic fluid to be measured and inputting the ultrasound image of the amniotic fluid to be measured into a preset YOLOv8 model to identify the number and location of the amniotic fluid sub-images, the method further includes:
[0100] Step 1: Obtain the annotation data of the amniotic fluid ultrasound image. The annotation data includes the polygonal outline annotation of the amniotic fluid dark area and the target detection box annotation of the amniotic fluid sub-image.
[0101] The dataset's annotation information consists of two main parts: ① fine-grained annotations of the amniotic fluid dark areas, i.e., polygonal outlines. ② object detection boxes of the amniotic fluid sub-images, i.e., rectangular boxes.
[0102] Step 2: Train an initial YOLOv8 model based on the labeled data to obtain a preset YOLOv8 model.
[0103] A novel segmentation model was trained using YOLOv8 based on a large amount of labeled data in the aforementioned format. This model adds the function of detecting amniotic fluid sub-images. Based on the number of sub-images detected by the model, the model makes auxiliary judgments by combining the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions, thus obtaining a final number of amniotic fluid sub-images. This facilitates the subsequent determination of the correct number of amniotic fluid depth measurement lines and avoids the problem of measurement failure in multiple regions of amniotic fluid dark areas in single or double images.
[0104] In one embodiment, such as Figure 4 As shown, S400 includes:
[0105] S420: The Canny algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection results.
[0106] The binarized amniotic fluid mask is as follows: Figure 5 As shown, the Canny algorithm is used for edge detection on the binarized amniotic fluid mask. The Canny algorithm is a classic and efficient edge detection algorithm that can effectively identify edge features in an image. By inputting the binarized amniotic fluid mask into the Canny algorithm, edge detection results containing the boundary information of the amniotic fluid region can be obtained. This result is represented as a series of edge points, which accurately depict the contour of the amniotic fluid region. The specific edge detection results are shown below. Figure 6 As shown.
[0107] S440: Combine the edge detection results with the eroded and expanded amniotic fluid mask to obtain enhanced edge information.
[0108] To enhance the accuracy and completeness of edge information, the edge detection results obtained from the Canny algorithm are combined with an amniotic fluid mask that has undergone erosion and dilation processing. The erosion operation removes fine noise and irregular edges from the mask, while the dilation operation fills in small holes and gaps, making 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 region.
[0109] S460: Based on the enhanced edge information and the adjusted amniotic fluid mask, the target binarized mask image is obtained.
[0110] Finally, a target binarized 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 contour of the edge information to ensure that the amniotic fluid region in the mask perfectly matches the edge information. After these processes, the final target binarized mask image will clearly show the boundary and internal features of the amniotic fluid region, providing an accurate basis for subsequent maximum depth measurement. The target binarized mask image is shown in the figure below. Figure 7 As shown.
[0111] Specifically, in this embodiment, for the amniotic fluid contour obtained above, the edge information obtained by edge detection through the Canny algorithm is combined with the original mask after erosion and dilation operations. A 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 amniotic fluid depth measurement.
[0112] In one embodiment, an ultrasound image of the amniotic fluid to be measured is acquired, and the ultrasound image of the amniotic fluid to be measured is input into a preset YOLOv8 model to identify the number and location of the amniotic fluid sub-images, including:
[0113] Step 1: Obtain an ultrasound image of the amniotic fluid to be measured.
[0114] Step 2: Input the ultrasound image of the amniotic fluid to be measured into the preset YOLOv8 model to identify the initial number and location of the amniotic fluid sub-images.
[0115] Step 3: Based on the identified initial number and the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions, determine the final number of amniotic fluid sub-images.
[0116] To obtain a more accurate number of amniotic fluid sub-images, the final number is determined based on the identified initial number, combined with the horizontal and vertical mapping logic of the amniotic fluid segmentation mask. Horizontal mapping logic: In the horizontal direction, adjacent amniotic fluid sub-images are checked for overlap or contiguity. If overlap exists, they are treated as the same amniotic fluid sub-image, and their regions are merged. If contiguity exists but does not overlap, their relative position and size are used to determine whether they should be considered as a larger amniotic fluid sub-image. Vertical mapping logic: In the vertical direction, the focus is on whether the amniotic fluid sub-images span multiple slices or layers of the image. Since amniotic fluid is usually continuous within the uterus, if amniotic fluid sub-images on adjacent slices correspond to each other vertically and are continuous, they are considered different parts of the same amniotic fluid region, and the number of amniotic fluid sub-images is adjusted accordingly. Comprehensive judgment: Combining the horizontal and vertical mapping logic, a comprehensive judgment is made to determine the final number of amniotic fluid sub-images. This number should accurately reflect the actual number of independent amniotic fluid regions present in the image.
[0117] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0118] Based on the same inventive concept, this application also provides an amniotic fluid ultrasound image maximum depth measuring device for implementing the above-mentioned method for measuring the maximum depth of amniotic fluid ultrasound images. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations of one or more embodiments of the amniotic fluid ultrasound image maximum depth measuring device provided below can be found in the limitations of the amniotic fluid ultrasound image maximum depth measuring method described above, and will not be repeated here.
[0119] In one embodiment, such as Figure 8 As shown, a device for measuring the maximum depth of amniotic fluid ultrasound images is provided, comprising:
[0120] The initial recognition module 100 is used to acquire the ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into the preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images;
[0121] The mask segmentation module 200 is used to determine the segmentation model based on the number of amniotic fluid subgraphs, and to segment the amniotic fluid region using the determined segmentation model to obtain the original amniotic fluid mask.
[0122] The adjustment module 300 is used to binarize the original amniotic fluid mask and perform a bitwise AND operation on the black areas in the binarized amniotic fluid mask to obtain the 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, obtain the edge detection result, and enhance the target region in the adjusted amniotic fluid mask according to the edge detection result to obtain the target binarized amniotic fluid mask image.
[0124] The measurement module 500 is used to obtain the maximum depth measurement value of amniotic fluid based on the target binarized amniotic fluid mask image.
[0125] In one embodiment, the measurement module 500 is further configured to extract the maximum vertical line segment in the target binarized amniotic fluid mask image to obtain the measurement line of the maximum amniotic fluid depth; calculate the actual length corresponding to the measurement line of the maximum amniotic fluid depth to obtain the measurement value of the maximum amniotic fluid depth.
[0126] In one embodiment, the measurement module 500 is further configured to convert the target binarized amniotic fluid mask image into a two-dimensional matrix; traverse each column of the two-dimensional matrix and analyze the white pixel regions in each column; based on the white pixel regions, find the largest continuous vertical line segment to obtain the measurement line of the maximum amniotic fluid depth.
[0127] In one embodiment, the adjustment module 300 is further configured to binarize the original amniotic fluid mask and dynamically select a threshold to adapt to different image styles and brightness differences, thereby obtaining a binarized amniotic fluid mask.
[0128] In one embodiment, the initial recognition module 100 is further configured to acquire annotation data of amniotic fluid ultrasound images, including polygonal outline annotations of amniotic fluid dark areas and target detection box annotations of amniotic fluid sub-images; and to train an initial YOLOv8 model based on the annotation data to obtain a preset YOLOv8 model.
[0129] In one embodiment, the edge detection module 400 is further configured to perform edge detection on the binarized amniotic fluid mask using the Canny algorithm to obtain the edge detection result; combine the edge detection result with the eroded and expanded amniotic fluid mask to obtain enhanced edge information; and obtain the target binarized mask image based on the enhanced edge information and the adjusted amniotic fluid mask.
[0130] In one embodiment, the initial identification module 100 is further configured to acquire an ultrasound image of the amniotic fluid to be measured; input the ultrasound image of the amniotic fluid to be measured into a preset YOLOv8 model to identify the initial number and position of the amniotic fluid sub-images; and determine the final number of amniotic fluid sub-images based on the identified initial number and the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions.
[0131] Each module in the aforementioned amniotic fluid ultrasound image maximum depth measurement device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can call and execute the corresponding operations of each module.
[0132] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores preset data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a method for measuring the maximum depth of amniotic fluid ultrasound images.
[0133] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0134] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method for measuring the maximum depth of amniotic fluid ultrasound images.
[0135] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described method for measuring the maximum depth of amniotic fluid ultrasound images.
[0136] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described method for measuring the maximum depth of amniotic fluid ultrasound images.
[0137] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0138] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for measuring the maximum depth of amniotic fluid ultrasound images, characterized in that, The method includes: Acquire an ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into a preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images; Based on the number of amniotic fluid sub-images, a segmentation model is determined, and the determined segmentation model is used to segment the amniotic fluid region to obtain the original amniotic fluid mask. The original amniotic fluid mask is binarized, and the black areas in the binarized amniotic fluid mask are ANDed to obtain the adjusted amniotic fluid mask. An edge detection algorithm is used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection result. The target region in the adjusted amniotic fluid mask is then enhanced based on the edge detection result to obtain the target binarized amniotic fluid mask image. The maximum depth of amniotic fluid is measured based on the target binarized amniotic fluid mask image. The process of acquiring the amniotic fluid ultrasound image to be measured and inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the number and location of amniotic fluid sub-images includes: acquiring the amniotic fluid ultrasound image to be measured; inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the initial number and location of amniotic fluid sub-images; and determining the final number of amniotic fluid sub-images based on the identified initial number and the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions.
2. The method according to claim 1, characterized in that, The step of obtaining the maximum amniotic fluid depth measurement value based on the target binarized amniotic fluid mask image includes: Extract the maximum vertical line segment from the target binarized amniotic fluid mask image to obtain the measurement line of the maximum amniotic fluid depth; Calculate the actual length corresponding to the measurement line of the maximum amniotic fluid depth to obtain the measurement value of the maximum amniotic fluid depth.
3. The method according to claim 2, characterized in that, The step of extracting the maximum vertical line segment from the target binarized amniotic fluid mask image to obtain the measurement line for the maximum amniotic fluid depth includes: The target binarized amniotic fluid mask image is converted into a two-dimensional matrix; Traverse each column of the two-dimensional matrix and analyze the white pixel region 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 amniotic fluid depth.
4. The method according to claim 1, characterized in that, Binarization 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 brightness differences, resulting in a binarized amniotic fluid mask.
5. The method according to claim 1, characterized in that, Before acquiring the amniotic fluid ultrasound image to be measured and inputting the amniotic fluid ultrasound image to be measured into a preset YOLOv8 model to identify the number and location of amniotic fluid sub-images, the process further includes: Obtain annotation data for amniotic fluid ultrasound images, the annotation data including polygonal outline annotations of the amniotic fluid dark area and target detection box annotations of the amniotic fluid sub-image; An initial YOLOv8 model is trained based on the labeled data to obtain a preset YOLOv8 model.
6. The method according to claim 1, characterized in that, The process involves using an edge detection algorithm to perform edge detection on the binarized amniotic fluid mask, obtaining edge detection results, and then enhancing the target region in the adjusted amniotic fluid mask based on the edge detection results to obtain a target binarized amniotic fluid mask image, including: The Canny algorithm was used to perform edge detection on the binarized amniotic fluid mask to obtain the edge detection results. The edge detection results are combined with the eroded and swollen amniotic fluid mask to obtain enhanced edge information; Based on the enhanced edge information and the adjusted amniotic fluid mask, a target binarized mask image is obtained.
7. A device for measuring the maximum depth of amniotic fluid ultrasound images, characterized in that, The device includes: The initial identification module is used to acquire the ultrasound image of the amniotic fluid to be measured, input the ultrasound image of the amniotic fluid to be measured into the preset YOLOv8 model, and identify the number and location of the amniotic fluid sub-images; The mask segmentation module is used to determine the segmentation model based on the number of amniotic fluid sub-images, and to segment the amniotic fluid region using the determined segmentation model to obtain the original amniotic fluid mask. The adjustment module is used to perform binarization on the original amniotic fluid mask and perform AND operation on the black areas in the binarized amniotic fluid mask to obtain the adjusted amniotic fluid mask. The edge detection module is used to perform edge detection on the binarized amniotic fluid mask using an edge detection algorithm, obtain the edge detection result, and enhance the target region in the adjusted amniotic fluid mask based on the edge detection result to obtain the target binarized amniotic fluid mask image. The measurement module is used to obtain the maximum depth measurement value of amniotic fluid based on the target binarized amniotic fluid mask image; The initial identification module is also used to acquire 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-images; and determine the final number of amniotic fluid sub-images based on the identified initial number and the mapping logic of the amniotic fluid segmentation mask in the horizontal and vertical directions.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and apparatus for analyzing amniotic fluid
EP1658484A2
Bladder wall thickness measurement system and methods
US20030229281A1