Search

CN-121974076-A - Intelligent pharmacy dispensing method based on visual positioning and accurate grabbing

CN121974076ACN 121974076 ACN121974076 ACN 121974076ACN-121974076-A

Abstract

The invention relates to an intelligent pharmacy dispensing method based on visual positioning and accurate grabbing, which comprises the following steps of step 1, electronic prescription analysis and dispensing task generation, step 2, visual recognition and medicine positioning, step 3, dispensing path optimization, step 4, flexible grabbing control, step 5, medicine verification and tracing, and step 6, intelligent warehouse management and system cooperation. Compared with traditional manual dispensing, the efficiency is improved by about 5 times, a large number of prescription demands in the outpatient peak period can be effectively met, and the medicine taking waiting time of patients is obviously shortened.

Inventors

  • LI YIPENG
  • WU HAO
  • ZHOU HONGWEI

Assignees

  • 江苏润和软件股份有限公司

Dates

Publication Date
20260505
Application Date
20260320

Claims (10)

  1. 1. An intelligent pharmacy dispensing method based on visual positioning and accurate grabbing is characterized by comprising the following steps: step 1, generating an electronic prescription analysis and dispensing task, Step 2, visual identification and medicine positioning, Step 3, optimizing the dispensing path, Step 4, flexible grabbing control is carried out, Step 5, medicine verification and tracing are carried out, And 6, intelligent library management is cooperated with the system.
  2. 2. The intelligent pharmacy dispensing method based on visual positioning and accurate grabbing of claim 1, wherein step 1, electronic prescription analysis and dispensing task generation, specifically as follows, Establishing a real-time data interface with a Hospital Information System (HIS), receiving an electronic prescription and carrying out structural analysis, providing task input for subsequent visual positioning and path planning, and setting a received prescription set as Wherein Represent the first Zhang Chufang the process of the preparation of the pharmaceutical composition, For the total number of prescriptions to be dispensed, each prescription Comprising a plurality of drug items, expressed as Wherein Represent the first Prescription of the first The identification code of the seed medicine is used for coding, Indicating the quantity of the medicament dispensed, For the number of types of drugs contained in the prescription, Firstly, the analysis engine performs semantic verification on the prescription, checks the validity of medicine codes, the rationality of dosages and the incompatibility among medicines, maps each medicine item to specific library position information by querying a medicine main database, and establishes medicines The bin position coordinates in the warehouse system are Wherein 、 、 Respectively representing three-dimensional position coordinates of the bin in the warehouse space, the bin coordinate information is transmitted as input to a path planning module for calculating an optimal grabbing sequence, Comprehensively calculating dispensing priorities based on time of receipt of prescriptions, patient type and drug attributes to determine order of treatment of prescriptions Is defined as: wherein the variables have the following meanings: Prescription of Priority scoring of (a) in a range of A larger value indicates a higher priority, The emergency degree coefficient of the prescription, the value of the common prescription is 0, the value of the emergency prescription is 0.5, the value of the critical prescription is 1.0, Prescription of The time (in seconds) that has been waiting, Maximum allowable waiting time (unit: seconds) set by the system, Whether the prescription contains the marks of special management medicines such as cold chain medicines, narcotics and the like or not, the value is 1.0 if the marks contain the marks, otherwise, the value is 0, 、 、 Weight coefficient satisfies , Priority scoring The higher prescriptions are subjected to priority arrangement and dispensing operation, after the analysis engine finishes prescription analysis and priority calculation, a dispensing task list is generated and pushed to the path planning module, and meanwhile, the bin coordinate information of each medicine is transmitted to the visual identification module so as to be accurately positioned and grabbed later.
  3. 3. The intelligent pharmacy dispensing method based on visual positioning and accurate grabbing of claim 2, wherein step 2, visual recognition and medicine positioning are as follows, 2-1 Extraction of appearance characteristics of the medicine, For acquired medicine images Wherein And The system adopts an improved convolutional neural network to extract visual characteristics of medicines, the network comprises a characteristic extraction trunk and a multi-scale detection head, the boundary frame coordinates, class labels and confidence scores of the medicines are output, Let the detected medicine boundary box set be Each bounding box Comprising the upper left angular position Lower right angular position Class of drugs Confidence score , Is the total number of drugs detected. The system matches the identification result with the target medicine code transmitted by the prescription analysis module, screens out candidate medicines related to the current task, The 2-2 barcode identification is matched with the information, Further positioning a medicine bar code area in the boundary box area, reading key information such as medicine batch number, production date, validity period and the like by adopting a bar code decoding algorithm, and setting a medicine information vector obtained by decoding as Wherein: The number of the bar code of the medicine is counted, The batch number of the batch is adopted, The production date is set to be the production date, The effective period of the method is that, Matching and verifying the identification result with a medicine main database, and calculating an information consistency score: wherein the variables have the following meanings: First of all The consistency score of each candidate medicine is 0 or 1, The current task target medicine code is transmitted in by the prescription analysis module, The current date of the system is used, The safety period threshold is set to 30 days, Only consistency scores The medicine is confirmed to be an effective grabbing target, so that the risk of taking the wrong medicine or taking the temporary medicine is avoided from the source, the verified medicine information and the position data are transmitted to the three-dimensional pose estimation link of the next step, 2-3 Three-dimensional pose estimation, In combination with the point cloud data acquired by the depth sensor, the system calculates the accurate three-dimensional pose of the target medicine, provides grabbing point position input for the flexible grabbing module, and sets the three-dimensional coordinates of the medicine center point under the depth camera coordinate system as Calibrating matrix by hand and eye Converting it to a robot arm end coordinate system: Wherein: the homogeneous transformation matrix from the camera coordinate system to the end effector coordinate system is obtained in advance through hand-eye calibration, The position of the target in the camera coordinate system (homogeneous form of coordinates), Target position in the end effector coordinate system, And converting the target position into a pose representation under a coordinate system of a base of the mechanical arm through positive kinematic calculation of the mechanical arm, and transmitting pose information to a flexible grabbing control module to serve as a target point for grabbing track planning.
  4. 4. The intelligent pharmacy dispensing method based on visual positioning and accurate grabbing according to claim 3, wherein the step 3, dispensing path optimization is specifically as follows, 3-1 Problem modeling was performed with the help of the model, Setting the medicine library position set to be grabbed in the current batch as Wherein Indicating the starting position of the robotic arm (dispensing window), To the point of The medicine storage positions are indicated to be in each medicine storage position, For the total number of medicine library positions, any two positions are defined And The movement time between them is The time is determined by the mechanical arm kinematics and the space distance, Dispensing path Representing the access order arrangement of one bank bit, Wherein And are different from each other. The total dispense time of the path is defined as: , wherein the variables have the following meanings: Path of Is used for the total dispensing time (unit: second), Slave library position Move to the warehouse location Setting the movement time of (2) The starting position is indicated as such, In the library position The time required for executing the grabbing action is related to the type of the medicine package and the grabbing strategy, the flexible grabbing module estimates according to the medicine attribute, 3-2 The genetic algorithm is optimized, Searching the optimal path by adopting a genetic algorithm, simulating the evolution process in the natural world, gradually approaching a global optimal solution through population iteration, carrying out four main operations of initialization, selection, crossing and variation, Initializing, generating an inclusion An initial population of individuals, each individual representing a viable path. Wherein 70% of individuals are generated by adopting a greedy strategy (each time the unvisited library position closest to the current position is selected), 30% of individuals are randomly generated to ensure the diversity of the population, Fitness calculation-fitness function is defined as the inverse of the dispense time, such that the shorter the dispense time, the higher the path fitness: , Wherein: Path of The larger the adaptation value, the better the path, A small constant for preventing zero removal is taken to be 0.001, Selecting, using roulette selection strategy, wherein each individual is selected with a probability proportional to its fitness, setting the first of the population Individual (Path) The selection probability of (2) is Wherein Individuals with high fitness have a greater probability of entering the next generation, Generating offspring by adopting sequence crossover operators (Order Crossover, OX), specifically, randomly selecting a fragment of a parent path, directly copying the fragment to the same position of the offspring, sequentially filling the unoccupied library bit numbers in the rest positions according to the sequence of the other parent, ensuring that the generated offspring is still a valid path (each library bit is accessed just once), The mutation operation is performed by probability (0.1-0.2) Performing mutation on the individual by randomly selecting two positions in the path and exchanging the bin numbers, introducing random disturbance to jump out of local optimum, The algorithm is iteratively executed until reaching a preset algebra or continuous multi-generation fitness without obvious improvement, and the algorithm converges, and the optimal individual of the generation is output as an optimal path , 3-3, Dynamic path adjustment, namely, adopting an incremental path updating strategy, namely, evaluating the time cost of inserting the newly added medicine library into each position of the current residual path, selecting an insertion point with the minimum cost, and directly deleting and recording information to be restocked from the path for the stock lacking position, and simultaneously notifying a prescription analysis module to update the prescription state. The dynamic adjustment mechanism enables the system to flexibly respond to real-time changes and keeps higher dispensing efficiency; after the path planning is completed, the system sequentially dispatches the mechanical arm to access each library position according to the optimal path sequence, and at each library position, the visual recognition module firstly carries out accurate medicine positioning, and after the target pose is confirmed, the flexible grabbing module executes grabbing actions.
  5. 5. The intelligent pharmacy dispensing method based on visual positioning and accurate grasping according to claim 2, characterized in that, Step 4, flexible grabbing control, specifically as follows, 4-1 Drug grabbing mode decision making, Pre-storing package attribute information of each medicine in a medicine main database, including package type External dimension (Wherein 、 、 Respectively representing the length, width and height of the medicine package, the unit is mm), and the weight And surface characteristics According to the attributes, the grabbing mode decision function outputs an optimal grabbing mode: For boxed medicines, parallel clamping jaws are adopted for grabbing, for bottled medicines, three-finger self-adaptive clamping jaw enveloping grabbing is adopted, for bagged medicines, vacuum suction cups are adopted for sucking grabbing, for blister board medicines, suction cups and supporting plates are adopted for combined grabbing, 4-2 The self-adaptive control of the grabbing force, Let the gripping force exerted by the gripping jaws be The weight of the medicine is that Wherein Is the medicine quality (unit: kg), For the gravitational acceleration constant (9.8 m/s 2), the safety grabbing condition requires: , wherein the variables have the following meanings: the gripping force (unit: N) applied by the gripping jaw, The gravity (unit: N) of the medicine, The friction coefficient between the clamping jaw and the medicine surface is determined according to the characteristics of the medicine surface, The safety factor is 1.5 to 2.0 to ensure that the medicine can be still held stably when the mechanical arm accelerates the movement, At the same time, the gripping force cannot exceed the bearing limit of the medicine package I.e. The system monitors the grabbing force in real time through a force sensor on the end effector, and adjusts the output of a clamping jaw motor by adopting a PID controller so as to maintain the grabbing force in a safe interval In the inner part of the inner part, 4-3 The track is grabbed and planned, After the grabbing point position is determined, the system plans the motion track of the mechanical arm from the current position to the grabbing point and then to the placement point, and in order to ensure the motion stability, the track needs to meet the boundary conditions that the positions of the starting point and the ending point are accurately reached, the speeds of the starting point and the ending point are zero (static starting and stopping), the accelerations of the starting point and the ending point are zero (motion impact is avoided), the six boundary conditions just need six free parameters to be met, therefore, a penta polynomial (containing six coefficients) is adopted to conduct track interpolation, Let the starting position and posture under the joint space be The final pose is The movement time is Then (1) Individual joint angle over time ( ) The change curve of (2) is: wherein the variables have the following meanings: First of all Individual joints at moment Is defined as the angle (in degrees), First of all The starting angle of the individual joints is set, 、 、 First of all The polynomial coefficients of the individual joints are used, Total time of track motion (unit: seconds), Polynomial coefficients are solved according to boundary conditions. Is provided with Is a joint The angular variation of the (2) can be deduced from constraint conditions that the speed and the acceleration of the start point and the stop point are zero, so that an analytical expression of the coefficient can be obtained: After the grabbing action is completed, the mechanical arm places the medicines into the medicine dispensing box, and then continues to execute the next library access task designated by the path planning module until all medicines of the current prescription are grabbed.
  6. 6. The intelligent pharmacy dispensing method based on visual positioning and accurate grabbing according to claim 2, wherein step 5, drug verification and traceability, specifically as follows, 5-1 Multiple authentication mechanism(s), An independent checking visual system is arranged at the medicine dispensing window, the image acquisition and the identification are carried out again on the medicine to be dispensed, the checking result is compared with the prescription information by the system, the verification items comprise whether the medicine variety is correct, the quantity is complete, the batch number is consistent, the validity period is within the safety range, Set the medicine set with prescription requirement as Wherein Is the first The code of the seed medicine is that, For the quantity of the pharmaceutical product, Checking the medicine set as the medicine category number contained in the prescription Wherein And Respectively the first to check and identify The code and the quantity of the seed medicines, For the number of identified drug categories, the conditions for verification pass are: , Wherein: a set of medicines required for prescription, each element containing a medicine code Sum and quantity , The medicine collection of the actual medicine dispensing is carried out, First of all Consistency score of the seed drug (with defined in visual recognition module The meanings are the same, subscripts herein Corresponding to the index of the drug in the prescription), the score is calculated by the visual recognition module according to the barcode matching and expiration date verification results during the grasping stage, I.e. the two sets are exactly equal and the validity of all drugs is verified. If the verification fails, the system automatically pauses the drug delivery flow and gives an alarm to prompt the pharmacist to perform manual intervention treatment, and simultaneously records the abnormal information into a traceable database, 5-2 The dispensing record is generated, After each dispensing operation is completed, the system automatically generates a detailed dispensing log, and the recorded contents comprise a prescription number, patient information, dispensing time, a library position source of each medicine, a batch number, a grabbing sequence, an operation mechanical arm number and a visual identification image, and all records are stored in a database according to the time stamp sequence, so that multidimensional inquiry according to the prescription number, the medicine batch number, the time range and the like is supported, and the traceability requirement of medicine supervision is met.
  7. 7. The intelligent pharmacy dispensing method based on visual positioning and accurate grabbing according to claim 2 is characterized in that step 6, intelligent inventory management and a system cooperate, the system monitors the stock state of each medicine inventory in real time, when the stock is lower than a preset threshold value, a replenishment prompt is automatically generated, inventory information is synchronized to a prescription analysis module, so that possible medicine shortage conditions can be identified in the prescription analysis stage, meanwhile, according to the taking frequency and inventory distribution of medicines, the inventory layout is periodically optimized, high-frequency medicines are adjusted to positions where a mechanical arm is easy to quickly arrive, dispensing efficiency is further improved, inventory adjustment information is updated to a medicine main database in real time, and the inventory information acquired by each module is ensured to be always accurate and consistent.
  8. 8. An intelligent pharmacy dispensing robot system based on visual positioning and accurate grabbing is characterized by being used for realizing the method of any one of claims 1-7, and comprises an electronic prescription analysis engine module, a visual identification positioning module, a dispensing path planning module, a flexible grabbing control module and a medicine verification traceability module, so that full-flow automation of pharmacy dispensing operation is realized, and the system starts from electronic prescription receiving, and completes accurate dispensing of medicines through medicine library position positioning, optimal path planning, accurate grabbing execution and multiple verification, and meanwhile, complete operation records are generated to support traceability management.
  9. 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the visual positioning and accurate gripping-based intelligent pharmacy dispensing method according to any one of the preceding claims 1 to 7 when executing the program.
  10. 10. A computer readable storage medium having stored thereon computer instructions which when executed by a processor implement the intelligent pharmacy compounding method of any one of claims 1-7 based on visual localization and accurate grasping.

Description

Intelligent pharmacy dispensing method based on visual positioning and accurate grabbing Technical Field The invention relates to an intelligent pharmacy dispensing method, in particular to an intelligent pharmacy dispensing method based on visual positioning and accurate grabbing, and belongs to the field of medical automation and intelligent robots. Background With the advancement of medical informatization construction and the continuous increase of patient visits, hospital pharmacies are faced with increasingly heavy dispensing pressures. The traditional manual dispensing mode mainly relies on pharmacists to manually find, pick and check medicines according to prescriptions, and the operation mode has a plurality of problems. First, there is a significant bottleneck in dispensing efficiency. The daily average prescription of the pharmacy of the large-scale three-hospital clinic can reach thousands of prescriptions, and the waiting time of patients in peak time is too long. The pharmacist needs to frequently walk among the medicine racks and repeatedly search for the medicine positions, the physical effort is high, and the single Zhang Chufang dispensing time is difficult to further shorten. Second, the risk of dispensing errors is difficult to completely eliminate. Although hospitals establish a strict check system, manual operations may still lead to wrong medications, wrong numbers or missing medications due to fatigue, distraction, etc. Statistics indicate that the error rate of manual dispensing is about two to five parts per million, although the probability is low, the actual number of errors is still not ignored in view of the huge prescription base, and potential threats may be caused to patient medication safety. Third, the degree of refinement of drug management is inadequate. The medicine quantity and the expiration date state of each warehouse position are difficult to monitor in real time in the manual mode, and the condition that partial medicines are broken and other medicines are backlogged easily occurs. Screening and cleaning of expired medicines rely on periodic manual checking, and are low in efficiency and have a missing detection risk. Fourth, existing automated dispensing equipment exposes certain limitations in practical applications. Part of equipment can only process standardized medicine packages with specific specifications, has insufficient adaptability to mixed scenes of various dosage forms such as boxes, bottles, bags and the like with large size difference, has limited processing capacity of a visual recognition system on abnormal conditions such as similar appearance of medicines, abrasion of labels or inclined arrangement and the like, has unsatisfactory optimizing effect when a dispensing path planning algorithm faces a large number of parallel prescriptions, and cannot fully exert throughput capacity of the equipment. Fifth, there is still room for improvement in the degree of intellectualization of the system. The prior equipment mostly adopts a fixed operation flow and preset grabbing parameters, lacks the capability of adaptively adjusting grabbing strategies according to medicine attributes, has rough prescription priority management, is not flexible enough to respond to emergency prescriptions, special medicines and other conditions, has imperfect man-machine cooperation mode design, and is difficult for pharmacists to conveniently participate in abnormal processing and quality control links. Therefore, an intelligent pharmacy dispensing robot system integrating an advanced visual identification technology, an intelligent planning algorithm and a flexible grabbing mechanism is needed, can adapt to various medicine packaging forms, realizes efficient and accurate automatic dispensing, is deeply integrated with a pharmacy management system, and provides effective auxiliary decision support for pharmacists. The invention provides a complete intelligent pharmacy dispensing robot solution aiming at the technical requirements. Disclosure of Invention The invention provides an intelligent pharmacy dispensing method based on visual positioning and accurate grabbing aiming at the technical problems existing in the prior art, according to the technical scheme, manual medicine picking is replaced by automatic grabbing through the mechanical arm, the empty time is minimized by matching with the path optimization algorithm, and the single-prescription average medicine preparation time can be controlled within 30 seconds. Compared with traditional manual dispensing, the efficiency is improved by about 5 times, a large number of prescription demands in the outpatient peak period can be effectively met, and the medicine taking waiting time of patients is obviously shortened. In order to achieve the above purpose, the technical scheme of the invention is that an intelligent pharmacy dispensing robot system based on visual positioning and accurate grabbing is used for realizing f