A method and system for reviewing dispensing of traditional Chinese medicine decoction pieces based on divided dosing

By employing a collaborative invocation mechanism between forward and inverse models and secondary identification using easily confused models, the high misidentification rate of easily confused medicinal materials in the traditional Chinese medicine dispensing system was resolved. This resulted in a reduction in error rate and an improvement in identification accuracy during the dispensing of easily confused medicinal materials, thereby ensuring medication safety.

CN122369839APending Publication Date: 2026-07-10HANGZHOU TANGGU INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU TANGGU INFORMATION TECH CO LTD
Filing Date
2026-04-10
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing Chinese herbal medicine dispensing systems have a high misidentification rate when identifying easily confused herbs and lack efficient and automated verification methods, leading to the risk of mis-dispensing and omissions.

Method used

A collaborative calling mechanism of forward and reverse models is adopted. The forward model identifies Chinese herbal medicine pieces, the reverse target model performs reverse identification of target pieces, the reverse non-target model excludes non-target pieces, and a secondary identification is performed in combination with the easily confused model to form multiple verifications to ensure the accuracy of identification.

Benefits of technology

It significantly reduced the dispensing error rate, improved the accuracy of identifying easily confused medicinal materials, ensured medication safety, balanced the accuracy of verification with operational efficiency, and reduced indiscriminate manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122369839A_ABST
    Figure CN122369839A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for verifying the dispensing of traditional Chinese medicine (TCM) decoction pieces based on dispensing in stages, belonging to the field of TCM decoction piece technology. The method includes the following steps: S1. Generating a list of expected TCM decoction pieces to be verified, containing all TCM decoction pieces to be dispensed, based on prescription information; S2. Pre-constructing a sub-model library of several TCM decoction pieces; S3. Forming a large model based on the sub-models covering all TCM decoction pieces as a forward model; calling the corresponding individual TCM decoction piece sub-models from the pre-constructed model library based on the TCM decoction piece information in the expected TCM decoction piece list to form a target model set as a reverse target model; forming a non-target model set from all other individual TCM decoction piece sub-models in the pre-constructed model library besides the target model as a reverse non-target model; S4. Dispensing the medicine in stages and image acquisition; S5. Identifying and comparing the medicine pieces; S6. Determining verification anomalies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traditional Chinese medicine decoction pieces technology, and more specifically, relates to a method and system for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in multiple stages. Background Technology

[0002] Dispensing of traditional Chinese medicine (TCM) decoction pieces is a crucial link in TCM services, and its accuracy directly affects clinical efficacy and medication safety. Currently, manual dispensing mainly relies on pharmacists' visual verification, which suffers from low efficiency, fatigue, and a high risk of identification errors, especially for easily confused decoction pieces with similar appearances, such as red peony root and white peony root. While automated dispensing machines have improved efficiency, risks such as "mis-dispensing" and "missed dispensing" still exist, and current technology lacks efficient and automated verification methods.

[0003] Existing image recognition-based verification schemes often employ a single model for identifying all medicinal herbs after dispensing. This approach struggles to balance broad coverage with high accuracy requirements for easily confused herbs and cannot effectively address mismatch detection during dispensing. For example, the Chinese invention patent document (CN202110503467.8) discloses a method and system for identifying medicinal herbs based on deep residual networks. This invention identifies medicinal herbs through a classification network and combines a channel attention mechanism with a deep residual network. The introduction of the attention mechanism can capture subtle differences in similar herbs, improving accuracy and reducing labor and time costs. However, this scheme still relies on a single model and cannot effectively address the identification confusion caused by highly similar shapes, colors, or textures of certain herbs, leading to a continued risk of mismatch.

[0004] Therefore, we need a method for verifying the dispensing of single-herb Chinese medicinal materials, especially to improve the accuracy of identifying easily confused Chinese medicinal materials. Summary of the Invention

[0005] The purpose of this invention is to provide a method for verifying the dispensing of traditional Chinese medicine (TCM) decoction pieces based on multiple dispensing steps. By setting up a collaborative calling mechanism between a forward model and a reverse model, multiple verifications are completed, including the identification of TCM decoction pieces by the forward model, the reverse identification of target decoction pieces by the reverse target model, and the reverse exclusion of non-target decoction pieces by the reverse non-target model. The verification accuracy is far superior to that of a single model method, reducing the dispensing error rate and ensuring medication safety from a technical perspective. Another objective of this invention is to provide a system for verifying the dispensing of TCM decoction pieces based on multiple dispensing steps.

[0006] To achieve the above objectives, the present invention provides the following technical solution: The present invention provides a method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in multiple stages, comprising the following steps: S1. Obtain prescription information: Obtain the known Chinese medicine prescription information of the Chinese medicine decoction pieces to be dispensed through the prescription information management module, and generate a list of expected Chinese medicine decoction pieces containing all the Chinese medicine decoction pieces to be dispensed based on the prescription information; S2. Pre-built model library: A pre-built sub-model library of several Chinese herbal medicine pieces, where each sub-model corresponds to the baseline image features of a Chinese herbal medicine piece; S3. Construct a verification model: Based on the sub-models covering all Chinese herbal medicine pieces, form a large model as the forward model. Call the individual Chinese herbal medicine piece sub-models corresponding to the expected Chinese herbal medicine pieces in the list, and combine them to form the reverse target model. Combine the other individual Chinese herbal medicine piece sub-models in the pre-built model library (excluding the target model) to form the reverse non-target model. The forward model and the reverse model constitute the model management module. S4. Phased drug dispensing and image acquisition: The dispensing device is controlled to dispense Chinese medicinal herbs into the dispensing area in the order of the expected list of Chinese medicinal herbs or in any order. After the dispensing is completed, the image acquisition module acquires the image and preprocesses the image. S5. Pill Recognition and Comparison: The recognition and arbitration module uses a positive model to recognize and compare the image information of the current dispensing area. If the newly added Chinese medicine slices in the image are in the expected list of Chinese medicine slices and this is the first time this has happened, it is judged as "recognition successful". S6. Verification of anomalies: After the Chinese herbal medicine pieces are dispensed, check the expected list of Chinese herbal medicine pieces. If the number of "successfully identified" items in the list matches the number of Chinese herbal medicine pieces in the expected list, the dispensing is considered successful; otherwise, proceed to the manual anomaly handling process.

[0007] As a further improvement of the present invention, the traditional Chinese medicine prescription information mentioned in step S1 is the current patient's electronic prescription received from the hospital information system or the decoction center management system.

[0008] As a further improvement of the present invention, the sub-model library of Chinese herbal medicine slices mentioned in step S2 is a collection of single sub-models trained for a variety of single Chinese herbal medicine slices. The sub-models are trained using one or more of the following: a target detection model based on convolutional neural networks and an end-to-end target detection model based on Transformer. The training dataset contains hundreds of thousands of images of Chinese herbal medicine slices collected in real dispensing scenarios.

[0009] As a further improvement of the present invention, after the medicine dispensing process described in step S4 is completed, a signal is triggered to notify the system to collect an image and take an image of the current dispensing and loading area. The image preprocessing includes image cleaning, size normalization, brightness correction and data enhancement to ensure that the signal of "medicine dispensing completed" accurately triggers the shooting and avoids image blurring.

[0010] As a further improvement of the present invention, the image cleaning is to remove noise, stains and background interference from the image, and improve the edge clarity and texture recognizability of the Chinese herbal medicine slices in the target area; the size normalization is to uniformly scale the image to a standard input size of 640×640 to ensure the consistency of the model input; the brightness correction is to adjust the overall brightness of the image by linear or nonlinear mapping; and the data augmentation includes basic enhancement methods such as random rotation and cropping to enhance the robustness of the model to changes in illumination and pose shift.

[0011] As a further improvement of the present invention, different triggering mechanisms are adopted according to the method of dispensing the medicine. In the scenario of manually dispensing Chinese herbal medicine slices, the system prompts the operator through a dialog box. The image capture command can only be triggered after the operator confirms that the dispensing operation of the herbal medicine slice has been completed, thereby ensuring the stability and controllability of the image acquisition timing. In the scenario of automatic dispensing of medicine, a preset trigger delay time is set based on the structural height of the dispensing cabinet and the free fall time of the herbal medicine slices. After the automatic dispensing mechanism sends a signal that the dispensing is completed, the system automatically performs image acquisition after a delay of several milliseconds to several seconds, to ensure that the herbal medicine slices are completely stable and the image has no obvious motion blur, thereby improving the accuracy of recognition.

[0012] As a further improvement of the present invention, step S5 includes the following steps: S51. If the newly identified Chinese herbal medicine slices information exists in the expected Chinese herbal medicine slices list and appears for the first time, mark "identification successful" and continue to compare the information of the second dispensing and filling area image; if the identified Chinese herbal medicine slices information exists in the expected Chinese herbal medicine slices list but does not appear for the first time, display the corresponding slice name and immediately trigger the "over-dispensing" alarm, manually review and readjust; S52. If the identified new Chinese herbal medicine slices information does not exist in the expected Chinese herbal medicine slices list, the scene image information in the currently captured dispensing area is identified and compared using the inverse non-target model, and manual confirmation is prompted. S53. If the forward model does not recognize the newly added Chinese herbal medicine slices, the reverse target model is called first for verification. If it still does not recognize them, the reverse non-target model is called for verification. Step S53 verification steps include: S531. If the reverse target model is successfully identified and appears for the first time, it is marked as "identification successful"; S532. If the reverse target model is successfully identified but not for the first time, an "over-allocation" alarm will be triggered immediately, and manual review and readjustment will be required; S533. If the reverse non-target model is successfully identified, mark it as a "mismatch" alarm, manually review and readjust; S534. If the reverse non-target model recognition fails, mark it as "unrecognized" and immediately trigger the "recognition failure" alarm for manual review.

[0013] As a further improvement of the present invention, step S52 includes the following steps: S521. If the identified Chinese herbal medicine slices information does not exist in the inverse non-target model set, the inverse target model is called for secondary verification; if the inverse target model identifies it, it is a conflict between the forward model and the inverse target model, so it is marked as "identification conflict" and an alarm is triggered, and the case is transferred to manual review; if the inverse target model also does not identify it, it is marked as "identification error" and an alarm is triggered, and the case is transferred to manual review. S522. If the identified Chinese herbal medicine slices information exists in the inverse non-target model set, mark it as a "mismatch" alarm, manually review and readjust the prescription.

[0014] As a further improvement of the present invention, after the "successful recognition" in step S51, the current image of the Chinese herbal medicine slices is updated as the benchmark for the next comparison; the initial benchmark image and the initial recognition result, as well as the updated benchmark image and recognition result set, are all stored in the cache to ensure the next fast comparison. The "next fast comparison" process only compares with the "previous benchmark image". The recognition result set is used for rule judgment and traceability. The system saves the image, recognition result and final review conclusion corresponding to each dispensing of medicine to form a traceable electronic dispensing record.

[0015] As a further improvement of the present invention, the verification model in step S3 also includes a confusion model specifically trained for easily confused Chinese herbal medicine pieces, and the confusion model includes several easily confused sub-models; the steps for constructing the confusion model are as follows: S31. Construct a set of easily confused medicinal herbs, which includes several easily confused subsets; the easily confused subsets consist of a single Chinese medicinal herb and its corresponding easily confused Chinese medicinal herb. S32. When a newly added Chinese herbal medicine piece is identified in the set of easily confused herbal medicine pieces, the easily confused sub-model for that easily confused herbal medicine piece is called for secondary identification, and the result of the secondary identification is used as the final verification result.

[0016] As a further improvement of the present invention, the set of easily confused medicinal slices mentioned in step S31 is determined by the following steps: S311: Construct a basic sample set and collect image samples of single Chinese herbal medicine pieces and their corresponding easily confused Chinese herbal medicine pieces in real dispensing scenarios. S312: Manual prior screening, where personnel with experience in identifying Chinese herbal medicine pieces manually compare the samples and mark the appearance factors that are easily misjudged by the naked eye as candidate easily confused features. This step provides directional constraints for subsequent algorithm analysis and is not used as a separate criterion for judgment. S313: Initial training of the basic model: The traditional Chinese medicine decoction piece recognition model is used to train the samples, and the initial recognition test is carried out without special differentiation training. S314: Statistical analysis of misidentified samples, statistical analysis of the probability matrix of misidentification among different Chinese herbal medicine pieces; when the probability of a certain Chinese herbal medicine piece being misidentified as another Chinese herbal medicine piece exceeds a preset threshold, it is determined that the two constitute an easily confused relationship; S315: Feature response analysis, for misidentified samples, analyze the regions and features that the model focuses on, and analyze the contribution of different feature channels to the classification results; S316: Confusing point attribution. When the model's responses to a feature dimension are highly overlapping in misclassified samples, that feature dimension is identified as a confusing point.

[0017] As a further improvement of the present invention, the set of easily confused medicinal materials is pre-entered manually based on the visual similarity of the medicinal materials, and the easily confused sub-model is specifically trained to target the easily confused points of the medicinal materials in the set of easily confused medicinal materials. The easily confused medicinal materials are shown in the table below: .

[0018] A system for verifying the dispensing of traditional Chinese medicine (TCM) decoction pieces based on dispensing in stages is disclosed. This system utilizes the aforementioned method for verifying the dispensing of TCM decoction pieces based on dispensing in stages. The system includes an image acquisition module, a prescription information management module, a model management module, a recognition and arbitration module, a flow control module, and a computer-readable storage medium. The image acquisition module acquires images of the dispensing area before and after each dispensing. The prescription information management module receives and parses prescription information, generates and manages a list of expected TCM decoction pieces. The model management module stores the model library and dynamically calls models based on the expected TCM decoction piece list to form a target model set and a non-target model set. The recognition and arbitration module performs image recognition comparison and outputs recognition results and alarm decisions based on predefined logic. The flow control module controls the dispensing trigger, image acquisition sequence, and the progress of the verification process.

[0019] Compared to existing technologies, the advantages of this invention are as follows: By setting up a collaborative calling mechanism between the forward and reverse models, multiple verifications are achieved, including the forward model's identification of Chinese herbal medicine pieces, the reverse target model's reverse identification of target pieces, and the reverse non-target model's reverse exclusion of non-target pieces. This reduces the dispensing error rate and technically ensures medication safety. By setting the reverse target model and the reverse non-target model as independent arbitration dimensions to complete secondary verification of the forward model, misjudgments are reduced, indiscriminate manual intervention is avoided, and the accuracy of verification and operational efficiency are balanced. Meanwhile, the reverse target model... Both the model and the inverse non-target model are single-herb Chinese medicine decoction piece sub-models, which have low computational power consumption and high recognition accuracy. By strictly coupling the process of dispensing medicine in stages with image recognition verification and by preprocessing the images, the acquired images are ensured to be clear, avoiding recognition failures caused by reflection, occlusion or motion blur, and improving the accuracy of the recognition process of the subsequent model management module. By setting up an easily confused model specifically trained for easily confused Chinese medicine decoction pieces, the ability to distinguish easily confused decoction piece pairs is significantly improved based on the confusion point features, effectively solving the problem of misidentification of easily confused decoction pieces in actual dispensing scenarios. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the process of Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the drug application in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the drug application and dispensing process in Embodiment 3 of the present invention. Detailed Implementation

[0021] Specific Implementation Example 1: Please refer to Figure 1 A method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in multiple stages includes the following steps: S1. Obtain Prescription Information: Obtain the known Chinese medicine prescription information of the Chinese medicine decoction pieces to be dispensed through the prescription information management module, and generate a list of expected Chinese medicine decoction pieces containing all the Chinese medicine decoction pieces to be dispensed based on the prescription information.

[0022] Specifically, the traditional Chinese medicine prescription information mentioned in step S1 is the current patient's electronic prescription received from the hospital information system or the decoction center management system.

[0023] S2. Pre-built model library: Pre-built sub-model libraries of several Chinese herbal medicine slices, where each sub-model corresponds to the baseline image features of a Chinese herbal medicine slice.

[0024] Specifically, the sub-model library of Chinese herbal medicine slices mentioned in step S2 is a collection of single sub-models trained on all Chinese herbal medicine slices used in the decoction center. The sub-models are trained using one or more of the following: a target detection model based on convolutional neural networks and an end-to-end target detection model based on Transformer. The training dataset contains tens of thousands of images of Chinese herbal medicine slices collected in real dispensing scenarios.

[0025] S3. Construct a verification model: Based on the sub-models covering all Chinese herbal medicine pieces, form a large model as the forward model. Call the individual Chinese herbal medicine piece sub-models corresponding to the expected Chinese herbal medicine pieces in the list, and combine them to form the reverse target model. Combine the other individual Chinese herbal medicine piece sub-models in the pre-built model library other than the target model to form the reverse non-target model. The forward model and the reverse model constitute the model management module.

[0026] S4. Phased drug dispensing and image acquisition: The dispensing device is controlled to dispense the Chinese herbal medicine slices into the dispensing area in the expected order or any order. After the dispensing is completed, the image acquisition module acquires the image and performs image preprocessing.

[0027] Specifically, after the medicine dispensing process described in step S4 is completed, a signal is triggered to notify the system to collect an image and take a picture of the current dispensing and loading area. Image preprocessing includes image cleaning, size normalization, brightness correction and data enhancement to ensure that the signal "one herb dispensing completed" accurately triggers the shooting and avoids image blurring.

[0028] Specifically, image cleaning removes noise, dirt, and background interference from the image, improving the edge clarity and texture recognizability of the Chinese herbal medicine slices in the target area; size normalization scales the image to a standard input size of 640×640 to ensure model input consistency; brightness correction adjusts the overall brightness of the image using linear or nonlinear mapping; and data augmentation includes basic enhancement techniques such as random rotation and cropping to enhance the model's robustness to changes in illumination and pose shifts.

[0029] Specifically, different triggering mechanisms are used depending on the method of dispensing the medicine. For scenarios where traditional Chinese medicine is manually dispensed, the system prompts the operator through a dialog box. The image capture command can only be triggered after the operator confirms that the dispensing operation has been completed, thus ensuring the stability and controllability of the image acquisition timing. For scenarios where medicine is automatically dispensed, a preset trigger delay time is set based on the structural height of the dispensing cabinet and the free fall time of the medicine pieces. For example, after the automatic dispensing mechanism sends a signal that the dispensing is complete, the system automatically performs image acquisition after a delay of 500ms to ensure that the medicine pieces are completely stable and the image has no obvious motion blur, thereby improving the accuracy of recognition.

[0030] S5. Pill Recognition and Comparison: The recognition and arbitration module uses a positive model to recognize and compare the image information of the current dispensing area. If the newly added Chinese herbal medicine pieces in the image are in the expected list of Chinese herbal medicine pieces and this is the first time this has happened, it is judged as "recognition successful".

[0031] Specifically, step S5 includes the following steps: S51. If the newly identified Chinese herbal medicine slices information exists in the expected Chinese herbal medicine slices list and appears for the first time, mark "identification successful" and continue to compare the information of the second dispensing and filling area image; if the identified Chinese herbal medicine slices information exists in the expected Chinese herbal medicine slices list but does not appear for the first time, display the corresponding slice name and immediately trigger the "over-dispensing" alarm, manually review and readjust; S52. If the identified new Chinese herbal medicine slices information does not exist in the expected Chinese herbal medicine slices list, the scene image information in the currently captured dispensing area is identified and compared using the inverse non-target model, and manual confirmation is prompted. S53. If the forward model does not recognize the newly added Chinese herbal medicine slices, the reverse target model is called first for verification. If it still does not recognize them, the reverse non-target model is called for verification.

[0032] Specifically, step S53, the verification step, includes: S531. If the reverse target model is successfully identified and appears for the first time, it is marked as "identification successful"; S532. If the reverse target model is successfully identified but not for the first time, an "over-allocation" alarm will be triggered immediately, and manual review and readjustment will be required; S533. If the reverse non-target model is successfully identified, mark it as a "mismatch" alarm, manually review and readjust; S534. If the reverse non-target model recognition fails, mark it as "unrecognized" and immediately trigger the "recognition failure" alarm for manual review.

[0033] Specifically, step S52 includes the following steps: S521. If the identified Chinese herbal medicine slices information does not exist in the inverse non-target model set, the inverse target model is called for secondary verification; if the inverse target model identifies it, it is a conflict between the forward model and the inverse target model, so it is marked as "identification conflict" and an alarm is triggered, and the case is transferred to manual review; if the inverse target model also does not identify it, it is marked as "identification error" and an alarm is triggered, and the case is transferred to manual review. S522. If the identified Chinese herbal medicine slices information exists in the inverse non-target model set, mark it as a "mismatch" alarm, manually review and readjust the prescription.

[0034] Specifically, after "successful recognition" in step S51, the current image of the Chinese herbal medicine slices is updated as the benchmark for the next comparison; the initial benchmark image and initial recognition result, as well as the updated benchmark image and recognition result set, are all stored in the cache to ensure the next fast comparison. The "next fast comparison" process only compares with the "previous benchmark image". The recognition result set is used for rule judgment and traceability; the system saves the image, recognition result and final review conclusion corresponding to each dispensing of medicine, forming a traceable electronic dispensing record.

[0035] S6. Verification of anomalies: After the Chinese herbal medicine pieces are dispensed, check the expected list of Chinese herbal medicine pieces. If the number of "successfully identified" items in the list matches the number of Chinese herbal medicine pieces in the expected list, the dispensing is considered successful; otherwise, proceed to the manual anomaly handling process.

[0036] Specifically, the verification model in step S3 also includes a confusion model specifically trained for easily confused Chinese herbal medicine pieces. The confusion model contains several easily confused sub-models; the steps for constructing the confusion model are as follows: S31. Construct a set of easily confused medicinal herbs, which includes several easily confused subsets; the easily confused subsets consist of a single Chinese medicinal herb and its corresponding easily confused Chinese medicinal herb. S32. When a newly added Chinese herbal medicine piece is identified in the set of easily confused herbal medicine pieces, the easily confused sub-model for that easily confused herbal medicine piece is called for secondary identification, and the result of the secondary identification is used as the final verification result.

[0037] Specifically, the set of easily confused medicinal slices mentioned in step S31 is determined through the following steps: S311: Construct a basic sample set, collect image samples of single Chinese herbal medicine pieces and their corresponding easily confused Chinese herbal medicine pieces in real dispensing scenarios, such as covering samples from different batches, different origins, different processing methods and different lighting conditions. S312: Manual prior screening, where personnel with experience in identifying Chinese herbal medicine pieces manually compare the samples and mark the appearance factors that are easily misjudged by the naked eye as candidate easily confused features. This step provides directional constraints for subsequent algorithm analysis and is not used as a separate criterion for judgment. S313: Initial training of the basic model: The traditional Chinese medicine decoction piece recognition model is used to train the samples, and the initial recognition test is carried out without special differentiation training. S314: Statistical analysis of misidentified samples, statistical analysis of the probability matrix of misidentification among different Chinese herbal medicines; when the probability of a certain Chinese herbal medicine being misidentified as another Chinese herbal medicine exceeds a preset threshold such as 10%, it is determined that the two constitute an easily confused relationship; S315: Feature response analysis. For misidentified samples, one or more methods, such as feature map visualization or attention heatmap, are used to analyze the model’s focus areas and features, and to analyze the contribution of different feature channels to the classification results. S316: Confusing Point Attribution. When the model's responses to the following feature dimensions are highly overlapping in misclassified samples, that feature dimension is identified as a confusing point: such as color distribution similarity, texture feature similarity, shape proportion, or contour feature difference.

[0038] Specifically, the set of easily confused medicinal herbs is pre-entered manually based on the visual similarity of the herbs. The easily confused sub-model is specifically trained to identify the points of confusion for the herbs in the set of easily confused medicinal herbs. The easily confused medicinal herbs are shown in the table below: .

[0039] Example 2: The system receives electronic prescriptions from the Hospital Information System (HIS) through the prescription information management module, and after parsing, generates a list of expected Chinese herbal medicines containing 7 kinds of herbs: stir-fried Atractylodes macrocephala, vinegar-processed Corydalis yanhusuo, Paeonia lactiflora, hawthorn, mistletoe, reed rhizome, and Atractylodes macrocephala. Before starting to add the herbs, the system controls an industrial camera to capture an image of the air conditioning agent area as an initial reference image. At the same time, assuming that the decoction center has pre-built a model library of 128 commonly used herbs, the model management module dynamically calls the corresponding 7 single-herb herbal medicine sub-models from the expected list of Chinese herbal medicines to form a reverse target model set. All other herbal medicine sub-models in the model library, which are also 121 non-target models, constitute the reverse non-target model set. In the first dispensing, the automatic dispensing mechanism places the stir-fried Atractylodes macrocephala into the dispensing container. After a preset delay of 500ms, the system acquires an image of the current dispensing area and performs data enhancement processing such as size normalization (640×640), brightness correction, and random rotation on the image. The "stir-fried Atractylodes macrocephala" sub-model in the forward model successfully identifies the newly added medicinal slice, which is appearing for the first time. The system displays "Identification successful" and updates the current image to the reference image for the next comparison to obtain the expected list of Chinese herbal medicine slices based on the Chinese medicine prescription information. During the second dispensing, the automatic dispensing mechanism drops the vinegar-treated Corydalis rhizome into the dispensing container. The system performs image preprocessing similar to the first dispensing process. Figure 2 The "vinegar-processed Corydalis" sub-model in the positive model shown successfully identified the newly added medicinal slice, which appeared for the first time; "Identification successful" was displayed, and the baseline image was updated; In the third dispensing, the automatic dispensing mechanism places the red peony root into the dispensing box. The system performs image preprocessing similar to the first dispensing process. The "red peony root" sub-model in the positive model successfully identifies the newly added medicinal slice, which is appearing for the first time. The easily confused model system detects that red peony root is easily confused with white peony root, so it calls the easily confused sub-model to perform a second identification of red peony root and white peony root. "Identification successful" is displayed, and the baseline image is updated. In the fourth dispensing, the automatic dispensing mechanism dispenses the "cleaned hawthorn" into the dispensing box. The system preprocesses the image as it did in the first dispensing process. The "cleaned hawthorn" sub-model in the positive model successfully identifies the newly added medicinal slice, which is the first time it has appeared, and displays "identification successful", updating the baseline image. During the fifth application of the herb, the automatic herb-dispensing mechanism dispenses the mistletoe into the dispensing box. The system performs image preprocessing similar to the first application process. The "mistletoe" sub-model in the forward model successfully identifies the newly added herb slice, which is appearing for the first time, and displays "identification successful," updating the baseline image. In the sixth dispensing, the automatic dispensing mechanism drops the reed root into the dispensing box. The system preprocesses the image as in the first dispensing process. The "reed root" sub-model in the positive model successfully identifies the newly added medicinal slice, which is the first time it has appeared, and displays "identification successful", updating the baseline image. In the seventh dispensing, the automatic dispensing mechanism dispenses Atractylodes macrocephala into the dispensing box. The system preprocesses the image as it did in the first dispensing process. The "Atractylodes macrocephala" sub-model in the forward model recognizes the newly added medicinal slice, which is appearing for the first time, and displays "Recognition successful", updating the baseline image. Example 3: The system receives electronic prescriptions from the Hospital Information System (HIS) through the prescription information management module, and after parsing, generates a list of expected Chinese herbal medicines containing 8 kinds of herbs: stir-fried Sichuan pepper, Angelica pubescens, wild chrysanthemum, Astragalus membranaceus, Polygonum multiflorum vine, stir-fried Atractylodes macrocephala, tangerine peel, and Poria cocos. Before starting to add the herbs, the system controls an industrial camera to capture an image of the air conditioning agent area as an initial reference image. At the same time, assuming that the decoction center has pre-built a model library of 128 commonly used herbs, the model management module dynamically calls the corresponding 8 single-herb herbal medicine sub-models from the pre-built model library according to the expected list of Chinese herbal medicines, forming a reverse target model set. All other herbal medicine sub-models in the model library, which are also 120 non-target models, constitute the reverse non-target model set. In the first dispensing, the automatic dispensing mechanism drops the roasted Sichuan pepper seeds into the dispensing frame. After a preset delay of 500ms, the system acquires an image of the current dispensing area and performs data enhancement processing such as size normalization (640×640), brightness correction, and random rotation. Figure 3 The "Stir-fried Sichuan Chinaberry" sub-model in the positive model shown successfully identified the newly added medicinal slice, which appeared for the first time, and displayed "Identification successful". The current image is then updated to the reference image for the next comparison. During the second dispensing, the automatic dispensing mechanism dispenses Angelica pubescens into the dispensing box. The system performs image preprocessing similar to the first dispensing process. The "Angelica pubescens" sub-model in the forward model successfully identifies the newly added medicinal slice, which is appearing for the first time, and displays "Identification successful," updating the baseline image. During the third application of the herb, the automatic herb-dispensing mechanism dispenses wild chrysanthemums into the dispensing box. The system performs image preprocessing similar to the first application process. The "wild chrysanthemum" sub-model in the forward model successfully identifies the newly added herb slice, which is appearing for the first time, and displays "identification successful," updating the baseline image. In the fourth dispensing, the automatic dispensing mechanism dispenses Astragalus membranaceus into the dispensing box. The system performs image preprocessing similar to the first dispensing process. The "Astragalus membranaceus" sub-model in the positive model successfully identifies the newly added medicinal slice, which is appearing for the first time, and displays "Recognition Successful", updating the baseline image. During the fifth application of the herb, the automatic herb-dispensing mechanism dispenses the Polygonum multiflorum vine into the dispensing box. The system performs image preprocessing similar to the first application process. The "Polygonum multiflorum vine" sub-model in the forward model successfully identifies the newly added herb slice, which is appearing for the first time, and displays "Identification successful," updating the baseline image. In the sixth dispensing, the automatic dispensing mechanism dispenses the stir-fried Atractylodes macrocephala into the dispensing box. The system preprocesses the image as it did in the first dispensing process. The "stir-fried Atractylodes macrocephala" sub-model in the forward model did not identify the new medicinal slice. The reverse model was used to identify the medicinal slice. The identification was successful and a "mismatch" alarm was displayed. After manual review, the medicine was re-dispensed. In the seventh dispensing, the automatic dispensing mechanism drops the dried tangerine peel into the dispensing box. The system preprocesses the image as in the first dispensing process. The "dried tangerine peel" sub-model in the positive model successfully identifies the newly added medicinal piece, which is appearing for the first time, and displays "identification successful", updating the baseline image.

[0040] In the eighth dispensing, the automatic dispensing mechanism dispenses Poria cocos into the dispensing box. The system preprocesses the image as it did in the first dispensing process. The "Poria cocos" sub-model in the positive model successfully identifies the newly added medicinal slice, which is the first time it has appeared, and displays "identification successful", updating the baseline image.

[0041] Comparative Example 1: The expected list of Chinese herbal medicine pieces is the same as that in Example 2: stir-fried Atractylodes macrocephala, vinegar-processed Corydalis yanhusuo, Paeonia lactiflora, hawthorn, mistletoe, reed rhizome, and Atractylodes macrocephala; it is assumed that the decoction center has pre-built a model library of 128 commonly used herbal medicine pieces, and the model management module dynamically calls the corresponding 7 single herb sub-models from the pre-built model library to directly identify them according to the expected list of Chinese herbal medicine pieces; During the first dispensing, the automatic dispensing mechanism placed the bran-fried Atractylodes macrocephala into the dispensing container. The single-herb "bran-fried Atractylodes macrocephala" sub-model successfully identified the newly added medicinal slice and displayed "Identification successful". During the second dispensing, the automatic dispensing mechanism dropped the vinegar-processed Corydalis into the dispensing box. The single-herb "vinegar-processed Corydalis" sub-model successfully identified the newly added medicinal slice and displayed "Identification successful". During the third dispensing, the automatic dispensing mechanism dispensed red peony into the dispensing box. However, when the single-herb "red peony" sub-model was identified, it failed to accurately extract the cross-sectional features of red peony and mistakenly added white peony. The fourth time the medicine was dispensed, the automatic dispensing mechanism dropped the cleaned hawthorn into the dispensing box. The single-herb "cleaned hawthorn" sub-model successfully identified the new medicinal slice and displayed "identification successful". On the fifth dispensing, the automatic dispensing mechanism placed the mistletoe into the dispensing box. The single-herb "mistletoe" sub-model successfully identified the newly added medicinal slice and displayed "Identification successful". During the sixth dispensing, the automatic dispensing mechanism dropped the reed root into the dispensing box. The single-herb "reed root" sub-model successfully identified the newly added medicinal slice and displayed "Identification successful". On the seventh dispensing, the automatic dispensing mechanism placed Atractylodes macrocephala into the dispensing box. The single-herb "Atractylodes macrocephala" sub-model successfully identified the newly added medicinal slice and displayed "Identification successful". Throughout the entire process of dispensing the medicine, due to the lack of dynamic baseline image updates and interference filtering from the inverse non-target model set, recognition delays or feature confusion occurred. Ultimately, after all the medicinal slices were dispensed, a mismatch of medicinal slices occurred, resulting in white peony being mixed into the actual Chinese medicinal slices, which did not match the expected list of Chinese medicinal slices. This required manual rework, which reduced dispensing efficiency and posed a potential safety hazard.

[0042] Example 4: A Traditional Chinese Medicine (TCM) decoction piece dispensing and verification system based on multiple dispensing steps, utilizing the aforementioned TCM decoction piece dispensing and verification method based on multiple dispensing steps. The system includes an image acquisition module, a prescription information management module, a model management module, a recognition and arbitration module, a flow control module, and a computer-readable storage medium. The image acquisition module acquires images of the dispensing area before and after each dispensing step. The prescription information management module receives and parses prescription information, generates and manages a list of expected TCM decoction pieces. The model management module stores the model library and dynamically calls models based on the expected TCM decoction piece list to form the target model set and the non-target model set. The recognition and arbitration module performs image recognition comparison and outputs recognition results and alarm decisions based on predefined logic. The flow control module controls the dispensing trigger, image acquisition sequence, and the progress of the verification process.

[0043] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, characterized in that: Includes the following steps: S1. Obtain prescription information: Obtain the known Chinese medicine prescription information of the Chinese medicine decoction pieces to be dispensed through the prescription information management module, and generate a list of expected Chinese medicine decoction pieces containing all the Chinese medicine decoction pieces to be dispensed based on the prescription information; S2. Pre-built model library: A pre-built sub-model library of several Chinese herbal medicine pieces, where each sub-model corresponds to the baseline image features of a Chinese herbal medicine piece; S3. Construct a verification model: Based on the sub-models covering all Chinese herbal medicine pieces, form a large model as the forward model. Call the individual Chinese herbal medicine piece sub-models corresponding to the expected Chinese herbal medicine pieces in the list, and combine them to form the reverse target model. Combine the other individual Chinese herbal medicine piece sub-models in the pre-built model library (excluding the target model) to form the reverse non-target model. The forward model and the reverse model constitute the model management module. S4. Phased drug dispensing and image acquisition: The dispensing device is controlled to dispense Chinese medicinal herbs into the dispensing area in the order of the expected list of Chinese medicinal herbs or in any order. After the dispensing is completed, the image acquisition module acquires the image and preprocesses the image. S5. Pill Recognition and Comparison: The recognition and arbitration module uses a positive model to recognize and compare the image information of the current dispensing area. If the newly added Chinese medicine slices in the image are in the expected Chinese medicine slices list and this is the first time this has happened, it is judged as "recognition successful". S6. Verification of anomalies: After the Chinese herbal medicine pieces are dispensed, check the expected list of Chinese herbal medicine pieces. If the number of "successfully identified" items in the list matches the number of Chinese herbal medicine pieces in the expected list, the dispensing is considered successful; otherwise, proceed to the manual anomaly handling process.

2. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 1, is characterized in that: The traditional Chinese medicine prescription information mentioned in step S1 is the current patient's electronic prescription received from the hospital information system or the decoction center management system.

3. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 1, is characterized in that: The sub-model library of Chinese herbal medicine slices mentioned in step S2 is a collection of single sub-models trained for various single Chinese herbal medicine slices. The sub-models are trained using one or more of the following: a target detection model based on convolutional neural networks and an end-to-end target detection model based on Transformer. The training dataset consists of images of Chinese herbal medicine slices collected in real dispensing scenarios.

4. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 1, is characterized in that: Step S4 describes the process of adding the drug. Once the drug is added, a signal is triggered to notify the system to acquire an image and capture an image of the current drug loading area. Image preprocessing includes image cleaning, size normalization, brightness correction, and data enhancement.

5. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 1, is characterized in that: Step S5 includes the following steps: S51. If the newly identified Chinese herbal medicine slices information exists in the expected Chinese herbal medicine slices list and appears for the first time, mark "identification successful" and continue to compare the information of the second dispensing and filling area image; if the identified Chinese herbal medicine slices information exists in the expected Chinese herbal medicine slices list but does not appear for the first time, display the corresponding slice name and immediately trigger the "over-dispensing" alarm, manually review and readjust; S52. If the identified new Chinese herbal medicine slices information does not exist in the expected Chinese herbal medicine slices list, the scene image information in the currently captured dispensing area is identified and compared using the inverse non-target model, and manual confirmation is prompted. S53. If the forward model does not recognize the newly added Chinese herbal medicine slices, the reverse target model is called first for verification. If it still does not recognize them, the reverse non-target model is called for verification. Step S53 verification steps include: S531. If the reverse target model is successfully identified and appears for the first time, mark it as "identification successful"; S532. If the reverse target model is successfully identified but not for the first time, an "over-allocation" alarm will be triggered immediately, and manual review and readjustment will be required; S533. If the reverse non-target model is successfully identified, mark it as a "mismatch" alarm, manually review and readjust; S534. If the reverse non-target model recognition fails, mark it as "unrecognized" and immediately trigger the "recognition failure" alarm for manual review.

6. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 5, is characterized in that: Step S52 includes the following steps: S521. If the identified Chinese herbal medicine slices information does not exist in the inverse non-target model set, the inverse target model is called for secondary verification; if the inverse target model identifies it, it is a conflict between the forward model and the inverse target model, so it is marked as "identification conflict" and an alarm is triggered, and the case is transferred to manual review; if the inverse target model also does not identify it, it is marked as "identification error" and an alarm is triggered, and the case is transferred to manual review. S522. If the identified Chinese herbal medicine slices information exists in the inverse non-target model set, mark it as a "mismatch" alarm, manually review and readjust the prescription.

7. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 5, is characterized in that: After "successful recognition" in step S51, the current image of Chinese herbal medicine slices is updated as the benchmark for the next comparison; the initial benchmark image and initial recognition result, as well as the updated benchmark image and recognition result set, are all stored in the cache to ensure rapid comparison next time; the system saves the image, recognition result and final review conclusion corresponding to each dispensing of medicine to form a traceable electronic dispensing record.

8. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 1, is characterized in that: Step S3, the verification model, also includes a confusion model specifically trained for easily confused Chinese herbal medicine pieces. This confusion model contains several easily confused sub-models. The steps for constructing the confusion model are as follows: S31. Construct a set of easily confused medicinal herbs, which includes several easily confused subsets; the easily confused subsets consist of a single Chinese medicinal herb and its corresponding easily confused Chinese medicinal herb. S32. When a newly added Chinese herbal medicine piece is identified in the set of easily confused herbal medicine pieces, the easily confused sub-model for that easily confused herbal medicine piece is called for secondary identification, and the result of the secondary identification is used as the final verification result.

9. The method for verifying the dispensing of traditional Chinese medicine decoction pieces based on dispensing in stages, as described in claim 8, is characterized in that: The set of easily confused medicinal slices mentioned in step S31 is determined through the following steps: S311: Construct a basic sample set and collect image samples of single Chinese herbal medicine pieces and their corresponding easily confused Chinese herbal medicine pieces in real dispensing scenarios. S312: Manual prior screening, where personnel with experience in identifying Chinese herbal medicine slices manually compare the samples and mark the appearance factors that are easily misjudged by the naked eye as candidate easily confused features, which are used to provide directional constraints for subsequent algorithm analysis; S313: Initial training of the basic model: The traditional Chinese medicine decoction piece recognition model is used to train the samples, and the initial recognition test is carried out without special differentiation training. S314: Statistical analysis of misidentified samples, statistical analysis of the probability matrix of misidentification among different Chinese herbal medicine pieces; If the probability of a certain Chinese herbal medicine being misidentified as another Chinese herbal medicine exceeds a preset threshold, then the two are determined to be easily confused. S315: Feature response analysis, for misidentified samples, analyze the region and features that the model focuses on, and analyze the contribution of different feature channels to the classification results; S316: Confusing point attribution. When the model's responses to a feature dimension are highly overlapping in misclassified samples, that feature dimension is identified as a confusing point.

10. A system for verifying the dispensing of traditional Chinese medicine decoction pieces based on the principle of dispensing in multiple applications as described in any one of claims 1-9, characterized in that: The system includes an image acquisition module, a prescription information management module, a model management module, a recognition and arbitration module, a process control module, and a computer-readable storage medium; The image acquisition module is used to acquire images of the dispensing area before and after each dose of medicine; The prescription information management module is used to receive and parse prescription information, generate and manage the expected list of Chinese herbal medicine pieces; The model management module is used to store the model library and dynamically call models according to the expected list of Chinese herbal medicine pieces to form the target model set and the non-target model set; The identification and arbitration module is used to perform image recognition and comparison, and output the identification results and alarm decisions according to predefined logic; The process control module is used to control the triggering of drug application, the image acquisition sequence, and the progress of the review process.

Citation Information

Patent Citations

  • Chinese herbal medicine slice recognition method and system based on deep residual network

    CN113361564B