Method and system for instrument tracking and automatic laparoscope operation in field of view of laparoscope
The target detection and tracking algorithm is used to identify and track instruments in the laparoscopic field of view and generate an automatic mirror movement strategy, which solves the problem of difficult instrument identification and tracking in multi-instrument scenarios and improves the accuracy and stability of automatic mirror movement during surgery.
Patent Information
- Application Number
- CN202410868852.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-07-01
AI Technical Summary
In laparoscopic minimally invasive surgery, it is difficult for the existing technology to effectively identify and track the main instruments in a multi-instrument scenario. It is especially difficult to process when there is overlapping occlusion at the front end of the instrument, and the parameters of the monocular visual depth estimation model are highly different from the camera parameters. Coupling leads to depth estimation errors and affects the accuracy of automatic mirror movement.
Using target detection, target matching and target tracking algorithms, the positioning frame information of the front end of the device is obtained through the pre-trained target detection model, and an automatic mirror movement strategy is generated after deduplication, and the mirror-holding robot is instructed to move in the image based on the position and size information of the device in the image. Movement in the plane and depth direction keeps the instrument in a reasonable position in the field of view.
It improves the stability and accuracy of instrument tracking in multi-instrument scenarios, avoids dependence on accurate acquisition of depth information, and ensures the accuracy and continuity of automatic mirror movement. It is suitable for situations where multiple instruments move quickly or block each other.
Smart Images

Figure CN118750170A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of laparoscopic surgical robots, and in particular to a method and system for tracking instruments and automatically moving the robot in a laparoscopic field of view. Background Art
[0002] Laparoscopic minimally invasive surgery is a surgery that is performed by making a hole in the abdomen to enter the abdominal cavity, using minimally invasive surgical instruments and laparoscopic imaging systems. This surgical method has the advantages of less trauma, less pain, and faster recovery, and has gradually become a commonly used surgical method in clinical practice.
[0003] In laparoscopic minimally invasive surgery, it is necessary to perform visual tracking of surgical instruments. The so-called instrument visual tracking is to achieve automatic recognition and accurate tracking of surgical instruments through image processing and computer vision technology. The implementation of this technology usually relies on advanced image processing and computer vision algorithms. These algorithms can perform real-time analysis of images collected by the laparoscope and identify information such as the shape, size, and position of surgical instruments. At the same time, through the processing and comparison of continuous images, the movement trajectory and posture changes of surgical instruments can also be accurately calculated.
[0004] At the same time, in the existing technology, laparoscopic minimally invasive surgery also uses an active mirror-holding robot, which receives instructions from the surgeon through a human-machine interface and adjusts the position and posture of the laparoscope, thereby providing the surgeon with a clear surgical field of view. The development trend of this human-machine interface is active guidance based on laparoscopic images, of which visual tracking of surgical instruments is one of the core technologies.
[0005] In the prior art, there are already some technical solutions for performing instrument vision on minimally invasive surgical instruments during laparoscopic minimally invasive surgery.
[0006] For example, patent application CN113538522A - a method for visual tracking of instruments for laparoscopic minimally invasive surgery discloses a solution: the laparoscopic surgery video stream is processed frame by frame, the target area of the surgical instrument is segmented, and the position of the tracking point on the joint of the surgical instrument is determined by an image processing method based on the segmentation result, the depth information of the image is obtained by a monocular vision depth estimation network, and the three-dimensional spatial coordinates of the tracking point in the world coordinate system are obtained based on the principle of camera calibration, which are used to guide the dynamic control of the robot.
[0007] However, the patent application CN113538522A - a visual tracking method for instruments used in laparoscopic minimally invasive surgery still has the following defects: the positioning and tracking of instruments is achieved based on the method of segmenting the target area of surgical instruments. When there are multiple instruments in the video image, this method is difficult to handle, especially when the front ends of multiple instruments overlap and are blocked, which will cause the subsequent processing logic to fail. In addition, the network for monocular visual depth estimation is obtained through deep learning training based on the image pair data set of real image-depth distance map. The model parameters are highly coupled with the camera parameters of laparoscopic imaging. Changing the laparoscope or shooting parameters will lead to errors in depth estimation, resulting in errors in the world coordinates of the converted tracking points.
[0008] For another example, patent application CN114663474A - A method for visual tracking of multiple instruments in the laparoscopic field of view of a laparoscopic robot discloses a solution: it is based on a workflow similar to that of CN113538522A, but improves the network for segmenting the target area of surgical instruments to make the positioning of surgical instrument joints more accurate. When multiple surgical instrument joints are visible, the tracking target point is defined as the midpoint of the line connecting the two joint points farthest apart, thereby solving the problem of tracking multiple instruments.
[0009] However, the following defects still exist in patent application CN114663474A - a method for visual tracking of multiple instruments in the laparoscopic field of view of a laparoscopic robot: when handling multi-instrument scenarios, the solution defines the tracking target point as the midpoint of the joint points of the two instruments farthest apart, and is unable to specify the main instrument in the multi-instrument scenario during laparoscopic surgery. In theory, it is more reasonable to use the main instrument as the tracking target. Summary of the invention
[0010] In view of the above problems, the purpose of the present invention is to provide a method and system for tracking instruments and automatically moving the lens in the field of view of a laparoscope, so as to solve the problem of real-time tracking of a specified instrument in a multi-instrument scene in the field of view of a laparoscope. In addition, in view of the problem that the automatic movement of the laparoscopic image is difficult due to the inability to effectively perceive the depth of the instrument target, the present invention forms an effective automatic movement strategy based on the position and size information of the instrument target detected in the image after algorithm processing, thereby improving the accuracy, stability and sustainability of the automatic movement of the mirror holding robot during surgery.
[0011] The above-mentioned object of the present invention is achieved through the following technical solutions:
[0012] A method for tracking instruments and automatically moving the scope in a laparoscope field of view comprises the following steps:
[0013] S1: acquiring an initial video frame image of the laparoscope field of view for instrument tracking and automatic mirror movement, selecting a tracking instrument as a main tracking target on the initial video frame image, outlining positioning frame information surrounding the front end of the main tracking target, and setting an ideal length of the front end of the main tracking target;
[0014] S2: acquiring a video stream image in the laparoscope field of view at a fixed frequency, and obtaining the positioning frame information of the front end of the tracking device including at least the main tracking target in the current image frame through target detection, target matching, target tracking, positioning frame synthesis update, and tracked target post-processing processing algorithms based on the acquired current frame image;
[0015] S3: Generate an automatic camera movement strategy based on the acquired position and size of the positioning frame information of the main tracking target in the current image frame in the video stream image.
[0016] Further, in step S2, the target detection is performed on the current frame image, specifically:
[0017] Based on the pre-trained target detection model, a set Y of all pending positioning frames on the current frame image is obtained. Each element y in the positioning frame set Y i Contains the positioning frame information, device category information and confidence score, wherein the positioning frame information includes the coordinates (r, c) of the upper left corner of the rectangular frame serving as the positioning frame and the width w and height h of the rectangular frame;
[0018] The elements in the positioning box set Y are subjected to deduplication operations including removal of highly overlapping positioning boxes and removal of nested positioning boxes. The specific logic is as follows:
[0019] a: The high overlap positioning frame is removed
[0020] Traverse all elements in the positioning frame set Y, calculate the target detection evaluation index IoU between the positioning frame information in the current element and the positioning frame information of other elements, the target detection evaluation index IoU is the ratio of the intersection area of two positioning frames to the combined area, if the target detection evaluation index IoU is greater than a preset evaluation critical threshold, delete the element with the smaller confidence score;
[0021]
[0022] Wherein, A is the current positioning frame, and B is other positioning frames in the positioning frame set Y;
[0023] b: The nested positioning frame is removed
[0024] Traverse all elements in the positioning frame set Y, calculate the inner_rate of the positioning frame information of the current element and other elements with the same device category information, the inner_rate being the ratio of the intersection area of the two positioning frames to the area of the positioning frame with a smaller area, if the inner_rate is greater than a preset inner_rate critical threshold, delete the element with a larger area;
[0025]
[0026] Wherein, A is the current positioning frame, and B is other positioning frames in the positioning frame set Y.
[0027] Further, in step S2, the target matching is performed on the current frame image, specifically:
[0028] Taking the positioning frame information of the front end of the tracking instrument drawn by the user as the target to be tracked as input, wherein the target to be tracked includes the main tracking target drawn on the initial video frame image, and the secondary tracking targets dynamically generated based on the result of the target detection for tracking other surgical instruments in the video stream image;
[0029] Get the deduplicated positioning frame set Y and the positioning frame set X of the main tracking target and the secondary tracking target after the previous image frame calculation and settlement, and solve the weighted bipartite graph maximum matching of the positioning frame set Y and the positioning frame set X. The weight matrix is G(X,Y), and the matrix element G ij =IoU(x i ,y j ) is the target detection evaluation index IoU of the i-th positioning frame information in the positioning frame set X and the j-th positioning frame information in the positioning frame set Y;
[0030] A matching combination that maximizes the weighted sum is found based on the weight matrix, so as to find the best pairing of the objects in the positioning frame set X and the positioning frame set Y, so as to prepare for the subsequent positioning frame synthesis update.
[0031] Further, in step S2, the target tracking is performed on the current frame image, specifically:
[0032] The main tracking target and all the secondary tracking targets are traversed, and the targets are tracked using the kernel correlation filter KCF algorithm to obtain the corresponding tracking target frames z of the main tracking target and all the secondary tracking targets in the current frame image.
[0033] Further, in step S2, the positioning frame synthesis update is performed on the current frame image, specifically:
[0034] Based on the primary tracking target and all the secondary tracking targets, and according to the calculation results of the target matching and the target tracking, updating the tracking results of all current tracking targets including the primary tracking target and the secondary tracking targets in the current frame image, including:
[0035] When the positioning frame information corresponding to the current tracking target in the positioning frame set X in the positioning frame set Y is matched in the target matching, and the target detection evaluation index IoU is greater than 0:
[0036] a: The kernel correlation filter KCF algorithm successfully tracks the current tracking target, the tracking target frame is z, the positioning frame information y and the tracking target frame z are synthesized as the positioning frame information updated by the current tracking target in the current frame image, the center point of the positioning frame information is the midpoint of the line connecting the center point of the positioning frame information y and the center point of the tracking target frame z, the area is the average of the areas of the positioning frame information y and the tracking target frame z, and the aspect ratio remains consistent with the positioning frame information y;
[0037] b: The kernel correlation filter KCF algorithm fails to track the current tracking target and cannot obtain the latest tracking target frame z, then the front end of the tracking device has a large deformation or a large displacement, and the matched positioning frame information y is used as the positioning frame information updated by the current tracking target in the current frame image;
[0038] When the positioning frame information of the current tracking target in the positioning frame set X in the positioning frame set Y is not matched in the target matching, and the target detection evaluation index IoU is equal to 0:
[0039] a: the kernel correlation filter KCF algorithm successfully tracks the current tracking target, the tracking target frame is z, the tracking target frame z is used as the positioning frame information updated by the current tracking target in the current frame image, and the current tracking target is marked as suspected lost;
[0040] b: The kernel correlation filter KCF algorithm fails to track the current tracking target, the current tracking target is not updated in the current frame image, the result of the previous image frame is retained, and the current tracking target is marked as suspected lost.
[0041] Further, in step S2, the tracked target is post-processed on the current frame image, specifically:
[0042] Traverse all the secondary tracking targets. When the number of times the secondary tracking target is continuously marked as suspected of being lost is greater than the first preset number threshold, delete the secondary tracking target, and no longer track the secondary tracking target in the subsequent video stream images;
[0043] If the number of times the primary tracking target is continuously marked as suspected of being lost is greater than the second preset number threshold, prompt that the primary tracking target is lost, and the user is allowed to choose to stop or restart the instrument tracking;
[0044] Extract the bounding box information in the set Y of bounding boxes that are not successfully paired in the target matching, and initialize to generate new secondary tracking targets.
[0045] Further, in step S3, based on the position and size of the bounding box information of the primary tracking target in the obtained current image frame in the video stream image, generate the automatic camera movement strategy, specifically:
[0046] Calculate the distance from the center point of the bounding box information of the primary tracking target to the center point of the video stream image. If the distance is greater than the preset distance threshold, prompt the camera-holding robot to move a fixed step length along the specified direction in the laparoscope image plane;
[0047] Calculate the diagonal length a of the bounding box information of the primary tracking target, and compare it with the ideal length L set at the front end of the primary tracking target in the initial video frame image. The preset ratio threshold is r (0 < r < 1);
[0048] a: a / L < r, the lens of the camera-holding robot is far from the primary tracking target, and the primary tracking target appears small in the video stream image. Prompt the camera-holding robot to move forward a fixed step length in the depth direction;
[0049] b: r ≤ a / L ≤ 1 / r, the lens of the camera-holding robot is at an appropriate distance from the primary tracking target, and the primary tracking target appears in a reasonable size in the video stream image. Keep the depth of the lens of the camera-holding robot unchanged;
[0050] c: a / L > 1 / r, the lens of the camera-holding robot is close to the primary tracking target, and the primary tracking target appears large in the video stream image. Prompt the camera-holding robot to move backward a fixed step length in the depth direction.
[0051] A laparoscopic vision instrument tracking and automatic camera movement system for performing the laparoscopic vision instrument tracking and automatic camera movement method as described above, including:
[0052] A tracking algorithm initialization module is used to obtain an initial video frame image of the laparoscope field of view to be used for instrument tracking and automatic mirror movement, select a tracking instrument as a main tracking target on the initial video frame image, outline positioning frame information surrounding the front end of the main tracking target, and set an ideal length of the front end of the main tracking target;
[0053] A positioning frame information acquisition module is used to acquire the video stream image in the laparoscope field of view at a fixed frequency, and obtain the positioning frame information of the front end of the tracking device including at least the main tracking target in the current image frame through target detection, target matching, target tracking, positioning frame synthesis update, and tracked target post-processing processing algorithms based on the acquired current frame image;
[0054] The automatic camera movement strategy generation module is used to generate an automatic camera movement strategy based on the position and size of the positioning frame information of the main tracking target in the current image frame obtained in the video stream image.
[0055] A computer device comprises a memory and one or more processors, wherein the memory stores computer codes, and when the computer codes are executed by the one or more processors, the one or more processors execute the above method.
[0056] A computer-readable storage medium stores computer codes. When the computer codes are executed, the above method is executed.
[0057] Compared with the prior art, the present invention has at least one of the following beneficial effects:
[0058] (1) The present invention combines the algorithm processing logic of target detection, target matching and target tracking, and can specify the tracking target of the device in a multi-device scenario, and improve the stability and tracking accuracy of the selected device. During the implementation of the solution, the primary tracking target object is generated based on the specified tracking target, and the secondary tracking target object is generated based on other targets in the target detection results. In the dynamic tracking process, the target detection result of the current image frame is paired with the historical positioning information of all tracking objects through multi-target matching, which effectively improves the tracking stability of the algorithm when the targets move quickly or are blocked by each other.
[0059] (2) When dealing with the problem of converting the tracking target positioning information into the mirror movement strategy of the mirror-holding robot, the present invention does not directly calculate the real-world physical coordinates of the tracking instrument target because the depth information cannot be accurately obtained. Based on the center point position of the rectangular frame of the front end of the instrument located in the image, the endoscope is instructed to move in the direction from the center point of the image to the center point of the front end of the instrument in the image plane, keeping the front end of the instrument in the central area of the image field; based on the diagonal length of the positioning frame, the size of the front end of the instrument in the lens is estimated, and the mirror-holding robot is instructed to move forward or backward in the depth direction, keeping the size of the front end of the instrument in the image within a reasonable range. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 It is an overall flow chart of the method for tracking instruments and automatically moving the scope in the laparoscopic field of view of the present invention;
[0061] Figure 2 A flowchart of the present invention for obtaining the positioning frame information of the front end of the tracking device including at least the main tracking target in the current image frame;
[0062] Figure 3 A schematic diagram of a laparoscopic surgery image with a positioning frame and instrument category marked for the present invention;
[0063] Figure 4 A schematic diagram of tracking when the automatic camera movement strategy is performed in the present invention;
[0064] Figure 5 The figure is an overall structural diagram of the instrument tracking and automatic mirror movement system in the laparoscope field of view of the present invention. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0066] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0067] In view of the problems in the background technology, the present invention obtains the detection frame of the front end of all instruments in the image by training the target detection model, and realizes the long-term stable tracking of the selected instrument in combination with the tracking algorithm. The tracking target can be switched at any time according to the user's intention. In order to provide the position information of the mirror holding robot, the present invention does not directly provide the accurate three-dimensional world coordinates, but gives the mirror displacement direction in the image plane and in the depth direction according to the position and size of the instrument target detected in real time in the image, thereby realizing stable and continuous automatic mirror movement and instrument tracking in the field of view.
[0068] The present invention mainly provides a method for tracking surgical instruments in the laparoscopic field of view of a mirror-holding robot and an automatic mirror movement strategy based on tracking information. The present invention does not require preoperative marking of surgical instruments, but detects multiple detection frames of the front ends of surgical instruments from the surgical video stream based on a deep learning method, and combines a multi-target matching algorithm and a target tracking algorithm to improve the stability and tracking accuracy of the selected instrument. The mirror movement displacement direction in the image plane is calculated based on the position of the instrument detection frame, and the forward or backward movement of the mirror in the depth direction is determined based on the size of the detection frame. The present invention realizes the automatic detection and tracking of the front ends of instruments in laparoscopic surgery, and designs a practical automatic mirror movement strategy based on tracking information.
[0069] The following is described by specific examples:
[0070] First embodiment
[0071] like Figure 1 As shown, this embodiment provides a method for tracking instruments and automatically moving the scope in a laparoscope field of view, comprising the following steps:
[0072] S1: Acquire an initial video frame image of the laparoscope field of view for instrument tracking and automatic mirror movement, select a tracking instrument as a primary tracking target on the initial video frame image, outline positioning frame information surrounding the front end of the primary tracking target, and set an ideal length of the front end of the primary tracking target.
[0073] Specifically, in this embodiment, before starting the instrument tracking method of the present invention, corresponding initialization is required, and the specific contents are: 1. Select the main tracking target to be tracked from multiple surgical instruments to be tracked on the initial video frame image, and draw a positioning frame surrounding the front end of the main instrument. In this embodiment, the positioning frame adopts a rectangular frame; 2. Set the ideal length L of the front end of the tracking instrument. The definition of this length is the diagonal length of the rectangular frame of the front end of the instrument in the video stream image when the distance between the target instrument and the laparoscope is optimal. After the initialization is completed, the algorithm generates the main tracking target object, and the drawn rectangular frame shows the size and position of the tracking target in the initial video frame.
[0074] S2: The video stream image in the laparoscope field of view is acquired at a fixed frequency, and based on the acquired current frame image, the positioning frame information of the front end of the tracking device including at least the main tracking target in the current image frame is obtained through target detection, target matching, target tracking, positioning frame synthesis update, and tracked target post-processing processing algorithms.
[0075] Specifically, Figure 2 As shown, in this embodiment, the video stream image is acquired frame by frame at a fixed frequency (such as 15fps), the current frame image and the tracking target positioning frame information obtained by processing the previous image frame are input, and the positioning frame information of the front end of the tracking device including at least the main tracking target in the current image frame is obtained through the processing algorithms of target detection, target matching, target tracking, positioning frame synthesis update, and tracked target post-processing in sequence. The principle details and implementation steps of each algorithm are as follows:
[0076] (1) performing target detection on the current frame image, specifically:
[0077] Based on the pre-trained target detection model, a set Y of all pending positioning frames on the current frame image is obtained. Each element y in the positioning frame set Y i The positioning frame information, the device category information and the confidence score are included. The positioning frame information includes the coordinates (r, c) of the upper left corner of the rectangular frame serving as the positioning frame and the width w and height h of the rectangular frame.
[0078] In order to ensure a sufficiently high target detection rate, a smaller confidence threshold is set. At this time, there may be multiple positioning frames on the front end of the same instrument. It is necessary to perform deduplication operations on the elements in the positioning frame set Y, including removal of highly overlapping positioning frames and nested positioning frames. The specific logic is as follows:
[0079] a: The high overlap positioning frame is removed
[0080] Traverse all elements in the positioning frame set Y, calculate the target detection evaluation index IoU (Intersection over Union) of the positioning frame information in the current element and the positioning frame information of other elements, the target detection evaluation index IoU is the ratio of the intersection area of two positioning frames to the combined area, if the target detection evaluation index IoU is greater than a preset evaluation critical threshold, delete the element with a smaller confidence score;
[0081]
[0082] Wherein, A is the current positioning frame, and B is other positioning frames in the positioning frame set Y;
[0083] b: The nested positioning frame is removed
[0084] Traverse all elements in the positioning frame set Y, calculate the inner_rate of the positioning frame information of the current element and the positioning frame information of other elements with the same instrument category information, the inner_rate being the ratio of the intersection area of the two positioning frames to the area of the smaller positioning frame. If the inner_rate is greater than the preset inner_rate critical threshold, it means that the smaller positioning frame between the two more accurately locates the front end of the instrument, and the larger positioning frame additionally includes part of the instrument rod, and the element with the larger area is deleted;
[0085]
[0086] Wherein, A is the current positioning frame, and B is other positioning frames in the positioning frame set Y.
[0087] In addition, the pre-trained target detection model in this embodiment is briefly described: the target detection model in this embodiment selects the YOLO detection network for training before performing surgical instrument tracking, and the training data is used as follows Figure 3 The laparoscopic surgery images with the positioning frame and instrument categories annotated are shown in the figure. YOLO is a classic target detection algorithm that can quickly and accurately detect multiple targets in the image and give their location and category information at the same time. The training data is the laparoscopic surgery images annotated with the positioning frame and instrument category. This means that for each image, each surgical instrument is annotated with a rectangular box and the category information to which it belongs. These annotated data will be used to train the YOLO model so that it can learn the appearance characteristics and location distribution of surgical instruments, so that the surgical instruments in the image can be accurately detected during the testing phase. During the training process, the YOLO model will optimize the model parameters through the back propagation algorithm so that the model can minimize the difference between the detection results and the annotations. After the training is completed, the model will be able to perform target detection on new images and output the location and category information of each detected surgical instrument. In this way, by using the trained YOLO model for target detection, you can track surgical instruments in real time during surgery, thereby improving the efficiency and safety of surgery.
[0088] In addition, you can also choose the target detection algorithms CenterNet and Faster R-CNN to replace the YOLO model to train the target detection model. CenterNet is a target detection algorithm based on target center point detection. It can not only detect the location of the target, but also accurately detect the center point of the target. CenterNet is simple and efficient, and is suitable for real-time target detection tasks. It can predict the target location and category simultaneously in a single network, so it has lower computational complexity and faster reasoning speed. Faster R-CNN is a classic target detection algorithm that adopts a two-stage detection framework, generates candidate detection boxes through the region proposal network (RPN), and uses the region classification network to classify and regress the candidate boxes. Faster R-CNN has high performance in accuracy and stability, and is especially suitable for target detection tasks in complex scenes.
[0089] (2) performing the target matching on the current frame image, specifically:
[0090] The positioning frame information of the front end of the tracking instrument to be tracked drawn by the user is used as input, wherein the target to be tracked includes the main tracking target drawn on the initial video frame image, and the secondary tracking target dynamically generated based on the result of the target detection for tracking other surgical instruments in the video stream image. The target matching method is used to make the tracking positioning clearer and the tracking result more stable and accurate.
[0091] Get the deduplicated positioning frame set Y and the positioning frame set X of the main tracking target and the secondary tracking target after the previous image frame calculation and settlement, and solve the weighted bipartite graph maximum matching of the positioning frame set Y and the positioning frame set X. The weight matrix is G(X,Y), and the matrix element G ij= IoU(x i ,y j ) is the target detection evaluation index IoU of the i-th positioning frame information in the positioning frame set X and the j-th positioning frame information in the positioning frame set Y;
[0092] A matching combination that maximizes the weighted sum is found based on the weight matrix, so as to find the best pairing of the objects in the positioning frame set X and the positioning frame set Y, so as to prepare for the subsequent positioning frame synthesis update.
[0093] In addition, for a given set of positioning boxes X and Y, and the corresponding weight matrix (i.e., IoU value matrix), a weighted bipartite graph maximum matching algorithm is used to find the best matching combination. The following are the general steps to solve this problem:
[0094] Construct a weighted bipartite graph: Construct the positioning box set X and the positioning box set Y into a weighted bipartite graph, where each positioning box in X is connected to each positioning box in Y, and the weight of the edge is the IoU value between them.
[0095] Solve the maximum matching problem: Use optimization algorithms such as the Hungarian algorithm to solve the maximum matching of a weighted bipartite graph. This process will find the matching combination that maximizes the weighted sum, that is, the matching solution that maximizes the sum of the IoU values of all matches.
[0096] Obtain matching results: Based on the maximum matching result, determine the best pairing method for the targets in the positioning box set X and the positioning box set Y. Each match corresponds to a pair of positioning boxes, and the IoU value between them indicates their similarity.
[0097] Through this best matching method, the best match between the targets in set X and set Y can be found, providing accurate matching information for subsequent processing. In actual operation, the existing optimization algorithm library can also be used to implement the weighted bipartite graph maximum matching algorithm, such as the linear_sum_assignment function in the scipy library.
[0098] (3) performing target tracking on the current frame image, specifically:
[0099] The main tracking target and all the secondary tracking targets are traversed, and the targets are tracked using a kernel correlation filter KCF (Kernel Correlation Filter) algorithm to obtain corresponding tracking target frames z of the main tracking target and all the secondary tracking targets in the current frame image.
[0100] The general steps of tracking the target using the kernel correlation filter KCF algorithm are:
[0101] Obtain target information: Extract the primary tracking target and all secondary tracking targets from the detected targets, including their location, appearance characteristics and other information.
[0102] Initialize the tracker: For each tracked target, use the kernel correlation filter (KCF) algorithm to initialize a target tracker. This tracker will use the appearance features of the target and the correlation between adjacent frames to track the target.
[0103] Frame-by-frame tracking: For the current frame image, use the initialized tracker to track the primary tracking target and all secondary tracking targets. The tracker will update the position of the target in the current frame image based on the target's appearance features and correlation.
[0104] Get the tracking target box: For each tracked target, get the target box output by the tracker, that is, the tracking target box of the corresponding target in the current frame image.
[0105] Store tracking results: Save the tracking target frames of all primary tracking targets and all secondary tracking targets in the current frame image for subsequent analysis and application.
[0106] In addition, similar algorithms that belong to the same discriminant method as the kernel correlation filter KCF algorithm, such as MOSSE, TLD, etc., can also be used as an alternative. Another type of method is the generative method, of which the more commonly used methods are Kalman filtering and optical flow methods, which can all be used as alternatives. In addition, deep learning methods for target tracking can also be used as an alternative.
[0107] (4) performing the positioning frame synthesis update on the current frame image, specifically:
[0108] Based on the primary tracking target and all the secondary tracking targets, and according to the calculation results of the target matching and the target tracking, updating the tracking results of all current tracking targets including the primary tracking target and the secondary tracking targets in the current frame image, including:
[0109] When the positioning frame information corresponding to the current tracking target in the positioning frame set X in the positioning frame set Y is matched in the target matching, and the target detection evaluation index IoU is greater than 0:
[0110] a: The kernel correlation filter KCF algorithm successfully tracks the current tracking target, the tracking target frame is z, the positioning frame information y and the tracking target frame z are synthesized as the positioning frame information updated by the current tracking target in the current frame image, the center point of the positioning frame information is the midpoint of the line connecting the center point of the positioning frame information y and the center point of the tracking target frame z, the area is the average of the areas of the positioning frame information y and the tracking target frame z, and the aspect ratio remains consistent with the positioning frame information y;
[0111] b: The kernel correlation filter KCF algorithm fails to track the current tracking target and cannot obtain the latest tracking target frame z, then the front end of the tracking device has a large deformation or a large displacement, and the matched positioning frame information y is used as the positioning frame information updated by the current tracking target in the current frame image;
[0112] When the positioning frame information of the current tracking target in the positioning frame set X in the positioning frame set Y is not matched in the target matching, and the target detection evaluation index IoU is equal to 0:
[0113] a: the kernel correlation filter KCF algorithm successfully tracks the current tracking target, the tracking target frame is z, the tracking target frame z is used as the positioning frame information updated by the current tracking target in the current frame image, and the current tracking target is marked as suspected lost;
[0114] b: The kernel correlation filter KCF algorithm fails to track the current tracking target, the current tracking target is not updated in the current frame image, the result of the previous image frame is retained, and the current tracking target is marked as suspected lost.
[0115] (5) performing post-processing of the tracked target on the current frame image, specifically:
[0116] Traversing all the secondary tracking targets, when the number of times the secondary tracking target is continuously marked as suspected lost is greater than a first preset number threshold, deleting the secondary tracking target, and no longer tracking the secondary tracking target in subsequent video stream images;
[0117] If the number of times that the main tracking target is continuously marked as suspected of being lost is greater than a second preset number threshold, it is prompted that the main tracking target is lost, and the user chooses to stop or restart the device tracking;
[0118] The positioning frame information in the positioning frame set Y that is not successfully matched in the target matching is extracted, and the new secondary tracking target is initialized and generated.
[0119] It should be noted that, in this embodiment, it is necessary to sample the image frames of the laparoscopic video stream at a fixed frequency, and execute step S2 frame by frame in a loop. The specific flow chart is shown in FIG. Figure 2 shown.
[0120] S3: Based on the acquired position and size of the positioning frame information of the main tracking target in the current image frame in the video stream image, an automatic camera movement strategy is generated, specifically:
[0121] The distance from the center point of the positioning frame information of the main tracking target to the center point of the video stream image is calculated. If the distance is greater than a preset distance threshold, the scope holding robot is prompted to move a fixed step length in the specified direction on the laparoscope image plane (i.e., the plane perpendicular to the optical axis), such as Figure 4 As shown, the length of the dashed arrow line is the measured distance, and the direction indicated by the arrow is the specified direction.
[0122] Calculate the diagonal length a of the positioning frame information of the main tracking target ( Figure 4 The diagonal line in the rectangular box is drawn), and compared with the ideal length L of the front end of the main tracking target set on the initial video frame image, the preset ratio threshold is r(0 <r<1);
[0123] a: a / L < r, where the lens of the robotic endoscope is far from the main tracking target, and the main tracking target appears small in the video stream image, indicating that the robotic endoscope advances a fixed step length in the depth direction;
[0124] b: r ≤ a / L ≤ 1 / r, where the distance between the lens of the robotic endoscope and the main tracking target is appropriate, and the main tracking target appears reasonable in size in the video stream image, keeping the depth of the lens of the robotic endoscope unchanged;
[0125] c: a / L > 1 / r, where the lens of the robotic endoscope is close to the main tracking target, and the main tracking target appears large in the video stream image, indicating that the robotic endoscope retreats a fixed step length in the depth direction.
[0126] Second Embodiment
[0127] As Figure 5 shown, this embodiment provides a robotic endoscope instrument tracking and automatic lens movement system for performing the instrument tracking and automatic lens movement method in the laparoscopic field of view as in the first embodiment, including:
[0128] Tracking algorithm initialization module 1, which is used to obtain the initial video frame image of the laparoscopic field of view for instrument tracking and automatic lens movement, select the tracking instrument as the main tracking target on the initial video frame image, draw the positioning frame information surrounding the front end of the main tracking target, and set the ideal length of the front end of the main tracking target;
[0129] Positioning frame information acquisition module 2, which is used to acquire the video stream image in the laparoscopic field of view at a fixed frequency, and obtain the positioning frame information of at least the front end of the tracking instrument including the main tracking target in the current image frame based on the acquired current frame image through the processing algorithms of target detection, target matching, target tracking, positioning frame synthesis update, and post-processing of the tracked target in sequence;
[0130] Automatic lens movement strategy generation module 3, which is used to generate an automatic lens movement strategy based on the position and size of the positioning frame information of the main tracking target in the acquired current image frame in the video stream image.
[0131] A computer-readable storage medium stores a computer code. When the computer code is executed, the above method is executed. A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium can include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0132] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
[0133] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0134] It should be noted that the above embodiments can be freely combined as needed. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention.
Claims
1. A method for tracking instruments and automatically moving the scope in a laparoscopic field of view, characterized in that: The following steps are involved: S1: acquiring an initial video frame image of the laparoscope field of view for instrument tracking and automatic mirror movement, selecting a tracking instrument as a main tracking target on the initial video frame image, outlining positioning frame information surrounding the front end of the main tracking target, and setting an ideal length of the front end of the main tracking target; S2: acquiring a video stream image in the laparoscope field of view at a fixed frequency, and obtaining the positioning frame information of the front end of the tracking device including at least the main tracking target in the current image frame through target detection, target matching, target tracking, positioning frame synthesis update, and tracked target post-processing processing algorithms based on the acquired current frame image; S3: Generate an automatic camera movement strategy based on the acquired position and size of the positioning frame information of the main tracking target in the current image frame in the video stream image.
2. The method for tracking instruments and automatically moving the laparoscope in the field of view according to claim 1, characterized in that: In step S2, the target detection is performed on the current frame image, specifically: Based on the pre-trained target detection model, a set Y of all pending positioning frames on the current frame image is obtained. Each element y in the positioning frame set Y i Contains the positioning frame information, device category information and confidence score, wherein the positioning frame information includes the coordinates (r, c) of the upper left corner of the rectangular frame serving as the positioning frame and the width w and height h of the rectangular frame; The elements in the positioning box set Y are subjected to deduplication operations including removal of highly overlapping positioning boxes and removal of nested positioning boxes. The specific logic is as follows: a: The high overlap positioning frame is removed Traverse all elements in the positioning frame set Y, calculate the target detection evaluation index IoU between the positioning frame information in the current element and the positioning frame information of other elements, the target detection evaluation index IoU is the ratio of the intersection area of two positioning frames to the combined area, if the target detection evaluation index IoU is greater than a preset evaluation critical threshold, delete the element with the smaller confidence score; Wherein, A is the current positioning frame, and B is other positioning frames in the positioning frame set Y; b: The nested positioning frame is removed Traverse all elements in the positioning frame set Y, calculate the inner overlap rate inner_rate of the positioning frame information of other elements whose positioning frame information in the current element has the same device category information, the inner overlap rate inner_rate being the ratio of the intersection area of two positioning frames to the area of a positioning frame with a smaller area, if the inner overlap rate inner_rate is greater than a preset inner overlap critical threshold, delete the element with a larger area; Wherein, A is the current positioning frame, and B is other positioning frames in the positioning frame set Y.
3. The method for tracking instruments and automatically moving the laparoscope in the field of view according to claim 2, characterized in that: In step S2, the target matching is performed on the current frame image, specifically: Taking the positioning frame information of the front end of the tracking instrument drawn by the user as the target to be tracked as input, wherein the target to be tracked includes the main tracking target drawn on the initial video frame image, and the secondary tracking targets dynamically generated based on the result of the target detection for tracking other surgical instruments in the video stream image; Get the deduplicated positioning frame set Y and the positioning frame set X of the main tracking target and the secondary tracking target after the previous image frame calculation and settlement, and solve the weighted bipartite graph maximum matching of the positioning frame set Y and the positioning frame set X. The weight matrix is G(X,Y), and the matrix element G ij =IoU(x i ,y j ) is the target detection evaluation index IoU of the i-th positioning frame information in the positioning frame set X and the j-th positioning frame information in the positioning frame set Y; A matching combination that maximizes the weighted sum is found based on the weight matrix, so as to find the best pairing of the objects in the positioning frame set X and the positioning frame set Y, so as to prepare for the subsequent positioning frame synthesis update.
4. The method for tracking instruments and automatically moving the laparoscope in the field of view according to claim 3, characterized in that: In step S2, the target tracking is performed on the current frame image, specifically: Traverse the main tracking target and all the secondary tracking targets, track the target using the kernel correlation filter KCF algorithm, and obtain the corresponding tracking target frame z of the main tracking target and all the secondary tracking targets in the current frame image.
5. The method for tracking instruments and automatically moving the laparoscope in the field of view according to claim 4, characterized in that: In step S2, the positioning frame synthesis update is performed on the current frame image, specifically: Based on the primary tracking target and all the secondary tracking targets, and according to the calculation results of the target matching and the target tracking, updating the tracking results of all current tracking targets including the primary tracking target and the secondary tracking targets in the current frame image, including: When the positioning frame information corresponding to the current tracking target in the positioning frame set X in the positioning frame set Y is matched in the target matching, and the target detection evaluation index IoU is greater than 0: a: The kernel correlation filter KCF algorithm successfully tracks the current tracking target, the tracking target frame is z, the positioning frame information y and the tracking target frame z are synthesized as the positioning frame information updated by the current tracking target in the current frame image, the center point of the positioning frame information is the midpoint of the line connecting the center point of the positioning frame information y and the center point of the tracking target frame z, the area is the average of the areas of the positioning frame information y and the tracking target frame z, and the aspect ratio remains consistent with the positioning frame information y; b: The kernel correlation filter KCF algorithm fails to track the current tracking target and cannot obtain the latest tracking target frame z, then the front end of the tracking device has a large deformation or a large displacement, and the matched positioning frame information y is used as the positioning frame information updated by the current tracking target in the current frame image; When the positioning frame information of the current tracking target in the positioning frame set X in the positioning frame set Y is not matched in the target matching, and the target detection evaluation index IoU is equal to 0: a: the kernel correlation filter KCF algorithm successfully tracks the current tracking target, the tracking target frame is z, the tracking target frame z is used as the positioning frame information updated by the current tracking target in the current frame image, and the current tracking target is marked as suspected lost; b: The kernel correlation filter KCF algorithm fails to track the current tracking target, the current tracking target is not updated in the current frame image, the result of the previous image frame is retained, and the current tracking target is marked as suspected lost.
6. The method for tracking instruments and automatically moving the laparoscope in the field of view according to claim 5, characterized in that: In step S2, the tracked target is post-processed on the current frame image, specifically: Traversing all the secondary tracking targets, when the number of times the secondary tracking target is continuously marked as suspected lost is greater than a first preset number threshold, deleting the secondary tracking target, and no longer tracking the secondary tracking target in subsequent video stream images; If the number of times that the main tracking target is continuously marked as suspected of being lost is greater than a second preset number threshold, it is prompted that the main tracking target is lost, and the user chooses to stop or restart the device tracking; Extract the bounding box information of the unpaired bounding box set Y in the target match, and initialize and generate a new secondary tracking target.
7. The method for tracking instruments and automatically moving the laparoscope in the field of view according to claim 1, characterized in that: In step S3, based on the position and size of the bounding box information of the primary tracking target in the obtained current image frame in the video stream image, an automatic camera movement strategy is generated. Specifically: Calculate the distance from the center point of the bounding box information of the primary tracking target to the center point of the video stream image. If the distance is greater than a preset distance threshold, prompt the camera-holding robot to move a fixed step length along a specified direction in the laparoscopic image plane. Calculate the diagonal length a of the bounding box information of the primary tracking target, and compare it with the ideal length L set at the front end of the primary tracking target in the initial video frame image. The preset ratio threshold is r (0 < r < 1). a: a / L < r, the lens of the camera-holding robot is far from the primary tracking target, and the primary tracking target appears small in the video stream image. Prompt the camera-holding robot to move forward a fixed step length in the depth direction. b: r ≤ a / L ≤ 1 / r, the lens of the camera-holding robot is at an appropriate distance from the primary tracking target, and the primary tracking target appears reasonable in size in the video stream image. Keep the depth of the lens of the camera-holding robot unchanged. c: a / L > 1 / r, the lens of the camera-holding robot is close to the primary tracking target, and the primary tracking target appears large in the video stream image. Prompt the camera-holding robot to move backward a fixed step length in the depth direction.
8. A system for tracking and automatically moving an instrument in a laparoscopic field of view for executing the method for tracking and automatically moving an instrument in a laparoscopic field of view as claimed in any one of claims 1 to 7, characterized in that: including: A tracking algorithm initialization module, configured to obtain an initial video frame image of a laparoscopic field of view for instrument tracking and automatic camera movement, select a tracking instrument as the primary tracking target on the initial video frame image, draw the bounding box information surrounding the front end of the primary tracking target, and set the ideal length of the front end of the primary tracking target. A bounding box information acquisition module, configured to acquire video stream images in the laparoscopic field of view at a fixed frequency, and based on the obtained current frame image, sequentially obtain the bounding box information of at least the front end of the tracking instrument of the primary tracking target in the current image frame through processing algorithms such as object detection, object matching, object tracking, bounding box synthesis update, and post-processing of the tracked target. An automatic camera movement strategy generation module, configured to generate an automatic camera movement strategy based on the position and size of the bounding box information of the primary tracking target in the obtained current image frame in the video stream image.
9. A computer device, including a memory and one or more processors, wherein computer code is stored in the memory, and when the computer code is executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores computer code, and when the computer code is executed, the method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Instrument visual tracking method for laparoscopic minimally invasive surgery
CN113538522A
Multi-instrument visual tracking method for laparoscope-holding robot in field of view of laparoscope
CN114663474A
Intelligent automatic moving laparoscope and precision adjustment system based on image feature recognition and tracking technology
CN109171957A
Man-machine collaborative minimally invasive endoscope holding robot system
CN113143461A
View control method and endoscope system
CN116098565A
Cited By
Automatic positioning method and system for optical tracking positioning instrument of surgical robot
CN121129451A
