Peritoneal dialysis fluid turbidity recognition method and system based on computer vision and deep learning

CN122906006APending Publication Date: 2026-10-13THE FIRST AFFILIATED HOSPITAL OF SUN YAT SEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611109057.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

然而,该方法主观性强、个体差异大,轻微浑浊或浑浊初期极易漏诊,容易延误治疗时机

Benefits of technology

利用轻量化卷积神经网络模型的视觉识别能力,通过提取腹透液背景文字的可读性特征进行浑浊度判断,避免了人眼主观差异;采用按患者分组的交叉验证训练策略,确保同一患者的图像不会同时出现在训练集和验证集中,使模型学习浑浊度本身特征,显著提升泛化能力;选用轻量化网络,模型参数量小,可转换为移动端格式部署于智能手机,实现居家实时筛查;通过Grad-CAM热力图可直观显示模型的关注区域,验证模型决策基于临床相关特征,提高了临床可信度;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122906006A_ABST
    Figure CN122906006A_ABST
Patent Text Reader

Abstract

The application discloses a peritoneal dialysis liquid turbidity recognition method and system based on computer vision and deep learning, and comprises the following steps: acquiring a peritoneal dialysis liquid image through a mobile terminal; extracting a liquid region from the image; intercepting a middle upper segment region at 1 / 5 to 4 / 5 of a vertical direction and 1 / 5 to 2 / 3 of a horizontal direction of a drainage bag to obtain a to-be-inspected region image containing background text; inputting the to-be-inspected region image into a pre-trained lightweight convolutional neural network model; the model extracts readability features of the background text and outputs a two-classification result of clarity or turbidity and a confidence score according to the features; the lightweight convolutional neural network model is trained based on a transfer learning strategy, and cross-validation is adopted in a training stage to prevent data leakage according to patient identities; turbidity is objectively recognized through computer vision and deep learning technology; the model has small parameter quantity, fast reasoning speed and can be deployed on a mobile terminal, and can assist home peritoneal dialysis patients to realize early warning of peritonitis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision and intelligent medical image analysis technology, and in particular to a method and system for identifying the turbidity of peritoneal dialysis fluid based on computer vision and deep learning. Background Technology

[0002] Peritoneal dialysis is one of the main renal replacement therapies for patients with end-stage renal disease. Peritonitis is the most common and serious complication of peritoneal dialysis, and turbidity of the dialysis fluid is recognized by the International Society for Peritoneal Dialysis guidelines as the earliest and most indicative clinical sign of peritonitis.

[0003] Currently, home peritoneal dialysis patients mainly rely on visual inspection of the dialysate for turbidity to determine the risk of peritonitis. However, this method is highly subjective and varies greatly from person to person; slight turbidity or early-stage turbidity can easily be missed, potentially delaying treatment. While dialysate white blood cell count and pathogen culture are the gold standard for diagnosing peritonitis, the procedures are cumbersome and the testing cycle is long, making them unsuitable for real-time home monitoring.

[0004] In recent years, deep learning and computer vision technologies have made significant progress in medical image analysis. Some studies have attempted to apply image processing techniques to peritoneal dialysis fluid analysis, but using them for peritoneal dialysis fluid turbidity identification still faces the following challenges: First, the background of images in home environments is complex and the lighting is variable, so the model needs to have good robustness; second, to meet the needs of mobile deployment, the model must be lightweight; finally, there are often multiple images of the same patient. If the dataset is randomly divided, the model may obtain inflated indices by memorizing irrelevant features such as the handwriting of a specific patient, rather than learning the true turbidity features, which seriously affects the generalization ability. Summary of the Invention

[0005] In order to overcome the above-mentioned shortcomings of the prior art, the purpose of this invention is to provide a method and system for identifying the turbidity of peritoneal dialysis fluid based on computer vision and deep learning.

[0006] The technical solution adopted by this invention to solve its technical problem is: a method for identifying the turbidity of peritoneal dialysis fluid based on computer vision and deep learning, comprising the following steps: S1. Obtain an image of the peritoneal dialysis fluid to be identified; S2. Extract the liquid region from the peritoneal dialysis fluid image to obtain the image of the region to be examined, which includes background text. S3. Input the image of the region to be inspected into a pre-trained lightweight convolutional neural network model, and the lightweight convolutional neural network model extracts the readability features of the background text. S4. Output the turbidity classification result based on the readability characteristics; The lightweight convolutional neural network model is trained based on a transfer learning strategy and employs a cross-validation method grouped by patient identity during training.

[0007] As a further improvement of the present invention: the peritoneal dialysis fluid image to be identified is obtained by taking a picture with a mobile terminal camera or importing it from the album; The peritoneal dialysis fluid image is subjected to liquid region extraction to obtain an image of the region to be inspected containing background text. The liquid region extraction specifically includes: converting the peritoneal dialysis fluid image to grayscale, performing Gaussian blurring, adaptive threshold binarization, and morphological closing operation, extracting the maximum contour as the drainage bag bounding box, and cropping the upper part of the drainage bag from 1 / 5 to 4 / 5 of the distance downward from the upper edge of the bounding box and 1 / 5 to 2 / 3 of the distance to the right from the left edge in the vertical direction based on the bounding box, and cropping the image of the region to be inspected containing liquid and background text. After scaling and normalization preprocessing, the image of the region to be inspected is input into a pre-trained lightweight convolutional neural network model. The model extracts the readability features of the background text and outputs the turbidity classification result based on the readability features. The lightweight convolutional neural network model is trained based on a transfer learning strategy, and a cross-validation method based on patient identification is used during training to limit the image data of the same patient to appear only in the training set or the validation set.

[0008] As a further improvement of the present invention: the liquid region extraction of the peritoneal dialysis fluid image in step S2 includes: The peritoneal dialysis fluid image was converted into a grayscale image, smoothed by Gaussian blur, and binarized by an adaptive thresholding algorithm. Perform morphological closing operations on the binarized image, extract the contour with the largest area among all closed contours as the overall contour of the drainage bag, and calculate its minimum bounding rectangle. Based on the minimum bounding rectangle, the upper part of the drainage bag is cut off vertically from 1 / 5 to 4 / 5 of the top edge of the bounding box downwards and from 1 / 5 to 2 / 3 of the left edge to the right, forming a trimmed rectangle; The image to be inspected is cropped from the original image based on the coordinates of the cropping rectangle.

[0009] As a further improvement of the present invention: the lightweight convolutional neural network model is the MobileNetV2 network. After the network is pre-trained on the ImageNet dataset, its top-level classifier is replaced with a binary classification output layer, and fine-tuned using peritoneal dialysis fluid images.

[0010] As a further improvement of the present invention: the readability features of the background text in step S3 include the clarity of the text strokes, the sharpness of the edges, or the degree of occlusion.

[0011] As a further improvement of the present invention: the turbidity classification result in step S4 is a binary classification result of clear or turbid.

[0012] As a further improvement of the present invention: the step S4, which outputs the turbidity classification result and corresponding action suggestions based on readability characteristics, includes: Obtain the classification result and confidence score output by the lightweight convolutional neural network model; when the classification result is clear, display a normal prompt message on the mobile terminal interface; when the classification result is murky, trigger an early warning prompt.

[0013] As a further improvement of the present invention: obtain the class activation map output by the lightweight convolutional neural network model; verify whether the turbidity classification result is derived based on the features of the background text region according to the class activation map.

[0014] As a further improvement of the present invention: before inputting the image of the region to be examined into the lightweight convolutional neural network model, the image of the region to be examined is subjected to privacy-de-suppressing processing to cover or remove patient personal information contained in the image.

[0015] As a further improvement of the present invention, it also includes: generating a Grad-CAM heatmap of the lightweight convolutional neural network model to verify whether the turbidity classification result is derived based on the features of the background text region.

[0016] This invention also includes a peritoneal dialysis fluid turbidity identification system based on computer vision and deep learning, comprising: The image acquisition module is used to acquire images of the peritoneal dialysis fluid to be identified. The region extraction module is used to extract liquid regions from the peritoneal dialysis fluid image to obtain an image of the region to be inspected that includes background text. The turbidity recognition module has a built-in pre-trained lightweight convolutional neural network model, which is used to extract the readability features of the background text and output the turbidity classification result based on the readability features. The early warning module is used to issue an early warning to the user and provide action suggestions for contacting medical institutions when the classification result output by the turbidity identification module is turbid. The lightweight convolutional neural network model is trained based on a transfer learning strategy and employs a cross-validation method grouped by patient identity during the training phase.

[0017] Compared with the prior art, the beneficial effects of the present invention are: Leveraging the visual recognition capabilities of a lightweight convolutional neural network model, turbidity is determined by extracting the readability features of text in the peritoneal dialysis fluid background, avoiding subjective differences in human vision. A cross-validation training strategy based on patient groups ensures that images of the same patient do not appear simultaneously in both the training and validation sets, allowing the model to learn the inherent characteristics of turbidity and significantly improving generalization ability. The lightweight network, with its small number of parameters, can be converted to a mobile format and deployed on smartphones for real-time home screening. Grad-CAM heatmaps visually display the model's areas of interest, validating that the model's decisions are based on clinically relevant features and enhancing clinical reliability. Through the coordinated operation of various modules, the entire process from image acquisition to turbidity discrimination is automated, making it easy to operate and suitable for daily self-monitoring by patients undergoing home peritoneal dialysis. The overall positioning of the drainage bag and the fixed-proportion cropping strategy in the fluid region extraction module effectively eliminates interference from irrelevant areas, allowing the model to focus on the key areas of the dialysis fluid and background text, thus improving recognition accuracy. A lightweight convolutional neural network model with few parameters and fast inference speed is employed, enabling offline real-time inference on smartphones and effectively protecting patient privacy. Grad-CAM heatmaps visually display the model's decision-making focus areas, enhancing the transparency and clinical credibility of the judgment results. The early warning module issues warnings with confidence level indicators when turbidity is detected, helping patients seek medical attention promptly and reducing the risk of delayed diagnosis of peritonitis. Attached Figure Description

[0018] To more clearly illustrate the technical solution, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating the peritoneal dialysis fluid turbidity identification method based on computer vision and deep learning according to the present invention.

[0020] Figure 2 This is a structural framework diagram of the peritoneal dialysis fluid turbidity identification system based on computer vision and deep learning of the present invention.

[0021] Figure 3 This is a schematic diagram of the electronic device structure for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning, as described in this invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0024] Peritoneal dialysis is a common alternative treatment for patients with end-stage renal disease, and peritonitis is its most common and serious complication. Turbidity of the dialysis fluid is recognized by the International Society for Peritoneal Dialysis guidelines as the earliest and most indicative clinical sign of peritonitis. Therefore, accurate and timely identification of turbidity in the dialysis fluid is crucial for early warning and timely intervention in peritonitis.

[0025] Currently, home peritoneal dialysis patients mainly rely on visual observation of the dialysate for turbidity. This method suffers from significant individual variation, and even slight turbidity is easily missed. While white blood cell counts and pathogen culture in dialysate are the gold standard for diagnosis, their long testing cycles and complex procedures cannot meet the needs of real-time home monitoring. In recent years, computer vision and deep learning technologies have provided new approaches to medical image analysis, but their application to peritoneal dialysis turbidity identification still faces many unresolved technical challenges. Home patients relying solely on visual judgment of dialysate turbidity are susceptible to factors such as lighting, viewing angle, and personal experience, resulting in inconsistent judgments and difficulty in identifying slight or early-stage turbidity, potentially delaying treatment. While white blood cell counts and pathogen culture are accurate, they require specialized equipment and considerable time, hindering high-frequency, low-cost home self-testing and failing to meet the timeliness requirements for early warning of peritonitis. Existing methods require precise location of floating objects and calculation of multi-regional edge gradients, involving complex algorithms, high image quality requirements, and decreased accuracy when floating objects are not clearly visible, making efficient operation on mobile devices difficult. Meanwhile, the varying conditions of home shooting (lighting, angle, background, and frosted area of ​​the bag) lead to interference such as overexposure, out-of-focus, and shadows in the images, making it difficult for existing models to stably extract effective features and limiting the practical application effect.

[0026] To address the aforementioned problems, this invention provides a method and system for identifying the turbidity of peritoneal dialysis fluid based on computer vision and deep learning, such as... Figure 1 As shown, the method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning includes the following steps: Step S1: Take a picture of the peritoneal dialysis drainage bag to be tested using the rear camera of the mobile terminal, or directly import a pre-stored image from the local album of the mobile terminal to obtain an image of the peritoneal dialysis fluid.

[0027] Furthermore, a mobile terminal refers to an electronic device capable of operation without a fixed power source or network connection, providing users with communication and information processing capabilities. It typically features hardware such as a touchscreen, camera, and sensors, supporting the installation of various applications and the execution of photo-taking functions. Photography refers to the process of placing a drainage bag containing dialysis fluid flat on a white background paper with clearly printed text, maintaining a shooting distance of 30-40 cm, preferably under bright ambient natural light, so that the text on the background paper can be clearly recorded through the liquid layer, and then using the mobile terminal's camera to capture the image. A peritoneal dialysis fluid image refers to an image captured during photography that includes the overall outline of the drainage bag, the dialysis fluid inside the bag, and the text on the background paper visible through the liquid.

[0028] Preferably, step S1 further includes an image quality pre-inspection step: after shooting or importing, automatically detect whether the image is overexposed, out of focus, or has a resolution lower than a preset threshold; if it does not meet the preset quality standards, prompt the user to reshoot through the interface, and provide improvement suggestions such as "Please avoid reflection" and "Please keep stable" to ensure that the image entering the subsequent process has basic analyzability.

[0029] Step S2: Extract the liquid region from the peritoneal dialysis fluid image obtained in Step S1 to obtain an image of the area to be examined containing background text. The core purpose of this step is to remove background elements such as the frosted area of ​​the drainage bag and the blank area of ​​the background paper, so that subsequent model inference can focus on the clear liquid part of the drainage bag and the text area below it, reducing background interference.

[0030] Furthermore, liquid region extraction refers to the process of locating and cropping key regions from the peritoneal dialysis fluid image, including clear, non-frosted areas of the dialysis fluid and the background text below it. The purpose is to remove irrelevant background areas, allowing subsequent model inference to focus on the contact area between the liquid and the text. The image to be inspected refers to the sub-image output after cropping in the liquid region extraction step, retaining only the core column of the dialysis fluid and the background text visible through the liquid below it. This image will serve as the direct input to a lightweight convolutional neural network model. The frosted area of ​​the drainage bag refers to the semi-transparent or opaque area on the surface of the peritoneal dialysis fluid drainage bag treated with a frosting process. This area is typically located at the top and bottom of the bag, near the tube opening, or where the label is attached. This area cannot clearly display the background text through the liquid and is considered an irrelevant interference area that needs to be removed in the liquid region extraction step. The clear portion of the drainage bag refers to the main analytical section of the permeate fluid within the drainage bag. This section has a transparent bag wall, with no frosted layer or other obstructions between the liquid and the background paper. The text on the background paper can be observed through this liquid, making it the core observation area for determining turbidity. Model inference refers to the process of inputting the image of the area to be examined into a pre-trained lightweight convolutional neural network model, which automatically extracts image features and outputs classification results. Background interference refers to the adverse effects of irrelevant regions in the peritoneal dialysis fluid image, excluding the main permeate fluid and background text, on the model's feature extraction and classification decisions. Removing these regions improves the model's focus on text readability features and increases recognition accuracy.

[0031] Furthermore, the liquid region extraction method is as follows: The acquired peritoneal dialysis fluid image was converted to grayscale and smoothed using Gaussian blur (kernel size 5×5) to suppress noise. Subsequently, an adaptive thresholding algorithm was used to binarize the image, highlighting the boundary between the drainage bag and the background paper. A morphological closing operation (kernel size 5×5, iterations 2) was performed on the binarized image to fill any voids caused by text or labels within the drainage bag, obtaining a continuous and complete drainage bag region. All closed contours were extracted, and the contour with the largest area was selected as the overall contour of the drainage bag. Its minimum bounding rectangle was calculated to obtain the bounding box coordinates (x, y, w, h), where x and y are the pixel coordinates of the upper left corner of the bounding box in the original image, and w and h are the width and height of the bounding box, respectively.

[0032] Based on the obtained drainage bag boundary frame, the cutting area is calculated. Since the permeate typically occupies the upper-middle section of the drainage bag, and the text on the background paper is located below the liquid layer, this embodiment selects the upper-middle section of the drainage bag in the vertical direction: starting from the upper edge of the boundary frame, 1 / 5 of the boundary frame height is taken downwards as the upper cutting boundary; 4 / 5 of the boundary frame height is taken downwards as the lower cutting boundary; horizontally, 1 / 5 of the distance from the left edge is the left boundary, and 1 / 3 of the distance from the right edge is the right boundary. The cutting rectangle determined in this way covers the upper-middle section of the drainage bag (approximately 40% of the bag height) in both the vertical and horizontal directions.

[0033] Mapping the coordinates of the cropped rectangle back to the original image, the image of the area to be inspected is extracted from the original image. This image of the area to be inspected includes the core liquid column of the permeate and the background text visible through the liquid below it, effectively eliminating interference from the drainage bag opening, bottom sediment, and the edges of the background paper.

[0034] The above steps achieve standardized preprocessing of the input image, ensuring that the image regions input to the subsequent model have a consistent spatial correspondence, which is beneficial for the model to learn text readability features.

[0035] Step S3: Scale the image of the region to be inspected output in step S2 to a uniform size of 224×224 pixels, and normalize it according to the mean [0.485, 0.456, 0.406] and standard deviation [0.229, 0.224, 0.225] to form an input tensor. This input tensor is then fed into a pre-trained lightweight convolutional neural network model for forward inference.

[0036] Furthermore, scaling refers to the operation of adjusting the pixel size of the image to be inspected using an interpolation algorithm, so that images of any original size are uniformly transformed into the standard input size required by the model, ensuring the consistency of the model input. Normalization refers to the process of subtracting the mean from the pixel values ​​of the image and then dividing by the standard deviation. Its purpose is to transform the original pixel values ​​from the integer range of 0 to 255 to a standardized distribution centered at 0, so that the distribution of input data is consistent with the data distribution used by the pre-trained model during training, which helps the model to stabilize inference and improve recognition accuracy. The input tensor refers to the multidimensional numerical array obtained after scaling and normalization, with a shape of [1, 3, 224, 224], corresponding to batch size, number of color channels, image height, and image width, respectively. This tensor can be directly fed into the lightweight convolutional neural network model for forward computation. Forward inference refers to the process of performing matrix operations and activation function mappings on the input tensor layer by layer from the input layer to the output layer of a lightweight convolutional neural network model. Each layer performs convolution, pooling, or nonlinear transformations on the input data to extract hierarchical visual features. Finally, the output layer generates probability predictions for two categories through the Softmax function. A lightweight convolutional neural network model refers to a convolutional neural network architecture with relatively few parameters and relatively low computational complexity, such as the MobileNetV2 network. It replaces standard convolution operations with efficient operators such as depthwise separable convolution and inverted residual structures, significantly reducing the model's storage space requirements and inference computation while maintaining high recognition accuracy. This makes it suitable for deployment on devices with limited computing resources, such as mobile terminals.

[0037] Step S4: Perform the corresponding operation based on the classification result output in Step S3: If the classification result is "clear," display the normal prompt message "clear transudate" on the mobile terminal interface, along with the confidence score of this test; if the classification result is "turbid," trigger a visual and / or audible warning, pop up a warning window, display the text prompt "turbid transudate, it is recommended to seek medical attention promptly" and the confidence score, and simultaneously trigger a vibration alert on the mobile terminal. Preferably, a shortcut button for dialing a preset medical institution's contact number is set in the turbidity warning pop-up window to shorten the response time from discovering the problem to seeking medical help.

[0038] Furthermore, "clear" refers to one state of the classification result, indicating that the text on the background paper can be clearly distinguished through the fluid in the peritoneal dialysis drainage bag. The edges of the characters are sharp, and the contrast is obvious, suggesting that the dialysis fluid has not become significantly turbid, and the risk of peritonitis is low. "Turbid" refers to another state of the classification result, indicating that the text on the background paper is difficult or completely illegible through the fluid in the peritoneal dialysis drainage bag. The characters are blurry, the contrast is reduced, or they are obscured by particulate matter, suggesting that the dialysis fluid has become turbid, and there may be a risk of peritonitis. "Normal prompt information" refers to the informative text displayed on the mobile terminal interface when the classification result is "clear," such as "dialysis fluid clear," to inform the user that the current test result is normal and home peritoneal dialysis can continue according to the standard protocol. The confidence score refers to the probability value given by the lightweight convolutional neural network model along with the classification result. It is the probability value of the corresponding category output by the Softmax function, usually presented as a percentage or decimal, used to represent the model's confidence in the current classification result, for reference by users and medical staff.

[0039] By combining a lightweight convolutional neural network model with a liquid region extraction module, the problem of inconsistent turbidity of peritoneal dialysis fluid and lack of objective quantitative standards in traditional subjective judgment by the naked eye can be solved. It realizes automated identification of turbidity, output of confidence of classification results and visualization and interpretability analysis. At the same time, based on the cross-validation strategy by patient group and the closed-loop optimization model of home monitoring log, the clinical application value and decision accuracy of home peritoneal dialysis screening are improved.

[0040] As another embodiment of the present invention, the step of acquiring or importing peritoneal dialysis fluid images from a mobile terminal camera to obtain raw peritoneal dialysis fluid images for analysis includes: The original peritoneal dialysis fluid image can be obtained by taking a picture of the peritoneal dialysis fluid drainage bag under test using the rear camera of the mobile terminal, or by importing a pre-stored peritoneal dialysis fluid image from the local album of the mobile terminal.

[0041] The peritoneal dialysis fluid image refers to an image that includes the overall outline of the drainage bag, the dialysis fluid inside the bag, and the background paper text visible through the fluid.

[0042] During the shooting, place the drainage bag containing the exudate flat on a white background paper with clear text printed on it, maintaining a shooting distance of 30-40 cm, so that the text on the background paper can be clearly recorded through the liquid layer.

[0043] In this embodiment, preferably, a framing guide frame is superimposed on the shooting interface. The shape of the guide frame matches the appearance of the drainage bag. When the overlap between the outline of the drainage bag and the guide frame reaches a preset threshold, shooting is automatically triggered or the user is prompted to manually press the shutter to reduce human framing deviation.

[0044] In this embodiment, after the peritoneal dialysis fluid image is captured or imported, an image quality pre-check is performed to detect whether the image has quality problems such as overexposure, out-of-focus, or resolution below a preset threshold. If it does not meet the preset quality standard, the corresponding improvement suggestions are displayed on the interface and the user is prompted to retake the image. If it meets the quality standard, the liquid area is further extracted from the image.

[0045] As another embodiment of the present invention, the step of extracting the region to be examined containing background text from the peritoneal dialysis fluid image includes: The peritoneal dialysis fluid image was converted into a grayscale image, and Gaussian blur was applied to smooth it to suppress noise. An adaptive thresholding algorithm was then used to binarize the smoothed image.

[0046] The grayscale image refers to a single-channel image that retains only brightness information and discards color information. The red, green and blue channel values ​​of each pixel in the original color image are calculated into grayscale values ​​from 0 to 255 using the weighted formula (R×0.299 + G×0.587 + B×0.114) to reduce the computational load of subsequent processing and highlight the brightness and darkness contrast features of the image.

[0047] The Gaussian blur refers to the operation of spatial domain filtering of an image using a convolution kernel generated by a Gaussian function. The original pixel value is replaced by the weighted average of each pixel and its neighboring pixels. The weights are determined by a Gaussian distribution, and the neighboring pixels closer to the center pixel have greater weights. This can effectively suppress high-frequency random noise in the image and make subsequent binarization processing more stable.

[0048] The adaptive threshold algorithm refers to dynamically calculating the segmentation threshold of each pixel based on the brightness distribution of the local neighborhood of the image, rather than using a single global threshold binarization method. In this embodiment, a parameter combination with a neighborhood size of 11 pixels and a constant of 2 is preferred, which can effectively highlight the boundary between the drainage bag and the background paper under uneven lighting conditions.

[0049] In this embodiment, morphological closing operations are performed on the binarized image to extract all closed contours. The contour with the largest area is selected as the overall contour of the drainage bag, and its minimum bounding rectangle is calculated. The morphological closing operation refers to a combined morphological processing method that first performs a dilation operation on the binary image and then performs an erosion operation. The dilation operation expands the white area outward to fill small holes and breaks, and the erosion operation shrinks the white area inward to restore the original boundary contour. After the closing operation, the holes inside the drainage bag caused by the transparent tube wall, label or handwritten text can be filled to obtain a continuous and complete drainage bag area. In this embodiment, a 5×5 pixel rectangular structural element is selected and the closing operation is performed iteratively twice.

[0050] The closed contour refers to the set of outer boundary points of the white connected region in a binary image, which is composed of continuous boundary pixels connected end to end, and each closed contour surrounds an independent white region.

[0051] The maximum area contour refers to the closed contour with the largest number of pixels within the enclosed area, which corresponds to the largest white connected region in the image. Under normal shooting conditions, this is the area where the drainage bag is located.

[0052] The minimum bounding rectangle refers to a rectangle that can completely enclose the outline and whose sides are parallel to the image coordinate axes. It is determined by the coordinates of the upper left corner (x, y) and four parameters: width w and height h, to obtain the bounding box coordinates of the drainage bag.

[0053] In this embodiment, based on the bounding box, a cropped rectangle is formed by vertically cropping the upper section of the drainage bag, extending from 1 / 5 to 4 / 5 of the way down from the top edge of the bounding box and from 1 / 5 to 2 / 3 of the way to the right from the left edge. This upper section refers to the portion of the drainage bag slightly above the middle in the vertical direction, accounting for approximately 40% of the total bag height. This area typically contains the clearest portion of the permeated liquid, where the visual relationship between the liquid and background text is most distinct. The area to be inspected is then cropped from the original image according to the coordinates of the cropped rectangle.

[0054] The image of the region to be inspected refers to the sub-image output after the liquid region extraction step, which retains only the core liquid column of the permeated liquid and the background text visible through the liquid below it. This image will be used as the direct input to the subsequent lightweight convolutional neural network model.

[0055] As another embodiment of the present invention, the step of extracting text readability features and determining clarity / turbidity using a lightweight convolutional neural network model includes: The image of the region to be inspected output in step S2 is scaled to a uniform size of 224×224 pixels, and then the scaled image is normalized. The scaling refers to adjusting the width and height of the image to be inspected to the standard input size required by the model through an interpolation algorithm, so that images acquired at different shooting distances and resolutions have the same spatial dimension in front of the input model, thus satisfying the fixed requirement of the lightweight convolutional neural network model for the shape of the input tensor.

[0056] The normalization process involves subtracting the preset mean [0.485, 0.456, 0.406] from the red, green, and blue channel values ​​of each pixel in the image and dividing by the preset standard deviation [0.229, 0.224, 0.225]. This maps the original pixel values ​​in the range of 0 to 255 to a zero-centered standard distribution, ensuring that the input data distribution is consistent with the data distribution used by the model during ImageNet pre-training. This helps stabilize the numerical calculation process of forward inference and improves recognition accuracy. The processed multidimensional array is the input tensor, which is a four-dimensional floating-point array with a shape of [1, 3, 224, 224], corresponding to the batch number in a single inference, the three color channels of the color image, the image height, and the image width, respectively. This is the standard input format received by lightweight convolutional neural network models.

[0057] The input tensor is fed into a pre-trained lightweight convolutional neural network model for forward inference.

[0058] The lightweight convolutional neural network model refers to a compact convolutional neural network constructed using efficient operators such as depthwise separable convolution and inverted residual structures. In this embodiment, the MobileNetV2 network is preferred. This network contains 17 inverted residual blocks and has a total of about 3.5M parameters. While maintaining high feature extraction capabilities, it significantly reduces computational complexity and storage space requirements, making it suitable for deployment on mobile terminals with limited computing resources, such as smartphones.

[0059] The inverted residual block refers to a network construction unit that first expands the number of channels through pointwise convolution, then extracts spatial features in the expanded high-dimensional space through depthwise convolution, and finally compresses the number of channels through pointwise convolution. Since its input and output are both low-dimensional tensors and the intermediate layers are high-dimensional tensors, it resembles an inverted structure of a normal residual block and can extract rich hierarchical visual features with less computation.

[0060] We load the weights obtained from pre-training on the ImageNet large-scale natural image dataset as initial parameters.

[0061] The pre-trained weights refer to the convolutional kernel parameters learned by the model on a general image recognition task containing 1.28 million images and 1,000 categories. These parameters already have the ability to extract general low-level visual features such as edges and textures. Subsequently, the original top layer of 1,000 categories is removed and replaced with a fully connected classification layer with an output dimension of 2. The weights of the entire network are then fine-tuned using a labeled peritoneal dialysis fluid image dataset, enabling the model to learn specific visual patterns related to the turbidity of peritoneal dialysis fluid on the basis of its general feature extraction capabilities.

[0062] The model automatically extracts the readability features of the background text through layer-by-layer forward propagation. The forward inference refers to the process in which the input tensor undergoes operations such as convolution, activation function, and pooling from shallow to deep layers in the model, gradually transforming the low-level pixel information into high-level semantic features. Finally, the softmax function is used to generate classification probabilities in the output layer.

[0063] The text readability features refer to the multi-dimensional visual attributes that reflect whether the background text can be clearly identified, including but not limited to the clarity of the text strokes (whether the stroke edges are sharp and distinct), edge sharpness (grayscale transition gradient between the text outline and the background), character contrast (the difference between the grayscale of the text and the grayscale of the surrounding liquid), and the degree of obstruction or blurring caused by liquid turbidity (whether the text strokes are interrupted by particles or appear as a foggy blur).

[0064] The Softmax function refers to a normalized exponential function that maps the raw real-valued scores output by the model to probability values ​​between 0 and 1, with the sum of probabilities for all categories being 1. This exponential amplification of score differences makes the probability distribution sharper, facilitating a clearer distinction between clear and murky categories. The model ultimately outputs two probability values. The category label corresponding to the higher probability is taken as the classification result, which is either "clear" or "murky." Simultaneously, the higher probability value is used as a confidence score, representing the model's degree of certainty regarding the current classification result. The confidence score ranges from 0.5 to 1.0; a score closer to 1.0 indicates greater certainty, while a score closer to 0.5 indicates the model is on the decision boundary with higher uncertainty. This score can be simultaneously displayed in the user interface for patients and medical staff to refer to, and a prompt for re-encoding is given when the confidence score falls below a preset threshold to reduce the risk of misjudgment.

[0065] As another embodiment of the present invention, the step of displaying "clear" or "cloudy" based on the identification result and proposing corresponding action suggestions includes: Obtain the classification results and confidence scores output by the lightweight convolutional neural network model.

[0066] The classification result refers to the category label determined by the model after reasoning about the input image, which is either "clear" or "cloudy".

[0067] The confidence score refers to the probability value of the corresponding category output by the Softmax function, which reflects the model's confidence in the current judgment result. The value ranges from 0.5 to 1.0, and the closer the value is to 1.0, the higher the confidence.

[0068] In this embodiment, when the classification result is "clear", a normal prompt message is displayed on the mobile terminal interface.

[0069] The normal notification message refers to informative text presented in soft colors such as green or blue, such as "Clear fluid, home dialysis can continue," along with the confidence score of this test to enhance the user's trust in the test results. In addition, the test results, confidence score, and test date and time are automatically recorded and appended to the home monitoring log in chronological order.

[0070] The home monitoring log refers to a structured data record stored locally on the mobile terminal. Each record includes the detection time, classification result, and confidence score. It supports filtering and viewing by daily, weekly, and monthly time ranges and can be exported as a table file or generate a trend line chart. It can be used to track the continuous changes in the patient's diathermy fluid status during daily follow-up examinations and can also be provided to medical staff as an objective reference for home monitoring during medical visits.

[0071] In this embodiment, a multimodal early warning mechanism is triggered when the classification result is "turbid".

[0072] The multimodal early warning mechanism refers to a combined alert method that simultaneously sends warnings to the user through visual, auditory, and tactile channels. Specifically, an alert pop-up window appears on the mobile terminal interface. This pop-up window is a modal dialog box presented in a warning color such as red or orange. The content includes the turbidity determination result (such as the words "turbid percolation fluid"), the confidence score, and a prominent note suggesting "Seek medical attention promptly." The user must manually confirm to close the window to ensure that the warning information is fully read. At the same time, the mobile terminal's speaker plays a preset prompt tone or alarm tone for audible warning, and a vibration motor is triggered to generate vibration feedback for tactile warning, allowing the patient to perceive the abnormality in a timely manner even when not looking at the screen or in a noisy environment.

[0073] In a further alternative approach, the steps also include an early warning escalation mechanism. When two or more consecutive tests show turbidity, the early warning level is automatically escalated from a regular early warning to an emergency early warning.

[0074] The emergency warning refers to: in addition to triggering stronger prompts locally on the mobile terminal (such as increasing the frequency of pop-ups and extending the duration of prompt sounds), a warning notification is also sent to a preset emergency contact via SMS or instant messaging. The notification includes the most recent test result, the test time, and a prompt to "please contact the patient in time", further reducing the risk of delayed medical treatment due to the patient's personal negligence or inconvenience.

[0075] like Figure 2 As shown, the present invention also includes a peritoneal dialysis fluid turbidity recognition system based on computer vision and deep learning, including: an image acquisition module 201, a liquid region extraction module 202, a turbidity recognition module 203, and an early warning module 204. The image acquisition module 201 is used to capture images of peritoneal dialysis fluid using a mobile terminal camera. During capture, the drainage bag is placed flat on a white background paper with printed text, and the image is taken at a distance of 30-40 cm under natural light. Artificial light can be used to supplement ambient light if necessary. The image includes the overall outline of the drainage bag, the permeate fluid inside the bag, and the text on the background paper visible through the fluid. This module can also integrate quality pre-inspection and privacy removal functions. The liquid region extraction module 202 is used to extract the region to be inspected containing background text from the original image. Its processing flow is as follows: First, the image is converted to grayscale, then subjected to Gaussian blur and adaptive threshold binarization. Holes are filled using morphological closing operations, and the contour of the largest connected component is extracted as the overall bounding box of the drainage bag. Second, based on this bounding box, the upper section of the drainage bag is cropped vertically from 1 / 5 to 4 / 5 of the way down from the upper edge of the bounding box, and from 1 / 5 to 2 / 3 of the way to the right from the left edge. Finally, the image of the region to be inspected, containing the main body of the exudate and the background text visible through the liquid, is cropped, effectively eliminating interference from the tube opening, bag bottom deposits, and the edges of the background paper. If no effective contour is detected due to abnormal lighting, the cropping is reversed to the central 60% ratio as a fallback solution. The turbidity recognition module 203 is used to extract the readability features of background text in the image of the region to be inspected and output the turbidity classification result. This module incorporates a lightweight convolutional neural network model (preferably MobileNetV2), containing 17 inverted residual blocks with a total parameter count of approximately 3.5M. The input is a 224×224 pixel image of the region to be inspected. After layer-by-layer feature extraction, the feature map is compressed by global average pooling, and finally, a fully connected layer outputs the binary classification probability. The model is trained using a transfer learning strategy: loading ImageNet pre-trained weights to initialize the network parameters, replacing the top-level classifier with a binary classification output layer, and fine-tuning the entire network using a peritoneal dialysis fluid image dataset. The early warning module 204 is used to perform corresponding operations based on the turbidity identification result. When the classification result is "clear", it displays "clear permeate, home monitoring can continue" and the confidence level; when the classification result is "turbid", it triggers a visual early warning, displays the warning message "turbid permeate, it is recommended to seek medical attention in time", and attaches the current confidence level value to assist the patient in taking timely medical measures.

[0076] In another embodiment of the present invention, the image acquisition module 201 is specifically used for: The mobile terminal's rear camera is used to take a picture. An auxiliary viewfinder is displayed in the shooting interface to guide the user to place the drainage bag containing the perfusion fluid flat on a white background paper with fixed text. The shooting distance should be 30-40 cm under natural light conditions, and artificial light should be used if necessary to ensure that the text on the background paper can be clearly recorded through the liquid layer. After the shooting is completed, an image of the peritoneal dialysis fluid is obtained, which includes the overall outline of the drainage bag, the perfusion fluid inside the bag, and the text on the background paper that is visible through the liquid.

[0077] In another embodiment of the present invention, the image acquisition module 201 is specifically used for: An image quality pre-inspection unit is added to automatically detect whether the image has quality problems such as overexposure, out-of-focus, or resolution below a preset threshold after shooting. If the image does not meet the preset quality standards, the user is prompted to reshoot through the interface, and corresponding improvement suggestions are given (such as "Please avoid reflections" and "Please keep stable") to ensure that the image entering the subsequent processing has basic analyzability.

[0078] In another embodiment of the present invention, the liquid region extraction module 202 is specifically used for: The peritoneal dialysis fluid image was converted to grayscale, smoothed using Gaussian blur, and then binarized using an adaptive thresholding algorithm to highlight the boundary between the drainage bag and the background paper. Morphological closing operations were performed on the binarized image to fill the holes inside the drainage bag caused by text or labels, obtaining a continuous and complete drainage bag region. The largest area contour among all closed contours was extracted as the overall contour of the drainage bag, and its minimum bounding rectangle was calculated to obtain the bounding box coordinates of the drainage bag.

[0079] Based on the bounding box, a cropping rectangle is formed by vertically cropping the upper section of the drainage bag from 1 / 5 to 4 / 5 of the way down from the top edge of the bounding box, and from 1 / 5 to 2 / 3 of the way to the right from the left edge. The area to be inspected is then cropped from the original image according to this cropping rectangle. If no valid contour is detected due to abnormal lighting or shooting angle deviation, the cropping is reverted to a preset fixed central proportion as a fallback solution.

[0080] In another embodiment of the present invention, the turbidity identification module 203 is specifically used for: The built-in lightweight convolutional neural network model is specifically the MobileNetV2 network. This network uses the inverted residual structure as the core building block and contains 17 inverted residual blocks with a total of about 3.5M parameters. It features low computational cost and fast inference speed, making it suitable for deployment on resource-constrained devices such as mobile terminals.

[0081] A transfer learning strategy was employed for training: First, weights pre-trained on the ImageNet large-scale natural image dataset were used as the initial state of the network to fully utilize its prior knowledge in general visual feature extraction. Then, the top 1000-class fully connected layer of the original network was removed and replaced with a fully connected layer with an output dimension of 2, corresponding to the "clear" and "turbid" categories respectively. Finally, the weights of the entire network, including the new classification layer, were fine-tuned using a labeled peritoneal dialysis fluid image dataset, enabling the model to learn specific visual features related to text readability in peritoneal dialysis fluid backgrounds. During training, cross-entropy loss, the AdamW optimizer, and cosine annealing learning rate scheduling were used, along with label smoothing regularization to suppress overfitting. This approach balances the need for lightweight deployment with high-precision recognition performance.

[0082] In another embodiment of the present invention, the turbidity identification module 203 is specifically used for: The lightweight convolutional neural network model is adopted as MobileNetV3-Small network or ShuffleNetV2 network to further reduce the number of parameters and inference latency, and adapt to mobile terminals with lower performance.

[0083] In another embodiment of the present invention, the turbidity identification module 203 is specifically used for: A threshold adjustment unit is included, allowing users or clinicians to adjust the sensitivity threshold for classification decisions based on actual needs, achieving a balance between sensitivity and specificity. For example, during peak seasons for peritonitis or for high-risk patients, the turbidity threshold can be lowered to increase sensitivity and reduce missed diagnoses; while in routine screening, the threshold can be increased to reduce false alarm rates.

[0084] In another embodiment of the present invention, the early warning module 204 is specifically used for: When the turbidity recognition module outputs a classification result of turbidity, a warning pop-up window appears on the mobile terminal interface. The pop-up window includes the turbidity judgment result (such as the words "turbid permeate"), the confidence score output by the lightweight convolutional neural network model (presented as a percentage or decimal), and a prominent note that "it is recommended to seek medical attention in time". At the same time, the mobile terminal is triggered to provide sound and / or vibration prompts to enhance the warning effect and ensure that the user can perceive the abnormality in time even when not looking at the screen. In another embodiment of the present invention, the warning output module is further used for: When the turbidity identification module outputs a clear classification result, a normal prompt message "Clear Translucent Fluid" is displayed on the mobile terminal interface, along with the confidence score of this test, to enhance the user's trust in the test results. Simultaneously, the warning output module automatically records the test result (clear or turbid), the confidence score, and the test date and time, generating a home monitoring log in chronological order. This home monitoring log can be stored locally on the mobile terminal for patients to review trend changes daily, and can also be exported or screenshotted during patient visits for reference by medical staff, providing continuous home monitoring data support for clinical decision-making.

[0085] In another embodiment of the present invention, the warning output module is further used for: When multiple consecutive test results are turbid, or the confidence score remains below the preset threshold, the warning level is automatically upgraded. For example, the frequency of the prompt pop-up window is increased, the duration of the sound prompt is extended, or a warning notification is sent to the preset emergency contact via SMS or instant messaging, further reducing the risk of delayed medical treatment due to patient negligence.

[0086] The system described above is only illustrated by the division of the above functional modules. In practical applications, the functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to the actual situation to complete all or part of the functions described above. The modules described in the embodiments of this invention can be implemented in software or hardware. The names of the modules do not necessarily constitute a limitation on the module itself.

[0087] The present invention also includes an electronic device, which may be a smartphone, tablet computer, or a dedicated portable peritoneal dialysis monitor. For example... Figure 3 As shown, the electronic device 4000 includes a processor 4001 and a memory 4003, wherein the processor 4001 and the memory 4003 are connected via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004 and a computer program stored in the memory and executable on the processor. The transceiver 4004 is used for data interaction between electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of this electronic device 4000 does not constitute a limitation on the embodiments of the present invention.

[0088] Processor 4001 is used to read and execute computer program instructions stored in memory 4003. When the computer program is executed by processor 4001, processor 4001 performs the peritoneal dialysis fluid turbidity identification process according to the steps in the aforementioned method embodiments, including acquiring peritoneal dialysis fluid images, performing fluid region extraction, calling a lightweight convolutional neural network model for forward inference, and outputting classification results and warnings. Processor 4001 may be a combination of one or more of a central processing unit, a graphics processing unit, a neural network processing unit, or a digital signal processor. Preferably, when processor 4001 includes a neural network processing unit, the forward inference operation of the lightweight convolutional neural network model can be hardware-accelerated by the neural network processing unit to further reduce inference latency and power consumption.

[0089] Bus 4002 is a communication channel connecting the various hardware components in the electronic device, used to realize data exchange and control signal transmission between processor 4001, memory 4003, transceiver 4004, and other peripheral devices such as cameras and displays. Bus 4002 can be one or more of an industry standard architecture bus, a peripheral component interconnect standard bus, a serial advanced technology accessory bus, or a universal serial bus. Through bus 4002, processor 4001 can read instructions and data from memory 4003, send shooting control signals to the camera and receive image data, and send display content to the display screen. In one optional embodiment, the electronic device can complete the entire recognition process from image acquisition to warning output offline, without uploading images to a cloud server, effectively protecting patient privacy. In another optional embodiment, the electronic device also includes a communication module for sending a warning notification to a preset emergency contact when the detection result is cloudy.

[0090] The memory 4003 is connected to the processor 4001 and is used to store computer program instructions, weight parameters of a lightweight convolutional neural network model, and home monitoring log data. The memory 4003 may include volatile and non-volatile memory. Preferably, the computer program and model weight parameters are stored in non-volatile memory (such as flash memory) to ensure persistent storage even after power loss. The computer program is loaded into volatile memory (such as random access memory) for execution, temporarily caching intermediate data generated during program execution. The memory 4003 may also include an external memory card interface for expanding storage capacity.

[0091] Transceiver 4004 is an interface module for data communication between the electronic device and external devices or networks. Transceiver 4004 can be a wireless communication module, such as a Wi-Fi module, Bluetooth module, or cellular mobile communication module, or it can be a wired communication interface. In one optional embodiment, when the turbidity identification module outputs a classification result of turbidity, processor 4001 sends an SMS or instant messaging alert to a preset emergency contact via transceiver 4004. In another optional embodiment, with user authorization, processor 4001 uploads home monitoring logs to a medical institution's data management system via transceiver 4004, allowing medical staff to remotely view the patient's long-term monitoring data. When the electronic device is in offline working mode, transceiver 4004 can be in sleep mode to save power.

[0092] Among them, electronic devices can also be terminal devices. A terminal device can be any terminal device that can install applications and access web pages through applications, including at least one of smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, smart TVs, and smart in-vehicle devices.

[0093] It should be noted that, Figure 3 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0094] This invention also includes a computer-readable storage medium storing a computer program thereon. The computer-readable storage medium refers to any physical carrier capable of storing program code, and can be a non-volatile storage medium such as the internal memory of a mobile terminal (e.g., FLASH memory chip), an external storage card (e.g., TF card, SD card), a USB flash drive, an optical disc, a cloud server's hard drive, or a solid-state drive. This embodiment does not limit the specific physical form of the storage medium, as long as it can be recognized by a computer or a mobile terminal's reading device and have the program code loaded therein.

[0095] When the computer program is executed by the processor of the mobile terminal, the processor performs the peritoneal dialysis fluid turbidity identification process according to method steps S1 to S4. Specifically, after the computer program is loaded into memory, the processor performs the following operations in sequence according to the program instructions: calling the mobile terminal's camera to capture or importing peritoneal dialysis fluid images from the album (S1); performing fluid region extraction based on drainage bag positioning and fixed-ratio cropping of the upper and middle sections of the image to obtain an image of the region to be inspected (S2); scaling and normalizing the image of the region to be inspected and inputting it into a pre-trained lightweight convolutional neural network model for forward inference to obtain a classification result of clear or turbid fluid and a confidence score (S3); and displaying a normal prompt message or triggering a multimodal warning on the display screen according to the classification result (S4).

[0096] Optionally, the computer program further includes a function to generate interpretable output of Grad-CAM class activation maps: when the user selects to view interpretable output, the processor obtains gradients and feature maps from the last convolutional layer of the lightweight convolutional neural network model, generates a heatmap after weighted summation and upsampling, and displays it on the screen as a pseudo-color overlay on the image of the region to be inspected.

[0097] In one alternative approach, the pre-trained weights of the lightweight convolutional neural network model are stored along with the computer program in the computer-readable storage medium, allowing the device to perform inference directly upon first use without requiring network download. In another alternative approach, the pre-trained weights are downloaded from a designated remote server and stored in local storage when the user first launches the program, reducing the initial footprint of the computer-readable storage medium while ensuring the user receives the latest version of the model weights.

[0098] Through the computer-readable storage medium, medical institutions or individual users who do not have deep learning development capabilities can directly install and run the above-mentioned peritoneal dialysis fluid turbidity identification method on a general mobile terminal without having to train a model or write program code themselves. This lowers the barrier to entry for the use of the present invention and is conducive to the large-scale promotion and application of home peritoneal dialysis.

[0099] This invention can be implemented as a system, method, or computer program product. Therefore, it can be specifically implemented in the following forms: it can be entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, this invention can also be implemented as a computer program product contained in one or more computer-readable media, which includes computer-readable program code.

[0100] In summary, after reading this invention document, those skilled in the art can make various other corresponding modifications to the technical solutions and concepts based on this invention without creative mental effort, and all of these modifications fall within the scope of protection of this invention.

Claims

1. A method for identifying the turbidity of peritoneal dialysis fluid based on computer vision and deep learning, characterized in that, Includes the following steps: S1. Obtain an image of the peritoneal dialysis fluid to be identified; S2. Extract the liquid region from the peritoneal dialysis fluid image to obtain the image of the region to be examined, which includes background text. S3. Input the image of the region to be inspected into a pre-trained lightweight convolutional neural network model, and the lightweight convolutional neural network model extracts the readability features of the background text. S4. Output the turbidity classification result based on the readability characteristics; The lightweight convolutional neural network model is trained based on a transfer learning strategy and employs a cross-validation method grouped by patient identity during training.

2. The method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning according to claim 1, characterized in that, Step S2, which involves extracting the liquid region from the peritoneal dialysis fluid image, includes: The peritoneal dialysis fluid image was converted into a grayscale image, smoothed by Gaussian blur, and binarized by an adaptive thresholding algorithm. Perform morphological closing operations on the binarized image, extract the contour with the largest area among all closed contours as the overall contour of the drainage bag, and calculate its minimum bounding rectangle. Based on the minimum bounding rectangle, the upper part of the drainage bag is cut off vertically from 1 / 5 to 4 / 5 of the top edge of the bounding box downwards and from 1 / 5 to 2 / 3 of the left edge to the right, forming a trimmed rectangle; The image to be inspected is cropped from the original image based on the coordinates of the cropping rectangle.

3. The method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning according to claim 1, characterized in that, In step S3, the lightweight convolutional neural network model is the MobileNetV2 network. After the MobileNetV2 network is pre-trained on the ImageNet dataset, its top-level classifier is removed and replaced with a new classifier for binary classification of turbidity. The weights are then fine-tuned using peritoneal dialysis fluid images.

4. The method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning according to claim 3, characterized in that, The readability features of the background text in step S3 include the clarity of the text strokes, the sharpness of the edges, or the degree of occlusion.

5. The method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning according to claim 1, characterized in that, In step S4, the turbidity classification result is a binary classification result of clear or turbid.

6. The method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning according to claim 5, characterized in that, The step S4, which outputs the turbidity classification result and corresponding action suggestions based on readability characteristics, includes: Obtain the classification result and confidence score output by the lightweight convolutional neural network model; when the classification result is clear, display a normal prompt message on the mobile terminal interface; when the classification result is murky, trigger an early warning prompt.

7. The method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning according to claim 6, characterized in that, Obtain the class activation map output by the lightweight convolutional neural network model; verify whether the turbidity classification result is derived based on the features of the background text region according to the class activation map.

8. The method for identifying peritoneal dialysis fluid turbidity based on computer vision and deep learning according to claim 7, characterized in that, Before inputting the image of the region to be inspected into the lightweight convolutional neural network model, the image of the region to be inspected is subjected to privacy-de-sore processing.

9. A peritoneal dialysis fluid turbidity identification system based on computer vision and deep learning, characterized in that, include: The image acquisition module is used to acquire images of the peritoneal dialysis fluid to be identified. The region extraction module is used to extract liquid regions from the peritoneal dialysis fluid image to obtain an image of the region to be inspected that includes background text. The turbidity recognition module has a built-in pre-trained lightweight convolutional neural network model, which is used to extract the readability features of the background text and output the turbidity classification result based on the readability features. The early warning module is used to issue an early warning to the user and provide action suggestions for contacting medical institutions when the classification result output by the turbidity identification module is turbid. The lightweight convolutional neural network model is trained based on a transfer learning strategy and employs a cross-validation method grouped by patient identity during the training phase.

10. The peritoneal dialysis fluid turbidity identification system based on computer vision and deep learning according to claim 9, characterized in that, The region extraction module is used to locate the overall outline of the drainage bag, and vertically extract the upper part of the drainage bag from 1 / 5 to 4 / 5 of the way down from the upper edge of the boundary frame, and from 1 / 5 to 2 / 3 of the way to the right from the left edge, to obtain the liquid area.