Operation duration prediction method and device, equipment and storage medium
By performing feature vectorization and self-attention mechanism processing on the surgical steps, a feature matrix of surgical steps is constructed, which solves the problems of subjectivity and low accuracy in the prediction of operation time in the existing technology, and achieves more accurate prediction and resource optimization.
Patent Information
- Application Number
- CN202511316836.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2026-01-02
AI Technical Summary
Existing methods for predicting surgical duration rely on human experience or traditional statistical models, which are highly subjective, have large errors, and cannot capture the semantic logic of surgical steps. Machine learning models ignore the temporal nature and step-related relationships of surgery, resulting in low prediction accuracy and insufficient generalization ability, making them unable to adapt to the differences between different hospitals and individual patients.
By breaking down surgical steps and vectorizing their features, a feature matrix of surgical steps is constructed. Combining self-attention mechanism and global feature aggregation algorithm, key surgical information is accurately captured, improving prediction accuracy.
It enables accurate prediction of surgery duration, improves prediction accuracy and adaptability, and optimizes operating room resource allocation and patient experience.
Smart Images

Figure CN121260486A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to methods, apparatus, devices and storage media for predicting operation duration. Background Technology
[0002] Predicting surgery duration is a core technological support for modern medical management, and is crucial for hospital operations, patient experience, and medical quality. For hospitals, accurate prediction can optimize the allocation of operating rooms, equipment, and medical resources, increasing operating room turnover by 15%-30% and reducing resource idleness. For patients, it can shorten pre-operative waiting time and alleviate anxiety. Simultaneously, it promotes a shift in medical quality management from experience-driven to data-driven approaches, contributing to the construction of smart hospitals.
[0003] Existing methods for predicting surgery duration can be divided into two categories: one is the traditional manual experience method, which relies on doctors' memory of past operations for estimation; the other is the traditional statistical model method, which mainly involves collecting structured data from historical surgical samples, cleaning the data, and then inputting it into a pre-set statistical model. The model learns the linear correlation between data, establishes a mapping relationship between input features and surgery duration, and finally outputs the predicted surgery duration.
[0004] However, existing technologies have obvious shortcomings: First, they rely on human experience or traditional statistical models. The former is highly subjective and the calculated error exceeds 30%, while the latter cannot capture the semantic logic and other features of surgical steps. Second, some machine learning models ignore the temporal sequence and step correlation of surgery, resulting in low prediction accuracy for complex multi-step surgeries. Third, the models have poor generalization, are not adaptable to different hospital operating procedures and individual patient differences, and lack the ability to adjust dynamic features during surgery. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, device, and storage medium for predicting the duration of surgery, which can accurately predict the duration of surgery.
[0006] To achieve the above objectives, this application adopts the following technical solution:
[0007] In a first aspect, this application provides a method for predicting the duration of an operation. The method includes: obtaining a sequence of surgical steps, vectorizing each step in the sequence of surgical steps into a feature vector to obtain a feature matrix of surgical steps corresponding to the sequence of surgical steps, and predicting the duration based on the feature matrix of surgical steps to obtain the predicted duration.
[0008] The technical solution provided in this application constructs a precise surgical step feature matrix by decomposing surgical steps and vectorizing their features, which can accurately predict the duration of surgery.
[0009] One possible approach is to predict the duration of surgery based on a feature matrix of surgical steps. Specifically, this can be achieved by inputting the feature matrix of surgical steps into a surgery duration prediction model to obtain the predicted duration. Inputting the feature matrix of surgical steps into the prediction model to obtain the duration allows the model to accurately capture key surgical information, improving prediction accuracy.
[0010] Another possible implementation involves inputting the surgical step feature matrix into the surgical duration prediction model to predict the predicted duration. Specifically, this can be achieved by: encoding the surgical step feature matrix at specific positions; integrating the position-encoded surgical step feature vectors to obtain a duration feature vector; and then weighting and fusing this duration feature vector using a global feature aggregation algorithm to obtain the predicted duration. Position encoding of the surgical step feature matrix accurately preserves the crucial information of the sequence of steps, avoiding feature bias caused by lost order. The subsequent feature integration results in a more prominent duration feature vector. The weighted fusion transformation using the global feature aggregation algorithm strengthens the influence of important features, weakens redundant interference, and significantly improves the accuracy of the predicted duration.
[0011] Another possible implementation involves using the position-encoded surgical step feature vector, which contains temporal and semantic information between each step. This vector is then integrated to obtain a duration feature vector. Specifically, this can be achieved by using the self-attention mechanism of the encoder in the surgical duration prediction model, along with the temporal and semantic information between each step, to assign attention weights to the position-encoded surgical step feature vector. Based on these attention weights, the surgical step feature vector is then weighted and corrected to obtain the duration feature vector. By leveraging the self-attention mechanism of the encoder in the surgical duration prediction model, and combining the temporal and semantic information of each step to assign weights to the position-encoded feature vector, the logical connections and criticality between steps can be accurately identified.
[0012] Another possible implementation involves vectorizing each step in the surgical procedure sequence to obtain a surgical step feature matrix. Specifically, this can be achieved by: standardizing the text of each step in the sequence to obtain standardized step text; processing the standardized step text to generate a semantic embedding vector for each step; and normalizing the semantic embedding vectors generated for each step to obtain the surgical step feature matrix. Thus, vector processing transforms text into semantic embedding vectors, accurately capturing the semantic relationships between steps.
[0013] Another possible implementation involves vectorizing the standardized step text for each step to generate a semantic embedding vector for each step. Specifically, this can be achieved by segmenting the standardized step text using a medical text embedding model to obtain a sequence of medical semantic tokens, then semantically encoding these tokens to generate the semantic embedding vector for each step. Medical word segmentation accurately extracts specialized semantic tokens, avoiding ambiguity, while semantic encoding generates vectors, efficiently preserving the semantic relationships between steps and providing high-quality semantic representations for subsequent surgical analysis.
[0014] Another possible implementation is that the row vectors of the surgical step feature matrix correspond to each step in the surgical step sequence. Since the row vectors of the surgical step feature matrix correspond one-to-one with each step in the surgical step sequence, a clear direct relationship between steps and features can be established.
[0015] Another possible approach is to obtain a surgical procedure sequence. Specifically, this involves acquiring patient characteristic information and, based on this information and a surgical knowledge base, obtaining a surgical procedure sequence that matches the patient's characteristics. By acquiring patient characteristic information and combining it with the surgical knowledge base to match a suitable surgical procedure sequence, personalized surgical plans can be achieved to improve safety and adaptability, ensure that the procedures conform to standards and reduce experience bias, and provide accurate data for subsequent duration prediction and resource allocation.
[0016] Another possible approach involves obtaining a surgical procedure sequence that matches patient characteristics based on patient feature information and a surgical knowledge base. Specifically, this can be achieved by standardizing the patient feature information to obtain patient feature information in a preset data format. Then, a large language model is used to combine the standardized patient feature information with the surgical knowledge base to obtain a surgical procedure sequence that matches the patient feature information. Standardizing the patient feature information eliminates data format differences and redundant interference, ensuring that the feature information is standardized and consistent, laying a precise foundation for subsequent matching. Furthermore, by connecting the large language model with process templates and historical cases in the surgical knowledge base, a surgical procedure sequence highly suited to the individual patient's characteristics can be quickly located.
[0017] Secondly, a training method for a surgical duration prediction model is provided. The method includes: obtaining a sample surgical step sequence and the actual surgical duration corresponding to the sample surgical step sequence; inputting the sample surgical step sequence into the surgical duration prediction model to predict the duration and obtain the predicted surgical duration; calculating the loss function value based on the predicted surgical duration and the actual surgical duration; and updating the model parameters of the surgical duration prediction model based on the loss function value.
[0018] The technical solution provided in this application obtains the sequence of surgical steps in the sample data and their corresponding actual surgical durations. The sample data is then input into a surgical duration prediction model to obtain the predicted duration. The model parameters are then calculated based on the predicted and actual values. This process enables the model to continuously learn the correlation between the surgical step sequence and the actual duration in the sample data, continuously optimize the parameters to reduce prediction errors, and ultimately enable the model to accurately predict surgical durations. This provides a reliable time reference for clinical surgical planning, resource allocation, and patient communication, thereby improving the efficiency and controllability of the medical process.
[0019] One possible implementation is that the above loss function value satisfies a first preset formula, which is:
[0020]
[0021] Where MAE represents the loss function value, n represents the total number of samples, and y i This represents the actual operation time of the i-th sample. Let represent the predicted operation time for the i-th sample. Therefore, the loss function value can be accurately calculated using the first preset formula.
[0022] Thirdly, a device for predicting the duration of surgery is provided, the device comprising: an acquisition module, a processing module, and a prediction module.
[0023] The aforementioned acquisition module is used to acquire the surgical procedure sequence.
[0024] The aforementioned processing module is used to vectorize each step in the surgical step sequence to obtain the surgical step feature matrix corresponding to the surgical step sequence.
[0025] The aforementioned prediction module is used to predict the duration based on the surgical step feature matrix, thereby obtaining the predicted duration.
[0026] In one possible implementation, the aforementioned prediction module is also used to input the surgical step feature matrix into the surgical duration prediction model to predict the duration and obtain the predicted duration.
[0027] In another possible implementation, the prediction module described above is also used to perform position encoding on the surgical step feature matrix, integrate the surgical step feature vectors after position encoding to obtain a duration feature vector, and perform weighted fusion transformation on the duration feature vector through a global feature aggregation algorithm to obtain the predicted duration.
[0028] In another possible implementation, the prediction module is also used to assign attention weights to the surgical step feature vector after position encoding by using the self-attention mechanism of the encoder in the surgical duration prediction model, as well as the temporal and semantic information between each step; and to perform weighted correction on the surgical step feature vector based on the attention weights to obtain the duration feature vector.
[0029] In another possible implementation, the above processing module is also used to perform text standardization processing on each step in the surgical step sequence to obtain the standardized step text of each step, perform vector processing on the standardized step text of each step to generate the semantic embedding vector of each step, and perform normalization processing on the semantic embedding vector generated by each step to obtain the surgical step feature matrix corresponding to the surgical step sequence.
[0030] In another possible implementation, the above processing module is also used to perform word segmentation on the standardized step text through a medical text embedding model to obtain a medical semantic token sequence, and to perform semantic encoding on the medical semantic token sequence to generate a semantic embedding vector for each step.
[0031] Another possible implementation is that the row vectors of the above surgical step feature matrix correspond to each step in the surgical step sequence.
[0032] In another possible implementation, the aforementioned acquisition module is also used to acquire patient characteristic information, and based on the patient characteristic information and the surgical knowledge base, to acquire a surgical step sequence that matches the patient characteristic information.
[0033] Another possible implementation is that the above-mentioned acquisition module is also used to standardize the patient feature information to obtain patient feature information in a preset data format, and then combine the standardized patient feature information with the surgical knowledge base through a large language model to obtain a surgical step sequence that matches the patient feature information.
[0034] Fourthly, a training device for a surgical duration prediction model is provided, the device comprising: an acquisition module, a prediction module, a calculation module, and an update module.
[0035] The aforementioned acquisition module is used to acquire the sample surgical step sequence and the actual surgical duration corresponding to the sample surgical step sequence.
[0036] The aforementioned prediction module is used to input the sequence of sample surgical steps into the surgical duration prediction model to predict the duration and obtain the predicted surgical duration.
[0037] The aforementioned calculation module is used to calculate the loss function value based on the predicted operation time and the actual operation time.
[0038] The aforementioned update module is used to update the model parameters of the operation duration prediction model based on the loss function value.
[0039] In one possible implementation, the aforementioned calculation module is further used to calculate a loss function value, which satisfies a first preset formula, the first preset formula being:
[0040]
[0041] Where MAE represents the loss function value, n represents the total number of samples, and y i This represents the actual operation time of the i-th sample. This represents the predicted operation time for the i-th sample.
[0042] The technical effects of any implementation method in the second aspect can be found in the technical effects of any implementation method in the first aspect mentioned above, and will not be repeated here.
[0043] The technical effects of any implementation method in the fourth aspect can be found in the technical effects of any implementation method in the third aspect above, and will not be repeated here.
[0044] Fifthly, a computer device is provided, comprising: a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the above-mentioned method for predicting the operation duration and the method for training the operation duration prediction model.
[0045] In a sixth aspect, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to implement the above-mentioned method for predicting the operation duration and the method for training the operation duration prediction model.
[0046] In a seventh aspect, a computer program product is provided, comprising a computer program or instructions, which, when executed by a processor, implement the above-mentioned method for predicting surgical duration and the method for training a surgical duration prediction model.
[0047] The solutions provided in aspects five through seven above are used to implement the method provided in aspect one above, and their specific implementations will not be described in detail here. The technical effects corresponding to any implementation method of the solutions provided in aspects five through seven above can be found in the technical effects corresponding to any implementation method in aspect one above, and will not be described in detail here.
[0048] It should be noted that any of the possible implementations of any of the above aspects can be combined, provided that the solutions do not contradict each other. Attached Figure Description
[0049] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the 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.
[0050] Figure 1 A schematic diagram of the structure of a computer system provided in an embodiment of this application;
[0051] Figure 2 A flowchart illustrating a method for predicting surgical duration provided in an embodiment of this application;
[0052] Figure 3 A flowchart illustrating a training method for an operation duration prediction model provided in an embodiment of this application;
[0053] Figure 4 A schematic diagram of the structure of a device for predicting operation time provided in an embodiment of this application;
[0054] Figure 5 A schematic diagram of the structure of a training device for a surgical duration prediction model provided in an embodiment of this application;
[0055] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0056] 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.
[0057] In the description of this application, it should be understood that the terms "upper," "lower," "left," "right," "front," "rear," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or relative positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this application and for simplification, 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. Therefore, they should not be construed as limitations on this application. Unless otherwise specified, the above-mentioned orientational descriptions can be flexibly set in practical applications, provided that the relative positional relationships shown in the accompanying drawings are satisfied.
[0058] 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 technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0059] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," "linking," and "communication" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection. They can refer to a direct connection or an indirect connection through an intermediate medium, or a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0060] In embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, article, or apparatus that includes that element.
[0061] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0062] In the embodiments of this application, at least one can also be described as one or more, and multiple can be two, three, four or more, and this application does not impose any restrictions.
[0063] In the description of this specification, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.
[0064] To facilitate understanding, the terms used in the embodiments of this application will be explained first.
[0065] Medical semantic token sequence: refers to an ordered sequence formed by decomposing and mapping unstructured medical text (such as surgical records, medical reports, medical guidelines, examination reports, etc.) or structured medical information (such as surgical procedure names, disease terms, drug names, etc.) into discrete token units with fixed formats and clear medical semantics through medical pre-trained language models or medical-specific word segmentation / encoding tools, and arranging them according to the logical order of the original information (such as text reading order, surgical procedure sequence, disease description order, etc.).
[0066] It should be noted that all information (including but not limited to device information, network information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the subject or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards. For example, patient characteristic information, medical semantic token sequences, etc., involved in this application were all obtained with full authorization.
[0067] The commonly used methods for predicting operation time in the industry are mainly traditional manual experience methods and traditional statistical model methods, which will be briefly explained below.
[0068] For example, traditional human experience-based methods mainly rely on doctors' memories of past procedures to predict the duration. Traditional statistical modeling methods mainly involve collecting structured data from historical surgical samples, cleaning the data, and then inputting it into a pre-set statistical model. The model learns the linear relationships between data points to establish a mapping relationship between input features and surgical duration, ultimately outputting a predicted result for the surgical duration.
[0069] However, the above-mentioned technical solutions still have the following drawbacks: First, they rely on human experience or traditional statistical models. The former is highly subjective and has an error of over 30%, while the latter cannot capture the semantic logic and other features of surgical steps. Second, some machine learning models ignore the temporal sequence and step correlation of surgery, resulting in low prediction accuracy for complex multi-step surgeries. Third, the models have poor generalization, are not adaptable to different hospital operating procedures and individual patient differences, and lack the ability to adjust dynamic features during surgery.
[0070] Based on this, this application proposes a method for predicting surgical duration, comprising: acquiring a sequence of surgical steps; vectorizing each step in the surgical step sequence to obtain a feature matrix corresponding to the surgical step sequence; and predicting the duration based on the surgical step feature matrix to obtain the predicted duration. Thus, by vectorizing each surgical step, key information of the surgical operation can be accurately extracted, improving the accuracy of surgical duration prediction.
[0071] The solution provided in this application can be applied to Figure 1 In the computer system shown, Figure 1 This is a schematic diagram of the structure of a computer system provided in an embodiment of this application.
[0072] For example, the computer system includes a computer device 100. The computer device 100 acquires a surgical step sequence 101 and, based on the surgical step sequence, obtains a predicted duration 102.
[0073] Optionally, the computer device 100 may be a device that directly acquires the surgical step sequence 101, or it may be a device that obtains the predicted duration 102 based on the surgical step sequence. The term "acquisition" used by the computer device 100 includes any term with acquisition function such as querying, discovering, and extracting, and this application does not limit this terminology.
[0074] Optionally, the computer device 100 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, embedded hardware for real-time simulation, or a cloud server providing cloud computing services such as cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and other basic cloud computing services. This application embodiment does not limit the implementation method or application scenario of the computer device 100.
[0075] Optionally, the computer device 100 may be a terminal device. Terminal devices include electronic devices with data processing and information interaction capabilities, such as smartphones, tablets, laptops, and desktop computers, but are not limited thereto, and the embodiments of this application do not specifically limit this.
[0076] The method for predicting the operation time in the embodiments of this application can be executed by a server, by a terminal device, or by a combination of both.
[0077] Figure 2 This is a flowchart illustrating a method for predicting surgical duration provided in an embodiment of this application. The method can be executed by a computer device. The computer device can be... Figure 1 Computer equipment 100.
[0078] like Figure 2 As shown, the method for predicting operation time provided in this application embodiment may include:
[0079] Step S201: The computer device acquires the surgical procedure sequence.
[0080] In this context, a surgical procedure sequence refers to a set of discrete medical operation units arranged according to medical standards, operational logic, or actual execution order in a specific surgical procedure, each with a clear purpose.
[0081] For example, a computer device acquires patient characteristic information and, based on the patient characteristic information and a surgical knowledge base, acquires a sequence of surgical steps that matches the patient characteristic information.
[0082] Patient characteristic information refers to a set of structured / unstructured information extracted from the patient's preoperative assessment, medical history, and examination reports, which is related to the implementation of surgery, postoperative recovery, and prediction of surgery duration. It covers key dimensions such as the patient's individual physiological attributes, disease-related status, and basic health status.
[0083] Optionally, patient characteristic information includes basic patient information (age, gender, body mass index), disease-related information (type and severity of underlying disease, specific parameters of lesions: location, size, shape, pathological stage), and physiological indicator information (preoperative heart rate, blood pressure, liver and kidney function indicators, coagulation function indicators), but is not limited thereto, and the embodiments of this application do not impose specific limitations on this.
[0084] Computer equipment standardizes patient characteristic information to obtain patient characteristic information in a preset data format.
[0085] For example, regarding patient characteristics: age: remove the "years" character and extract the value 52; blood pressure: split systolic pressure / diastolic pressure and extract the key value of systolic pressure 135 (Note: the model defaults to using systolic pressure to represent blood pressure level); history of diabetes: simplify to yes = 1, no = 0; surgical history: simplify to abdominal surgery = 1, no = 0, etc.
[0086] The computer equipment constructs a surgical knowledge base, which includes standard procedure templates for various types of surgeries (such as standard procedures for laparoscopic cholecystectomy and knee replacement surgery), surgical step adjustment rules corresponding to different patient characteristics (such as supplementary rules for intraoperative blood pressure monitoring steps for hypertensive patients and rules for surgical instrument selection for patients with liver and kidney dysfunction), and a historical surgical case database (containing the mapping relationship between patient characteristics and corresponding surgical step sequences), but is not limited thereto. This application embodiment does not impose specific limitations on this.
[0087] The computer device combines standardized patient characteristic information with the surgical knowledge base through a large language model to obtain a sequence of surgical steps that matches the patient characteristic information.
[0088] In this embodiment, the large language model refers to a pre-trained model with preset medical common sense. The medical common sense covers at least the core content of anatomy, physiology, surgical contraindication association logic, surgical risk prediction rules and clinical diagnosis and treatment guidelines. The core is used to receive standardized patient characteristic information, reason about the adaptation relationship between patient characteristics and surgical procedures, call the labeled surgical knowledge base and complete the personalized adjustment of the procedure, and provide a medical logical reasoning basis for the generation of surgical procedures.
[0089] For example, large language models provide a foundation of medical common sense (such as anatomy, physiology, and the logic of surgical contraindications) as a basis for underlying judgments. For instance, they can identify the correlation between a patient's history of diabetes and the risk of surgical wound healing, or the necessity of adjusting anesthesia dosage for elderly patients, providing basic logical support for subsequent process adjustments.
[0090] The surgical knowledge base provides a standardized workflow framework: Compared to the medical common sense of a large language model, the knowledge base consists of standard operating procedures for specific surgeries (such as standard steps of laparoscopic cholecystectomy and core steps of knee replacement surgery) that have been manually / algorithm-filtered and structurally labeled. It must include:
[0091] Step-by-step modules: such as preoperative assessment, anesthesia induction, surgical procedure (in stages), postoperative hemostasis, suturing, postoperative monitoring, and other core modules.
[0092] Notes: Applicable scenarios for each step (e.g., applicable to patients with gallstones <3cm in diameter; risk warnings such as avoiding damage to the bile duct when separating the Calot's triangle; alternative solutions such as switching to XX hemostasis method if intraoperative bleeding >50ml).
[0093] Patient information provides personalized adaptation parameters: Patient characteristic information (age, disease-related information, physiological indicators, etc.) is used as variables and input into the system after the first two layers are integrated. The large language model judges which standard steps need to be adjusted based on medical common sense, and then combines the annotation information of the knowledge base to obtain the surgical step sequence.
[0094] For example, the patient's characteristic information is as follows:
[0095] Basic information: Male, 65 years old, with a 10-year history of hypertension (taking medication regularly and blood pressure well controlled), and recurrent right upper quadrant pain accompanied by nausea and vomiting for 3 months (worsening for 1 week).
[0096] Physiological indicators: Complete blood count (white blood cell count 12.5 × 10⁻⁶) 9 / L, neutrophil percentage 85%), liver function [Alanine Aminotransferase (ALT) 120 U / L, Aspartate Aminotransferase (AST) 95 U / L, total bilirubin 45 μmol / L].
[0097] Disease-related information: Abdominal ultrasound showed "thickened gallbladder wall and multiple gallstones in the gallbladder". The preoperative diagnosis was "gallbladder stones with acute cholecystitis and common bile duct stones with obstructive jaundice".
[0098] The generated surgical procedure sequence is as follows:
[0099] Step 1: During laparoscopic cholecystectomy, a 10mm incision is made at the upper edge of the patient's umbilicus, and a pneumoperitoneum needle is inserted to inject carbon dioxide gas to establish an artificial pneumoperitoneum of 12-15mmHg.
[0100] Step 2: Insert the laparoscope and trocar and cannula (Trocar) into the operating port. Insert the laparoscope through the umbilical opening and establish the main operating port (10mm below the xiphoid process) and the auxiliary port (5mm below the right costal margin).
[0101] Step 3: Dissect Calot's Triangle (Calot's Triangle), separate the cystic duct and cystic artery, double-clamp with titanium clips and then sever, ensuring that the common bile duct is not accidentally damaged (depending on the patient's common bile duct stones, extra care should be taken to ensure the clarity of the bile duct anatomy during separation).
[0102] Step 4: Bluntly dissect along the gallbladder bed with an ultrasonic scalpel to completely remove the gallbladder, place it in a specimen bag, and remove it through the umbilicus (adapting to the patient's gallbladder wall thickening characteristics, the dissection force needs to be precisely controlled).
[0103] Step 5: Make a longitudinal incision 1-2 cm in the anterior wall of the common bile duct (avoiding the vascular area), use an electrocoagulation hook to make the incision in the anterior wall of the common bile duct, confirm the location of the stone and puncture the bile for bacterial culture (for patients with obstructive jaundice, it is necessary to confirm the bile infection status first).
[0104] Step 6: Insert a fiberoptic cholangioscope through a subxiphoid trocar to explore the bile ducts, observe the intrahepatic and extrahepatic bile ducts under direct vision, and remove the stones using a stone retrieval basket or electrohydraulic lithotripsy.
[0105] Step 7: After trimming the short arm of the T-tube, insert the common bile duct, suture the incision intermittently, and suture the bile duct incision with 4-0 absorbable sutures in full thickness, with a margin of 1-1.5mm. Test with pressurized water injection to ensure no leakage.
[0106] Step 8: The T-tube is brought out through the right midclavicular line, fixed and connected to a low negative pressure suction device. The drainage tube needs to be retained for 1-2 months. Postoperatively, regular irrigation and cholangiography are required (considering the patient's age of 65, the drainage tube needs to be fixed more securely to reduce the risk of postoperative dislodgement).
[0107] Step 9: Place an abdominal drainage tube through the Winsor hole and bring it out through the right anterior axillary line puncture hole. Monitor the postoperative drainage volume (>50ml / day suggests possible bile leakage).
[0108] Step 10: Expel CO2 gas from the abdominal cavity, suture each incision layer by layer, close the pneumoperitoneum, check for bleeding and organ damage, and cover the skin incision with a band-aid.
[0109] Step S202: The computer device vectorizes each step in the surgical step sequence to obtain the surgical step feature matrix corresponding to the surgical step sequence.
[0110] Feature vectorization refers to the process of converting non-numerical features (such as text, categories, image semantics, etc.) or heterogeneous numerical features into fixed-dimensional numerical vectors that can be directly processed by computers through specific algorithms (such as encoding, embedding, normalization, etc.).
[0111] The surgical step feature matrix is a matrix composed of the semantic vectors of each step in the surgical step sequence arranged in order.
[0112] Specifically, the steps of vectorizing each step in the surgical procedure sequence include:
[0113] Step 1: Perform text standardization on each step in the surgical procedure sequence to obtain the standardized step text for each step.
[0114] For example, the standardized description of inserting a pneumoperitoneum needle for inflating has been revised to "injecting carbon dioxide gas to establish an artificial pneumoperitoneum," and the specifications of the pneumoperitoneum needle have been supplemented (e.g., 18G).
[0115] Step 2: Perform vector processing on the standardized step text of each step to generate a semantic embedding vector for each step.
[0116] The standardized procedure text is segmented using a medical text embedding model to obtain a medical semantic token sequence.
[0117] A medical semantic token sequence refers to an ordered set of character units consisting of Chinese medical semantic tokens (including special identifier tokens) formed by arranging Chinese medical texts in a logical order according to the text's semantics after the text has been processed by a medical-specific word segmenter.
[0118] Sequence Start Token: Classification ([CLS]), located at the beginning of the sequence, is used for subsequent extraction of the global semantic vector.
[0119] Sequence End Token: Separator ([SEP]), located at the end of valid text, indicating the end of the text.
[0120] Padding Token: Padding token ([PAD]) is used to pad to the specified length when the text length is less than the maximum input length of the model (e.g., 512 tokens). The model does not assign attention weights to it.
[0121] For example, during laparoscopic cholecystectomy, a 10mm incision is made at the upper edge of the patient's umbilicus, and a pneumoperitoneum needle is inserted to inject carbon dioxide gas to establish an artificial pneumoperitoneum of 12-15mmHg.
[0122] The medical semantic token sequence after word segmentation is as follows: [CLS], laparoscopic cholecystectomy, middle, , at, patient, umbilicus, do, 10mm, small, incision, , insert, pneumoperitoneum needle, inject, carbon dioxide, gas, , establish, 12-15mmHg, artificial pneumoperitoneum, [SEP], [PAD], [PAD], ... (up to 512 tokens).
[0123] Semantic encoding is performed on the medical semantic token sequence to generate a semantic embedding vector for each step.
[0124] For example, by calling the medical vocabulary (such as the Bio BERT vocabulary) that accompanies the medical text embedding model, each token in the sequence is mapped to a corresponding unique integer identifier (ID).
[0125] Special tokens: [CLS] corresponds to a fixed ID (e.g., 101), [SEP] corresponds to a fixed ID (e.g., 102), and [PAD] corresponds to a fixed ID (e.g., 0).
[0126] Medical terminology and common vocabulary: such as laparoscopic cholecystectomy mapped to a preset ID in the vocabulary list (e.g., 12345), pneumoperitoneum needle mapped to an ID (e.g., 6789), 12-15mmHg mapped to an ID (e.g., 10112), etc.
[0127] Punctuation marks: “,” are mapped to their corresponding IDs (e.g., 117).
[0128] The final generated ID sequence has the same length as the original token sequence (512 characters), for example: [101, 12345, 345, 117, 567, ..., 102, 0, 0, ..., 0].
[0129] Next, a binary mask sequence of length 512 is generated to identify the valid token (non-padded token) and the padded token (PAD):
[0130] For all valid tokens other than PAD, such as CLS, laparoscopic cholecystectomy, and pneumoperitoneum needle, the mask value is set to 1 (indicating that the model needs to pay attention to this token).
[0131] For all PADs, the mask value is set to 0 (meaning the model ignores the token).
[0132] If there are 38 valid tokens in the original sequence and the remaining 474 are PADs, then the mask sequence is: [1,1,1,...,1 (first 38 bits),0,0,...,0 (last 474 bits)].
[0133] The process of generating semantic embedding vectors includes:
[0134] Token embedding: The model’s built-in vocabulary maps each token (such as pneumoperitoneum needle, 10mm) to a fixed-dimensional base vector.
[0135] Position embedding: Position information is superimposed on the vector of each token (e.g., the position vectors of the 3rd and 5th tokens are different) to ensure that the semantic differences between inserting a pneumoperitoneum needle and inserting a pneumoperitoneum needle are captured.
[0136] Segment embedding (optional): If the text contains multiple parts (such as surgical steps and precautions), use different vectors to identify different segments to help the model distinguish semantic boundaries.
[0137] Step 3: Normalize the semantic embedding vectors generated in each step to obtain the surgical step feature matrix corresponding to the surgical step sequence.
[0138] For the semantic embedding vector (e.g., 768-dimensional or 1024-dimensional) corresponding to each surgical step, L2 normalization (dividing the value of each dimension of the vector by the magnitude of the vector) or Z-score standardization (subtracting the mean from the value of each dimension and then dividing by the standard deviation) is used to ensure that the numerical distribution of each vector is on a uniform scale.
[0139] For example, the values in the 1024-dimensional vector used to establish pneumoperitoneum can be adjusted to a reasonable range to prevent a certain dimension (such as the dimension related to the operation parameters) from dominating the subsequent calculations due to differences in numerical magnitude.
[0140] All normalized semantic embedding vectors of the surgical steps are arranged in matrix form according to the execution order of the surgical steps.
[0141] If the surgery contains N core steps, and the semantic embedding vector of each step is D-dimensional, then the resulting surgical step feature matrix has a dimension of N×D (e.g., 10 steps correspond to a matrix of 10×1024).
[0142] In the matrix, each row corresponds to the normalized semantic features of a single surgical step sequence, and each column corresponds to the normalized values of all steps on the same semantic dimension. The overall matrix completely preserves the temporal logic of the surgical steps and the standardized semantic information of each step.
[0143] Step S203: The computer device predicts the duration based on the surgical step feature matrix to obtain the predicted duration.
[0144] For example, the computer device inputs the surgical step feature matrix into the surgical duration prediction model to predict the duration and obtain the predicted duration.
[0145] Optionally, the surgical duration prediction model adopts a Transformer architecture, specifically configured as follows: the input layer receives the feature matrix of surgical steps (including step semantic vectors and temporal relationship features); the encoder consists of 6 stacked Transformer layers, each equipped with an 8-head self-attention mechanism to capture long-distance dependencies and execution logic associations between steps; the output layer is set as a single-neuron regression layer, outputting the predicted value of the total surgical duration in minutes. The model training aims to minimize the mean absolute error (MAE), and iteratively optimizes the parameters through backpropagation to improve the accuracy of duration prediction for complex multi-step surgeries.
[0146] Specifically, the detailed steps to obtain the predicted duration include:
[0147] Step 1: Perform positional encoding on the feature matrix of surgical steps.
[0148] For example, for 10 steps (position indices pos are 0 to 9, corresponding to steps 1 to 10), the 1024-dimensional position vectors PE(pos,2i) and PE(pos,2i+1) (where i is the dimension index, 0 to 511) for each position pos are calculated using the following formula:
[0149] Even-numbered dimensions (e.g., the 0th, 2nd, 4th...1022nd dimension): PE(pos,2i)=sin(pos / 10000^(2i / 1024)).
[0150] Odd-numbered dimensions (such as the 1st, 3rd, 5th...1023rd dimension): PE(pos,2i+1)=cos(pos / 10000^(2i / 1024)).
[0151] Using the above formula, each step (pos = 0 to 9) will generate a unique 1024-dimensional position vector. The closer the steps are in time, the smaller the difference in the position vector values (e.g., pos = 1 and pos = 2); the further apart the steps are in time, the greater the difference (e.g., pos = 1 and pos = 6).
[0152] The 1024-dimensional position vectors of the 10 steps are arranged sequentially according to the time sequence of the steps to form a 10×1024 position encoding matrix that is completely consistent with the dimension of the feature matrix of the surgical steps.
[0153] Line 1: The 1024-dimensional position vector of step 1 (pos=0).
[0154] Line 2: The 1024-dimensional position vector of step 2 (pos=1). ...
[0156] Line 10: The 1024-dimensional position vector of step 10 (pos=9).
[0157] The semantic embedding vector of the surgical step feature matrix is added to the corresponding position vector to obtain the surgical step feature vector after position encoding.
[0158] For example, the surgical step feature matrix has dimensions (10, 1024), with each row corresponding to a 1024-dimensional semantic embedding vector for one core step, denoted as X = [x1, x2, x3, x4, x5, x6, x7, x8, x9, x 10 (x1 corresponds to step 1: laparoscopic cholecystectomy..., x2 corresponds to step 2: insertion of laparoscope and trocar..., ..., x 10 (Corresponding to step 10: Expel CO2 gas from the abdominal cavity...)
[0159] The surgical step feature vector after position encoding is: [x1+p1,x2+p2,x3+p3,x4+p4,x5+p5,x6+p6,x7+p7,x8+p8,x9+p9,x 10 +p 10 ].
[0160] The surgical step feature vector after location encoding includes temporal and semantic information between each step.
[0161] The temporal information in the surgical step feature matrix is mainly reflected by the row / column index order, that is, the dimensional order of the matrix corresponds one-to-one with the temporal order.
[0162] The core of semantic information is content (such as the operational meaning of preoperative preparation and the technical characteristics of establishing pneumoperitoneum). In the matrix, the numerical values of the matrix elements need to be associated with their specific meanings through numerical encoding of the original semantics.
[0163] Step 2: Integrate the feature vectors of the surgical steps after location encoding to obtain the duration feature vector.
[0164] Specifically, the computer device uses the self-attention mechanism of the encoder in the surgical duration prediction model, as well as the temporal and semantic information between each step, to assign attention weights to the surgical step feature vector after position encoding, and then performs weighted correction on the surgical step feature vector based on the attention weights to obtain the duration feature vector.
[0165] The encoder's self-attention layer is computed in three steps, assigning dynamic weights to each step vector (the weights represent the degree of influence of that step on the duration prediction).
[0166] For each vector x i +p i It is generated through three different linear layers:
[0167] Query vector q i This indicates what needs to be focused on in the current step;
[0168] Key vector k i This indicates what information the current step can provide;
[0169] value vector v i This indicates the core feature of the current step.
[0170] For the query vector q in step i i , and the key vector k of all steps (including itself) j Calculate the dot product to obtain the attention score of step i on step j.
[0171] The scores are normalized using the Softmax function to obtain the attention weight W of step i on step j. ij .
[0172] For example, the weight W of the dissection of the gallbladder-hepatic triangle (step 3) on itself. 33 =0.35 (highest, as it is a time-consuming and critical step), the weight W for inserting the laparoscope (step 2) 32 =0.2 (due to proximity in time and correlation in operation), the weight W for inserting the common bile duct after trimming the short arm of the T-tube (step 7) 37 =0.05 (distant time series and weak correlation).
[0173] Based on attention weights, the value vectors of each step are weighted and summed to obtain the corrected step feature vector, which is the duration feature vector.
[0174] Step 3: Use a global feature aggregation algorithm to perform weighted fusion transformation on the duration feature vector to obtain the predicted duration.
[0175] Global feature aggregation algorithms refer to a class of algorithms that integrate information scattered in local feature units (such as each element in a sequence, each pixel / region in an image, and each word in a text) into a global feature vector or global feature matrix through specific operational rules.
[0176] For example, suppose the duration feature vector is [1.2, 0.8, 1.5, 0.5, 0.3], corresponding to weights {0.25, 0.18, 0.32, 0.15, 0.1}, and bias b = 2.5. After weighted fusion transformation, S = (0.25 × 1.2) + (0.18 × 0.8) + (0.32 × 1.5) + (0.15 × 0.5) + (0.1 × 0.3) + 2.5 = 0.3 + 0.144 + 0.48 + 0.075 + 0.03 + 2.5 = 3.529.
[0177] Where b represents the bias term, a constant used in model learning to adjust the overall numerical offset.
[0178] The weighted fusion transformation value S is converted into a value that matches the actual operation time by linear scaling using an activation function.
[0179] For example, the duration of the operation follows the formula:
[0180]
[0181] Where Tpred represents the operation time, Smin / Smax represents the minimum / maximum value of the global weighted fusion value of all samples (e.g., Smin = 1.2, Smax = 5.8), and Tmax / Tmin represents the preset operation time range.
[0182] Using the example above, S = 3.529, calculate:
[0183] Tpred=30+(3.529-1.2)×(60-30) / (5.8-1.2)=30+2.329×6.52≈30+15.18≈45.18 minutes.
[0184] In summary, the technical solution provided in this application can accurately extract key information of surgical operations and improve the accuracy of surgical duration prediction by vectorizing each surgical step into a feature vector.
[0185] The above embodiments have described in detail the process of the method for predicting operation time. The training method of the operation time prediction model will be briefly described below.
[0186] Figure 3This application provides a flowchart illustrating a training method for a surgical duration prediction model. The method can be executed by a computer device, which may be... Figure 1 The method includes: (The computer device 100 is mentioned in the original text.)
[0187] Step S301: The computer device acquires the sample surgical step sequence and the actual surgical duration corresponding to the sample surgical step sequence.
[0188] Among them, the sample surgical procedure sequence refers to a set of discrete medical operation units arranged in accordance with medical standards, operational logic, or actual execution order in a specific surgical operation, and each unit has a clear purpose.
[0189] For example, a computer device acquires patient characteristic information, and based on the patient characteristic information and a surgical knowledge base, acquires a sample surgical step sequence that matches the patient characteristic information, and the actual surgical duration corresponding to the sample surgical step sequence.
[0190] Patient characteristic information refers to a set of structured / unstructured information extracted from the patient's preoperative assessment, medical history, and examination reports, which is related to the implementation of surgery, postoperative recovery, and prediction of surgery duration. It covers key dimensions such as the patient's individual physiological attributes, disease-related status, and basic health status.
[0191] Optionally, patient characteristic information includes basic patient information (age, gender, body mass index), disease-related information (type and severity of underlying disease, specific parameters of lesions: location, size, shape, pathological stage), and physiological indicator information (preoperative heart rate, blood pressure, liver and kidney function indicators, coagulation function indicators), but is not limited thereto, and the embodiments of this application do not impose specific limitations on this.
[0192] Computer equipment standardizes patient characteristic information to obtain patient characteristic information in a preset data format.
[0193] For example, regarding patient characteristics: age: remove the "years" character and extract the value 52; blood pressure: split systolic pressure / diastolic pressure and extract the key value of systolic pressure 135 (Note: the model defaults to using systolic pressure to represent blood pressure level); history of diabetes: simplify to yes = 1, no = 0; surgical history: simplify to abdominal surgery = 1, no = 0, etc.
[0194] The computer equipment constructs a surgical knowledge base, which includes standard procedure templates for various types of surgeries (such as standard procedures for laparoscopic cholecystectomy and knee replacement surgery), surgical step adjustment rules corresponding to different patient characteristics (such as supplementary rules for intraoperative blood pressure monitoring steps for hypertensive patients and rules for surgical instrument selection for patients with liver and kidney dysfunction), and a historical surgical case database (containing the mapping relationship between patient characteristics and corresponding sample surgical step sequences), but is not limited thereto, and the embodiments of this application do not impose specific limitations on this.
[0195] The computer device combines standardized patient feature information with the surgical knowledge base through a large language model to obtain a sample surgical step sequence that matches the patient feature information and the actual operation time corresponding to the sample surgical step sequence.
[0196] Step S302: The computer device inputs the sequence of sample surgical steps into the surgical duration prediction model to predict the duration and obtain the predicted surgical duration.
[0197] For example, the computer device inputs the sample surgical step feature matrix generated from the sample surgical step sequence into the surgical duration prediction model to predict the duration and obtain the predicted surgical duration.
[0198] Optionally, the surgical duration prediction model adopts a Transformer architecture, specifically configured as follows: the input layer receives the feature matrix of sample surgical steps (including step semantic vectors and temporal relationship features); the encoder consists of 6 stacked Transformer layers, each equipped with an 8-head self-attention mechanism to capture long-distance dependencies and execution logic associations between steps; the output layer is set as a single-neuron regression layer, outputting the predicted value of the total surgical duration in minutes. The model training aims to minimize the mean absolute error (MAE), and iteratively optimizes the parameters through backpropagation to improve the accuracy of duration prediction for complex multi-step surgeries.
[0199] Specifically, the detailed steps to obtain the predicted surgery duration include:
[0200] Step 1: Perform position encoding on the feature matrix of the surgical steps in the sample.
[0201] For example, for 10 steps (position indices pos are 0 to 9, corresponding to steps 1 to 10), the 1024-dimensional position vectors PE(pos,2i) and PE(pos,2i+1) (where i is the dimension index, 0 to 511) for each position pos are calculated using the following formula:
[0202] Even-numbered dimensions (e.g., the 0th, 2nd, 4th...1022nd dimension): PE(pos,2i)=sin(pos / 10000^(2i1024)).
[0203] Odd-numbered dimensions (such as the 1st, 3rd, 5th...1023rd dimension): PE(pos,2i+1)=cos(pos / 10000^(2i1024)).
[0204] Using the above formula, each step (pos = 0 to 9) will generate a unique 1024-dimensional position vector. The closer the steps are in time, the smaller the difference in the position vector values (e.g., pos = 1 and pos = 2); the further apart the steps are in time, the greater the difference (e.g., pos = 1 and pos = 6).
[0205] The 1024-dimensional position vectors of the 10 steps are arranged sequentially according to the time sequence of the steps to form a 10×1024 position encoding matrix that is completely consistent with the dimension of the feature matrix of the sample surgical steps.
[0206] Line 1: The 1024-dimensional position vector of step 1 (pos=0).
[0207] Line 2: The 1024-dimensional position vector of step 2 (pos=1). ...
[0209] Line 10: The 1024-dimensional position vector of step 10 (pos=9).
[0210] The semantic embedding vector of the sample surgical step feature matrix is added to the corresponding position vector to obtain the sample surgical step feature vector after position encoding.
[0211] For example, the feature matrix of surgical steps in a sample has dimensions (10, 1024), with each row corresponding to a 1024-dimensional semantic embedding vector for one core step, denoted as X = [x1, x2, x3, x4, x5, x6, x7, x8, x9, x 10 (x1 corresponds to step 1: laparoscopic cholecystectomy..., x2 corresponds to step 2: insertion of laparoscope and trocar..., ..., x 10 (Corresponding to step 10: Expel CO2 gas from the abdominal cavity...)
[0212] The feature vector of surgical steps in the sample after position encoding is: [x1+p1,x2+p2,x3+p3,x4+p4,x5+p5,x6+p6,x7+p7,x8+p8,x9+p9,x 10 +p 10 ].
[0213] Among them, the feature vector of surgical steps in the sample after location encoding processing contains temporal and semantic information between each step.
[0214] The temporal information in the sample surgical step feature matrix is mainly reflected by the row / column index order, that is, the dimensional order of the matrix corresponds one-to-one with the temporal order.
[0215] The core of semantic information is content (such as the operational meaning of preoperative preparation and the technical characteristics of establishing pneumoperitoneum). In the matrix, the numerical values of the matrix elements need to be associated with their specific meanings through numerical encoding of the original semantics.
[0216] Step 2: Integrate the feature vectors of the surgical steps in the sample after location encoding to obtain the duration feature vector.
[0217] Specifically, the computer device uses the self-attention mechanism of the encoder in the surgical duration prediction model, as well as the temporal and semantic information between each step, to assign attention weights to the sample surgical step feature vector after position encoding, and then performs weighted correction on the sample surgical step feature vector based on the attention weights to obtain the duration feature vector.
[0218] The encoder's self-attention layer is computed in three steps, assigning dynamic weights to each step vector (the weights represent the degree of influence of that step on the duration prediction).
[0219] For each vector x i +p i It is generated through three different linear layers:
[0220] Query vector q i This indicates what needs to be focused on in the current step;
[0221] Key vector k i This indicates what information the current step can provide;
[0222] value vector v i This indicates the core feature of the current step.
[0223] For the query vector q in step i i , and the key vector k of all steps (including itself) j Calculate the dot product to obtain the attention score of step i on step j.
[0224] The scores are normalized using the Softmax function to obtain the attention weight W of step i on step j. ij .
[0225] For example, the weight W of the dissection of the gallbladder-hepatic triangle (step 3) on itself. 33 =0.35 (highest, as it is a time-consuming and critical step), the weight W for inserting the laparoscope (step 2) 32 =0.2 (due to proximity in time and correlation in operation), the weight W for inserting the common bile duct after trimming the short arm of the T-tube (step 7) 37 =0.05 (distant time series and weak correlation).
[0226] Based on attention weights, the value vectors of each step are weighted and summed to obtain the corrected step feature vector, which is the duration feature vector.
[0227] Step 3: Use a global feature aggregation algorithm to perform weighted fusion transformation on the duration feature vector to obtain the predicted duration.
[0228] Global feature aggregation algorithms refer to a class of algorithms that integrate information scattered in local feature units (such as each element in a sequence, each pixel / region in an image, and each word in a text) into a global feature vector or global feature matrix through specific operational rules.
[0229] For example, suppose the duration feature vector is [1.2, 0.8, 1.5, 0.5, 0.3], corresponding to weights {0.25, 0.18, 0.32, 0.15, 0.1}, and bias b = 2.5. After weighted fusion transformation, S = (0.25 × 1.2) + (0.18 × 0.8) + (0.32 × 1.5) + (0.15 × 0.5) + (0.1 × 0.3) + 2.5 = 0.3 + 0.144 + 0.48 + 0.075 + 0.03 + 2.5 = 3.529.
[0230] Where b represents the bias term, a constant used in model learning to adjust the overall numerical offset.
[0231] The weighted fusion transformation value S is converted into a value that matches the actual operation time by linear scaling using an activation function.
[0232] For example, the predicted operation time can satisfy the following formula:
[0233]
[0234] Where Tpred represents the operation time, Smin / Smax represents the minimum / maximum value of the global weighted fusion value of all samples during model training (e.g., Smin = 1.2, Smax = 5.8), and Tmax / Tmin represents the preset range of operation time.
[0235] Using the example above, S = 3.529, calculate:
[0236] Tpred=30+(3.529-1.2)×(60-30) / (5.8-1.2)=30+2.329×6.52≈30+15.18≈45.18 minutes.
[0237] Step S303: The computer device calculates the loss function value based on the predicted operation time and the actual operation time.
[0238] The loss function value satisfies the following formula:
[0239]
[0240] Where MAE represents the loss function value, n represents the total number of samples, and y i This represents the actual operation time of the i-th sample. This represents the predicted operation time for the i-th sample.
[0241] Step S304: The computer device updates the model parameters of the operation duration prediction model based on the loss function value.
[0242] For example, the computer device updates the model parameters of the operation duration prediction model based on the loss function value.
[0243] Model parameter update refers to updating the network parameters in the operation duration prediction model, or updating the network parameters of each network module in the model, or updating the network parameters of each network layer in the model, but it is not limited to these, and the embodiments of this application do not limit it.
[0244] Optionally, based on the loss function value of the surgical duration prediction model, the model parameters of the surgical duration prediction model are adjusted until the training system of the surgical duration prediction model reaches the training stopping condition, thus obtaining a trained surgical duration prediction model. In some embodiments, before the training system of the surgical duration prediction model reaches the training stopping condition, the model parameters of other learning models in the training system of the surgical duration prediction model are also continuously adjusted according to the training loss.
[0245] In summary, the technical solution provided in this application obtains the sequence of surgical steps in the sample data and their corresponding actual surgical durations. The sample data is then input into a surgical duration prediction model to obtain the predicted duration. The model parameters are then calculated based on the predicted and actual values to update the model parameters. This process enables the model to continuously learn the correlation between the surgical step sequence and the actual duration in the sample data (such as the impact of key steps on duration, the implicit relationship between the temporal logic and time consumption between steps), continuously optimize the parameters to reduce prediction errors, and ultimately enable the model to accurately predict the duration of new surgeries. This provides a reliable time reference for clinical surgical planning, resource allocation, and patient communication, improving the efficiency and controllability of the medical process.
[0246] The foregoing mainly describes the solution provided in this application. Accordingly, this application also provides a device for predicting the duration of surgery, which is used to implement the above-described method embodiments.
[0247] Figure 4 A schematic diagram of a surgical duration prediction device provided in an embodiment of this application is shown below. Figure 4As shown, the device for predicting the duration of surgery may include an acquisition module 401, a processing module 402, and a prediction module 403. The acquisition module 401 is used to perform... Figure 2 The illustrated method includes step S201; the processing module 402 is used to execute... Figure 2 The operation of step S202; the prediction module 403 is used to perform Figure 2 The operation of step S203.
[0248] The foregoing mainly describes the solution provided in this application. Accordingly, this application also provides a training device for an operation duration prediction model, which is used to implement the above-described method embodiments.
[0249] Figure 5 This is a schematic diagram of the structure of a training device for a surgical duration prediction model provided in an embodiment of this application, as shown below. Figure 5 As shown, the training device for the surgical duration prediction model may include an acquisition module 501, a prediction module 502, a calculation module 503, and an update module 504. The acquisition module 501 is used to execute... Figure 3 The illustrated method includes step S301; the prediction module 502 is used to execute... Figure 3 In the illustrated method, step S302 is performed by the calculation module 503. Figure 3 In the illustrated method, step S303 is performed by update module 504. Figure 3 The illustrated method includes step S304.
[0250] In some embodiments, the surgical duration prediction device includes hardware structures and / or software modules corresponding to the execution of each function in order to achieve the above-described functions. Those skilled in the art will readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0251] This application embodiment can divide the operation duration prediction device into functional modules according to the above method embodiment. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into a feature extraction module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0252] like Figure 6 As shown, the computer device provided in this application embodiment may include a processor 601, a bus 602, a communication interface 603, and a memory 604. The processor 601, memory 604, and communication interface 603 communicate with each other via the bus 602. It should be understood that this application does not limit the number of processors and memories in the network device.
[0253] Bus 602 can be a PCI bus, an Extended Industry Standard Architecture (EISA) bus, or a UB bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 6 The bus 602 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 602 may include a path for transmitting information between various components of the network device (e.g., memory 604, processor 601, communication interface 603).
[0254] Processor 601 may include any one or more processors such as CPU, graphics processing unit (GPU), microprocessor (MP), or digital signal processor (DSP).
[0255] Memory 604 may include volatile memory, such as random access memory (RAM). Processor 601 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0256] The communication interface 603 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between network devices and other devices or communication networks.
[0257] The memory 604 stores executable program code, which the processor 601 executes to implement the functions of the aforementioned method embodiments. That is, the memory 604 stores instructions for performing the aforementioned method for predicting surgical duration.
[0258] In another aspect, a computer-readable storage medium is provided, which stores at least one computer program, which is loaded and executed by a processor to implement the method for predicting the duration of surgery as provided in the above-described method embodiments.
[0259] In another aspect, a computer program product is provided, which includes a computer program or instructions that, when executed by a processor, implement the method for predicting the duration of surgery as provided in the above-described method embodiments.
[0260] Through the above description of the implementation methods, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the module can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, modules, and units described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0261] Since the prediction module, computer-readable storage medium, and computer program product in the embodiments of the present invention can be applied to the above method, the technical effects obtained can also be referred to the above method embodiments. The embodiments of the present invention will not be repeated here.
[0262] The method steps in this embodiment can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a network device. Of course, the processor and storage medium can also exist as discrete components in the network device.
[0263] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions of the embodiments of this application are performed, in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable module. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, a computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).
[0264] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for predicting the duration of an operation, characterized in that, The method includes: Obtain the surgical procedure sequence; Each step in the surgical step sequence is vectorized to obtain the surgical step feature matrix corresponding to the surgical step sequence. The predicted duration is obtained by predicting the duration based on the feature matrix of the surgical steps.
2. The method according to claim 1, characterized in that, The process of predicting the duration based on the surgical step feature matrix to obtain the predicted duration includes: The surgical step feature matrix is input into the surgical duration prediction model to predict the duration and obtain the predicted duration.
3. The method according to claim 2, characterized in that, The step of inputting the surgical step feature matrix into the surgical duration prediction model to predict the duration and obtain the predicted duration includes: The feature matrix of the surgical steps is processed by position encoding. The feature vectors of the surgical steps after location encoding are integrated to obtain the duration feature vector; The predicted duration is obtained by weighted fusion and transformation of the duration feature vector through a global feature aggregation algorithm.
4. The method according to claim 3, characterized in that, The surgical step feature vector after location encoding processing contains temporal and semantic information between each step. The step of integrating the location-encoded surgical step feature vector to obtain a duration feature vector includes: Attention weights are assigned to the feature vector of the surgical steps after the position encoding process by using the self-attention mechanism of the encoder in the surgical duration prediction model, as well as the temporal information and semantic information between the steps. The surgical step feature vector is weighted and corrected based on the attention weights to obtain the duration feature vector.
5. The method according to claim 1, characterized in that, The step of vectorizing each step in the surgical step sequence to obtain the surgical step feature matrix corresponding to the surgical step sequence includes: Each step in the surgical procedure sequence is subjected to text normalization processing to obtain the normalized step text for each step; The standardized step text of each step is vectorized to generate a semantic embedding vector for each step; The semantic embedding vector generated in each step is normalized to obtain the surgical step feature matrix corresponding to the surgical step sequence.
6. The method according to claim 5, characterized in that, The step of vector processing the standardized step text of each step to generate a semantic embedding vector for each step includes: The standardized steps text is segmented using a medical text embedding model to obtain a medical semantic token sequence; The medical semantic token sequence is semantically encoded to generate the semantic embedding vector for each step.
7. The method according to any one of claims 1-6, characterized in that, The row vectors of the surgical step feature matrix correspond to each step in the surgical step sequence.
8. The method according to claim 1, characterized in that, The acquisition of the surgical step sequence includes: Obtain patient characteristic information; Based on the patient's characteristic information and the surgical knowledge base, the surgical procedure sequence that matches the patient's characteristic information is obtained.
9. The method according to claim 8, characterized in that, The step of obtaining the surgical step sequence matching the patient's characteristic information based on the patient's characteristic information and the surgical knowledge base includes: The patient feature information is standardized to obtain the patient feature information in a preset data format; By combining the standardized patient feature information with the surgical knowledge base using a large language model, a surgical step sequence that matches the patient feature information is obtained.
10. A training method for a surgical duration prediction model, characterized in that, The method includes: Obtain the sample surgical step sequence and the actual operation time corresponding to the sample surgical step sequence; The sequence of surgical steps in the sample is input into the surgical duration prediction model to predict the duration and obtain the predicted surgical duration. Based on the predicted operation time and the actual operation time, the loss function value is calculated; Based on the loss function value, the model parameters of the operation duration prediction model are updated.
11. The method according to claim 10, characterized in that, The loss function value satisfies a first preset formula, which is: Where MAE represents the loss function value, n represents the total number of samples, and y i This represents the actual operation time of the i-th sample. This represents the predicted operation time for the i-th sample.
12. A device for predicting the duration of an operation, characterized in that, The device includes: an acquisition module, a processing module, and a prediction module; The acquisition module is used to acquire the surgical step sequence; The processing module is used to vectorize each step in the surgical step sequence to obtain the surgical step feature matrix corresponding to the surgical step sequence. The prediction module is used to predict the duration based on the feature matrix of the surgical steps, and obtain the predicted duration.
13. A training device for a surgical duration prediction model, characterized in that, The device includes: an acquisition module, a prediction module, a calculation module, and an update module; The acquisition module is used to acquire the sample surgical step sequence and the actual operation time corresponding to the sample surgical step sequence; The prediction module is used to input the sequence of surgical steps of the sample into the operation time prediction model to predict the operation time and obtain the predicted operation time. The calculation module is used to calculate the loss function value based on the predicted operation time and the actual operation time; The update module is used to update the model parameters of the operation duration prediction model based on the loss function value.
14. A computer device, characterized in that, The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the method for predicting the operation duration as described in any one of claims 1-9, and the method for training the operation duration prediction model as described in any one of claims 10-11.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the surgical duration prediction method as described in any one of claims 1-9, and the surgical duration prediction model training method as described in any one of claims 10-11.