Method for measuring volume of liquid in drainage bag based on computer vision

Through deep learning technology based on computer vision, the problem of inaccurate measurement of liquid volume in drainage bags and lack of real-time accurate measurement is solved, and fast and accurate measurement of liquid volume is achieved, assisting medical staff in judging the condition and making treatment decisions.

CN119723081APending Publication Date: 2025-03-28THE THIRD AFFILIATED HOSPITAL OF SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411787692.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The prior art has problems such as inaccurate data and lack of real-time accurate measurement in liquid volume measurement in drainage bags, which is difficult to meet the needs of clinical applications.

Method used

Using a computer vision-based method, through image acquisition and data set division, image data preprocessing, building a drainage liquid volume prediction model and iterative training, deep learning technology is used to quickly and accurately measure the drainage liquid volume.

Benefits of technology

It realizes rapid and accurate measurement of the liquid volume in the drainage bag, assists medical staff in accurately judging the patient's condition and making treatment decisions, and improves the convenience and safety of measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723081A_ABST
    Figure CN119723081A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of medical treatment. The invention discloses a method for measuring the volume of liquid in a drainage bag based on computer vision. The method comprises the following steps: an image acquisition and data set division step, an image data preprocessing step, a drainage liquid volume prediction model building step, a drainage liquid volume measurement deep learning model iterative training step and a drainage liquid volume prediction step. Based on the steps, drainage liquid can be separated from background pixels through an image semantic segmentation technology to serve as prior information of drainage liquid volume prediction, regression prediction is conducted on the drainage liquid volume through the deep convolutional network, and then the measured value of the drainage liquid volume in the drainage bag can be rapidly and accurately obtained. The drainage bag has the advantages that the volume of liquid in the drainage bag can be rapidly and accurately measured to assist medical staff in accurately judging the condition of a patient and making a treatment decision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of medical technology, and more specifically, to a method for measuring the volume of liquid in a drainage bag based on computer vision. Background Art

[0002] Drainage refers to a medical technique that uses medical surgical techniques to remove abnormal fluid substances from the human body. In clinical practice, measuring the volume of drainage fluid can well reflect the accumulation of fluid in the patient's body, thereby assisting medical staff in judging the patient's condition and treatment effect and deciding the timing of tube removal. Therefore, measuring the volume of drainage fluid is very important for evaluating the patient's condition and treatment effect.

[0003] At present, the common method for measuring the volume of drainage fluid in clinical practice is to use a scale measurement method, which mainly relies on the scale on the drainage bag. Although this method can meet certain needs, it is easy to cause inaccurate measurement data during use due to the plasticity of the drainage bag, thereby affecting the judgment of the patient's condition and the formulation of treatment decisions; in addition, the existing measurement method also lacks automatic recording and transmission of data, and cannot achieve real-time and accurate measurement of the drainage fluid volume, which is difficult to meet actual application needs.

[0004] The Chinese patent application with publication number CN111265726A discloses a drainage fluid measurement device and method, which mainly uses a Murphy's dropper as a drainage fluid volume measurement container, uses electromagnetic valves installed at the input and output ends of the Murphy's dropper to control the input and output control of the Murphy's dropper, and uses a liquid level sensor to perform volume cycle measurement on the drainage fluid overflowing to the detection position. After the measurement is completed, the drainage fluid is released to the drainage bag, and the single-chip microcomputer obtains the liquid level sensor data, calculates it, and outputs it to the display screen. Although it can meet certain needs, it has the problem that it is not convenient to quickly measure the liquid volume because the liquid volume measurement is relatively complicated.

[0005] The Chinese patent application with publication number CN210486994U discloses a new type of drainage fluid volume measuring instrument, which measures the weight of the drainage fluid in the cup body through a weighing sensor module set in the scale body, and inputs the corresponding drainage fluid density information through a key module to calculate the volume of the drainage fluid. This liquid volume measurement method is difficult to apply to the traditional drainage bag liquid volume measurement.

[0006] How to solve the above problems has become a technical problem that needs to be solved urgently. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide a method for measuring the volume of liquid in a drainage bag based on computer vision, which can quickly and accurately measure the liquid in the drainage bag to assist medical staff in accurately judging the patient's condition and making treatment decisions.

[0008] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0009] The present invention provides a method for measuring the volume of liquid in a drainage bag based on computer vision, the method comprising the following steps:

[0010] S1. Image acquisition and data set division steps:

[0011] S1.1. Collect several frontal images of drainage bags with different volumes of drainage fluid in advance, and measure the volume of the liquid inside each drainage bag in advance with a measuring cup to obtain the drainage fluid volume Y, and use the above data as the first category label of the dataset sample;

[0012] S1.2. Use the segmentation model to perform semantic segmentation on the image of the liquid in the drainage bag to obtain the segmentation result. After manually calibrating the segmentation result, use it as the second type of label for the dataset sample.

[0013] S1.3, divide the above dataset samples into training set, validation set and test set based on the specified ratio;

[0014] S2, image data preprocessing steps:

[0015] S2.1, using the Canny edge detection operator to extract the contours of all front images of the drainage bags, so as to separate the drainage bag images from the images containing background noise;

[0016] S2.2, performing affine transformation on the drainage bag image obtained in step S2.1 to correct the distorted image;

[0017] S2.3, adjusting the drainage bag graphic to a predetermined size to facilitate batch processing and model training;

[0018] S2.4, randomly rotating the drainage bag pattern within a predetermined angle range to increase data diversity, thereby improving the adaptability of the model to different directions to enhance training data;

[0019] S2.5, scaling the pixels of the drainage bag graphic to a predetermined value range according to a predetermined standard to achieve pixel value normalization, thereby accelerating the model training speed;

[0020] S3. Steps for building a drainage fluid volume prediction model:

[0021] S3.1. Use the ResNet50 network structure to build a feature extraction backbone network, and use the pre-trained model parameters on the ImageNet image dataset as initialization parameters to pre-process the front image of the drainage bag. After inputting the feature extraction backbone network and processing, the abstract image features are obtained Among them, H and W represent the length and width of the input image respectively, C represents the number of feature channels, and R represents the real number domain;

[0022] S3.2. Build an image semantic segmentation head to convert the feature image into a segmentation mask, and then generate a foreground / background binary classification result for each feature image pixel through the Sigmoid activation function

[0023] S3.3. The segmentation result of the image semantic segmentation head is used as the prior information for drainage fluid volume prediction. The segmentation result is concatenated with the original input image I along the channel dimension to obtain the feature image Then, the feature image I′ is subjected to feature extraction and downsampling operations through a multi-layer convolutional network to obtain the abstract image features. The global mean pooling layer is used to convert the abstract image feature F2 into a fixed-size vector to reduce parameters and prevent overfitting. The abstract image feature F2 is then concatenated with the abstract image feature F1 to obtain the abstract image feature Then add multiple fully connected layers as the drainage volume output module, in which the ReLU activation function is used to enhance the nonlinear ability of the network, and finally output a scalar as the predicted drainage volume;

[0024] S4. Iterative training steps of the deep learning model for drainage fluid volume measurement:

[0025] S4.1. Based on step S3, batch input the images processed in step S1 into the feature extraction backbone network of step S3.1, and use the actual value and predicted value of the drainage fluid volume corresponding to the image as input data of the loss function to implement iterative training, wherein Dice Loss is used as the semantic loss function, mean square error is used as the drainage fluid volume prediction loss function, and Adam optimization algorithm is used to update network parameters;

[0026] S4.2. Iterate the network training epochs on the training data set until the overall loss function value converges to obtain the optimal As the predicted drainage volume, the semantic loss, drainage volume prediction loss and overall loss of the model are calculated as follows:

[0027] Semantic Loss

[0028] Predicted loss of drainage volume

[0029] The total loss l = l dice +l mse (3)

[0030] Among them, an epoch means that all the data are sent to the network to complete a forward calculation and back propagation process. X represents the pixel label of the predicted segmented image, Y represents the pixel label of the real segmented image, the numerator X∩Y represents the pixel intersection of the predicted image and the real label image, and the denominator |X|+|Y| represents the sum of their respective pixels, y i represents the actual volume of drainage fluid of the i-th sample accurately measured by the measuring cup, represents the drainage fluid volume of the i-th sample predicted by the model based on the input image, and N represents the total number of input samples;

[0031] S5. Steps for predicting drainage fluid volume:

[0032] S5.1. Based on steps S1 to S4, network training is completed to obtain a trained drainage fluid volume prediction model by integrating the predicted drainage fluid volume values ​​of several feature images. Then, the image data processing of step S2 is performed on the front image of the drainage bag sample to be tested to obtain a preprocessed image sample. The preprocessed image sample is then input into the trained drainage fluid volume prediction model to obtain the measured value of the drainage fluid volume in the drainage bag.

[0033] Preferably, in step S1.2, the segmentation model is a pre-trained Segment Anything Model to prompt the segmentation system.

[0034] Preferably, in step S1.3, the data set samples are divided into a training set, a validation set and a test set according to a predetermined standard based on a ratio of 5:3:2.

[0035] Preferably, in step S2.1, based on the discontinuity of the pixel values ​​of the image, the first-order derivative or second-order derivative of the edge detection operator Canny is used to detect the edge points of the drainage bag in the image so as to extract the contour of the drainage bag graphic, thereby separating the drainage bag graphic from the background graphic.

[0036] Preferably, in step S2.2, translation, rotation, scaling and affine transformation operations are performed on the drainage bag image according to a predetermined standard to correct the distorted image caused by the imaging angle or the device position.

[0037] Preferably, in step S3.2, it also includes the following steps: by adding a UNet decoder network on the basis of the ResNet50 network structure to build an image semantic segmentation head, a two-dimensional upsampling layer is used to implement feature image sampling and gradually enlarge it to the size of the input image I, and then a two-dimensional convolution layer with a predetermined convolution kernel size is used to extract finer-grained image features, and at the same time, nonlinear correction is performed on the image features through the ReLU activation function, and then the feature image is converted into a segmentation mask through the two-dimensional convolution layer in the image semantic segmentation head, and then the Sigmoid activation function is used to generate a foreground / background binary classification result for each pixel of the feature image.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] In the present invention, through the coordination of the image acquisition and data set division steps, the image data preprocessing step, the construction of a deep learning model step for measuring the drainage fluid volume, the iterative training step of the deep learning model for measuring the drainage fluid volume, and the step of predicting the drainage fluid volume, the drainage fluid can be separated from the background pixels through the image semantic segmentation technology as the prior information for predicting the drainage fluid volume, and then the convolutional network technology can be used to implement regression prediction on the drainage fluid volume, so as to quickly and accurately obtain the measured value of the drainage fluid volume in the drainage bag. In the present invention, it is only necessary to input a picture of the drainage bag, and the volume value of the drainage fluid in the drainage bag can be directly obtained without complicated operations to assist medical staff in accurately judging the patient's condition and making treatment decisions. Therefore, the present invention has the advantage of being able to quickly and accurately measure the liquid in the drainage bag to assist medical staff in accurately judging the patient's condition and making treatment decisions. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0041] Figure 1 This is a flow chart of a method for measuring the volume of liquid in a drainage bag based on computer vision described in the present invention. DETAILED DESCRIPTION

[0042] See also Figure 1 As shown, a method for measuring the volume of liquid in a drainage bag based on computer vision, the method comprises the following steps:

[0043] S1. Image acquisition and data set division steps:

[0044] S1.1. Collect several frontal images of drainage bags with different volumes of drainage fluid in advance, and measure the volume of the liquid inside each drainage bag in advance with a measuring cup to obtain the drainage fluid volume Y, and use the above data as the first category label of the dataset sample;

[0045] S1.2. Use the segmentation model to perform semantic segmentation on the image of the liquid in the drainage bag, obtain the segmentation result, and manually calibrate the segmentation result as the second type of label for the dataset sample;

[0046] S1.3, based on the specified ratio, divide the above data set samples into training set, validation set and test set according to the predetermined standard;

[0047] S2, image data preprocessing steps:

[0048] S2.1, using the Canny edge detection operator to extract the contours of all front images of the drainage bags, so as to separate the drainage bag images from the images containing background noise;

[0049] S2.2, performing affine transformation on the drainage bag image obtained in step S2.1 according to a predetermined standard to correct the distorted image;

[0050] S2.3, adjusting the drainage bag graphic to a predetermined size to facilitate batch processing and model training;

[0051] S2.4, randomly rotating the drainage bag pattern within a predetermined angle range to increase data diversity, thereby improving the adaptability of the model to different directions to enhance training data;

[0052] S2.5, scaling the pixels of the drainage bag graphic to a predetermined value range according to a predetermined standard to achieve pixel value normalization, thereby accelerating the model training speed;

[0053] S3. Steps for building a drainage fluid volume prediction model:

[0054] S3.1. Use the ResNet50 network structure to build a feature extraction backbone network, and use the pre-trained model parameters on the ImageNet image dataset as initialization parameters to pre-process the front image of the drainage bag. After inputting the feature extraction backbone network and processing, the abstract image features are obtained Among them, H and W represent the length and width of the input image respectively, C represents the number of feature channels, and R represents the real number domain;

[0055] S3.2. Build an image semantic segmentation head to convert the feature image into a segmentation mask, and then generate a foreground / background binary classification result for each feature image pixel through the Sigmoid activation function

[0056] S3.3. The segmentation result of the image semantic segmentation head is used as the prior information for drainage fluid volume prediction. The segmentation result is concatenated with the original input image I along the channel dimension to obtain the feature image Then, the feature image I′ is subjected to feature extraction and downsampling operations through a multi-layer convolutional network to obtain the abstract image features. The global mean pooling layer is used to convert the abstract image feature F2 into a fixed-size vector to reduce parameters and prevent overfitting. The abstract image feature F2 is then concatenated with the abstract image feature F1 to obtain the abstract image feature Then add multiple fully connected layers as the drainage volume output module, in which the ReLU activation function is used to enhance the nonlinear ability of the network, and finally output a scalar as the predicted drainage volume;

[0057] S4. Iterative training steps of the deep learning model for drainage fluid volume measurement:

[0058] S4.1. Based on step S3, batch input the images processed in step S1 into the feature extraction backbone network of step S3.1, and use the actual value and predicted value of the drainage fluid volume corresponding to the image as input data of the loss function to implement iterative training, wherein Dice Loss is used as the semantic loss function, mean square error is used as the drainage fluid volume prediction loss function, and Adam optimization algorithm is used to update network parameters;

[0059] S4.2. Iterate the network training epochs on the training data set until the overall loss function value converges to obtain the optimal As the predicted drainage volume, the semantic loss, drainage volume prediction loss and overall loss of the model are calculated as follows:

[0060] Semantic Loss

[0061] Predicted loss of drainage volume

[0062] The total loss l = l dice +l mse (3)

[0063] Among them, an epoch means that all the data are sent to the network to complete a forward calculation and back propagation process. X represents the pixel label of the predicted segmented image, Y represents the pixel label of the real segmented image, the numerator X∩Y represents the pixel intersection of the predicted image and the real label image, and the denominator |X|+|Y| represents the sum of their respective pixels, y i represents the actual volume of drainage fluid of the i-th sample accurately measured by the measuring cup, represents the drainage fluid volume of the i-th sample predicted by the model based on the input image, and N represents the total number of input samples;

[0064] S5. Steps for predicting drainage fluid volume:

[0065] S5.1. Based on steps S1 to S4, network training is completed to obtain a trained drainage fluid volume prediction model by integrating the predicted drainage fluid volume values ​​of several feature images. Then, the image data processing of step S2 is performed on the front image of the drainage bag sample to be tested to obtain a preprocessed image sample. The preprocessed image sample is then input into the trained drainage fluid volume prediction model to obtain the measured value of the drainage fluid volume in the drainage bag.

[0066] During use, through the cooperation of the image acquisition and data set division steps, the image data preprocessing steps, the drainage fluid volume measurement deep learning model steps, the drainage fluid volume measurement deep learning model iterative training steps and the drainage fluid volume prediction steps, you only need to input the picture of the drainage bag to directly obtain the volume value of the drainage fluid in the drainage bag to assist medical staff in accurately judging the patient's condition and making treatment decisions. Through the image acquisition and data set division steps, the drainage fluid can be separated from the background pixels as the prior information for drainage fluid volume prediction. Then, through the image data preprocessing steps, the drainage fluid volume measurement deep learning model steps, the drainage fluid volume measurement deep learning model iterative training steps and the drainage fluid volume prediction steps, the drainage fluid volume can be regressively predicted, and then the measurement value of the drainage fluid volume in the drainage bag can be quickly and accurately obtained. In the entire prediction process, you only need to input the picture of the drainage bag, and you can implement data processing according to predetermined standards without complicated operations to directly obtain the volume value of the drainage fluid in the drainage bag, thereby assisting medical staff in accurately judging the patient's condition and making treatment decisions, effectively improving the convenience and safety of use.

[0067] In this embodiment, in step S1.2, the segmentation model is a pre-trained Segment Anything Model to prompt the segmentation system.

[0068] In this embodiment, in step S1.3, the data set samples are divided into a training set, a validation set, and a test set according to a predetermined standard based on a ratio of 5:3:2.

[0069] In this embodiment, in step S2.1, based on the discontinuity of the pixel values ​​of the image, the first-order derivative or the second-order derivative of the edge detection operator Canny is used to detect the edge points of the drainage bag in the image so as to extract the contour of the drainage bag graphic, thereby separating the drainage bag graphic from the background graphic.

[0070] In this embodiment, in step S2.2, translation, rotation, scaling and affine transformation operations are performed on the drainage bag image according to a predetermined standard to correct the distorted image caused by the imaging angle or the device position.

[0071] In this embodiment, in step S3.2, it also includes the following steps: by adding a UNet decoder network on the basis of the ResNet50 network structure to build an image semantic segmentation head, a two-dimensional upsampling layer is used to implement feature image sampling and gradually enlarge it to the size of the input image I, and then a two-dimensional convolution layer with a predetermined convolution kernel size is used to extract finer-grained image features, and at the same time, nonlinear correction is performed on the image features through the ReLU activation function, and then the feature image is converted into a segmentation mask through the two-dimensional convolution layer in the image semantic segmentation head, and then the Sigmoid activation function is used to generate a foreground / background binary classification result for each pixel of the feature image.

[0072] When this embodiment is used specifically, first, several front-view images of drainage bags with different volumes of drainage fluid are collected in advance, and the volume of the fluid inside each drainage bag is measured in advance by a measuring cup to obtain the drainage fluid volume Y, and the above data are used as the first type of label of the data set sample, and then the segmentation model is used to perform image semantic segmentation on the fluid in the drainage bag to obtain the segmentation result, and the segmentation result is manually calibrated as the second type of label of the data set sample, and the above data set samples are divided into a training set, a validation set and a test set according to a predetermined standard based on a specified ratio; secondly, based on the discontinuity of the pixel value of the image, the first-order derivative or the second-order derivative of the edge detection operator Canny is used to detect the edge points of the drainage bag in the image so as to extract the contour of the drainage bag graphic, thereby separating the drainage bag graphic from the background graphic. Then, according to the predetermined standards, the drainage bag graphics are translated, rotated, and scaled by affine transformation operations to correct the distorted image caused by the imaging angle or the position of the device. Then, according to the needs, all the drainage bag graphics are adjusted to the predetermined size to facilitate batch processing and model training. The drainage bag graphics are randomly rotated within the predetermined angle range to increase data diversity, thereby improving the adaptability of the model to different directions to enhance the training data. Then, according to the predetermined standards, the pixels of the drainage bag graphics are scaled to the predetermined value range to achieve pixel value normalization, thereby speeding up the model training speed; then, the ResNet50 network structure is used to build the feature extraction backbone network, and the pre-trained model parameters on the ImageNet image dataset are used as initialization parameters to pre-process the frontal image of the drainage bag. After inputting the feature extraction backbone network and processing, the abstract image features are obtained Then, a UNet decoder network is added to the ResNet50 network structure to build an image semantic segmentation head. A two-dimensional upsampling layer is used to implement feature image sampling and gradually enlarge it to the size of the input image I. Then, a two-dimensional convolutional layer with a predetermined convolution kernel size is used to extract finer-grained image features. At the same time, the image features are nonlinearly corrected through the ReLU activation function. Then, the feature image is converted into a segmentation mask through the two-dimensional convolutional layer in the image semantic segmentation head, and the Sigmoid activation function is used to generate a foreground / background binary classification result for each pixel of the feature image. The segmentation result of the image semantic segmentation head is used as the prior information for drainage fluid volume prediction, and the segmentation result is concatenated with the original input image along the channel dimension to obtain the feature map Then, the feature image I′ is extracted and downsampled through a multi-layer convolutional network to obtain the abstract image features. The global mean pooling layer is used to convert the abstract image feature F2 into a fixed-size vector to reduce parameters and prevent overfitting. The abstract image feature F2 is then concatenated with the abstract image feature F1 to obtain the abstract image feature Then, multiple layers of fully connected layers are added as the drainage volume output module, in which the ReLU activation function is used to enhance the nonlinear ability of the network, and the prediction head outputs a scalar as the predicted drainage fluid volume; finally, based on the constructed deep learning model for drainage fluid volume measurement, the processed picture images are batch-input into the deep learning model for drainage fluid volume measurement, and the true value and predicted value of the picture image are used as input data of the loss function to implement iterative training, wherein Dice Loss is used as the semantic loss function, and the mean square error is used as the drainage fluid volume prediction loss function, and the Adam optimization algorithm is used to update the network parameters. The network is iteratively trained on the training data set for epochs until the overall loss function value converges, thereby obtaining a drainage fluid volume prediction model composed of the predicted drainage fluid volume values ​​of several feature images, and then image data processing is performed on the drainage bag sample image to obtain a preprocessed picture sample, and the preprocessed picture sample is input into the trained drainage fluid volume prediction model to obtain the measured value of the drainage fluid volume in the drainage bag to assist medical staff in accurately judging the patient's condition and making treatment decisions.

[0073] In summary, the present invention adopts the above method, which has the advantage of being able to quickly and accurately measure the liquid in the drainage bag to assist medical staff in accurately judging the patient's condition and making treatment decisions.

[0074] For those skilled in the art, various other corresponding changes and deformations can be made according to the technical solutions and concepts described above, and all of these changes and deformations should fall within the protection scope of the claims of the present invention.

Claims

1. A method for measuring the volume of liquid in a drainage bag based on computer vision, characterized in that: The method comprises the following steps: S1. Image acquisition and data set division steps: S1.

1. Collect several frontal images of drainage bags with different volumes of drainage fluid in advance, and measure the volume of the liquid inside each drainage bag in advance with a measuring cup to obtain the drainage fluid volume Y, and use the above data as the first category label of the dataset sample; S1.

2. Use the image segmentation model to perform semantic segmentation on the liquid in the drainage bag, obtain the segmentation result, and manually calibrate the segmentation result as the second type of label for the dataset sample; S1.3, divide the above dataset samples into training set, validation set and test set based on the specified ratio; S2, image data preprocessing steps: S2.1, using the Canny edge detection operator to extract the contours of all front images of the drainage bags, so as to separate the drainage bag images from the images containing background noise; S2.2, performing affine transformation on the drainage bag image obtained in step S2.1 to correct the distorted image; S2.3, adjusting the drainage bag graphic to a predetermined size to facilitate batch processing and model training; S2.4, randomly rotating the drainage bag pattern within a predetermined angle range to increase data diversity, thereby improving the adaptability of the model to different directions to enhance training data; S2.5, scaling the pixels of the drainage bag graphic to a predetermined value range according to a predetermined standard to achieve pixel value normalization, thereby accelerating the model training speed; S3. Steps for building a drainage fluid volume prediction model: S3.

1. Use the ResNet50 network structure to build a feature extraction backbone network, and use the pre-trained model parameters on the ImageNet image dataset as initialization parameters. After the input feature extraction backbone network is processed, the abstract image features are obtained Among them, H and W represent the length and width of the input image respectively, C represents the number of feature channels, and R represents the real number domain; S3.

2. Build an image semantic segmentation head to convert the feature image into a segmentation mask, and then generate a foreground / background binary classification result for each feature image pixel through the Sigmoid activation function S3.

3. The segmentation result of the image semantic segmentation head is used as the prior information for drainage fluid volume prediction. The segmentation result is concatenated with the original input image I along the channel dimension to obtain the feature image Then, the feature image I′ is subjected to feature extraction and downsampling operations through a multi-layer convolutional network to obtain the abstract image features. The global mean pooling layer is used to convert the abstract image feature F2 into a fixed-size vector to reduce parameters and prevent overfitting. The abstract image feature F2 is then concatenated with the abstract image feature F1 to obtain the abstract image feature Then add multiple fully connected layers as the drainage volume output module, in which the ReLU activation function is used to enhance the nonlinear ability of the network, and finally output a scalar as the predicted drainage volume; S4. Iterative training steps of the deep learning model for drainage fluid volume measurement: S4.

1. Based on step S3, batch input the images processed in step S1 into the feature extraction backbone network of step S3.1, and use the actual value and predicted value of the drainage fluid volume corresponding to the image as input data of the loss function to implement iterative training, wherein Dice Loss is used as the semantic loss function, mean square error is used as the drainage fluid volume prediction loss function, and Adam optimization algorithm is used to update network parameters; S4.

2. Iterate the network training epochs on the training data set until the overall loss function value converges to obtain the optimal As the predicted drainage volume, the semantic loss, drainage volume prediction loss and overall loss of the model are calculated as follows: The total loss l = l dice +l mse (3) Among them, an epoch means that all the data are sent to the network to complete a forward calculation and back propagation process. X represents the pixel label of the predicted segmented image, Y represents the pixel label of the real segmented image, the numerator X∩Y represents the pixel intersection of the predicted image and the real label image, and the denominator |X|+|Y| represents the sum of their respective pixels, y i represents the actual volume of drainage fluid of the i-th sample accurately measured by the measuring cup, represents the drainage fluid volume of the i-th sample predicted by the model based on the input image, and N represents the total number of input samples; S5. Steps for predicting drainage fluid volume: S5.

1. Based on steps S1 to S4, network training is completed to obtain a trained drainage fluid volume prediction model by integrating the predicted drainage fluid volume values ​​of several feature images. Then, the image data processing of step S2 is performed on the front image of the drainage bag sample to be tested to obtain a preprocessed image sample. The preprocessed image sample is then input into the drainage fluid volume prediction model trained in step S4 to obtain the measured value of the drainage fluid volume in the drainage bag.

2. The method for measuring the volume of liquid in a drainage bag based on computer vision according to claim 1, characterized in that: In step S1.2, the segmentation model is a pre-trained Segment Anything Model that can prompt the segmentation system.

3. The method for measuring the volume of liquid in a drainage bag based on computer vision according to claim 2, characterized in that: In step S1.3, the data set samples are divided into a training set, a validation set, and a test set according to a predetermined standard based on a ratio of 5:3:

2.

4. The method for measuring the volume of liquid in a drainage bag based on computer vision according to claim 1, characterized in that: In step S2.1, based on the discontinuity of the pixel values ​​of the image, the first-order derivative or second-order derivative of the edge detection operator Canny is used to detect the edge points of the drainage bag in the image so as to extract the contour of the drainage bag graphic, thereby separating the drainage bag graphic from the background graphic.

5. The method for measuring the volume of liquid in a drainage bag based on computer vision according to claim 4, characterized in that: In step S2.2, translation, rotation, scaling and affine transformation operations are performed on the drainage bag image according to a predetermined standard to correct the distorted image caused by the imaging angle or the device position.

6. The method for measuring the volume of liquid in a drainage bag based on computer vision according to any one of claims 1 to 5, characterized in that: In step S3.2, it also includes the following steps: by adding a UNet decoder network on the basis of the ResNet50 network structure to build an image semantic segmentation head, a two-dimensional upsampling layer is used to implement feature image sampling and gradually enlarge it to the size of the input image I, and then a two-dimensional convolution layer with a predetermined convolution kernel size is used to extract finer-grained image features, and at the same time, nonlinear correction is performed on the image features through the ReLU activation function, and then the feature image is converted into a segmentation mask through the two-dimensional convolution layer in the image semantic segmentation head, and then the Sigmoid activation function is used to generate a foreground / background binary classification result for each pixel of the feature image.

Citation Information

Patent Citations

  • Drainage liquid measuring device and drainage liquid measuring method

    CN111265726A

  • Novel drainage liquid volume measuring instrument

    CN210486994U