Method and device for detecting a leak in an endoscope tube

By using the YOLOv5+DeepSORT model to detect leaks in endoscopic tubing, the problem of low detection accuracy in existing technologies is solved, enabling more efficient leak location identification and reducing the risk of endoscopic damage and cross-infection.

CN115661103BActive Publication Date: 2026-05-01WUHAN ENDOANGEL MEDICAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WUHAN ENDOANGEL MEDICAL TECH CO LTD
Filing Date
2022-10-31
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

The accuracy of detecting leakage points in existing endoscopic tubing is not high, leading to reduced endoscope lifespan and increased risk of cross-infection for patients.

Method used

The YOLOv5+DeepSORT model was used to perform multi-target tracking of air bubbles in the video of the hose being submerged in water. The leakage location was determined by line fitting and clustering. The average value of the intersection coordinates was calculated by combining the bubble movement trajectory captured by the camera to determine the leakage location.

Benefits of technology

It improves the accuracy of detecting leaks in endoscopic tubing, reduces endoscopic damage and repair costs, and lowers the probability of cross-infection among patients.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115661103B_ABST
    Figure CN115661103B_ABST
Patent Text Reader

Abstract

This application provides a method and apparatus for detecting the leakage location of an endoscopic tubing. The method includes: capturing a video of the tubing being immersed in water for a preset duration; performing multi-target tracking on air bubbles in the immersion video to obtain multiple bubble movement trajectories in the camera's view, and fitting these trajectories with straight lines to obtain multiple straight-line movement trajectories; clustering these trajectories based on the midpoint x-coordinate and slope of each trajectories to obtain multiple movement trajectory clusters; identifying each movement trajectory cluster as a target movement trajectory cluster, and calculating the intersection points of each straight-line movement trajectory in the target movement trajectory cluster with the endoscopic tubing; determining the average coordinate of the intersection points of each straight-line movement trajectory in the target movement trajectory cluster with the endoscopic tubing as the leakage location corresponding to the target movement trajectory cluster, thus obtaining the leakage location corresponding to each movement trajectory cluster; and determining the leakage location corresponding to each movement trajectory cluster as the leakage location of the endoscopic tubing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application mainly relates to the field of image processing technology, and specifically to a method and apparatus for detecting the leakage location of an endoscope tube. Background Technology

[0002] Flexible endoscopes are high-end consumable medical devices that are susceptible to fatigue, aging, and damage. Leakage detection can reduce the cost of endoscope damage and repair, and also lower the probability of cross-infection among patients. Neglecting leak detection of the endoscope tubing is a significant factor leading to a substantial reduction in the lifespan of the endoscope (e.g., neglecting leak detection can cause lens blurring, corrosion of internal components can result in insufficient angle, etc.); at the same time, damage to the endoscope lumen is also a major factor in sterilization failure, so leak detection must be emphasized.

[0003] Checking for leaks in flexible endoscopes is a crucial aspect of routine maintenance and upkeep. However, current technology primarily relies on manually inflating the endoscope tubing and placing it in water to observe the air bubbles, which cannot accurately pinpoint the location of the leak.

[0004] In other words, the accuracy of detecting leakage locations of endoscope tubing in existing technologies is not high. Summary of the Invention

[0005] This application provides a method and apparatus for detecting the leakage location of an endoscope tube, aiming to solve the problem of low detection accuracy of the leakage location of an endoscope tube in the prior art.

[0006] In a first aspect, this application provides a method for detecting leakage points of an endoscope tubing, applied to an endoscope device. The endoscope device includes an electrical connector, a threaded waterproof cap, and the endoscope tubing. One end of the electrical connector has a threaded hollow rod, and one end of the electrical connector is connected to the endoscope tubing. The threaded waterproof cap is threadedly connected to the threaded hollow rod to seal the endoscope tubing. The method for detecting leakage points of the endoscope tubing includes:

[0007] The camera is controlled to capture a video of the endoscope tube being submerged in water for a preset duration from one side of the endoscope tube. During the capture of the video of the endoscope tube being submerged in water, the threaded waterproof cap is threaded to the threaded hollow rod to seal the endoscope tube. The endoscope tube is submerged in water, and the air pressure inside the endoscope tube is maintained at a preset air pressure value.

[0008] The YOLOv5+DeepSORT model was used to perform multi-target tracking of bubbles in the video of the hose being immersed in water, and the movement trajectories of multiple bubbles in the camera shooting interface were obtained.

[0009] By performing linear fitting on the trajectories of multiple bubbles, multiple linear trajectories are obtained;

[0010] Multiple straight-line trajectories are clustered based on the x-coordinate of the midpoint and the slope of each straight-line trajectories to obtain multiple trajectory clusters.

[0011] Each movement trajectory cluster is determined as a target movement trajectory cluster, and the intersection points of each straight movement trajectory in the target movement trajectory cluster and the endoscope tube are calculated;

[0012] The average coordinates of the intersection points of each straight-line movement trajectory in the target movement trajectory cluster with the endoscope tube are determined as the leakage location corresponding to the target movement trajectory cluster, thus obtaining the leakage location corresponding to each movement trajectory cluster.

[0013] The leakage location corresponding to each movement trajectory cluster is determined as the leakage location of the endoscope tube.

[0014] Optionally, the control camera captures a video of the endoscope tubing being submerged in water for a preset duration from one side of the tubing, including:

[0015] Acquire initial hose images captured by the camera at a preset frequency;

[0016] The initial tube image is segmented using the endoscope tube to obtain a segmented endoscope tube image;

[0017] Determine whether an endoscope tube region exists in the segmented image of the endoscope tube;

[0018] If there is an endoscope tube region in the segmented image of the endoscope tube, the Zhang-Suen thinning algorithm is used to obtain the center line of the endoscope tube region.

[0019] Determine if the centerline of the hose is a straight line;

[0020] If the center line of the hose is a straight line, the camera is controlled to capture a video of the hose being submerged in water for a preset duration from one side of the endoscope hose.

[0021] Optionally, before acquiring the initial hose image captured by the camera at a preset frequency, the process includes:

[0022] Obtain an image of the waterproof cap taken from the inside of the threaded waterproof cap;

[0023] The waterproof cover image is input into the waterproof cover segmentation model to obtain the first waterproof cover region;

[0024] The image within the first waterproof cover area is input into the water droplet segmentation model to obtain the water droplet segmentation image;

[0025] Determine whether the water droplet segmentation image contains water droplet regions;

[0026] If the water droplet segmentation image contains a water droplet region, then determine whether the outer contour of the water droplet region meets the preset water droplet shape conditions;

[0027] If the outer contours of each water droplet region in the water droplet segmentation image do not meet the preset water droplet shape conditions, then the initial hose image captured by the camera is obtained at a preset frequency.

[0028] Optionally, determining whether the outer contour of the water droplet region meets the preset water droplet shape conditions includes:

[0029] Obtain the maximum inscribed circle and the minimum circumscribed circle of the outer contour of the water droplet region;

[0030] Obtain a predetermined number of reference circles located between the largest inscribed circle and the smallest circumscribed circle, wherein the predetermined number of reference circles are concentric with the largest inscribed circle, and the radii of the predetermined number of reference circles and the largest inscribed circle form an arithmetic sequence;

[0031] Calculate the number of intersections between a preset number of reference circles and the outer contour of the water droplet region;

[0032] If the number of intersections is less than a preset value, then the outer contour of the water droplet region is determined to meet the preset water droplet shape condition; if the number of intersections is not less than the preset value, then the outer contour of the water droplet region does not meet the preset water droplet shape condition.

[0033] Optionally, before acquiring the initial hose image captured by the camera at a preset frequency, the process includes:

[0034] Obtain an image of the waterproof cap taken from the inside of the threaded waterproof cap;

[0035] The waterproof cover image is input into the waterproof cover segmentation model to obtain the first waterproof cover region;

[0036] The image within the first waterproof cover area is input into the attachment segmentation model to obtain the attachment segmentation image;

[0037] Determine whether the segmented image of the attachment contains a first attachment region;

[0038] If the waterproof cover image has a first attachment area, an inner boundary contour and an outer boundary contour are generated inside and outside the first attachment area, respectively. The area between the inner boundary contour and the outer contour of the first attachment area is defined as the second attachment area. The area between the outer boundary contour and the outer contour of the first attachment area is defined as the attachment comparison area. The outer boundary contour, the inner boundary contour, and the outer contour of the first attachment area have the same shape and the same centroid. The area of ​​the attachment comparison area is the same as the area of ​​the second attachment area.

[0039] Obtain the first, second, and third moments of the second attachment region; obtain the first, second, and third moments of the attachment comparison region;

[0040] The variances of the first, second, and third moments of the second attachment region are determined as the first color quantization value; the variances of the first, second, and third moments of the attachment contrast region are determined as the second color quantization value.

[0041] Calculate the color quantization ratio between the smaller and larger values ​​of the first and second color quantization values ​​to obtain the color quantization ratio of each second attachment region;

[0042] If the color quantization ratio of each second attachment area is not less than the first preset ratio, then the initial hose image captured by the camera is obtained at the preset frequency.

[0043] Optionally, acquiring the initial hose image captured by the camera at a preset frequency includes:

[0044] Acquire a first image captured by the camera along the extension direction of the threaded hollow rod;

[0045] The first image is segmented to obtain a first segmented image;

[0046] Determine whether there is a first electrical connector segmentation region and a second waterproof cover region on the first segmented image;

[0047] If there is a first electrical connector segmentation region and a second waterproof cover region on the first segmented image, then determine whether the intersection-union ratio between the minimum bounding rectangle of the first electrical connector segmentation region and the minimum bounding rectangle of the second waterproof cover region exceeds the preset intersection-union ratio.

[0048] If the intersection-union ratio between the minimum bounding rectangle of the first electrical connector segmentation area and the minimum bounding rectangle of the second waterproof cover area exceeds the preset intersection-union ratio, a voice control command to tighten the threaded waterproof cover is issued, and the initial hose image captured by the camera is acquired at a preset frequency.

[0049] Optionally, acquiring the initial hose image captured by the camera at a preset frequency includes:

[0050] Acquire a second image taken by the camera along the direction perpendicular to the extension of the threaded hollow rod;

[0051] Perform image segmentation on the second image to obtain a second segmented image;

[0052] Determine whether the second segmented image contains a threaded rod segmentation region, a second electrical connector segmentation region, and a third waterproof cover region;

[0053] If the second segmented image contains a threaded rod segmentation region, a second electrical connector segmentation region, and a third waterproof cover region, obtain the first projection length of the threaded rod segmentation region in a preset direction and the second projection length in a direction perpendicular to the preset direction, wherein the straight line determined by the centroid of the second electrical connector segmentation region and the third waterproof cover region is parallel to the preset direction.

[0054] Determine whether the ratio of the first projection length to the second projection length exceeds a second preset ratio;

[0055] If the ratio of the first projection length to the second projection length does not exceed the second preset ratio, then the initial hose image captured by the camera is obtained at a preset frequency.

[0056] Secondly, this application provides a device for detecting leakage points of an endoscope tubing, applied to an endoscope device. The endoscope device includes an electrical connector, a threaded waterproof cap, and the endoscope tubing. One end of the electrical connector is provided with a threaded hollow rod, and one end of the electrical connector is connected to the endoscope tubing. The threaded waterproof cap is threadedly connected to the threaded hollow rod to seal the endoscope tubing. The device for detecting leakage points of the endoscope tubing includes:

[0057] The video acquisition unit is used to control the camera to capture a video of the endoscope tube being submerged in water for a preset duration from one side of the endoscope tube. When capturing the video of the tube being submerged in water, the threaded waterproof cap is threadedly connected to the threaded hollow rod to seal the endoscope tube. The endoscope tube is submerged in water, and the air pressure inside the endoscope tube is maintained at a preset air pressure value.

[0058] The bubble tracking unit is used to perform multi-target tracking of bubbles in the video of the hose being immersed in water using the YOLOv5+DeepSORT model, and to obtain the movement trajectories of multiple bubbles in the camera shooting interface.

[0059] The line fitting unit is used to perform line fitting on the movement trajectories of multiple bubbles respectively, so as to obtain multiple line movement trajectories;

[0060] Clustering units are used to cluster multiple straight-line movement trajectories based on the x-coordinate of the midpoint and the slope of each straight-line movement trajectory, thereby obtaining multiple movement trajectory clusters;

[0061] The intersection calculation unit is used to determine each movement trajectory cluster as a target movement trajectory cluster and calculate the intersection points of each straight movement trajectory in the target movement trajectory cluster with the endoscope tube.

[0062] The first determining unit is used to determine the average coordinate of the intersection points of each straight-line movement trajectory in the target movement trajectory cluster and the endoscope tube as the leakage location corresponding to the target movement trajectory cluster, thereby obtaining the leakage location corresponding to each movement trajectory cluster.

[0063] The second determining unit is used to determine the leakage location corresponding to each movement trajectory cluster as the leakage location of the endoscope tube.

[0064] Thirdly, this application provides a computer device, the computer device comprising:

[0065] One or more processors;

[0066] Memory; and

[0067] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the method for detecting the location of leakage of the endoscope tubing as described in any of the first aspects.

[0068] Fourthly, this application provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to perform the steps in the method for detecting the location of leakage in an endoscopic tubing as described in any one of the first aspects.

[0069] This application provides a method and apparatus for detecting the leakage location of an endoscope tube. The method includes: controlling a camera to capture a video of the tube being submerged in water for a preset duration from one side of the endoscope tube; wherein, during the capture of the video, a threaded waterproof cap is threadedly connected to a threaded hollow rod to seal the endoscope tube, the endoscope tube is immersed in water, and the air pressure inside the endoscope tube is maintained at a preset air pressure value; using a YOLOv5+DeepSORT model to perform multi-target tracking of air bubbles in the video of the tube being submerged in water, obtaining the movement trajectories of multiple air bubbles in the camera's capture interface; and analyzing the movement trajectories of the multiple air bubbles separately. Linear fitting is performed to obtain multiple linear movement trajectories. These trajectories are then clustered based on their midpoint x-coordinates and slopes to obtain multiple trajectory clusters. Each trajectory cluster is designated as a target trajectory cluster, and the intersection points of each linear movement trajectory within the target cluster with the endoscopic tubing are calculated. The average coordinate of these intersection points is used to determine the leakage location corresponding to the target trajectory cluster, thus obtaining the leakage location for each trajectory cluster. Finally, the leakage location corresponding to each trajectory cluster is determined as the leakage location of the endoscopic tubing. This application improves the accuracy of endoscopic tubing leakage location detection. Attached Figure Description

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

[0071] Figure 1 This is a schematic diagram of a scenario for a system for detecting the leakage location of an endoscope tube provided in an embodiment of this application;

[0072] Figure 2 This is a flowchart illustrating an embodiment of the method for detecting leakage locations of endoscopic tubing provided in this application.

[0073] Figure 3 This is a schematic diagram of the interface of a video of the endoscope tube being immersed in water in one embodiment of the method for detecting leakage location of the endoscope tube provided in this application.

[0074] Figure 4 This is a schematic diagram of the maximum inscribed circle and minimum circumscribed circle of the water droplet area in one embodiment of the method for detecting leakage location of endoscope tubing provided in this application.

[0075] Figure 5 This is a schematic diagram of the first image in an embodiment of the method for detecting leakage location of endoscope tubing provided in this application;

[0076] Figure 6 This is a schematic diagram of the second image in one embodiment of the method for detecting the leakage location of the endoscope tube provided in this application;

[0077] Figure 7 This is a schematic diagram of multiple linear movement trajectories in one embodiment of the method for detecting leakage location of endoscopic tubing provided in this application;

[0078] Figure 8 This is a schematic diagram of an embodiment of the endoscope tubing leakage detection device provided in this application.

[0079] Figure 9 This is a schematic diagram of an embodiment of the computer device provided in this application. Detailed Implementation

[0080] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0081] In the description of this application, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0082] In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0083] This application provides a method and apparatus for detecting leakage locations of endoscopic tubing, which will be described in detail below.

[0084] Please see Figure 1 , Figure 1 This is a schematic diagram of a system for detecting the leakage location of an endoscope tube provided in an embodiment of this application. The system may include a computer device 100, which integrates a device for detecting the leakage location of the endoscope tube.

[0085] In this embodiment, the computer device 100 can be a standalone server, a server network, or a server cluster. For example, the computer device 100 described in this embodiment includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.

[0086] In this embodiment, the computer device 100 described above can be a general-purpose computer device or a special-purpose computer device. In specific implementations, the computer device 100 can be a desktop computer, a portable computer, a network server, a handheld computer (Personal Digital Assistant, PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, an embedded device, etc. This embodiment does not limit the type of computer device 100.

[0087] Those skilled in the art will understand that Figure 1 The application environment shown is merely one application scenario of the solution in this application and does not constitute a limitation on the application scenario of the solution in this application. Other application environments may include more than one application scenario. Figure 1 The number of computer devices shown is more or less, for example Figure 1 Only one computer device is shown in the diagram. It is understood that the system for detecting the location of leakage in the endoscopic tubing may also include one or more other computer devices capable of processing data, which are not specifically limited here.

[0088] In addition, such as Figure 1 As shown, the system for detecting the location of leakage in the endoscope tubing may also include a memory 200 for storing data.

[0089] It should be noted that, Figure 1 The schematic diagram of the endoscope tube leakage detection system shown is merely an example. The endoscope tube leakage detection system and scenario described in this application embodiment are for the purpose of more clearly illustrating the technical solutions of this application embodiment and do not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the evolution of the endoscope tube leakage detection system and the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.

[0090] First, this application provides a method for detecting the leakage location of an endoscope tube. The method includes: controlling a camera to capture a video of the tube being submerged in water for a preset duration from one side of the endoscope tube; wherein, during the capture of the submerged video, a threaded waterproof cap is threadedly connected to a threaded hollow rod to seal the endoscope tube, the endoscope tube is immersed in water, and the air pressure inside the endoscope tube is maintained at a preset air pressure value; using a YOLOv5+DeepSORT model to perform multi-target tracking of air bubbles in the submerged video, obtaining the movement trajectories of multiple air bubbles in the camera's shooting interface; and analyzing the movement trajectories of multiple air bubbles. Linear fitting is performed separately to obtain multiple linear movement trajectories. These trajectories are then clustered based on their midpoint x-coordinates and slopes to obtain multiple trajectory clusters. Each trajectory cluster is identified as a target trajectory cluster, and the intersection points of each linear movement trajectory within the target cluster with the endoscopic tubing are calculated. The average coordinate of the intersection points of each linear movement trajectory within the target trajectory cluster with the endoscopic tubing is used to determine the leakage location corresponding to the target trajectory cluster, thus obtaining the leakage location for each trajectory cluster. The leakage location corresponding to each trajectory cluster is then determined as the leakage location for the endoscopic tubing.

[0091] like Figure 2 As shown, Figure 2 This is a schematic flowchart of an embodiment of the method for detecting leakage locations of endoscopic tubing in this application. The method for detecting leakage locations of endoscopic tubing includes the following steps S201 to S207:

[0092] S201. Control the camera to capture a video of the endoscope tube being submerged in water for a preset duration from one side of the tube.

[0093] The preset duration t can be 5 minutes, etc., and can be set according to the specific situation.

[0094] The interface of the video showing the hose being submerged in water is as follows: Figure 3 As shown, the endoscope device 12 includes an electrical connector 123, a threaded waterproof cap 121, and an endoscope hose 124. One end of the electrical connector 123 has a threaded hollow rod 122, and the other end of the electrical connector 123 is connected to the endoscope hose 124. The threaded waterproof cap 121 is threadedly connected to the threaded hollow rod 122 to seal the endoscope hose 124. When filming a video of the hose being submerged in water, the threaded waterproof cap 121 is threadedly connected to the threaded hollow rod 122 to seal the endoscope hose 124. The endoscope hose 124 is immersed in the water of the elongated transparent cleaning tank 11, and the air pressure inside the endoscope hose 124 is maintained at a preset air pressure value.

[0095] In this embodiment, when starting the detection of leakage at the endoscope tubing 124, a voice control command is issued stating "Please place the endoscope in the water tank." Upon receiving this command, the operator or robot connects the threaded waterproof cap 121 to the threaded hollow rod 122 to seal the endoscope tubing 124. The endoscope tubing is then immersed in the water of the elongated transparent cleaning tank 11, and the air pressure inside the endoscope tubing 124 is maintained at a preset pressure value. Specifically, the endoscope tubing 124 is placed in the elongated transparent cleaning tank 11, the length of which is longer than the length of the endoscope tubing 124, ensuring that the endoscope tubing 124 remains taut during the detection process.

[0096] In this embodiment, the camera captures a video of the endoscope tubing 124 being submerged in water for a preset duration t. When the air pressure inside the endoscope tubing 124 remains at a preset pressure value, air will leak and bubbles will form at the leakage points of the endoscope tubing 124.

[0097] In one specific embodiment, after issuing the voice control command "Please place the endoscope in the water tank," to ensure the operator completes the voice control command and achieves automation, the camera is controlled to capture a preset duration of video footage of the endoscope tubing 124 being immersed in water. Prior to this, the following may be included:

[0098] (1) Acquire the initial hose image captured by the camera at a preset frequency.

[0099] The preset frequency can be 1Hz, 2Hz, etc. The initial hose image is taken from the elongated transparent cleaning tank 11.

[0100] (2) Perform endoscope tube segmentation on the initial tube image to obtain the endoscope tube segmentation image.

[0101] In one specific embodiment, an endoscope tube segmentation model is pre-trained, preferably using Unet++, and the boundaries of the endoscope tube 124 are delineated by a professional endoscopist.

[0102] The initial tube image is input into the endoscope tube segmentation model to perform endoscope tube segmentation, resulting in an endoscope tube segmentation image.

[0103] (3) Determine whether there is an endoscope tube region in the segmented image of the endoscope tube.

[0104] (4) If there is an endoscope tube region in the segmented image of the endoscope tube, the Zhang-Suen thinning algorithm is used to obtain the center line of the endoscope tube region.

[0105] If an endoscope tube region exists in the segmented image, it indicates that the operator has placed the endoscope tube 124 in water. In this case, the Zhang-Suen thinning algorithm is used to obtain the center line of the endoscope tube region.

[0106] (5) Determine whether the center line of the hose is a straight line.

[0107] (6) If the center line of the hose is a straight line, the camera is controlled to capture a video of the hose being submerged in water for a preset duration from one side of the endoscope hose.

[0108] If the center line of the flexible tube is straight, it means that the endoscope flexible tube 124 has been straightened, indicating that the operator has completed the voice control command. Then, the camera will capture a video of the flexible tube being submerged in water for a preset duration from one side of the endoscope flexible tube 124.

[0109] Of course, in other embodiments, when a control command is received from a button operation, touch screen operation, or other means, the camera can be controlled to capture a video of the endoscope tubing being submerged in water for a preset duration from one side of the tubing.

[0110] Furthermore, acquiring initial hose images captured by the camera at a preset frequency may include, prior to:

[0111] (1) Obtain the image of the waterproof cover taken from the inside of the threaded waterproof cover 121.

[0112] Specifically, all components of the endoscope device 12 are placed under the camera. If the threaded waterproof cap 121 is identified from the endoscope device 12, a voice control command is issued saying, "Please align the inside of the waterproof cap with the camera." After the operator aligns the inside of the threaded waterproof cap 121 with the camera, an image of the waterproof cap taken from the inside of the threaded waterproof cap 121 is obtained.

[0113] In one specific embodiment, a waterproof cap segmentation model is pre-trained, preferably using Unet++, and the segmentation boundaries of the waterproof cap are delineated by a professional endoscopist.

[0114] (2) Input the waterproof cover image into the waterproof cover segmentation model to obtain the first waterproof cover region.

[0115] In one specific embodiment, a water droplet segmentation model is pre-trained, preferably using Unet++, and the water droplet segmentation boundaries are delineated by a professional endoscopist.

[0116] (3) Input the image of the first waterproof cover area into the attachment segmentation model to obtain the attachment segmentation image.

[0117] In one specific embodiment, an attachment segmentation model is pre-trained, preferably using Unet++, and the boundaries of the attachments are delineated by a professional endoscopist.

[0118] (4) Determine whether the first attachment region exists in the attachment segmentation image.

[0119] (5) If the waterproof cover image has a first attachment area, an inner boundary contour and an outer boundary contour are generated inside and outside the first attachment area respectively. The area between the inner boundary contour and the outer contour of the first attachment area is determined as the second attachment area. The area between the outer boundary contour and the outer contour of the first attachment area is determined as the attachment comparison area. The outer boundary contour, the inner boundary contour and the outer contour of the first attachment area have the same shape and the same centroid. The area of ​​the attachment comparison area is the same as the area of ​​the second attachment area.

[0120] (5) Obtain the first, second and third moments of the second attachment region; obtain the first, second and third moments of the attachment comparison region.

[0121] Specifically, the average value of the pixels in the r, g, and b channels of the second attachment region is obtained to get the first moment, as shown in the following formula:

[0122]

[0123] Specifically, the second moment is obtained by calculating the standard deviation of the pixels in the r, g, and b channels of the second attachment region, as shown in the following formula:

[0124]

[0125] Specifically, the third moment is calculated using the following formula:

[0126]

[0127] (6) The variances of the first, second, and third moments of the second attachment region are determined as the first color quantization value; the variances of the first, second, and third moments of the attachment comparison region are determined as the second color quantization value.

[0128] Among them, the first color quantization value is color. F As shown below,

[0129] color F =std(r mean ,g mean ,b mean ,r std ,g std ,b std ,r offset ,g offset ,b offset )

[0130] The second color quantization value is denoted as color. G .

[0131] (7) Calculate the color quantization ratio between the smaller and larger values ​​of the first and second color quantization values ​​to obtain the color quantization ratio of each second attachment region.

[0132] The color quantization ratio (color1) is shown in the following formula.

[0133]

[0134] (8) If the color quantization ratio of each second attachment area is not less than the first preset ratio, the initial hose image captured by the camera is obtained at the preset frequency.

[0135] The first preset ratio can be set according to specific circumstances, for example, the first preset ratio is 0.85. If the color quantization ratio of each second attachment area is not less than the first preset ratio, it indicates that the attachment predicted by the model may be incorrect, and there is actually no attachment. In this case, the initial hose image captured by the camera is obtained at a preset frequency. If the color quantization ratio of the second attachment area is less than the first preset ratio, it indicates that the attachment is indeed a real attachment. At this time, the voice prompt device announces "Please use cleaning agent to clean the attachment".

[0136] Furthermore, acquiring initial hose images captured by the camera at a preset frequency may include, prior to:

[0137] (1) Obtain the image of the waterproof cover taken from the inside of the threaded waterproof cover 121.

[0138] Specifically, all components of the endoscope device 12 are placed under the camera. If the threaded waterproof cap 121 is identified from the endoscope device 12, a voice control command is issued saying, "Please align the inside of the waterproof cap with the camera." After the operator aligns the inside of the threaded waterproof cap 121 with the camera, an image of the waterproof cap taken from the inside of the threaded waterproof cap 121 is obtained.

[0139] (2) Input the waterproof cover image into the waterproof cover segmentation model to obtain the first waterproof cover region.

[0140] In one specific embodiment, a waterproof cap segmentation model is pre-trained, preferably using Unet++, and the boundaries of the waterproof cap are delineated by a professional endoscopist.

[0141] (3) Input the image within the first waterproof cover area into the water droplet segmentation model to obtain the water droplet segmentation image.

[0142] In one specific embodiment, a water droplet segmentation model is pre-trained, preferably using Unet++, and the boundaries of the water droplets are delineated by a professional endoscopist.

[0143] In another specific embodiment, the image within the first waterproof cover area is input into the attachment segmentation model to obtain an attachment segmentation image. If the waterproof cover image contains a first attachment area, an inner boundary contour and an outer boundary contour are generated inside and outside the first attachment area, respectively. The area between the inner boundary contour and the outer contour of the first attachment area is defined as the second attachment area, and the area between the outer boundary contour and the outer contour of the first attachment area is defined as the attachment comparison area. The outer boundary contour, inner boundary contour, and outer contour of the first attachment area have the same shape and centroid, and the area of ​​the attachment comparison area is the same as the area of ​​the second attachment area. The first, second, and third moments of the second attachment area and the attachment comparison area are obtained. The variances of the first, second, and third moments of the second attachment area are determined as the first color quantization value; the variances of the first, second, and third moments of the attachment comparison area are determined as the second color quantization value. The color quantization ratio between the smaller and larger values ​​of the first and second color quantization values ​​is calculated to obtain the color quantization ratio of each second attachment area. If the color quantization ratio of each second attachment region is not less than the first preset ratio, then the image within the first waterproof cover region is input into the water droplet segmentation model to obtain the water droplet segmentation image.

[0144] (4) Determine whether there is a water droplet region in the water droplet segmentation image.

[0145] (5) If there is a water droplet region in the water droplet segmentation image, determine whether the outer contour of the water droplet region meets the preset water droplet shape conditions.

[0146] (6) If the outer contours of each water droplet region on the water droplet segmentation image do not meet the preset water droplet shape conditions, the initial hose image captured by the camera is obtained at the preset frequency.

[0147] The preset water droplet shape condition can be that the outer contour of the water droplet area is circular.

[0148] If the outer contours of each water droplet region on the water droplet segmentation image do not meet the preset water droplet shape conditions, it indicates that the predicted water droplet region may not be a real water droplet. If the threaded waterproof cover 121 meets the requirements, the initial hose image captured by the camera is obtained at the preset frequency.

[0149] Since the water droplet region may not be a complete circle, in order to accurately identify the water droplet, in a specific embodiment, determining whether the outer contour of the water droplet region meets the preset water droplet shape conditions may include:

[0150] (1) Obtain the maximum inscribed circle and minimum circumscribed circle of the outer contour of the water droplet region.

[0151] like Figure 4As shown, the maximum inscribed circle 132 and the minimum circumscribed circle 131 of the outer contour of the water droplet region 134 are obtained.

[0152] (2) Obtain a preset number of reference circles located between the largest inscribed circle and the smallest circumscribed circle. The preset number of reference circles are concentric with the largest inscribed circle, and the radii of the preset number of reference circles and the largest inscribed circle are an arithmetic sequence.

[0153] like Figure 4 As shown, a reference circle 133 is obtained between the largest inscribed circle 132 and the smallest circumscribed circle 131.

[0154] Of course, the preset number can be 2, 3, etc., depending on the specific settings. For example, the radius of the largest inscribed circle 132 is 10, and the preset number of reference circles is 3, with radii of 11, 12, and 13 respectively.

[0155] (3) Calculate the number of intersections between the preset number of reference circles and the outer contour of the water droplet area.

[0156] (4) If the number of intersections is less than the preset value, the outer contour of the water droplet area is determined to meet the preset water droplet shape condition; if the number of intersections is not less than the preset value, the outer contour of the water droplet area does not meet the preset water droplet shape condition.

[0157] If the number of intersections is less than the preset value, it means that the outer contour of the water droplet region is closer to a circle. This confirms that the outer contour of the water droplet region meets the preset water droplet shape conditions and is a real water droplet, thus performing a secondary verification of the model's output.

[0158] Furthermore, the number of intersection points is con, and the perimeter of the water droplet region is C; it is determined whether con / C is lower than a preset threshold. If con / C is lower than the preset threshold, it is determined that the outer contour of the water droplet region meets the preset water droplet shape condition.

[0159] In another specific embodiment, it is determined whether the ratio of the areas of the largest inscribed circle and the smallest circumscribed circle exceeds a third preset ratio. If the ratio exceeds the third preset ratio and the number of intersection points is less than a preset value, the outer contour of the water droplet region is determined to meet the preset water droplet shape condition. If the ratio does not exceed the third preset ratio and the number of intersection points is not less than the preset value, the outer contour of the water droplet region is determined not to meet the preset water droplet shape condition, thus more accurately determining whether the predicted water droplet is a real water droplet. For example, the third preset ratio is 0.9.

[0160] Furthermore, if the outer contours of each water droplet region in the water droplet segmentation image do not meet the preset water droplet shape conditions, then the initial hose image captured by the camera is acquired at a preset frequency, which also includes:

[0161] (1) Acquire the first image taken by the camera along the extension direction of the threaded hollow rod 122.

[0162] If the outer contours of each water droplet region in the water droplet segmentation image do not meet the preset water droplet shape conditions, the first image captured by the camera along the extension direction of the threaded hollow rod 122 is obtained.

[0163] The first image is as follows Figure 5 As shown.

[0164] (2) Perform image segmentation on the first image to obtain the first segmented image;

[0165] (3) Determine whether there is a first electrical connector segmentation area and a second waterproof cover area on the first segmentation image.

[0166] (4) If there is a first electrical connector segmentation area and a second waterproof cover area on the first segmentation image, then determine whether the intersection-union ratio between the minimum bounding rectangle of the first electrical connector segmentation area and the minimum bounding rectangle of the second waterproof cover area exceeds the preset intersection-union ratio.

[0167] The preset intersection-union ratio is 0.98.

[0168] (5) If the intersection-union ratio between the minimum bounding rectangle of the first electrical connector segmentation area and the minimum bounding rectangle of the second waterproof cover area exceeds the preset intersection-union ratio, a voice control command to tighten the threaded waterproof cover 121 is issued, and the initial hose image captured by the camera is obtained at a preset frequency.

[0169] Place both the electrical connector and the threaded waterproof cover under the camera. If the Intersection over Union (IOU) between the minimum bounding rectangle of the first electrical connector area and the minimum bounding rectangle of the second waterproof cover area exceeds the preset IOU, for example, IOU>0.98, the voice prompt device will announce "Please press the waterproof cover and rotate it 45 degrees clockwise".

[0170] Furthermore, if the intersection-union ratio between the minimum bounding rectangle of the threaded rod segmentation area and the minimum bounding rectangle of the second waterproof cover area exceeds a preset intersection-union ratio, a voice control command to tighten the threaded waterproof cover 121 is issued, and the initial hose image captured by the camera is acquired at a preset frequency, including:

[0171] (1) Acquire a second image taken by the camera along the extension direction of the vertical threaded hollow rod 122.

[0172] The second image is as follows Figure 6 As shown.

[0173] (2) Perform image segmentation on the second image to obtain the second segmented image.

[0174] (3) Determine whether there is a threaded rod segmentation area, a second electrical connector segmentation area, and a third waterproof cover area on the second segmentation image.

[0175] (4) If there is a threaded rod segmentation area, a second electrical connector segmentation area and a third waterproof cover area on the second segmentation image, then obtain the first projection length of the threaded rod segmentation area in the preset direction and the second projection length in the direction perpendicular to the preset direction, wherein the straight line determined by the centroid of the second electrical connector segmentation area and the third waterproof cover area is parallel to the preset direction.

[0176] Figure 6 In the middle, the preset direction is horizontal, the first projection length is W, and the second projection length is H.

[0177] (5) Determine whether the ratio of the first projection length to the second projection length exceeds the second preset ratio.

[0178] (6) If the ratio of the first projection length to the second projection length does not exceed the second preset ratio, the initial hose image captured by the camera is obtained at the preset frequency.

[0179] The second preset ratio is δ. If the ratio of the first projection length to the second projection length does not exceed the second preset ratio, it indicates that the threaded waterproof cap is tightened and remains sealed. Then, the initial hose image captured by the camera is obtained at the preset frequency.

[0180] Specifically, place electrical connectors 1, 2, and 3 horizontally under the camera to further verify that the waterproof cap is tightened. Figure 6 As shown. Obtain the first projected length W and the second projected length H of the threaded rod segmentation region. If the waterproof cap is not tightened, the device will announce, "Please tighten the waterproof cap again." Otherwise, the device will announce, "Please place the endoscope in the water tank," and will acquire the initial hose image from the camera at a preset frequency.

[0181] S202. Use the YOLOv5+DeepSORT model to perform multi-target tracking on the air bubbles in the video of the hose being immersed in water, and obtain the movement trajectories of multiple air bubbles in the camera shooting interface.

[0182] Multiple Object Tracking (MOT) locates targets and plots their trajectories in each video frame. Its input is a video sequence, and its output is the trajectory and a unique ID for each target. This means that for different frames, we not only need to identify the targets (with bounding boxes), but also assign an ID to each target to link them to preceding and following frames. Specifically, the YOLOv5+DeepSORT model is used to perform multi-target tracking on air bubbles in a video of a hose immersing in water, obtaining the movement trajectories of multiple bubbles in the camera's view. The YOLOv5+DeepSORT model is used to perform multi-target tracking on air bubbles in a video of a hose immersing in water, obtaining the movement trajectories of multiple bubbles in the camera's view.

[0183] Since there may be multiple leak locations, each leak location may generate multiple bubbles, and each bubble corresponds to a bubble movement trajectory.

[0184] S203. Perform linear fitting on the multiple bubble movement trajectories to obtain multiple linear movement trajectories.

[0185] Multiple linear movement trajectories, such as Figure 7 As shown.

[0186] Since the bubble's trajectory may not be a straight line, we perform linear fitting on multiple bubble trajectories to obtain multiple straight-line trajectories.

[0187] S204. Cluster the multiple straight-line movement trajectories according to the midpoint x-coordinate and slope of each straight-line movement trajectory to obtain multiple movement trajectory clusters.

[0188] In this embodiment, the abscissa of the midpoint and the slope of each linear movement trajectory are obtained. Multiple linear movement trajectories are then clustered based on their midpoint abscissas and slopes to obtain multiple movement trajectory clusters. Since the bubble movement trajectories generated at the same leakage location are relatively close, multiple movement trajectory clusters are obtained through clustering, with the multiple linear movement trajectories generated at each leakage location located within one movement trajectory cluster.

[0189] S205. Determine each movement trajectory cluster as the target movement trajectory cluster, and calculate the intersection points of each straight-line movement trajectory in the target movement trajectory cluster with the endoscope tube.

[0190] In one specific embodiment, an image of the endoscopic tube immersed in water is acquired from a video of the tube being immersed in water. This image is then segmented to obtain the endoscopic tube region. The Zhang-Suen thinning algorithm is used to obtain the centerline of the endoscopic tube region. The intersection points of each straight-line movement trajectory in the target movement trajectory cluster with the tube centerline are determined as the intersection points of each straight-line movement trajectory with the endoscopic tube 124. These intersection points are the locations where air bubbles are generated.

[0191] S206. The average coordinates of the intersection points of each straight-line movement trajectory in the target movement trajectory cluster and the endoscope tube are determined as the leakage location corresponding to the target movement trajectory cluster, thus obtaining the leakage location corresponding to each movement trajectory cluster.

[0192] Due to detection errors, the intersection points of each straight-line movement trajectory within the target movement trajectory cluster and the endoscope tube may not be in the same position. The average coordinate of the intersection points of each straight-line movement trajectory within the target movement trajectory cluster and the endoscope tube is determined as the leakage location corresponding to the target movement trajectory cluster, thus obtaining the leakage location corresponding to each movement trajectory cluster.

[0193] S207. Determine the leakage location corresponding to each movement trajectory cluster as the leakage location of the endoscope tube.

[0194] The leakage location corresponding to each movement trajectory cluster is the leakage location of the endoscope tube 124.

[0195] Furthermore, arbitrarily select a pixel on the center line of the flexible tube, obtain the two intersection points of the pixel's normal with the endoscope flexible tube region, and calculate the Euclidean distance between the two intersection points to obtain the flexible tube image diameter d; calculate the distance l from each leakage location to the flexible tube port. i ;Calculate the actual distance from each leak location to the hose port based on the actual hose diameter D. And make a record of it in the repair documentation.

[0196] Furthermore, the number of trajectories Num in each movement trajectory cluster is obtained. When an air bubble is detected, the voice prompt device announces, "Please align the location of the air bubble on the pipe wall directly towards the camera," and then a timer begins. Within a preset time t, the multi-target tracking model YOLOv5+DeepSORT counts the number of air bubbles Num generated, which is the number of trajectories Num in each movement trajectory cluster. The damage level of the leakage location is determined based on the ratio of the number of trajectories Num to the preset time t. The larger the hole, the more likely the inner hose is to be damaged and unusable; conversely, a smaller hole indicates it can be repaired and reused, and this should be documented in the repair log. If... If the hole at the leakage location is large, the hose is unusable; otherwise, if it is small, it can be repaired and reused, and this should be recorded in the repair documentation. Here, λ is the threshold value for the ratio of the number of tracks Num to the preset duration t.

[0197] To better implement the method for detecting the leakage location of the endoscopic tubing in the embodiments of this application, this application also provides a device for detecting the leakage location of the endoscopic tubing, such as... Figure 8 As shown, the endoscope tubing leakage detection device 300 includes:

[0198] The video acquisition unit 301 is used to control the camera to capture a video of the endoscope tube being submerged in water for a preset duration from one side of the endoscope tube. When capturing the video of the tube being submerged in water, the threaded waterproof cap is threaded to the threaded hollow rod to seal the endoscope tube. The endoscope tube is submerged in water, and the air pressure inside the endoscope tube is maintained at a preset air pressure value.

[0199] Bubble tracking unit 302 is used to perform multi-target tracking of bubbles in the video of hose immersion in water using the YOLOv5+DeepSORT model, and obtain the movement trajectories of multiple bubbles in the camera shooting interface.

[0200] The linear fitting unit 303 is used to perform linear fitting on the movement trajectories of multiple bubbles respectively to obtain multiple linear movement trajectories;

[0201] Clustering unit 304 is used to cluster multiple straight-line movement trajectories based on the midpoint x-coordinate and slope of each straight-line movement trajectory to obtain multiple movement trajectory clusters;

[0202] The intersection calculation unit 305 is used to determine each movement trajectory cluster as a target movement trajectory cluster and calculate the intersection point of each straight movement trajectory in the target movement trajectory cluster with the endoscope tube.

[0203] The first determining unit 306 is used to determine the average coordinate of the intersection points of each straight line movement trajectory in the target movement trajectory cluster and the endoscope tube as the leakage location corresponding to the target movement trajectory cluster, and obtain the leakage location corresponding to each movement trajectory cluster.

[0204] The second determining unit 307 is used to determine the leakage location corresponding to each movement trajectory cluster as the leakage location of the endoscope tube.

[0205] This application also provides a computer device that integrates any of the endoscope tubing leakage detection devices provided in this application. The computer device includes:

[0206] One or more processors;

[0207] Memory; and

[0208] One or more applications, wherein the applications are stored in memory and configured to be executed by a processor in the steps of the endoscope tube leakage location detection method in any of the embodiments described above.

[0209] like Figure 9 As shown, it illustrates a structural schematic diagram of the computer device involved in the embodiments of this application, specifically:

[0210] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that the computer device structure shown in the figures does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0211] Processor 401 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in memory 402, and by calling data stored in memory 402, thereby providing overall monitoring of the computer device. Optionally, processor 401 may include one or more processing cores; processor 401 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may not be integrated into processor 401.

[0212] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0213] The computer device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0214] The computer device may also include an input unit 404, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0215] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the computer device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:

[0216] A camera is controlled to capture a video of the endoscope tubing being submerged in water for a preset duration from one side. During the video capture, a threaded waterproof cap is threadedly connected to a threaded hollow rod to seal the endoscope tubing, which is then immersed in water. The air pressure inside the endoscope tubing is maintained at a preset value. A YOLOv5+DeepSORT model is used to perform multi-target tracking of air bubbles in the submerged video, obtaining multiple bubble movement trajectories on the camera's view. Linear fitting is performed on each bubble movement trajectory to obtain multiple linear movement trajectories. These linear movement trajectories are then clustered based on the midpoint x-coordinate and slope of each trajectory, resulting in multiple trajectory clusters. Each trajectory cluster is identified as a target trajectory cluster, and the intersection points of each linear movement trajectory within the target cluster with the endoscope tubing are calculated. The average coordinate of the intersection points of each linear movement trajectory within the target trajectory cluster with the endoscope tubing is used to determine the leakage location corresponding to the target trajectory cluster, thus obtaining the leakage location for each trajectory cluster. The leakage location corresponding to each trajectory cluster is then determined as the leakage location of the endoscope tubing.

[0217] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0218] Therefore, embodiments of this application provide a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any of the endoscope tube leakage detection methods provided in embodiments of this application. For example, the computer program loaded by the processor can execute the following steps:

[0219] A camera is controlled to capture a video of the endoscope tubing being submerged in water for a preset duration from one side. During the video capture, a threaded waterproof cap is threadedly connected to a threaded hollow rod to seal the endoscope tubing, which is then immersed in water. The air pressure inside the endoscope tubing is maintained at a preset value. A YOLOv5+DeepSORT model is used to perform multi-target tracking of air bubbles in the submerged video, obtaining multiple bubble movement trajectories on the camera's view. Linear fitting is performed on each bubble movement trajectory to obtain multiple linear movement trajectories. These linear movement trajectories are then clustered based on the midpoint x-coordinate and slope of each trajectory, resulting in multiple trajectory clusters. Each trajectory cluster is identified as a target trajectory cluster, and the intersection points of each linear movement trajectory within the target cluster with the endoscope tubing are calculated. The average coordinate of the intersection points of each linear movement trajectory within the target trajectory cluster with the endoscope tubing is used to determine the leakage location corresponding to the target trajectory cluster, thus obtaining the leakage location for each trajectory cluster. The leakage location corresponding to each trajectory cluster is then determined as the leakage location of the endoscope tubing.

[0220] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed descriptions of other embodiments above, which will not be repeated here.

[0221] In practice, each of the above units or structures can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units or structures, please refer to the previous method embodiments, which will not be repeated here.

[0222] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0223] The above provides a detailed description of the method and apparatus for detecting leakage locations of an endoscope tube according to the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for detecting the location of leakage in an endoscopic tubing, characterized in that, This invention relates to an endoscopic device, which includes an electrical connector, a threaded waterproof cap, and an endoscopic tubing. One end of the electrical connector has a threaded hollow rod, and this end is connected to the endoscopic tubing. The threaded waterproof cap is threadedly connected to the threaded hollow rod to seal the endoscopic tubing. A method for detecting leakage points in the endoscopic tubing includes: The camera is controlled to capture a video of the endoscope tube being submerged in water for a preset duration from one side of the endoscope tube. During the capture of the video of the endoscope tube being submerged in water, the threaded waterproof cap is threaded to the threaded hollow rod to seal the endoscope tube. The endoscope tube is submerged in water, and the air pressure inside the endoscope tube is maintained at a preset air pressure value. The YOLOv5+DeepSORT model was used to perform multi-target tracking of bubbles in the video of the hose being immersed in water, and the movement trajectories of multiple bubbles in the camera shooting interface were obtained. By performing linear fitting on the trajectories of multiple bubbles, multiple linear trajectories are obtained; Multiple straight-line trajectories are clustered based on the x-coordinate of the midpoint and the slope of each straight-line trajectories to obtain multiple trajectory clusters. Each movement trajectory cluster is determined as a target movement trajectory cluster, and the intersection points of each straight movement trajectory in the target movement trajectory cluster and the endoscope tube are calculated; The average coordinates of the intersection points of each straight-line movement trajectory in the target movement trajectory cluster with the endoscope tube are determined as the leakage location corresponding to the target movement trajectory cluster, thus obtaining the leakage location corresponding to each movement trajectory cluster. The leakage location corresponding to each movement trajectory cluster is determined as the leakage location of the endoscope tube.

2. The method for detecting leakage locations of endoscopic tubing according to claim 1, characterized in that, The control camera captures a video of the endoscope tubing being submerged in water for a preset duration from one side, including: Acquire initial hose images captured by the camera at a preset frequency; The initial tube image is segmented using the endoscope tube to obtain a segmented endoscope tube image; Determine whether an endoscope tube region exists in the segmented image of the endoscope tube; If there is an endoscope tube region in the segmented image of the endoscope tube, the Zhang-Suen thinning algorithm is used to obtain the center line of the endoscope tube region. Determine if the centerline of the hose is a straight line; If the center line of the hose is a straight line, the camera is controlled to capture a video of the hose being submerged in water for a preset duration from one side of the endoscope hose.

3. The method for detecting leakage locations of the endoscopic tubing according to claim 2, characterized in that, Prior to acquiring the initial hose image captured by the camera at a preset frequency, the process includes: Obtain an image of the waterproof cap taken from the inside of the threaded waterproof cap; The waterproof cover image is input into the waterproof cover segmentation model to obtain the first waterproof cover region; The image within the first waterproof cover area is input into the water droplet segmentation model to obtain the water droplet segmentation image; Determine whether the water droplet segmentation image contains water droplet regions; If the water droplet segmentation image contains a water droplet region, then determine whether the outer contour of the water droplet region meets the preset water droplet shape conditions; If the outer contours of each water droplet region in the water droplet segmentation image do not meet the preset water droplet shape conditions, then the initial hose image captured by the camera is obtained at a preset frequency.

4. The method for detecting leakage locations of the endoscopic tubing according to claim 3, characterized in that, The step of determining whether the outer contour of the water droplet region meets the preset water droplet shape conditions includes: Obtain the maximum inscribed circle and the minimum circumscribed circle of the outer contour of the water droplet region; Obtain a predetermined number of reference circles located between the largest inscribed circle and the smallest circumscribed circle, wherein the predetermined number of reference circles are concentric with the largest inscribed circle, and the radii of the predetermined number of reference circles and the largest inscribed circle form an arithmetic sequence; Calculate the number of intersections between a preset number of reference circles and the outer contour of the water droplet region; If the number of intersections is less than a preset value, then the outer contour of the water droplet region is determined to meet the preset water droplet shape condition; if the number of intersections is not less than the preset value, then the outer contour of the water droplet region does not meet the preset water droplet shape condition.

5. The method for detecting leakage locations of the endoscopic tubing according to claim 2, characterized in that, Prior to acquiring the initial hose image captured by the camera at a preset frequency, the process includes: Obtain an image of the waterproof cap taken from the inside of the threaded waterproof cap; The waterproof cover image is input into the waterproof cover segmentation model to obtain the first waterproof cover region; The image within the first waterproof cover area is input into the attachment segmentation model to obtain the attachment segmentation image; Determine whether the segmented image of the attachment contains a first attachment region; If the waterproof cover image has a first attachment area, an inner boundary contour and an outer boundary contour are generated inside and outside the first attachment area, respectively. The area between the inner boundary contour and the outer contour of the first attachment area is defined as the second attachment area. The area between the outer boundary contour and the outer contour of the first attachment area is defined as the attachment comparison area. The outer boundary contour, the inner boundary contour, and the outer contour of the first attachment area have the same shape and the same centroid. The area of ​​the attachment comparison area is the same as the area of ​​the second attachment area. Obtain the first, second, and third moments of the second attachment region; obtain the first, second, and third moments of the attachment comparison region; The variances of the first, second, and third moments of the second attachment region are determined as the first color quantization value; the variances of the first, second, and third moments of the attachment contrast region are determined as the second color quantization value. Calculate the color quantization ratio between the smaller and larger values ​​of the first and second color quantization values ​​to obtain the color quantization ratio of each second attachment region; If the color quantization ratio of each second attachment area is not less than the first preset ratio, then the initial hose image captured by the camera is obtained at the preset frequency.

6. The method for detecting leakage locations of the endoscopic tubing according to claim 2, characterized in that, The step of acquiring the initial hose image captured by the camera at a preset frequency includes: Acquire a first image captured by the camera along the extension direction of the threaded hollow rod; The first image is segmented to obtain a first segmented image; Determine whether there is a first electrical connector segmentation region and a second waterproof cover region on the first segmented image; If there is a first electrical connector segmentation region and a second waterproof cover region on the first segmented image, then determine whether the intersection-union ratio between the minimum bounding rectangle of the first electrical connector segmentation region and the minimum bounding rectangle of the second waterproof cover region exceeds the preset intersection-union ratio. If the intersection-union ratio between the minimum bounding rectangle of the first electrical connector segmentation area and the minimum bounding rectangle of the second waterproof cover area exceeds the preset intersection-union ratio, a voice control command to tighten the threaded waterproof cover is issued, and the initial hose image captured by the camera is acquired at a preset frequency.

7. The method for detecting leakage locations of endoscopic tubing according to claim 2, characterized in that, The step of acquiring the initial hose image captured by the camera at a preset frequency includes: Acquire a second image taken by the camera along the direction perpendicular to the extension of the threaded hollow rod; Perform image segmentation on the second image to obtain a second segmented image; Determine whether the second segmented image contains a threaded rod segmentation region, a second electrical connector segmentation region, and a third waterproof cover region; If the second segmented image contains a threaded rod segmentation region, a second electrical connector segmentation region, and a third waterproof cover region, obtain the first projection length of the threaded rod segmentation region in a preset direction and the second projection length in a direction perpendicular to the preset direction, wherein the straight line determined by the centroid of the second electrical connector segmentation region and the third waterproof cover region is parallel to the preset direction. Determine whether the ratio of the first projection length to the second projection length exceeds a second preset ratio; If the ratio of the first projection length to the second projection length does not exceed the second preset ratio, then the initial hose image captured by the camera is obtained at a preset frequency.

8. A device for detecting the leakage location of an endoscope tubing, characterized in that, An endoscope device is used in endoscopic equipment, the endoscope device including an electrical connector, a threaded waterproof cap, and the endoscope tubing. One end of the electrical connector has a threaded hollow rod, and one end of the electrical connector is connected to the endoscope tubing. The threaded waterproof cap is threadedly connected to the threaded hollow rod to seal the endoscope tubing. The device for detecting leakage points of the endoscope tubing includes: The video acquisition unit is used to control the camera to capture a video of the endoscope tube being submerged in water for a preset duration from one side of the endoscope tube. When capturing the video of the tube being submerged in water, the threaded waterproof cap is threadedly connected to the threaded hollow rod to seal the endoscope tube. The endoscope tube is submerged in water, and the air pressure inside the endoscope tube is maintained at a preset air pressure value. The bubble tracking unit is used to perform multi-target tracking of bubbles in the video of the hose being immersed in water using the YOLOv5+DeepSORT model, and to obtain the movement trajectories of multiple bubbles in the camera shooting interface. The line fitting unit is used to perform line fitting on the movement trajectories of multiple bubbles respectively, so as to obtain multiple line movement trajectories; Clustering units are used to cluster multiple straight-line movement trajectories based on the x-coordinate of the midpoint and the slope of each straight-line movement trajectory, thereby obtaining multiple movement trajectory clusters; The intersection calculation unit is used to determine each movement trajectory cluster as a target movement trajectory cluster and calculate the intersection points of each straight movement trajectory in the target movement trajectory cluster with the endoscope tube. The first determining unit is used to determine the average coordinate of the intersection points of each straight-line movement trajectory in the target movement trajectory cluster and the endoscope tube as the leakage location corresponding to the target movement trajectory cluster, thereby obtaining the leakage location corresponding to each movement trajectory cluster. The second determining unit is used to determine the leakage location corresponding to each movement trajectory cluster as the leakage location of the endoscope tube.

9. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the method for detecting the location of leakage of the endoscope tubing as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It contains a computer program that is loaded by a processor to perform the steps in the method for detecting the location of leakage in the endoscopic tubing as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Video-processing method and device

    CN104867161A

  • Pedestrian target movement track acquisition method and system based on multiple cameras

    CN110378931A