Traditional Chinese medicine dispensing authenticity real-time detection method, system and equipment and storage medium
By improving the YOLOv11n-seg model to LEO-YOLO-CM, combined with ODConv, iEMA Bloc and LADH, the problem of insufficient authenticity and accuracy of Chinese medicinal materials detection models is solved, and efficient and low-complexity detection of Chinese medicinal materials is achieved.
Patent Information
- Application Number
- CN202510742571.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-06-05
AI Technical Summary
The existing Chinese medicinal materials detection models have shortcomings in capturing subtle features of authenticity and falsehood and detection accuracy. At the same time, the model is complex and difficult to be widely used in actual production.
Build the LEO-YOLO-CM model, and optimize the model structure to improve feature extraction and detection accuracy by introducing ODConv to replace C3K2 in the Backbone of the YOLOv11n-seg model.
It significantly improves the detection accuracy and robustness of the model in complex contexts, reduces computing resource consumption, is suitable for automated quality inspection of traditional Chinese medicinal materials, and has high efficiency, stability and low cost application prospects.
Smart Images

Figure CN120259686A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image detection, and particularly to a real-time detection method, system, device, and storage medium for the authenticity of traditional Chinese medicine dispensing. Background Art
[0002] As an important part of traditional Chinese medicine, Chinese herbal medicines not only play a crucial role in clinical treatment and preventive healthcare, but also increasingly demonstrate unique value in the global healthcare industry. However, in recent years, the problem of the authenticity of Chinese herbal medicines in the market has emerged one after another, resulting in uneven quality of Chinese herbal medicines, seriously threatening the safety and efficacy of medication, and posing a potential hazard to consumer health at the same time. Traditional methods for detecting the quality of Chinese herbal medicines rely on manual observation and chemical analysis, which are not only highly subjective, inefficient, and costly to operate, but also difficult to maintain consistency and objectivity in the detection results due to the large variety of Chinese herbal medicines, obvious morphological differences, and complex geographical origins. Therefore, how to achieve automation and intelligence while ensuring detection accuracy has become an important technical problem in promoting the standardization and industrial upgrading of modern Chinese herbal medicines.
[0003] Driven by deep learning frameworks, computer vision technology has experienced rapid development, especially achieving revolutionary progress in tasks such as object detection, semantic segmentation, and image recognition. With the continuous emergence of advanced models such as CNN (Convolutional Neural Network), RNN (Recurrent Neural Network), and Transformer models (deep learning models based on attention mechanisms), computer vision systems have shifted from traditional feature engineering to end-to-end learning, demonstrating excellent performance in processing high-dimensional data, complex backgrounds, and multi-scale targets. For example, the Faster R-CNN model (an object detection model) based on the region proposal algorithm provides strong support for real-time detection, and the development of object detection technology has provided a new research direction for the identification of traditional Chinese medicine compounds. In recent years, the YOLO (You Only Look Once) series of models have been widely used in industrial quality inspection and medical image analysis due to their efficient detection capabilities. In the field of Chinese herbal medicines, Li Ming et al. (2022) proposed a method for identifying Chinese herbal medicines based on YOLOv4 (the v4 version of YOLO), achieving high-precision detection of a variety of common Chinese herbal medicines. In addition, Zhao Zhe et al. (2024) improved the model structure based on YOLOv8 (the v8 version of YOLO), enhanced the ability to distinguish morphologically similar herbs, and optimized the inference speed to make it suitable for real-time detection scenarios. These studies indicate that YOLO technology has great application potential in the field of traditional Chinese medicine identification. The successful application of deep learning models in fields such as medical image analysis, autonomous driving, and security monitoring has made computer vision an indispensable technical support for realizing intelligent automation.
[0004] In the field of agriculture and food testing, computer vision systems are also used in tasks such as crop maturity assessment, pest and disease detection, and agricultural product sorting. Improved deep feature extraction methods are used to improve the accuracy of target segmentation and recognition, providing accurate data support for yield prediction and quality control. These technological advances provide a theoretical basis and technical inspiration for Chinese herbal medicine testing, prompting researchers to try to introduce visual recognition and deep segmentation methods into the quality monitoring system of Chinese herbal medicines to achieve accurate, fast, and low-cost automated testing.
[0005] In the field of Chinese herbal medicine detection, most of the work focuses on using deep learning to classify and roughly locate Chinese herbal medicine images. For example, the Chinese herbal medicine authenticity detection method proposed by Zhang Ming et al. based on YOLOv5 (v5 version of YOLO) initially achieved rapid detection of targets, but its robustness needs to be further improved under complex backgrounds and non-ideal lighting conditions. At the same time, Li Hong et al. pointed out in a review that most of the current Chinese herbal medicine recognition methods mainly rely on local feature extraction and simple classification algorithms, and fail to fully deal with the morphological changes and subtle authenticity features of Chinese herbal medicines during the collection process. Some foreign studies have attempted to combine traditional machine learning algorithms with modern deep learning methods, such as the tomato maturity evaluation method proposed by Nashwa El-Bendary (name) and Xiaoqiang Du (name) and others using the improved YOLO model to detect partial occlusion and small targets, which to a certain extent solved the problem of target detection in complex scenes. However, when these methods are actually applied to Chinese herbal medicine detection, they are often difficult to achieve the expected results in feature extraction and fine segmentation due to the complex structure of the Chinese herbal medicine itself, the diverse authenticity methods, and the significant differences between samples. In addition, some quality inspection systems based on deep learning perform well in high-precision inspection, but they also face problems such as large model size, high consumption of computing resources, and lack of real-time performance, which limits their promotion and application in actual production.
[0006] Therefore, how to further reduce the complexity of the model while ensuring high detection accuracy, and achieve efficient capture and precise segmentation of subtle features of Chinese medicinal materials detection and judgment of the authenticity of prescription formulas, is a key technical problem that needs to be solved urgently. It is also an important research direction to promote the intelligent detection of Chinese medicinal materials quality. Summary of the invention
[0007] The present invention solves the problem that the existing model has low ability to capture subtle features of authenticity of traditional Chinese medicines and low detection accuracy while ensuring low model complexity.
[0008] The method for real-time detection of the authenticity of Chinese medicine preparations of the present invention comprises the following steps: Step S1, constructing a Chinese medicine dispensing image dataset; Step S2: Construct the LEO-YOLO-CM model, specifically as follows: In the Backbone of the YOLOv11n-seg model, fuse the iEMA Bloc module into the C2PSA module. In the Backbone and Neck of the YOLOv11n-seg model respectively, replace C3K2 with ODConv. In the Head of the YOLOv11n-seg model, replace the detection head with LADH; Step S3: Based on the LEO-YOLO-CM model, perform real-time authenticity detection on the traditional Chinese medicine dispensing image dataset.
[0009] Furthermore, in the embodiment of the present invention, in the step S2, the iEMA Bloc module is specifically as follows: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset passes through the iEMA attention mechanism module and then performs residual connection with the other path of the traditional Chinese medicine dispensing image dataset, outputting the traditional Chinese medicine dispensing feature image dataset. The traditional Chinese medicine dispensing feature image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing feature image dataset passes through the multi-cascade convolutional layer module and then performs residual connection with the other path of the traditional Chinese medicine dispensing feature image dataset.
[0010] Furthermore, in the embodiment of the present invention, the iEMA attention mechanism module is specifically as follows: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset sequentially passes through the batch normalization two-dimensional layer, the EMA attention mechanism module, and the convolutional layer module. After starting the skip connection function between the EMA attention mechanism module and the convolutional layer module for addition, it is then sequentially input into the convolutional layer module and the dropout path, and then added to the other path of the traditional Chinese medicine dispensing image dataset.
[0011] Furthermore, in the embodiment of the present invention, in the step S2, the fusion of the iEMA Bloc module into the C2PSA module is specifically as follows: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset sequentially passes through the convolutional layer module and the multi-cascade iEMA Bloc module, and then is connected to the other path of the traditional Chinese medicine dispensing image dataset and passes through the convolutional layer module.
[0012] The real-time authenticity detection system for traditional Chinese medicine dispensing of the present invention includes the following modules: A construction module for constructing a traditional Chinese medicine dispensing image dataset; A model module for constructing the LEO-YOLO-CM model, specifically as follows: In the Backbone of the YOLOv11n-seg model, the iEMA Bloc module is integrated into the C2PSA module. In the Backbone and Neck of the YOLOv11n-seg model respectively, ODConv is used to replace C3K2. In the Head of the YOLOv11n-seg model, the detection head is replaced with LADH; The detection module, based on the LEO-YOLO-CM model, performs real-time authenticity detection on the traditional Chinese medicine dispensing image dataset.
[0013] An electronic device according to the present invention includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; The memory is used to store computer programs; The processor, when executing the program stored on the memory, implements the real-time authenticity detection method for traditional Chinese medicine dispensing described in any of the above methods.
[0014] A computer-readable storage medium according to the present invention stores a computer program therein, and when the computer program is executed by a processor, it implements the real-time authenticity detection method for traditional Chinese medicine dispensing described in any of the above methods.
[0015] The present invention solves the problem that the existing models have low ability to capture subtle features of the authenticity of traditional Chinese medicines and low detection accuracy, while ensuring a low model complexity. The specific beneficial effects include: 1. For the real-time authenticity detection method for traditional Chinese medicine dispensing described in the present invention, the existing models have low ability to capture subtle features of the authenticity of traditional Chinese medicines and low detection accuracy, while ensuring a low model complexity. To solve the above technical problems, the present invention improves the YOLOv11n-seg model to construct the LEO-YOLO-CM model. The experimental results show that the LEO-YOLO-CM model not only significantly improves the boundary localization accuracy and segmentation performance while maintaining low computational resource consumption, but also has good generalization ability under complex backgrounds, natural light interference, and diverse adulteration methods. It provides a new technology with high efficiency, stability, and low cost for the automated quality detection of traditional Chinese medicines, and has important application prospects and industrial promotion value; 2. For the real-time authenticity detection method for traditional Chinese medicine dispensing described in the present invention, in order to improve the feature selection ability of the model in complex backgrounds, the present invention integrates the iEMA Bloc module into the C2PSA module in the Backbone of the YOLOv11n-seg model, realizing an overall improvement in multiple aspects such as feature extraction, feature enhancement, and training stability; The real-time detection method for the authenticity of traditional Chinese medicine dispensing described in the present invention, the LEO-YOLO-CM model has higher detection accuracy, lower computational resource occupancy and stronger deployment adaptability. It is particularly suitable for industrial actual scenarios such as the quality detection and authenticity identification of traditional Chinese medicine dispensing, and has broad engineering application value and market potential. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and / or additional aspects and advantages of the present invention will become apparent and be readily understood from the following description of the embodiments in conjunction with the drawings, in which: Figure 1 is the structural diagram of the LEO-YOLO-CM model described in Embodiment 1; Figure 2 is the performance comparison diagram of the LEO-YOLO-CM model described in Embodiment 1; Figure 3 is the diagram of the performance index of the LEO-YOLO-CM model changing with the training process described in Embodiment 1; Figure 4 is the structural diagram of the iEMA attention mechanism module described in Embodiment 2; Figure 5 is the structural diagram of the iEMA Bloc module described in Embodiment 2; Figure 6 is the structural diagram of the C2PSA-iEMA Bloc module described in Embodiment 2; Figure 7 is the performance comparison diagram of each model described in Embodiment 2; Figure 8 is the detection comparison diagram before and after the model improvement described in Embodiment 2. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0017] The following will clearly and completely describe various embodiments of the present invention in conjunction with the drawings. The embodiments described by referring to the drawings are exemplary and are intended to explain the present invention, and should not be construed as limiting the present invention.
[0018] Embodiment 1. The real-time detection method for the authenticity of traditional Chinese medicine dispensing described in this embodiment includes the following steps: Step S1, constructing a traditional Chinese medicine dispensing image dataset; Step S2, constructing the LEO-YOLO-CM model, specifically: In the Backbone of the YOLOv11n-seg model, the iEMA Bloc module is fused into the C2PSA module. In the Backbone and Neck of the YOLOv11n-seg model respectively, C3K2 is replaced with ODConv. In the Head of the YOLOv11n-seg model, the detection head is replaced with LADH; Step S3, based on the LEO-YOLO-CM model, perform real-time authenticity detection on the traditional Chinese medicine dispensing image dataset.
[0019] When existing models are applied to the detection of traditional Chinese medicine materials, due to the complex structure of traditional Chinese medicine materials themselves, diverse authenticity methods, and significant differences among samples, it is often difficult for the models to achieve the expected results in feature extraction and fine segmentation. In addition, some deep learning-based quality inspection systems perform excellently in high-precision detection, but at the same time, they also face problems such as large model size, high computational resource consumption, and insufficient real-time performance, which limit their popularization and application in actual production.
[0020] To solve the above technical problems, this embodiment is based on the improvement of YOLOv11n-seg (the v11-seg version of YOLO), and proposes a real-time authenticity detection method for traditional Chinese medicine dispensing, including the following steps: Step S1, construct a traditional Chinese medicine dispensing image dataset, specifically: Collect a representative traditional Chinese medicine dispensing image dataset, covering a variety of common adulteration types and morphologically similar medicinal materials, and use professional annotation tools to accurately annotate the traditional Chinese medicine dispensing images, including the boundaries of adulterated areas, class labels, and instance mask information, and finally form a high-quality dataset for model training and evaluation.
[0021] Step S2, construct the LEO-YOLO-CM model (an improved version of the YOLOv11n-seg model), specifically: As Figure 1 shown, based on the lightweight instance segmentation framework of the YOLOv11n-seg model, build the overall network model structure, retain its efficient feature extraction ability and end-to-end prediction advantage, and provide a basis for subsequent module optimization, specifically: To improve the detection efficiency and feature expression ability of the model under edge deployment conditions, the C3K2 (feature extraction component) is replaced with ODConv (Omni-Dimensional Dynamic Convolution) in the Backbone (main network) and Neck (neck network) of the YOLOv11n-seg model. Here, C3K2 represents a 3×3 convolution kernel and a 2×2 stride. However, although this convolution operation is simple and effective, when dealing with complex objects or diverse textures, it may encounter the balance problem between efficiency and accuracy. To further improve the computational efficiency and performance of the model, this embodiment proposes to use ODConv to replace C3K2. ODConv is an optimized depthwise separable convolution that can significantly reduce the computational complexity while maintaining a high computational efficiency. Different from the existing C3K2, ODConv divides the convolution operation into depthwise convolution and pointwise convolution, reducing the number of parameters and improving the speed of feature extraction. A dynamic attention mechanism is jointly introduced from the channel, spatial, and convolution kernel dimensions to enhance the model's perception ability of complex textures, edges, and local structures. This greatly improves the real-time performance of the model in resource-constrained environments, such as edge computing devices, without affecting the accuracy and robustness of the model. Therefore, by replacing C3K2 with ODConv in this embodiment, the redundancy of parameters is greatly reduced, the computational efficiency is improved, and a better balance is achieved between efficiency and accuracy for the model.
[0022] In the Backbone of the YOLOv11n-seg model, the iEMA Bloc module (efficient inverted attention mechanism block module) is integrated into the C2PSA module (enhanced feature extraction module) to form the C2PSA-iEMA Bloc module (improved dual-part spatial attention module), which enhances the model's attention and discrimination stability for key adulterated regions and adapts to the differential recognition requirements of morphologically similar medicinal materials.
[0023] In the Head (head network) of the YOLOv11n-seg model, the detection head is replaced with LADH (Lightweight Adaptive Decoupled Head). Using a decoupled detection head design, the class branch and the boundary regression branch are independently modeled through 1×1 convolution and 3×3 convolution respectively, effectively reducing the interference of feature redundancy. At the same time, a lightweight attention selection module is introduced to dynamically adjust the channel weights of different class responses during the training process, enhancing the model's localization ability for small-scale adulterated medicinal materials and making the boundaries more fitting. This is mainly reflected in the following aspects: Decoupled design: The existing detection heads couple the classification task and the regression task of the target, which may cause interference between the two. LADH adopts a decoupled design, modeling the classification task and the regression task separately, making the optimization objectives of each task clearer, avoiding mutual influence, and improving the accuracy of localization and classification.
[0024] Anchor-free design: LADH does not rely on the traditional anchor mechanism, but adopts the PointSet Regression strategy. This method directly locates the center point of the target, enabling the model to maintain good performance even when the target shapes are diverse and the distributions are uneven. In addition, removing the anchor mechanism simplifies the model training process, reduces the complex anchor matching process, and improves the training efficiency.
[0025] Lightweight design: LADH adopts a lightweight convolutional structure to reduce the amount of computation and the number of parameters. Especially on edge devices, this lightweight design greatly improves the detection efficiency while ensuring high detection accuracy.
[0026] Therefore, by replacing the detection head with LADH in this embodiment, the flexibility and robustness of the model are effectively improved. Especially in complex scenarios, dense targets, and occlusion situations, LADH provides higher detection accuracy and adaptability.
[0027] To verify the recognition degree and segmentation accuracy of the LEO-YOLO-CM model for the targets in traditional Chinese medicine dispensing images described in this embodiment, a series of systematic ablation experiments were carried out in this embodiment to verify the influence of the improvements of each module on the model performance, and the results are as Figure 2 shown.
[0028] In the actual circulation link of traditional Chinese medicine dispensing, there are often replacement fraud behaviors, and their counterfeit features have characteristics such as strong disguise and insignificant subtle morphological changes, which pose high requirements for the discrimination ability of the detection system. Therefore, while ensuring the lightweight deployment ability of the model, achieving high-precision detection and segmentation is the key goal of the research in this embodiment.
[0029] First, in this embodiment, C3K2 in the YOLOv11n-seg model is replaced with ODConv. ODConv enhances the model's ability to model multi-scale features and adaptability by introducing a dynamic weighting mechanism in the spatial, channel, and convolutional kernel dimensions, and is particularly suitable for discriminating complex backgrounds and fine structures in the adulteration scenario of traditional Chinese medicine. Experimental results show that introducing ODConv alone can increase mAP@50 (Box) (mean average precision @50 (bounding box)) from 0.915% to 0.963%, and mAP@50 (Mask) (mean average precision @50 (segmentation box)) from 0.923% to 0.966%, significantly enhancing the model's feature expression ability and discrimination accuracy.
[0030] Subsequently, this embodiment introduces the C2PSA-iEMA Bloc module, aiming to improve the model's ability to focus on fine-grained features such as texture boundaries and morphological edges. The C2PSA-iEMA Bloc module further improves the model's performance in terms of P (precision) and R (recall) on the basis of the ODConv-enhanced backbone network, especially achieving better performance in the Mask task, verifying the practical effect of this attention mechanism in the extraction of details of traditional Chinese medicine images.
[0031] In addition, this embodiment replaces the detection head with LADH. This structure explicitly decouples the classification and localization tasks and simultaneously introduces an efficient attention module, significantly reducing GFLOPs (computational volume) while improving detection performance. When ODConv and LADH are used in combination, the model's mAP@50 (Box) and mAP@50 (Mask) are respectively increased to 0.973% and 0.971% while maintaining a relatively low GFLOPs, demonstrating excellent precision and complexity balance capabilities.
[0032] Finally, this embodiment integrates the three modules of ODConv, C2PSA-iEMA Bloc module, and LADH to construct a complete LEO-YOLO-CM model. This model achieves optimal performance in both detection and segmentation tasks, with mAP@50 (Box) reaching 0.978% and mAP@50 (Mask) reaching 0.979%. All P and R indicators are significantly better than the comparison models. At the same time, the model's Params is only 2.46M and GFLOPs is only 7.8s. Compared with the original YOLOv11n-seg model, the LEO-YOLO-CM model realizes improvements of 6.3% and 5.6% in mAP@50 (Box) and mAP@50 (Mask) respectively, fully verifying the effectiveness and synergy of the proposed modules in the task of traditional Chinese medicine adulteration detection.
[0033] Step S3, train and evaluate the performance of the LEO-YOLO-CM model, specifically: The constructed Chinese medicine dispensing image dataset is used to systematically train and validate the LEO-YOLO-CM model, and its performance in terms of metrics such as accuracy, recall, segmentation effect, and inference efficiency is evaluated to ensure that the model has the ability for actual deployment and promotion.
[0034] Overall, the model shows an obvious convergence trend and high stability at the initial stage of training. All kinds of loss functions show a smooth decline and finally tend to be stable, fully reflecting the excellent learning ability of the model in tasks such as feature extraction, object detection, and region segmentation. As Figure 3 shown, specifically, Box_loss (bounding box regression loss) rapidly drops from the initial high value and stabilizes below 0.35, indicating that the model shows strong discriminative ability in accurately positioning the boundaries of traditional Chinese medicine material targets. seg_loss (segmentation loss) gradually drops to about 0.25, showing the model's efficient fitting of target edge details when dealing with semantic-level region segmentation tasks. At the same time, cls_loss (classification loss) quickly converges below 0.1 after initial fluctuations, reflecting the continuous improvement of the model's recognition accuracy for adulterated categories such as staining, wax coating, and root breakage. Another key indicator, dfl_loss (distribution focal loss), shows a steady downward trend and finally stabilizes at about 0.02, indicating that the model has strong perception ability in capturing the internal spatial layout information of the target. It is worth noting that the performance of each loss in the training set and the validation set is highly consistent, and the validation loss is always slightly higher than the training loss without significant fluctuations, fully demonstrating the excellent generalization ability and anti-overfitting performance of the model. In terms of evaluation metrics, the P and R of the model in the Mask branch are both stably maintained above 0.92, the mAP@50 under the condition of IoU (loss value)=0.5 reaches 97.9%, and it also achieves a score of 72.5% under the more stringent mAP@50–95 metric, further verifying the excellent segmentation robustness and adaptability of the model under interference conditions such as complex backgrounds, natural light changes, and occlusions.
[0035] In summary, the LEO-YOLO-CM model shows significant advantages in the task of detecting the authenticity of Chinese medicine dispensing: all losses of the model show good convergence during the training stage, with high object detection and segmentation accuracy, and excellent generalization performance on the validation set. This model can not only accurately extract the fine structural features of traditional Chinese medicine materials but also effectively identify various types of adulteration behaviors, showing broad practical application prospects and promotion value.
[0036] Embodiment 2: This embodiment further limits the real-time detection method for the authenticity of Chinese medicine dispensing described in Embodiment 1. In the step S2, the iEMA Bloc module is specifically: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset passes through the iEMA attention mechanism module and then undergoes residual connection with the other path of the traditional Chinese medicine dispensing image dataset to output the traditional Chinese medicine dispensing feature image dataset. The traditional Chinese medicine dispensing feature image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing feature image dataset passes through the multi-cascade convolutional layer module and then undergoes residual connection with the other path of the traditional Chinese medicine dispensing feature image dataset.
[0037] In this embodiment, the iEMA attention mechanism module is specifically: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset sequentially passes through the batch normalization two-dimensional layer, the EMA attention mechanism module, and the convolutional layer module. After adding by starting the skip connection function between the EMA attention mechanism module and the convolutional layer module, it is then sequentially input into the convolutional layer module and the dropout path, and then added to the other path of the traditional Chinese medicine dispensing image dataset.
[0038] In this embodiment, in step S2, the integration of the iEMA Bloc module into the C2PSA module is specifically: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset sequentially passes through the convolutional layer module and the multi-cascade iEMA Bloc module, and then is connected to the other path of the traditional Chinese medicine dispensing image dataset and passes through the convolutional layer module.
[0039] The C2PSA module itself is a module that combines channel and spatial attention, aiming to enhance the model's attention to important regions. However, the existing channel and spatial attention mechanisms may still have deficiencies in complex scenarios. To solve the above technical problems, in this embodiment, in the Backbone of the YOLOv11n-seg model, the iEMA attention mechanism module (Efficient Inverted Attention Mechanism Module) is fused into the C2PSA module to further improve the model's feature selection ability in complex backgrounds. The iEMA attention mechanism module is composed of the fusion of the iRMB attention mechanism module (Improved Residual Module-based Attention, Efficient Multi-scale Attention Mechanism Module) and the EMA attention mechanism module (Exponential Moving Average, Efficient Multi-scale Attention Mechanism Module for Cross-space Learning). The iRMB attention mechanism module uses the residual module to extract multi-level feature information and weights the channel information on this basis, thereby enhancing the response to key features. By adaptively adjusting the channel weights of the feature map, the iRMB attention mechanism module can more accurately identify useful information and suppress irrelevant background noise. The EMA attention mechanism module weights the input features in an exponentially weighted manner, enabling the effective fusion of feature information at multiple moments and ensuring the stability and consistency of the feature map information. The EMA attention mechanism module can better capture the less-changing but important detail parts in the image, especially having significant advantages for fine-grained object recognition. Fusing these two attention mechanism modules, taking the inverted residual structure of the iRMB attention mechanism module and the EMA attention mechanism module and fusing them to form the iEMA attention mechanism module and adding it to the C2PSA module not only improves the ability to capture complex textures but also enhances the discriminative power of the model in the detail part, enabling the model to more accurately process objects under occlusion, stacking, and complex backgrounds.
[0040] As Figure 4 shown, the iEMA attention mechanism module is specifically as follows: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset passes through the batch normalization two-dimensional layer, the EMA attention mechanism module, and the convolutional layer module in sequence, and after adding with the jump connection function activated between the EMA attention mechanism module and the convolutional layer module, it is then input into the convolutional layer module and the dropout path in sequence, and then added with the other path of the traditional Chinese medicine dispensing image dataset.
[0041] However, in this embodiment, it is found that if the iEMA attention mechanism module is directly integrated into the C2PSA module, several technical problems will be faced. First of all, the iEMA attention mechanism module itself contains a complex joint attention mechanism in the spatial and channel dimensions and an inverted residual structure. If it is directly embedded into the C2PSA module without distinction, the network structure will become too complex locally, which will lead to feature redundancy and information disorder, affecting the coherence and effectiveness of feature extraction. At the same time, after the iEMA attention mechanism module is directly embedded, it lacks support for progressive modeling of multi-layer features and is difficult to fully utilize the advantages of the iEMA attention mechanism module in long-term and short-term dependent feature extraction. In addition, the C2PSA module design itself focuses on spatial attention. If the fusion structure is not optimized, there may be conflicts between their characteristics, resulting in problems such as unstable gradients and difficult convergence during the training process of the model, ultimately affecting the overall detection performance.
[0042] To solve the above technical problems, in this embodiment, the iEMA attention mechanism module is improved, and the iEMA Bloc module is proposed. The optimized iEMA Bloc module is introduced into the C2PSA module to form the C2PSA-iEMABloc module, rather than directly embedding a single iEMA attention mechanism module. The iEMA Bloc module is a deep encapsulation and extension of the iEMA attention mechanism module structure. It not only retains the joint modeling ability of the iEMA attention mechanism module for the spatial and channel dimensions, but also makes the features maintain consistency and efficiency during the flow process through hierarchical convolutional modules and residual connections. The iEMA Bloc module effectively alleviates the feature conflict caused by direct fusion through the cooperation of multiple convolutional modules and supports the layer-by-layer optimization and progressive enhancement of features.
[0043] As Figure 5 shown, the iEMA Bloc module is specifically as follows: The traditional Chinese medicine dispensing image dataset is divided into two paths. After one path of the traditional Chinese medicine dispensing image dataset passes through the iEMA attention mechanism module, it is connected with the other path of the traditional Chinese medicine dispensing image dataset through a residual connection to output the traditional Chinese medicine dispensing feature image dataset. The traditional Chinese medicine dispensing feature image dataset is divided into two paths. After one path of the traditional Chinese medicine dispensing feature image dataset passes through two convolutional layer modules, it is connected with the other path of the traditional Chinese medicine dispensing feature image dataset through a residual connection.
[0044] As Figure 6 shown, the C2PSA-iEMA Bloc module is specifically as follows: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset passes through a convolutional layer module and N (N = 1, 2, 3..., a positive integer) layers of the iEMA Bloc module in sequence, and then is connected with the other path of the traditional Chinese medicine dispensing image dataset and passes through a convolutional layer module.
[0045] Based on the C2PSA module structure, the input convolutional module is retained for preliminary feature extraction. Subsequently, the ordinary attention structure in the C2PSA module is replaced by multiple cascaded iEMA Bloc modules. Each iEMA Bloc module contains an inverted residual structure and an iEMA attention mechanism module inside. Through the residual path, efficient gradient propagation is achieved, and at the same time, joint modeling is carried out in the spatial dimension and the channel dimension to more comprehensively capture the long-term and short-term dependent features in the image. Multiple iEMA Bloc modules are cascaded to form a deep feature enhancement path, and at the end, the enhanced features are fused with the initial features through a feature concatenation operation, and then the fused features are re-extracted through a convolutional module. This fusion method significantly improves the feature expression ability and detection accuracy of the network while ensuring computational efficiency.
[0046] Through this optimized fusion method, the iEMA Bloc module not only solves the problems of feature redundancy and conflict caused by the direct fusion of the iEMA attention mechanism module and the C2PSA module, but also achieves high efficiency and stability in deep feature modeling. Finally, the fused module can comprehensively improve the performance of the LEO-YOLO-CM model in the object detection task without significantly increasing the computational complexity, especially the robustness and accuracy performance in complex scenarios.
[0047] To better illustrate the real-time detection method for the authenticity of traditional Chinese medicine dispensing described in this embodiment, it is described in detail through the following examples: To comprehensively evaluate the comprehensive performance of each model in the authenticity detection and semantic segmentation tasks of traditional Chinese medicine dispensing, in this embodiment, under the same dataset and experimental environment, the Mask R-CNN model (mask-based region convolutional neural network model), YOLOv5-seg model (v5-seg version of YOLO), YOLOv7-seg model (v7-seg version of YOLO), YOLOv8-seg model (v8-seg version of YOLO), YOLOv9-seg model (v9-seg version of YOLO), YOLOv10-seg model (v10-seg version of YOLO), YOLOv11n-seg model, YOLOv12-seg model (v12-seg version of YOLO) and the LEO-YOLO-CM model proposed in this embodiment are selected for comparative analysis. As Figure 7The following details the P, R, mAP@50 and other metrics of each model on the Box and Mask tasks, as well as the corresponding Params. The experimental results show that although the Mask R-CNN model performs well in P (for example, P(Box) = 0.907), its R and mAP@50 are slightly inferior to some lightweight models, and the model Params are as high as 4,574,243. In contrast, during the continuous iterative optimization process of the YOLO series of models, through structural innovation and the improvement of the attention mechanism, not only have significant improvements been achieved in mAP@50 and R, but also the Params scale has been maintained at an ideal level. For example, the YOLOv5-seg model, YOLOv7-seg model and YOLOv8-seg model all exceed 95% in key metrics, and the LEO-YOLO-CM model proposed in this embodiment has achieved a leading performance in both detection and segmentation tasks. Its P(Box) reaches 0.964, P(Mask) reaches 0.966, and mAP@50 is as high as 0.979. At the same time, the model Params are reduced to 2,464,598, which is 13.4% lower than the baseline model respectively. This series of data fully demonstrates that the LEO-YOLO-CM model combines lightweight and efficiency while ensuring high precision and high recall rate.
[0048] Judging from the comparison data of various metrics, the LEO-YOLO-CM model shows obvious advantages in many aspects such as P, R, mAP and model scale, and is particularly suitable for the requirements of real-time, accurate and efficient online detection in the scenario of detecting the authenticity of traditional Chinese medicine dispensing.
[0049] In response to the actual application requirements of the authenticity detection and semantic segmentation of traditional Chinese medicine dispensing, based on the lightweight YOLOv11n-seg model framework, this embodiment proposes an improved traditional Chinese medicine adulteration detection model - the LEO-YOLO-CM model. ODConv is introduced into the original network, effectively enhancing the ability to capture fine-grained texture and structural features of traditional Chinese medicine. At the same time, by integrating the iEMA Bloc module into the C2PSA module, the responsiveness of the model to key adulterated areas is further improved. In addition, LADH is adopted, which significantly reduces the Params and GFLOPs of the model while ensuring high precision and real-time performance. The results of the verification experiment conducted on the constructed dataset show that the mAP@50 of the LEO-YOLO-CM model for Box and Mask reaches 97.8% and 97.9% respectively, which are 6.3% and 5.6% higher than those of the original model. At the same time, the Params of the model are controlled within 2.46M, and the GFLOPs are reduced to 7.8 s, showing a significant balance in terms of accuracy, efficiency, and lightweight design. Further ablation experiments also verify the positive role of each structural module in improving the detection robustness of the model and the accuracy of the segmentation boundary.
[0050] As Figure 8 shown, the detection comparison results of the LEO-YOLO-CM model proposed in this embodiment and the YOLOv11n-seg model on typical traditional Chinese medicine dispensing images. Among them, the second column is the detection output of the YOLOv11n-seg model, and the first column is the detection output of the LEO-YOLO-CM model. Each medicinal material in the figure is presented in the form of a mask, and the border and label are used to identify the recognition category, true or false type (T- represents the real medicinal material, F- represents the adulterated medicinal material), and confidence level. It can be seen from the illustrated results that the YOLOv11n-seg model has problems such as missing detection of false medicinal materials and unclear recognition boundaries. For example, in the figure, F-MZC (Equisetum hiemale adulteration) is only partially detected or misjudged as other categories in the YOLOv11n-seg model. The LEO-YOLO-CM model proposed in this embodiment can completely cover the adulterated area in multiple formula samples, the boundary is close to the real shape, and it can accurately segment some small targets. In addition, the LEO-YOLO-CM model significantly improves the discrimination of real medicinal materials and still has good recognition accuracy in the case of overlapping and occlusion. This figure fully verifies the effectiveness of the proposed improvement scheme in improving the recognition ability of adulterated medicinal materials, enhancing the edge perception ability, and the overall detection accuracy, providing a more reliable technical support for the authenticity discrimination of traditional Chinese medicine formula images.
[0051] Embodiment 3. The real-time authenticity detection system for traditional Chinese medicine dispensing described in this embodiment includes the following modules: A construction module for constructing a traditional Chinese medicine dispensing image dataset; Model module, which constructs the LEO-YOLO-CM model, specifically as follows: In the Backbone of the YOLOv11n-seg model, the iEMA Bloc module is integrated into the C2PSA module. In the Backbone and Neck of the YOLOv11n-seg model respectively, C3K2 is replaced by ODConv. In the Head of the YOLOv11n-seg model, the detection head is replaced by LADH; Detection module, which is based on the LEO-YOLO-CM model to perform real-time authenticity detection on the traditional Chinese medicine dispensing image dataset.
[0052] Embodiment 4. An electronic device described in this embodiment includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; The memory is used to store computer programs; The processor, when executing the program stored on the memory, implements the real-time authenticity detection method for traditional Chinese medicine dispensing described in any one of Embodiments 1-2.
[0053] Embodiment 5. A computer-readable storage medium described in this embodiment stores a computer program in the computer-readable storage medium. When the computer program is executed by a processor, it implements the real-time authenticity detection method for traditional Chinese medicine dispensing described in any one of Embodiments 1-2.
[0054] The above has introduced in detail the real-time authenticity detection method, system, device, and storage medium for traditional Chinese medicine dispensing proposed by the present invention. Specific examples are used in this article to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A real-time detection method for the authenticity of traditional Chinese medicine dispensing, characterized in that, It includes the following steps: Step S1, constructing a traditional Chinese medicine dispensing image dataset; Step S2, constructing a LEO-YOLO-CM model, specifically: In the Backbone of the YOLOv11n-seg model, fuse the iEMA Bloc module into the C2PSA module. Respectively in the Backbone and Neck of the YOLOv11n-seg model, replace C3K2 with ODConv. In the Head of the YOLOv11n-seg model, replace the detection head with LADH; Step S3, based on the LEO-YOLO-CM model, perform real-time authenticity detection on the traditional Chinese medicine dispensing image dataset.
2. The real-time detection method for the authenticity of traditional Chinese medicine dispensing according to claim 1, wherein, In the said Step S2, the said iEMA Bloc module is specifically: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset passes through the iEMA attention mechanism module and then performs a residual connection with the other path of the traditional Chinese medicine dispensing image dataset, outputting a traditional Chinese medicine dispensing feature image dataset. The traditional Chinese medicine dispensing feature image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing feature image dataset passes through the multi-stage convolutional layer module and then performs a residual connection with the other path of the traditional Chinese medicine dispensing feature image dataset.
3. The real-time detection method for the authenticity of traditional Chinese medicine dispensing according to claim 2, wherein The said iEMA attention mechanism module is specifically: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset passes through the batch normalization 2D layer, the EMA attention mechanism module, and the convolutional layer module in sequence. After adding by starting the skip connection function between the EMA attention mechanism module and the convolutional layer module, it is then input into the convolutional layer module and the dropout path in sequence and added to the other path of the traditional Chinese medicine dispensing image dataset.
4. The real-time detection method for the authenticity of traditional Chinese medicine dispensing according to claim 1, characterized in that, In the said Step S2, the fusion of the said iEMA Bloc module into the C2PSA module is specifically: The traditional Chinese medicine dispensing image dataset is divided into two paths. One path of the traditional Chinese medicine dispensing image dataset passes through the convolutional layer module and the multi-stage iEMA Bloc module in sequence and then is connected to the other path of the traditional Chinese medicine dispensing image dataset and passes through the convolutional layer module.
5. A real-time detection system for the authenticity of traditional Chinese medicine dispensing, characterized in that, It includes the following modules: A construction module for constructing a traditional Chinese medicine dispensing image dataset; A model module for constructing a LEO-YOLO-CM model, specifically: In the Backbone of the YOLOv11n-seg model, fuse the iEMA Bloc module into the C2PSA module. Respectively in the Backbone and Neck of the YOLOv11n-seg model, replace C3K2 with ODConv. In the Head of the YOLOv11n-seg model, replace the detection head with LADH; A detection module for performing real-time authenticity detection on the traditional Chinese medicine dispensing image dataset based on the LEO-YOLO-CM model.
6. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; The memory is used for storing computer programs; The processor, when executing the programs stored on the memory, implements the real-time authenticity detection method for traditional Chinese medicine dispensing as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the real-time detection method for the authenticity of traditional Chinese medicine dispensing according to any one of claims 1-4.
Citation Information
Patent Citations
Distributed AIGC forgery detection method based on deep fusion network
CN118015715A
Fine-grained deep fake face identity detection method under remote identity authentication scene
CN118172810A
Fan surface defect detection method, device and equipment based on lightweight PC-EMA algorithm and storage medium
CN118691573A
Underwater target detection method and system based on improved Yolov11
CN120014235A
Small sample steel defect detection method based on attention feature pyramid mechanism
WO2025010883A1
Cited By
Traditional Chinese medicinal material target detection method and system based on improved YOLOV11
CN121074358A
Target detection model and method based on deep learning
CN121095726A
Target identification method and device, storage medium and program product
CN121415368A