Traditional Chinese medicine decoction piece dispensing and weighing electronic scale based on machine vision recognition and intelligent recognition method

Through machine vision recognition technology and deep learning algorithms, combined with the improved FasterYOLO algorithm and modules, intelligent and real-time adjustment of Chinese herbal medicines is achieved, solving the technical difficulties of identification and weighing in the adjustment of traditional Chinese herbal medicines, improving efficiency and accuracy, and adapting to the identification and data management of various Chinese herbal medicines.

CN120685182AActive Publication Date: 2025-09-23HUZHOU CENT HOSPITAL

Patent Information

Application Number
CN202510680556.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-09-23
Estimated Expiration
2045-05-26

AI Technical Summary

Technical Problem

The preparation of traditional Chinese medicines relies on manual experience, with a high misjudgment rate and low efficiency. Ordinary electronic scales cannot measure weight in real time, and there is a shortage of highly qualified Chinese medicine pharmacists, resulting in low efficiency in the preparation of Chinese medicines.

Method used

A machine vision-based electronic scale for dispensing and weighing Chinese herbal medicines is used, combined with multiple precision electronic scales, a high-resolution wide-angle camera, and a deep learning algorithm to achieve automatic recognition and real-time weighing of Chinese herbal medicines. The improved FasterYOLO algorithm and FasterNet module are used to improve computing efficiency, and the CSP-EB module and NWD loss function are introduced to improve recognition accuracy.

Benefits of technology

It realizes intelligent and real-time identification and weighing of Chinese herbal medicines, reduces manual intervention, improves work efficiency, ensures the accuracy and safety of the dispensing process, supports the identification of more than 300 kinds of Chinese herbal medicines, adapts to different lighting conditions and stacking forms, and has data traceability and information management capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120685182A_ABST
    Figure CN120685182A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of traditional Chinese medicine decoction piece dispensing, and discloses a traditional Chinese medicine decoction piece dispensing and weighing electronic scale based on machine vision recognition and an intelligent recognition method. The system comprises an operation table, a precision electronic scale, a high-resolution wide-angle camera and an upper computer, and automatic identification and weighing of the traditional Chinese medicine decoction pieces are achieved through combination of high-precision weighing and machine vision technologies. An improved FasterYOLO algorithm is innovatively adopted, and PConv partial convolution and a CSP-EB feature fusion module are introduced, so that the calculation efficiency is remarkably improved; the NWD loss function is adopted to optimize small target detection, and the recognition accuracy is high. The system can automatically compare prescription information, intelligently warn in case of abnormity, support recognition of more than 300 kinds of decoction pieces, and has the characteristics of high real-time performance, adaptability to different illumination conditions, data traceability and the like. Compared with a traditional manual mode, the dispensing efficiency and accuracy are greatly improved, the labor cost is reduced, and a reliable solution is provided for intelligent management of the traditional Chinese medicine pharmacy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Chinese herbal medicine dispensing, and in particular relates to a Chinese herbal medicine dispensing weighing electronic scale based on machine vision recognition and an intelligent recognition method. Background Art

[0002] During the preparation and dispensing of Chinese herbal medicines, accurate identification and precise weighing are crucial in the preparation and production of Chinese medicines, and are also key quality control points for this process. Traditional identification of Chinese herbal medicines relies primarily on manual experience, which is prone to misjudgment and inefficient. Conventional electronic scales can only perform single-threaded weight measurements after each dispensing is completed, and are unable to perform real-time weight measurement during the dispensing process. The review of Chinese herbal medicines requires highly qualified Chinese medicine pharmacists for accurate identification. However, the labor costs of senior technical personnel are high and in short supply. The development of machine vision technology and deep learning algorithms has provided intelligent solutions for the review of Chinese herbal medicines. Summary of the Invention

[0003] The purpose of the present invention is to provide an electronic scale for dispensing and weighing Chinese herbal medicine slices based on machine vision recognition and an intelligent recognition method to solve the above-mentioned technical problems.

[0004] To solve the above technical problems, the specific technical solutions of the electronic scale for weighing Chinese herbal medicine preparations based on machine vision recognition and the intelligent recognition method of the present invention are as follows:

[0005] A machine vision-based electronic scale for dispensing and weighing Chinese herbal medicine slices comprises an operating table, a precision electronic scale, a high-resolution wide-angle camera, a data acquisition circuit, and a host computer. Multiple precision electronic scales are embedded on the surface of the operating table for placing and weighing Chinese herbal medicine slices, and each precision electronic scale has an independent display screen for displaying the weighed weight of the Chinese herbal medicine slices. An artificial intelligence development circuit mainboard is provided in the operating table, and the artificial intelligence development circuit mainboard of the precision electronic scale is connected to the host computer to realize data transmission. The high-resolution wide-angle camera is fixedly mounted on the operating table via a bracket, and is electrically connected to the host computer via the data acquisition circuit to transmit the collected image data to the host computer.

[0006] Furthermore, the precision electronic scale has a built-in high-precision pressure sensor, which has multiple channels and an accuracy of 0.01g; the high-resolution wide-angle camera is equipped with automatic focus and dimming functions; the data acquisition circuit includes an image acquisition card and a data transmission line, which is used to transmit the image data collected by the high-resolution wide-angle camera to the host computer.

[0007] Furthermore, the host computer has a built-in software program, which includes a Chinese medicine HIS prescription receiving module, a medicine piece identification module, a medicine piece weight measurement and statistics module, an information storage module and an instruction operation module. The Chinese medicine HIS prescription receiving module is used to receive Chinese medicine medicine piece prescriptions issued by the hospital HIS system; the medicine piece identification module is used to receive image data transmitted from the data acquisition circuit, and use the medicine piece type recognition algorithm to identify the Chinese medicine medicine pieces in the image and determine their types; the medicine piece weight measurement and statistics module is used to receive and process the weight data transmitted by the precision electronic scale, and determine the weight of the medicine piece. The information storage module is used to store images and weight data of medicinal slices; the instruction operation module compares the detection results of the medicinal slice type identification algorithm with the prescription content of the medicinal slices received by the Chinese medicine HIS prescription acceptance module, and makes corresponding warnings. When the detection result is consistent with the prescription, it is displayed on the host computer to confirm that it has passed; when some Chinese medicinal slices detect multiple similar results, a yellow warning is output to remind manual intervention; when multiple Chinese medicinal slices detect different results, a red warning is output and manual intervention is required.

[0008] The present invention also discloses an intelligent recognition method for an electronic scale for dispensing and weighing Chinese herbal medicine slices based on machine vision recognition, comprising the following steps:

[0009] Step 1: Build the overall network architecture of FasterYOLO;

[0010] Step 2: Improve the FasterYOLO backbone network;

[0011] Step 3: Build the CSP-EB module;

[0012] Step 4: Construct the NWD loss function.

[0013] Furthermore, the step 1 includes the following steps:

[0014] Based on the basic structure of YOLOv11, we build a target detection model - FasterYOLO. FasterYOLO consists of three parts: backbone network Backbone, feature fusion network Neck and detection head Head:

[0015] In the backbone network part, the efficient and lightweight FasterNet architecture is adopted as the basis. The backbone network uses the Merging module and FasterNet Block module contained in FasterNet to extract important features from the input original Chinese medicine decoction slice images layer by layer, and generate feature maps of three different sizes to meet the needs of target detection at different scales. These three feature maps are then passed to the Neck structure for further fusion and processing.

[0016] In the feature fusion network part, the CSP-EB module is designed and introduced. The CSP-EB module combines the CSP structure with the Bottleneck design. Through feature fusion and gradient diversion, while maintaining feature expression capabilities, it improves the network's ability to abstractly express target features in complex scenes through efficient feature map transformation and feature extraction.

[0017] Furthermore, the step 2 includes the following steps:

[0018] The FasterNet neural network architecture is adopted. Partial convolution PConv is introduced to replace the traditional depth-wise separable convolution. PConv only performs convolution operations on a part of the channels of the input feature map. The calculation formula is as follows:

[0019]

[0020] Among them, the input feature map size is C×H×W, where C is the number of channels and H×W is the spatial size. Randomly select consecutive channels, r is the reduction factor, and the rest Channels are directly reserved, only the selected Perform regular convolution on each channel with a kernel size of K×K, and keep the number of output channels the same as the input;

[0021] Optimize the number of floating-point operations per second (FLOPS), and the delay formula is:

[0022]

[0023] It is proposed to use the FasterNet module in the backbone of the YOLO network to replace the original standard convolution module: the FasterYOLO network first gradually reduces the spatial resolution of the original image with an input size of 640×640×3 through downsampling operations to control the feature map size and reduce the amount of computation; then the FasterNet module is used to perform efficient deep feature extraction on the downsampled features to obtain richer semantic information. Through the step-by-step feature extraction and transformation of the backbone network, three feature maps of different scales are finally output, with sizes of 80×80×128, 40×40×256, and 20×20×512, respectively, to meet the needs of target detection at different scales. These multi-scale feature maps are further passed to the neck structure of the network for fusion and feature enhancement.

[0024] Furthermore, the step 3 includes the following steps:

[0025] The CSP-EB module is divided into CSP and EB structures. The CSP structure divides the feature map into two parts. One part is directly convolved to extract rich features, and the other part is skipped and connected to the subsequent stage to reduce computational redundancy and feature redundancy. The EB structure uses a more efficient convolution design to capture more feature information while reducing redundant computation. The specific calculation formula is:

[0026]

[0027] The CSP-EB module is introduced to improve its Neck module. The CSP-EB module combines the CSP structure with the efficient Bottleneck design. Through feature fusion and gradient diversion, it effectively reduces the redundant calculation and parameter redundancy of the network while maintaining the feature expression capability. The CSP-EB module enhances the diversity and robustness of feature expression by rationally dividing and reorganizing feature paths.

[0028] Furthermore, step 4 includes the following steps:

[0029] Based on the following NWD loss function, an N-Loss formula is proposed:

[0030] N-Loss=0.05L obj +0.1L rect +0.15L cls (4)

[0031] Among them L obj , L cls They are confidence loss function and classification loss function, both of which are binary cross loss functions; L rect is the coordinate loss;

[0032] The NWD loss function is calculated as follows:

[0033]

[0034] L rect =1-NWD(N a ,N b ) (7)

[0035] where cx a ,cy a , w a , h a , cx b ,cy b , w b , h b are the center coordinates, width, and height of the predicted and ground truth bounding boxes, and C is the average absolute size of the dataset.

[0036] The electronic scale for weighing Chinese herbal medicine preparations based on machine vision recognition and the intelligent recognition method of the present invention have the following advantages:

[0037] 1. High degree of intelligence:

[0038] Through the combination of multiple precision electronic scales, high-resolution wide-angle cameras and deep learning algorithms, the system can accurately weigh a variety of Chinese herbal medicines at the same time, automatically identify the types of Chinese herbal medicines, reduce manual intervention, improve the level of intelligence, greatly shorten the operation time, and significantly improve work efficiency compared to traditional manual methods.

[0039] The intelligent early warning function (yellow warning and red warning) can detect abnormal situations in a timely manner and ensure the accuracy and safety of the adjustment process.

[0040] 2. Strong adaptability:

[0041] The high-resolution wide-angle camera is equipped with autofocus and dimming functions, which can adapt to different lighting conditions and the stacking form of Chinese herbal medicines, ensuring the clarity and stability of image acquisition.

[0042] The system supports the recognition of a variety of Chinese herbal medicines (more than 300 kinds), has a wide range of applications, and can meet the needs of different scenarios.

[0043] 3. Efficiency and real-time performance:

[0044] The use of the improved FasterYOLO algorithm and FasterNet module significantly improves computing efficiency, enabling the system to run efficiently on low-computing power platforms and achieve real-time detection and feedback.

[0045] 4. Data traceability:

[0046] The information storage module fully records the images and weight data of Chinese herbal medicine pieces, facilitating subsequent quality traceability and management, and meeting the requirements of modern medical quality management.

[0047] The data can be connected to the hospital HIS system to achieve seamless connection between prescription and dispensing data, and improve the level of medical informationization.

[0048] In summary, the present invention not only solves the technical difficulties of identification and weighing in the preparation of traditional Chinese medicine slices, but also provides significant beneficial effects in terms of intelligence, efficiency, data management, etc., and has broad application prospects and market value. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 This is a schematic diagram of the structure of the electronic scale for dispensing and weighing Chinese herbal medicine slices of the present invention;

[0050] Figure 2 Schematic diagram of the system structure of the present invention;

[0051] Figure 3 It is the working logic diagram of the software program of the present invention;

[0052] Figure 4 This is a schematic diagram of the structure of the FasterYOLO intelligent recognition method model of the present invention;

[0053] Figure 5 A schematic diagram of the FasterNet architecture of the intelligent recognition method of the present invention;

[0054] Figure 6 Schematic diagram of the CSP module structure of the intelligent identification method of the present invention;

[0055] Description of the markings in the figure: 1. Operating table; 2. Precision electronic scale; 3. High-resolution wide-angle camera. DETAILED DESCRIPTION

[0056] In order to better understand the purpose, structure and function of the present invention, the following is a further detailed description of the electronic scale for weighing and dispensing Chinese herbal medicine slices based on machine vision recognition and the intelligent recognition method of the present invention in conjunction with the accompanying drawings.

[0057] like Figure 1 Figure 2As shown, the electronic scale for dispensing and weighing Chinese herbal medicine slices based on machine vision recognition of the present invention includes an operating table 1, a precision electronic scale 2, a high-resolution wide-angle camera 3 (camera), a data acquisition circuit and a host computer. Multiple precision electronic scales 2 are embedded on the surface of the operating table 1 for placing and weighing Chinese herbal medicine slices. The precision electronic scale 2 has a built-in high-precision pressure sensor. The high-precision pressure sensor has up to 16 channels with an accuracy of 0.01g, which can accurately measure the weight of Chinese herbal medicine slices. Each precision electronic scale 2 has an independent display screen for displaying the weight of the Chinese herbal medicine slices. The operating table 1 is provided with an artificial intelligence circuit mainboard. The pressure signal collected by the high-precision pressure sensor is sent to the artificial intelligence circuit mainboard after signal amplification and AD conversion. The precision electronic scale 2 establishes a connection with the host computer through the artificial intelligence circuit mainboard to realize data transmission. A high-resolution, wide-angle camera 3 is fixedly mounted on the operating table 1 via a bracket, ensuring a complete panoramic image of the Chinese herbal medicine pieces placed on the precision electronic scale 2. The high-resolution, wide-angle camera 3 is used to capture images of the Chinese herbal medicine pieces on the precision electronic scale 2 and is electrically connected to a host computer via a data acquisition circuit, transmitting the captured image data to the host computer. The high-resolution, wide-angle camera 3 is equipped with autofocus and dimming functions, adapting to varying lighting conditions and the stacking configuration of the Chinese herbal medicine pieces to capture clear, high-quality raw image data. The data acquisition circuit, which includes an image acquisition card and data transmission cables, is used to quickly and stably transmit the image data captured by the high-resolution, wide-angle camera to the host computer. The host computer includes a built-in software program, which includes a Chinese herbal medicine HIS prescription acceptance module, a herbal medicine piece identification module, a herbal medicine piece weight measurement and statistics module, an information storage module, and an instruction operation module. The Chinese herbal medicine HIS prescription acceptance module is used to receive prescriptions for Chinese herbal medicine pieces issued by the hospital's HIS system. The herbal medicine piece identification module receives image data transmitted from the data acquisition circuit and uses a herbal medicine piece type recognition algorithm to identify and determine the type of Chinese herbal medicine pieces in the image. The medicine slice weight measurement and statistics module is used to receive and process the weight data transmitted by the precision electronic scale 2, and classify and count the weights of different types of Chinese medicine slices in combination with the slice identification results. The information storage module is used to store the images and weight data of the medicine slices. The instruction operation module compares the detection results of the slice type identification algorithm with the Chinese medicine slice prescription content received by the Chinese medicine HIS prescription receiving module, and makes corresponding warnings. Figure 3 As shown, when the test result is consistent with the prescription, the confirmation is displayed on the host computer; when some Chinese herbal medicines detect multiple similar results, a yellow warning is output to remind manual intervention; when multiple Chinese herbal medicines detect different results, a red warning is output and manual intervention is required.

[0058] The herbal medicine slice type recognition algorithm utilizes a deep learning algorithm. This deep learning model is trained using a large number of TCM slice image samples, enabling it to learn the characteristics of different types of TCM slices. During the actual recognition process, the collected TCM slice images are input into the trained deep learning model, which then outputs the TCM slice type recognition result. The algorithm can identify over 300 types of herbal slices based on their appearance, including graphics, color, and shape, and initially verify their consistency with the prescribed TCM slices.

[0059] During use, the Chinese herbal medicine pieces to be identified and weighed are first placed on a precision electronic scale 2. A high-resolution, wide-angle camera 3 captures an image of the piece and transmits the image data to a host computer via a data acquisition circuit. The piece identification module in the host computer software program uses a trained deep learning model to identify the image and determine the type of Chinese herbal medicine piece. Simultaneously, the precision electronic scale 2 measures the weight of the piece and transmits the weight data to a piece weight measurement and statistics module in the host computer software program. Finally, the host computer software displays, records, and stores the identified type of Chinese herbal medicine piece and the corresponding weight.

[0060] The intelligent identification method of Chinese herbal medicine slices of the present invention is based on machine vision recognition technology and accurately identifies the varieties of Chinese herbal medicine slices by improving the YOLOv11 algorithm structure. The method specifically includes the following steps:

[0061] Step 1: Build the overall network architecture of FasterYOLO.

[0062] Chinese herbal medicine slices are finished products after the processing of Chinese medicinal materials. They include some Chinese herbal medicine slices processed at the place of origin, original medicinal material slices, and sliced ​​and processed medicinal material slices, including slices, segments, blocks, and silk. Because their original shapes have been processed, the accuracy of ordinary image recognition methods is not high. In response to the special needs of the task of identifying the types of Chinese herbal medicine slices, this invention introduces a series of innovative functional designs and targeted structural improvements on the basic structure of YOLOv11. Through comprehensive data enhancement strategies, model structure optimization, hyperparameter fine-tuning and other means, a new and efficient target detection model, FasterYOLO, is finally constructed. The FasterYOLO model not only inherits the advantages of the YOLO series models of speed and flexibility, but also has significant improvements in recognition accuracy and generalization ability. It is especially suitable for the identification of Chinese herbal medicine slice types in complex backgrounds and with many similar features, and has stronger practical application value.

[0063] The overall network structure of FasterYOLO is as follows Figure 4 As shown in the figure, it mainly includes three parts: backbone network (Backbone), feature fusion network (Neck) and detection head (Head):

[0064] In the backbone network, we adopted the efficient and lightweight FasterNet architecture as its foundation to better adapt to the unique and complex characteristics of TCM decoction piece images. Specifically, the backbone network utilizes the Merging and Block modules included in FasterNet to extract important features from the input raw TCM decoction piece images layer by layer. This feature extraction method effectively captures richer spatial and semantic information in the image while maintaining the model's lightweightness, generating feature maps of three different sizes to meet the needs of object detection at different scales. These three feature maps are then passed to the Neck structure for further fusion and processing.

[0065] In the feature fusion network (Neck), we designed and introduced the CSP-EB module. Combining the Cross Stage Partial (CSP) architecture with the efficient Bottleneck design, the CSP-EB module utilizes feature fusion and gradient splitting to effectively enhance the network's ability to abstractly represent target features in complex scenarios through efficient feature map transformation and extraction, while maintaining feature expressiveness. Furthermore, the introduction of this module further enhances the expressive power of feature map fusion and multi-scale information, significantly improving the model's recognition accuracy and generalization performance for TCM decoction pieces.

[0066] Step 2: Improve the FasterYOLO backbone network to effectively improve the computational efficiency of the model architecture and adapt it to deployment on low-computing platforms.

[0067] In object detection tasks, YOLO, a typical one-stage detector, has been widely used in various vision tasks due to its advantages such as fast inference speed and easy model deployment. However, due to its inherent structural characteristics, the YOLO model generally performs poorly in detecting small objects. This is mainly due to the network's low spatial resolution during the feature extraction stage, which causes information about small objects to be easily ignored or weakened in deep feature maps. Furthermore, the limited receptive field further limits the network's ability to capture contextual information about multi-scale objects. Therefore, to effectively improve the network's detection accuracy for multi-scale objects, we need to build higher feature resolution and expand the network's perception range to enhance the model's ability to capture and recognize small object features.

[0068] Although many current improved YOLO models attempt to achieve better object perception by stacking additional convolutional layers, introducing attention mechanisms, or building deeper network structures, these methods often result in a significant increase in computational effort, leading to more complex models, more parameters, and a heavier computational burden. This increased computational complexity not only reduces the model's inference speed but also significantly limits its practical deployment capabilities on resource-constrained devices (such as mobile devices or edge computing devices). Therefore, improving detection performance while maintaining model lightweight has become a major challenge in the current field of object detection research.

[0069] like Figure 5 As shown in the figure, FasterNet, as a new and efficient neural network architecture, provides an effective solution to the above problems. FasterNet replaces the traditional depthwise separable convolution by introducing partial convolution (PConv), which effectively reduces the amount of network calculation while further optimizing the computational efficiency in the feature extraction process. Specifically, PConv only performs convolution operations on part of the channels of the input feature map, rather than all channels, thereby reducing a large amount of unnecessary redundant calculations and memory access overhead. This mechanism not only effectively improves the operating efficiency of the network, but also enables the model to achieve better performance on low-computing power platforms. The calculation formula is as follows:

[0070]

[0071] The input feature map size is C×H×W, where C is the number of channels and H×W is the spatial size. channels (r is the reduction factor, usually 4), and the rest Channels are directly reserved. The conventional convolution (kernel size is K×K) is performed on each channel, and the number of output channels remains the same as the input.

[0072] FasterNet's performance advantage comes not only from the reduction of FLOPs, but also from the optimization of FLOPS (floating-point operations per second). Its delay formula is:

[0073]

[0074] Although traditional models (such as MobileNet) reduce FLOPs, frequent memory accesses result in low FLOPS. PConv significantly increases FLOPS by reducing memory accesses, thereby reducing actual latency.

[0075] Based on the above advantages, we propose to use FasterNet modules in the backbone of the YOLO network to replace the original standard convolutional modules. This replacement method fully utilizes the computing power and hardware parallel characteristics of the target device, effectively improving the network's spatial feature extraction capabilities and information expression efficiency. The specific implementation method is as follows Figure 2 As shown in the figure, the FasterYOLO network first downsamples the original input image of size 640×640×3 to gradually reduce the spatial resolution to control the feature map size and reduce the amount of computation. The FasterNet module then performs efficient deep feature extraction on the downsampled features to obtain richer semantic information. Through the backbone network's step-by-step feature extraction and transformation, it ultimately outputs feature maps of three different scales: 80×80×128, 40×40×256, and 20×20×512, respectively, to meet the needs of object detection at different scales. These multi-scale feature maps are further passed to the network's neck structure for fusion and feature enhancement, ultimately achieving more accurate detection and recognition of small and even multi-scale objects.

[0076] Step 3: Construct the CSP-EB module to effectively improve the detection accuracy of the model for Chinese herbal medicines.

[0077] The YOLO model boasts advantages such as high efficiency and real-time performance in the field of object detection. However, while rapidly processing large amounts of data, it often faces numerous limitations. These include: limited feature representation, resulting in loss of detailed information and insufficient semantic features; deep CNNs typically have large parameter counts and information redundancy, which impacts inference speed and model generalization; and a lack of a clear mechanism to emphasize important information within feature channels, making it difficult to effectively capture and enhance key features. To address these issues, we constructed the CSP-EB module, significantly improving feature extraction efficiency through a more efficient network structure, thereby enhancing the object detection accuracy of the YOLO model.

[0078] CSP-EB modules are mainly divided into CSP structure and EB structure. Figure 6 As shown in the figure, the CSP structure divides the feature map into two parts, one part is directly convolved to extract rich features, and the other part is jump-connected to the subsequent stage to reduce computational redundancy and feature redundancy. This structure significantly reduces the number of parameters and computational cost through partial connections, while improving the network's ability to distinguish and generalize features. The main goal of the EB structure is to capture more feature information while reducing redundant calculations through a more efficient convolution design. This structure adopts a deeper and narrower bottleneck structure (deep and narrow channels) and combines it with dilated convolution or grouped convolution to expand the receptive field while reducing the number of parameters and improving feature extraction efficiency. The specific structure is as follows Figure 3 shown.

[0079] The specific calculation formula is:

[0080]

[0081] To further optimize the structural performance of the YOLO model, this paper introduces the CSP-EB module to improve its Neck module. The CSP-EB module combines the Cross Stage Partial (CSP) structure with the efficient Bottleneck design. Through feature fusion and gradient diversion, it effectively reduces redundant network calculations and parameter redundancy while maintaining feature expression capabilities. Specifically, the CSP-EB module enhances the diversity and robustness of feature expression by rationally dividing and reorganizing feature paths, thereby alleviating the model overfitting problem to a certain extent and improving the model's generalization ability.

[0082] Furthermore, the improved Neck module significantly reduces the model's overall parameter count and computational complexity while maintaining detection accuracy, enabling the YOLO model to maintain high detection accuracy and stability in complex and changing real-world environments. Thanks to the streamlined design of the CSP-EB module, the network structure is more lightweight, which not only improves the model's training convergence speed but also greatly enhances its real-time reasoning capabilities, making it particularly suitable for edge devices and applications requiring high computing resources. Overall, the introduction of this module provides solid technical support for the efficiency and performance of the YOLO series of models in actual deployments.

[0083] Step 4: Construct the NWD loss function to effectively improve the recognition accuracy of Chinese herbal medicines.

[0084] The loss function is an important component of the neural network. Its main function is to measure the deviation between the network's predicted output and the expected output. The smaller the deviation, the lower the value of the loss function. In the YOLO series, the loss function is divided into three parts. The first part is the category loss, which is used to predict the category of the object within the bounding box. The second part is the bounding box loss, which is responsible for calculating the error between the model's predicted bounding box and the true bounding box. The third part is the confidence loss. It is used to measure the accuracy of the model's confidence in its prediction. In the yolov5 model, both confidence loss and category loss are calculated by the binary cross entropy (BCE) loss function. The bounding box loss is calculated by the CIoUloss function, and its formula is as follows:

[0085]

[0086] in and are the centroids of the predicted frame and the target frame respectively. ρ is the Euclidean distance between the two centroids. c is the diagonal length of the minimum closed area between the predicted frame and the target frame. α is the weight of the function. v is the consistency of the aspect ratio of the two frames. h prd and w prd are the height and width of the predicted frame respectively. gt and w gt are the height and width of the target frame respectively.

[0087] The CIoU loss function used in YOLO comprehensively considers three important geometric factors: overlap area, center point distance, and aspect ratio. This function addresses the inclusion relationship between the predicted and true bounding boxes by directly regressing the Euclidean distance between the center points of the two bounding boxes. The regression process also considers the aspect ratio of the bounding boxes. This approach not only improves bounding box accuracy but also enhances the model's robustness when handling objects of varying sizes and shapes.

[0088] However, the CIOU loss function only considers the degree of overlap of bounding boxes without considering their size, which results in IOU being more sensitive to larger objects and less sensitive to smaller objects when evaluating model performance. NWD is a distance-based loss function that can effectively handle the problem of class imbalance by normalizing the distance between the predicted value and the true value and combining it with a weighting coefficient. In addition, NWD is insensitive to changes in external scale and is particularly suitable for small target detection. Therefore, we propose an N-Loss formula based on the following NWD loss function:

[0089] N-Loss=0.05L obj +0.1L rect +0.15L cls (4)

[0090] Among them L obj 、L cls They are confidence loss function and classification loss function, both of which are binary cross loss functions; L rect is the coordinate loss.

[0091] The NWD loss function is calculated as follows:

[0092]

[0093] L rect =1-NWD(N a ,N b ) (7)

[0094] where cx a ,cy a , w a , h a, cx b ,cy b , w b , h b are the center coordinates, width, and height of the predicted and ground truth bounding boxes, and C is the average absolute size of the dataset.

[0095] To fully validate the proposed model's advantages in terms of precision-efficiency trade-offs and systematically evaluate its potential for engineering applications in edge computing scenarios, we conducted comparative experiments with six mainstream models, including single-stage detectors (YOLO series), two-stage detectors (Faster R-CNN), and Transformer-based detection frameworks (DETR series). As shown in Table 1, a systematic comparative analysis of multi-dimensional indicators fully demonstrates the comprehensive advantages of the FasterYOLO model in embedded deployment scenarios.

[0096] Experimental results show that FasterYOLO achieves breakthrough accuracy while maintaining a minimalist model structure (only 15M parameters and 35GFLOPs of computation): reaching 78.8% on the mAP@0.5 metric, a 2.3 percentage point improvement over the next-best model; both F1-Score (0.73) and Recall (0.71) rank first, demonstrating excellent balance between positive and negative samples. Notably, under the more stringent mAP@0.5:0.95 evaluation system, the model still achieves a detection accuracy of 54.8%, validating the algorithm's robustness in complex scenarios. Compared with Transformer-based detection frameworks such as RF-DETR (83.6M / 215G FLOPs) and LAE-DINO (79.2M / 198G FLOPs), which have more than 80M parameters, FasterYOLO shows an order of magnitude advantage in computational efficiency (83% reduction in FLOPs) while maintaining comparable detection accuracy, fully demonstrating the advanced design of the method of this invention.

[0097] Table 1: Comparison of target detection models

[0098]

[0099] In order to verify the unique advantages of the model proposed in the present invention in the classification of Chinese herbal medicine pieces, the present invention also conducted a classification comparison experiment on various types of Chinese herbal medicine pieces. The results are shown in Table 2.

[0100] Experimental results show that FasterYOLO achieves the highest Precision (93.6%), Recall (92.1%), and Accuracy (90.11%) in the table while maintaining a medium model size (4.9M parameters, 8.6GFLOPs), far surpassing other mainstream models in classification accuracy and comprehensive performance. Compared with ConvNeXt, VisionTransformer, and Swin Transformer, which have larger parameters and higher computational complexity, FasterYOLO achieves an excellent balance between efficiency and accuracy; it also outperforms lightweight models such as MobileNet-V3 and EfficientNet, and has an overwhelming advantage in accuracy and recall. Therefore, FasterYOLO combines high performance, low latency, and lightweight features, making it one of the most deployable models.

[0101] Table 2: Comparison of classification models for Chinese herbal medicine pieces:

[0102]

[0103] In summary, the intelligent recognition method presented in this paper offers significant advantages in terms of speed, precision, lightweightness, and adaptability, making it particularly suitable for applications such as Chinese herbal medicine slice identification, which requires diverse targets, complex backgrounds, and high real-time performance. Through the combined optimization of FasterYOLO, PConv, CSP-EB, and NWD Loss, efficient, accurate, and stable intelligent recognition is achieved, providing reliable technical support for the automation of Chinese herbal medicine dispensing.

[0104] It will be understood that the present invention is described by way of some embodiments, and it will be appreciated by those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are intended to be protected by the present invention.

Claims

1. An electronic scale for dispensing and weighing Chinese herbal medicine slices based on machine vision recognition, characterized in that: The invention comprises an operating table (1), a precision electronic scale (2), a high-resolution wide-angle camera (3), a data acquisition circuit and a host computer. A plurality of precision electronic scales (2) are embedded on the surface of the operating table (1) for placing and weighing Chinese herbal medicine slices. Each precision electronic scale (2) has an independent display screen for displaying the weight of the weighed Chinese herbal medicine slices. An artificial intelligence development circuit mainboard is provided in the operating table (1). The artificial intelligence development circuit mainboard of the precision electronic scale (2) is connected to the host computer to realize data transmission. The high-resolution wide-angle camera (3) is fixedly mounted on the operating table (1) through a bracket and is electrically connected to the host computer through the data acquisition circuit to transmit the collected image data to the host computer.

2. The electronic scale for weighing Chinese herbal medicine pieces based on machine vision recognition according to claim 1, characterized in that: The precision electronic scale (2) has a built-in high-precision pressure sensor, which has multiple channels and an accuracy of 0.01g; the high-resolution wide-angle camera (3) is equipped with automatic focus and dimming functions; the data acquisition circuit includes an image acquisition card and a data transmission line, which is used to transmit the image data collected by the high-resolution wide-angle camera to the host computer.

3. The electronic scale for weighing Chinese herbal medicine preparations based on machine vision recognition according to claim 1, characterized in that: The host computer has a built-in software program, which includes a Chinese medicine HIS prescription receiving module, a decoction piece identification module, a decoction piece weight measurement and statistics module, an information storage module and an instruction operation module. The Chinese medicine HIS prescription receiving module is used to receive the Chinese medicine decoction piece prescription issued by the hospital HIS system; the decoction piece identification module is used to receive image data transmitted from the data acquisition circuit, and use the decoction piece type recognition algorithm to identify the Chinese medicine decoction piece in the image to determine its type; The decoction piece weight measurement and statistics module is used to receive and process the weight data transmitted by the precision electronic scale (2), and to classify and count the weights of different types of Chinese medicine decoction pieces in combination with the decoction piece identification results; The information storage module is used to store images and weight data of medicinal pieces; The instruction operation module compares the detection results of the slice type identification algorithm with the Chinese medicine slice prescription content received by the Chinese medicine HIS prescription acceptance module and makes corresponding warnings. When the detection result is consistent with the prescription, a confirmation is displayed on the host computer; when multiple similar results are detected for some Chinese medicine slices, a yellow warning is output to remind manual intervention; When different results are detected for multiple Chinese herbal medicines, a red alert is output and manual intervention is required.

4. An intelligent recognition method for an electronic scale for dispensing and weighing Chinese herbal medicine slices based on machine vision recognition according to any one of claims 1 to 3, characterized in that: The steps include: Step 1: Build the overall network architecture of FasterYOLO; Step 2: Improve the FasterYOLO backbone network; Step 3: Build the CSP-EB module; Step 4: Construct the NWD loss function.

5. The intelligent identification method according to claim 4, characterized in that: The step 1 comprises the following steps: Based on the basic structure of YOLOv11, we build a target detection model - FasterYOLO. FasterYOLO consists of three parts: backbone network Backbone, feature fusion network Neck and detection head Head: In the backbone network part, the efficient and lightweight FasterNet architecture is adopted as the basis. The backbone network uses the Merging module and FasterNet Block module contained in FasterNet to extract important features from the input original Chinese medicine decoction slice images layer by layer, and generate feature maps of three different sizes to meet the needs of target detection at different scales. These three feature maps are then passed to the Neck structure for further fusion and processing. In the feature fusion network part, the CSP-EB module is designed and introduced. The CSP-EB module combines the CSP structure with the Bottleneck design. Through feature fusion and gradient diversion, while maintaining feature expression capabilities, it improves the network's ability to abstractly express target features in complex scenes through efficient feature map transformation and feature extraction.

6. The intelligent identification method according to claim 4, characterized in that: The step 2 comprises the following steps: The FasterNet neural network architecture is adopted. Partial convolution PConv is introduced to replace the traditional depth-wise separable convolution. PConv only performs convolution operations on a part of the channels of the input feature map. The calculation formula is as follows: Among them, the input feature map size is C×H×W, where C is the number of channels and H×W is the spatial size. Randomly select consecutive channels, r is the reduction factor, and the rest Channels are directly reserved, only the selected Perform regular convolution on each channel with a kernel size of K×K, and keep the number of output channels the same as the input; Optimize the number of floating-point operations per second (FLOPS), and the delay formula is: It is proposed to use the FasterNet module in the backbone of the YOLO network to replace the original standard convolution module: the FasterYOLO network first gradually reduces the spatial resolution of the original image with an input size of 640×640×3 through downsampling operations to control the feature map size and reduce the amount of computation; then the FasterNet module is used to perform efficient deep feature extraction on the downsampled features to obtain richer semantic information. Through the step-by-step feature extraction and transformation of the backbone network, three feature maps of different scales are finally output, with sizes of 80×80×128, 40×40×256, and 20×20×512, respectively, to meet the needs of target detection at different scales. These multi-scale feature maps are further passed to the neck structure of the network for fusion and feature enhancement.

7. The intelligent identification method according to claim 4, characterized in that: The step 3 comprises the following steps: The CSP-EB module is divided into CSP and EB structures. The CSP structure divides the feature map into two parts. One part is directly convolved to extract rich features, and the other part is skipped and connected to the subsequent stage to reduce computational redundancy and feature redundancy. The EB structure uses a more efficient convolution design to capture more feature information while reducing redundant computation. The specific calculation formula is: The CSP-EB module is introduced to improve its Neck module. The CSP-EB module combines the CSP structure with the efficient Bottleneck design. Through feature fusion and gradient diversion, it effectively reduces the redundant calculation and parameter redundancy of the network while maintaining the feature expression capability. The CSP-EB module enhances the diversity and robustness of feature expression by rationally dividing and reorganizing feature paths.

8. The intelligent identification method according to claim 4, characterized in that: The step 4 comprises the following steps: Based on the following NWD loss function, an N-Loss formula is proposed: N-Loss=0.05L obj +0.1L rect +0.15L cls (4) Among them L obj , L cls They are confidence loss function and classification loss function, both of which are binary cross loss functions; L rect is the coordinate loss; The NWD loss function is calculated as follows: L rect =1-NWD(N a ,OF b ) (7) where cx a ,cy a , w a , h a , cx b ,cy b , w b , h b are the center coordinates, width, and height of the predicted and ground truth bounding boxes, and C is the average absolute size of the dataset.

Citation Information

Patent Citations

  • Traditional Chinese medicine decoction piece dispensing automatic rechecking method based on image recognition technology

    CN110717530A

  • Obstacle detection method of visual impaired group guiding waistcoat system based on improved YOLOv11

    CN119600523A

  • Crop pest detection method based on improved YOLOv11s model

    CN120014434A

  • Herbal pieces - data acquisition system

    CN205537889U

  • Traditional Chinese medicine decoction piece dispensing and rechecking system

    CN214956030U

Cited By

  • Unmanned aerial vehicle spraying system for interchange road accumulated snow recognition and path dynamic planning

    CN121457768A