AI authenticity identification method and system based on traditional chinese medicine powder microscopic image

By employing a closed-loop annotation process involving standardized microscopic slide preparation, lightweight models, and manual correction, combined with the DETR architecture and Transformer feature enhancement module, the subjectivity and efficiency issues of microscopic identification of traditional Chinese medicine powders have been resolved, achieving high-accuracy identification of genuine and counterfeit traditional Chinese medicine powders.

CN122336743APending Publication Date: 2026-07-03HUBEI UNIV OF CHINESE MEDICINE +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUBEI UNIV OF CHINESE MEDICINE
Filing Date
2026-01-23
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing microscopic identification techniques for Chinese herbal medicine powders suffer from problems such as strong subjectivity, low efficiency, and difficulty in quantification and scaling. Furthermore, intelligent identification methods lack accuracy when data annotation and microscopic feature differences are minor.

Method used

We employ standardized microscopic slide preparation and imaging techniques, combined with a closed-loop annotation process involving lightweight model construction and manual correction. We use a DETR architecture detection model to recognize microscopic images of traditional Chinese medicine, and introduce a Transformer feature enhancement module and a multi-scale feature fusion network to optimize the loss function and improve recognition accuracy.

Benefits of technology

It achieves high-accuracy identification of microscopic images of Chinese medicine powders, reduces the threshold for data preparation, improves the ability to model small targets and complex texture information, and significantly enhances the accuracy of identifying closely related adulterants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122336743A_ABST
    Figure CN122336743A_ABST
Patent Text Reader

Abstract

This invention discloses an AI-based method and system for identifying the authenticity of traditional Chinese medicine (TCM) powder based on microscopic images, belonging to the field of TCM identification technology. The method includes: performing microscopic imaging of the TCM to be tested and performing depth-of-field fusion to obtain a microscopic image; inputting the microscopic image into a trained detection model for TCM identification; constructing a detection model based on a deep learning recognition model with a Transformer architecture; the training process of the detection model is as follows: selecting a subset of standard sample microscopic images and manually annotating the microscopic identification features to obtain manually annotated images; using the manually annotated images to train the detection model to obtain a lightweight model; using the lightweight model to identify and annotate the microscopic identification features of all standard sample microscopic images, and then manually reviewing and correcting them to obtain corrected standard sample microscopic images; training the detection model using the corrected standard sample microscopic images to obtain the trained detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traditional Chinese medicine identification technology, and specifically relates to an AI-based method and system for identifying the authenticity of traditional Chinese medicine powder based on microscopic images. It relates to a method for identifying traditional Chinese medicine decoction pieces or powders that can be identified by microscopic images as specified in the pharmacopoeia. Background Technology

[0002] Prepared herbal medicines are a core form of clinical application in Traditional Chinese Medicine (TCM), and their authenticity and quality directly affect medical safety and efficacy. With the continuous expansion of the TCM market, the variety of herbs in circulation is vast, leading to frequent instances of confusion between closely related species of the same family and the adulteration of counterfeit products with similar characteristics. Because many herbs lose their original morphological characteristics, such as shape and surface texture, after being pulverized into powder, traditional methods of identification often fail. In such cases, microscopic identification becomes a crucial means of determining the authenticity of powdered TCM.

[0003] However, existing microscopic identification techniques for traditional Chinese medicine powders face challenges in practical applications. Firstly, there are limitations to traditional manual identification. Currently, the microscopic identification methods stipulated in the Chinese Pharmacopoeia mainly rely on professional inspectors observing the cellular characteristics of Chinese medicine powders under a microscope. However, this method suffers from high subjectivity, low standardization, and inefficiency, making it difficult to quantify and scale up. The judgment of characteristics is highly dependent on the personal experience and professional competence of the inspectors; different personnel may yield different results for the same sample. Furthermore, manual microscopic examination is time-consuming and labor-intensive, failing to meet the high-throughput demands of large-scale quality testing by modern Chinese medicine enterprises and drug testing institutes. Simultaneously, there is a relative shortage of professional identification personnel with profound knowledge of microscopic taxonomy.

[0004] Existing technologies also disclose methods for intelligent identification using microscopic images. For example, patent application number CN202511031623.X discloses a method for identifying Chinese medicinal materials based on dual-path dynamic convolution, including the following steps: Step 1, constructing a Chinese medicinal material identification database; Step 2, constructing a lightweight medicinal material identification model; this lightweight medicinal material identification model is based on the YOLOv11 model and introduces global... Local dual-path dynamic convolution module and granular coordinate attention module; global [function] embedded in the backbone network The local dual-path dynamic convolution module features dual-path feature extraction and adaptive fusion mechanisms; the granular coordinate attention module maintains the basic CA core architecture and introduces a multi-granularity pooling mechanism; Step 3: Iteratively train the constructed lightweight medicinal herb recognition model until the optimal model parameters are obtained; Step 4: Perform performance verification on the optimized lightweight medicinal herb recognition model; Step 5: Deploy the lightweight medicinal herb recognition model that meets the performance verification requirements to GPUs and edge devices; Step 6: Call the lightweight medicinal herb recognition model to recognize the input Chinese medicinal herb images.

[0005] For example, patent application number CN202411324724.1 discloses a microscopic detection method for components of a thin-layer sample of traditional Chinese medicine powder, comprising: acquiring a microscopic image of the thin-layer sample of traditional Chinese medicine powder, wherein the microscopic image is obtained by taking pictures of a glass slide of the thin-layer sample of traditional Chinese medicine powder to be tested using an electric scanning microscope; inputting the microscopic image into a TransNeXt target detection model to obtain the category information and location information of different components in the thin-layer sample of traditional Chinese medicine powder; wherein, the TransNeXt target detection model includes an input layer, a feature extraction network, a multi-scale feature fusion network, and a target detection layer. The system comprises a network and an output layer; the input layer is used to crop and enhance the input microscopic image; the feature extraction network is a TransNeXt network, used to extract features of different scales from the microscopic image output by the input layer; the multi-scale feature fusion network is used to fuse and enhance the features of different scales extracted by the TransNeXt network; the target detection network is used to detect the category information of Chinese medicine powder and the location information of different categories of Chinese medicine powder based on the fused features; and the output layer is used to output the category information and location information of different components in the detected Chinese medicine powder.

[0006] When the applicant used existing intelligent identification methods for authentication, the following problems were found: (1) When training the model, a large amount of data in the training set needs to be labeled manually, which is a lot of work; (2) When preparing glass slides, the powder particles of traditional Chinese medicine have a three-dimensional thickness, and traditional single-layer photography can easily lead to some features being blurred, which will affect the accuracy of identification. (3) The differences in microscopic features between genuine and counterfeit products are small. For example, the stone cells of Magnolia officinalis and Magnolia liliiflora are both branched, with only differences in wall thickness. The sample quantity of some features is small, such as the small number of oil cell samples of Magnolia officinalis, which affects the accuracy of identification. Summary of the Invention

[0007] To address the aforementioned problems, this invention provides an AI-based method and system for identifying the authenticity of traditional Chinese medicine powders using microscopic images. This invention achieves high-accuracy identification through three levels of technological innovation: (1) standardized microscopic slide preparation and imaging processes; (2) a closed-loop annotation process of "lightweight model construction - manual correction"; and (3) a model fine-tuning strategy targeting microscopic features. The technical solution is as follows: On one hand, embodiments of the present invention provide an AI-based method for identifying the authenticity of traditional Chinese medicine powder based on microscopic images, comprising the following steps: S1: Perform microscopic imaging on the Chinese medicine to be tested and perform depth-of-field fusion to obtain the microscopic image of the medicine to be tested; S2: Input the microscopic image to be tested into the trained detection model for the identification of traditional Chinese medicine; The detection model is built upon a deep learning recognition model that detects Transformer architectures, and the detection model has the following adjustments: (1) Add a Transformer feature enhancement module and a multi-scale feature fusion network between the backbone network and the detection head; (2) Freeze the convolution parameters of the first 10 layers of the backbone network in the early stage of training, and only adjust the high-level semantic network. (3) For the loss function, increase the weight coefficient γ of the segmentation mask loss term L_mask, increase the weight ratio of scarce categories in the target classification loss term L_total, and introduce a constraint mechanism for small targets and structural boundary regions in the segmentation mask loss term L_mask. The training process of the detection model is as follows: S101: Obtain a microscopic image of the standard sample, wherein the microscopic image of the standard sample is obtained by performing microscopic imaging on the standard sample and performing depth-of-field fusion. S102: Select some standard sample microscopic images and manually annotate the microscopic identification features to obtain manually annotated images. Use the manually annotated images to train the detection model to obtain a lightweight model. S103: A lightweight model is used to identify and label the microscopic identification features of all standard microscopic images, and then the corrected standard microscopic images are obtained after manual review and correction. S104: The detection model is trained by using the corrected standard microscopic image to obtain the trained detection model; The microscopic identification features are those specified in the pharmacopoeia for the microscopic identification of traditional Chinese medicine.

[0008] Before microscopic imaging, the traditional Chinese medicine was processed as follows: the medicine was dried in a 60℃ oven for 2 hours, pulverized, and then passed through an 80-mesh sieve; a set amount of powder was weighed and placed on a glass slide, and the slide was prepared using a standardized clearing and sealing method; the standardized clearing method was to add 20μL of chloral hydrate solution and clear it over an alcohol lamp at intervals of 5 times, each time for 8-12 seconds, with an interval of 30 seconds, until all air bubbles were removed; the sealing method was to add 1 drop of glycerol after cooling and then seal the slide; during microscopic imaging, the magnification of the objective lens was 40 times, and the resolution of the image obtained was 3840*2160.

[0009] Preferably, the set amount is 1.0-1.5 mg.

[0010] Preferably, the parameters for depth-of-field fusion are: 40-50 layers, with a scanning interval of 2μm between each layer.

[0011] Among them, the microscopic identification features include a variety of features such as stone cells, phloem fibers, wood fibers, vessels, cork cells, parenchyma cells, starch grains, oil cells, calcium oxalate crystals, secretory tissues, hyphae, spores, and irregular clumps.

[0012] Specifically, in step S101, the slides of 5-50 standard samples are subjected to microscopic imaging and depth-of-field fusion to obtain a corresponding number of microscopic images. Each microscopic image is segmented to obtain a large number of standard sample microscopic images. Each standard sample microscopic image contains 0-10 microscopic identification features. In step S102, during manual annotation, standard microscopic images with 1-4 microscopic identification features conforming to the pharmacopoeia are selected for manual annotation, and standard microscopic images that do not meet the requirements are discarded. For rare microscopic identification features, if the number of annotations for other microscopic identification features meets the requirements, standard microscopic images with rare microscopic identification features are selected for annotation, and only the rare microscopic identification features are annotated. In step S103, the manual review and correction includes adding annotations, reducing annotations, changing the annotation category, changing the annotation border, and determining whether the identification requirements are met. The detection model is trained using the corrected standard microscopic images that meet the identification requirements to obtain the trained detection model. In step S1, a microscope image of one Chinese medicine to be tested is formed by microscopic imaging and depth fusion to obtain a microscopic image of the medicine to be tested, and the microscopic image of the medicine to be tested is segmented; in step S2, all the segmented microscopic images of the medicine to be tested are input into the trained detection model.

[0013] The model's loss function L_total is: L_total=α*L_cls+β*L_box+γ*L_mask; Wherein, L_total is the target classification loss term, used to constrain the prediction results of the microstructure category; L_box is the bounding box regression loss term, used to constrain the localization accuracy of the target position and scale; L_mask is the segmentation mask loss term, used to constrain the segmentation accuracy of the microstructure at the pixel level; α, β, and γ are the weight coefficients of L_total, L_box, and L_mask, respectively.

[0014] Specifically, the Chinese herbal medicine to be tested is Magnolia officinalis, and the microscopic identification features include sclereid features, fiber features, and oil cell features, with oil cell features being a rare microscopic identification feature; in step S102, the microscopic images of some standard samples contain a total of at least N1 sclereid features, at least N2 fiber features, and at least N3 oil cell features, where N1∈[300,1000], N2∈[300,1000], and N3∈[100,500]; in step In step S104, the corrected standard microscopic image that meets the identification requirements contains a total of at least M1 stone cell features, at least M2 fiber features, and at least M3 oil cell features, where M1∈[500,50000], M2∈[500,50000], and M3∈[300,10000]; when calculating the loss function, α∈[0.2,0.5], β∈[0.2,0.5], and γ∈[0.2,0.6].

[0015] The hyperparameters of the detection model are as follows: the optimizer uses AdamW with weight decay; the learning rate scheduling adopts the Cosine Warmup strategy with 3 warm-up rounds; the input image size is 640×640, the batch size is 16, and the training takes 300 rounds.

[0016] On the other hand, embodiments of the present invention also provide an AI-based system for authenticating traditional Chinese medicine powder based on microscopic images, comprising: Microscopic image acquisition module: used for microscopic imaging of the Chinese medicine to be tested and the standard; The depth-of-field fusion module is used to perform depth-of-field fusion on the microscopic images obtained by the microscopic image acquisition module to obtain the microscopic image of the test sample and the microscopic image of the standard sample respectively. The detection model creation module is used to build detection models based on deep learning recognition models with the Transformer architecture. The detection model training module is used to select a subset of standard sample microscopic images and manually annotate the microscopic identification features to obtain manually annotated images. The detection model is then trained using these manually annotated images to obtain a lightweight model. The lightweight model is then used to identify and annotate the microscopic identification features of all standard sample microscopic images, and after manual review and correction, corrected standard sample microscopic images are obtained. The detection model is then trained using these corrected standard sample microscopic images to obtain the trained detection model. The identification module is used to input the microscopic image to be tested into the trained detection model for the identification of traditional Chinese medicine.

[0017] The beneficial effects of the technical solution provided by the embodiments of the present invention are as follows: (1) Standardized microscopy preparation and multidimensional imaging techniques adapted for AI recognition are adopted. To address the problems of arbitrary sampling amounts and inconsistent permeability leading to high background noise and severe cell stacking in traditional microscopy preparation, this invention establishes a set of sample preparation standards. Quantitative preparation: The sampling amount of Chinese herbal medicine powder is clearly limited to 1.0-1.5 mg. Experiments have shown that this weight range can effectively balance feature coverage and background clarity under microscopic field of view, avoiding feature omissions due to insufficient powder or cell overlap and occlusion due to excessive powder. Multi-layer depth-of-field fusion acquisition: Addressing the issue that Chinese herbal medicine powder particles have three-dimensional thickness and traditional single-layer imaging easily leads to blurred features, this invention introduces a 40-50 layer Z-stack depth-of-field fusion technology (layer spacing 2 μm). This technology significantly improves the edge clarity of thick-walled cells (such as stone cells) and refractive structures (such as oil cells), providing high-quality standardized image input for AI algorithms.

[0018] (2) Annotation process based on "lightweight model pre-training - manual correction". Addressing the high cost of annotating microscopic images of traditional Chinese medicine, this invention avoids direct full manual annotation. Instead, it first trains a lightweight model based on a small number of standardized images, pre-annotates new data, and then has traditional Chinese medicine identification experts correct the pre-annotation results. Finally, the corrected data is used to train the model. This process can quickly construct a large-scale dataset containing fine structures such as stone cells, vessels, and oil chambers, significantly reducing the data preparation threshold and workload.

[0019] (3) Fine-tuning of the detection model based on the DETR architecture. Addressing the challenge of subtle differences in microscopic features between adulterated and counterfeit Chinese medicines (TCMs), such as the branched structure of stone cells in Magnolia officinalis and Magnolia liliiflora with only differences in wall thickness, this invention constructs a hybrid deep learning architecture integrating a convolutional neural network and a Transformer feature enhancement module. This architecture, based on the local texture extraction of the convolutional backbone network, adds a Transformer feature enhancement module between it and the detection head. Without altering the original detection output structure, it effectively models small targets, multi-scale structures, and complex texture information in microscopic images of TCMs. Based on a general visual model, fine-tuning is performed on microscopic texture features by introducing a multi-scale feature fusion network. To address class imbalance issues such as oil cells, the recognition accuracy is significantly improved by optimizing the loss function. Simultaneously, the weight analysis of fine features such as cell wall thickness and pore density is enhanced, thereby achieving accurate differentiation of closely related adulterated and counterfeit products. Attached Figure Description

[0020] Figure 1 This is a flowchart of the AI-based method for identifying the authenticity of traditional Chinese medicine powder based on microscopic images in an embodiment of the present invention; Figure 2 This is a flowchart of the training process for the detection model; Figure 3 This is a schematic diagram of the processing principle of the detection model; Figure 4 These are comparison images of the microscopic slide preparation effects under different powder dosages (0.5-2.0mg); Figure 5 These are comparison images of the effects of different depth-of-field blending techniques; Figure 6 This is a diagram illustrating the microscopic identification features of Magnolia officinalis. Figure 7 It is the precision-recall curve for the microscopic feature recognition of Magnolia officinalis; Figure 8 It is the confusion matrix of the recognition results of the Houpu model; Figure 9 This is the F1-confidence curve of the Homo pueraria model; Figure 10 This is a chart showing the number of microscopic features of Magnolia officinalis; Figure 11 This is a schematic diagram of the automated analysis main interface of the microscopic intelligent identification system for traditional Chinese medicine; Figure 12 This is a schematic diagram of a human-machine collaborative microscopic feature visualization and correction interface; Figure 13 This is a block diagram illustrating the principle of the detection model. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings.

[0022] Example 1 See Figure 1-3 Example 1 discloses an AI-based method for identifying the authenticity of traditional Chinese medicine powder based on microscopic images, comprising the following steps: S1: Perform microscopic imaging on the Chinese medicine to be tested and perform depth-of-field fusion to obtain the microscopic image of the medicine to be tested.

[0023] Specifically, a microscopic image of a glass slide containing a Chinese herbal medicine to be tested is obtained by performing depth-of-field fusion, and the microscopic image to be tested is then segmented.

[0024] S2: Input the microscopic image to be tested into the trained detection model for the identification of traditional Chinese medicine.

[0025] Specifically, in step S2, all (preferred) or partially segmented microscopic images to be tested are input into the trained detection model.

[0026] The detection model is built upon a deep learning recognition model that detects the Transformer architecture (DETR), and the detection model has the following adjustments: (1) Add a Transformer feature enhancement module and a multi-scale feature fusion network (structure as follows) between the backbone network and the detection head. Figure 13 (As shown). This modification enables effective modeling of small targets, multi-scale structures, and complex texture information in microscopic images of traditional Chinese medicine without altering the original detection output structure. The backbone network is a convolutional neural network (CNN), specifically ResNet-50.

[0027] (2) During the initial training phase, the convolutional parameters of the first 10 layers of the backbone network are frozen, and only the high-level semantic network is adjusted. This change preserves the model's ability to recognize general lines (without modifying the first 10 layers), allowing the model to concentrate its computing power on fine-tuning the high-level semantic network. This enables the model to specifically adapt to the feature variations of fine textures such as "cell wall thickness" and "pore density" in microscopic images of traditional Chinese medicine.

[0028] (3) For the loss function, the weight coefficient γ of the segmentation mask loss term L_mask is increased, the weight ratio of scarce categories in the target classification loss term L_total is increased, and a constraint mechanism for small targets and structural boundary regions is introduced into the segmentation mask loss term L_mask. By optimizing the loss function, the recognition accuracy is significantly improved, while the weight analysis of fine features such as cell wall thickness and pore density is enhanced, thereby achieving accurate differentiation of closely related imitations.

[0029] The model's loss function L_total is: L_total=α*L_cls+β*L_box+γ*L_mask.

[0030] Wherein, L_total is the target classification loss term, used to constrain the prediction results of the microscopic structure category; L_box is the bounding box regression loss term, used to constrain the localization accuracy of the target position and scale; L_mask is the segmentation mask loss term, used to constrain the segmentation accuracy of the microscopic structure at the pixel level; α, β, and γ are the weight coefficients of L_total, L_box, and L_mask, respectively, which can be set by normalization. Among them, α, β, and γ can be dynamically adjusted according to the category distribution characteristics of different microscopic datasets; specifically, α∈[0.2,0.5], β∈[0.2,0.5], γ∈[0.2,0.6].

[0031] Specifically, by increasing the weight coefficient γ of the segmentation mask loss term L_mask and increasing the weight ratio of scarce categories in the target classification loss term L_total, small-sized, low-frequency microstructures such as oil cells (or scarce microscopic identification features) can gain a higher contribution during gradient updates, thereby mitigating the dominant effect of high-frequency categories on model training. A constraint mechanism targeting small targets and structural boundary regions is introduced into the segmentation mask loss term L_mask to enhance the model's ability to learn the continuity and boundary consistency of microscopic structure contours. While ensuring overall detection and segmentation stability, this significantly improves the segmentation accuracy and recognition reliability for microstructures with few samples, such as oil cells.

[0032] The training process of the detection model is as follows: S101: Obtain microscopic images of the standard samples. These images are obtained by performing microscopic imaging and depth-of-field fusion on the standard samples. Specifically, microscopic imaging and depth-of-field fusion are performed on slides of 5-50 standard samples to obtain a corresponding number of microscopic images (specifically, a 14*14mm field of view is selected). Each microscopic image is segmented to obtain a large number of standard sample microscopic images (e.g., each microscopic image is segmented into 400 standard sample microscopic images). Each standard sample microscopic image contains 0-10 microscopic identification features. The segmentation process is existing technology, and detailed description is omitted in this embodiment.

[0033] S102: Select a portion of standard sample microscopic images and manually annotate the microscopic identification features to obtain manually annotated images. Use the manually annotated images to train the detection model to obtain a lightweight model. The total number of each microscopic identification feature in the manually annotated images should preferably be greater than or equal to 300 (at least 100 for rare microscopic identification features).

[0034] Specifically, during manual annotation, standard microscopic images with 1-4 microscopic identification features conforming to the pharmacopoeia are selected for manual annotation, while standard microscopic images that do not meet the requirements are discarded. Taking Magnolia officinalis as an example, typically each standard microscopic image has 1-3 sclereid and fibrous features, and 0-1 oil cell features. The entire microscopic image (before segmentation) has 10-50 oil cell features. Oil cell features are very scarce compared to sclereid and fibrous features, leading to an imbalance. For scarce microscopic identification features, provided the number of annotations for other microscopic identification features meets the requirements, standard microscopic images with scarce microscopic identification features are selected for annotation, and only the scarce microscopic identification features are annotated. Taking Magnolia officinalis as an example, typically, 5-10 standard slides with sclereid and fibrous features may meet the quantity requirement, while oil cell features may require manual annotation of all standard slides.

[0035] S103: A lightweight model is used to identify and annotate the microscopic identification features of all standard sample microscopic images. After manual review and correction, corrected standard sample microscopic images are obtained. Manual review and correction includes adding or removing annotations, changing annotation categories, altering annotation borders, and determining whether the images meet identification requirements. Typically, the requirement is first determined, and correction is only performed if it is met. Figure 6 As shown, taking Magnolia officinalis as an example, the characteristics of stone cells, fibers and oil cells are marked by lines of different colors (implemented by corresponding programs).

[0036] S104: The detection model is trained using corrected microscopic images of standard samples that meet the identification requirements. In the corrected microscopic images of the standard samples, the total number of each microscopic identification feature in the manually labeled images should preferably be greater than or equal to 500; specifically, the total number of rare microscopic identification features should be greater than or equal to 300 (preferably greater than or equal to 500), and the total number of other microscopic identification features (excluding rare microscopic identification features) should be greater than or equal to 500 (preferably greater than or equal to 1000).

[0037] Both manual labeling and manual review and correction require personnel with the ability and experience to identify Chinese medicines.

[0038] Microscopic identification features are those specified in the pharmacopoeia for the microscopic identification of traditional Chinese medicines. Specifically, these features include one or more of the following: tissue structure features, intracellular inclusion features, and exogenous impurity features; including but not limited to: multiple features such as stone cells, phloem fibers, wood fibers, vessels, cork cells, parenchyma cells, starch grains, oil cells, calcium oxalate crystals (e.g., needle crystals, cluster crystals, prismatic crystals), secretory tissues, hyphae, spores, and irregular aggregates. For most traditional Chinese medicines, the pharmacopoeia specifies corresponding microscopic identification features and identification methods. More specifically, for Magnolia officinalis, microscopic identification features include stone cell features, fiber features, and oil cell features; for Poria cocos, microscopic identification features include hyphal features, branched aggregate features, and granular aggregate features; for Dioscorea opposita, microscopic identification features include calcium oxalate needle crystal features, vessel features, starch grain features, fiber features, and sieve tube features.

[0039] The processing and slide preparation procedures for the Chinese herbal medicines to be tested and the standard substances shall comply with the requirements of the pharmacopoeia, national standards, or industry standards. Different medicines may require different processing methods. This embodiment standardizes the processing and slide preparation methods based on the method of this patent and the provisions of the pharmacopoeia. For most Chinese herbal medicine slices, the following process can be adopted: In practice, the sample size, permeabilizer ratio, and permeabilization time are entirely dependent on the operator's feel. Furthermore, the quality of data sources varies greatly. If the powder sample size is too large, cell tissues are severely stacked and obscured under the microscope, preventing the AI ​​model from extracting effective features. If the sample size is too small, the feature distribution is sparse, making it difficult to represent the overall sample situation, leading to missed detections. If permeabilization is incomplete, background impurities cause severe interference, significantly increasing the signal-to-noise ratio of the image. This non-standardized front-end sample preparation directly leads to poor robustness and a significant drop in recognition rate when the back-end algorithm faces real market samples. This patent, through exploration, standardizes the slide preparation process, achieving excellent results with its method.

[0040] Before microscopic imaging, the traditional Chinese medicine was processed as follows: the medicine was dried in an oven at 60℃ for 2 hours, pulverized, and then passed through an 80-mesh sieve. A predetermined amount of powder was weighed and placed on a glass slide, spread as flat as possible, and the slide was prepared using standardized transmission and mounting methods.

[0041] The standardized permeation method is as follows: add 20 μL of chloral hydrate solution, permeate over an alcohol lamp 5 times at intervals, each time for 8-12 seconds (specifically 10 seconds), with an interval of 30 seconds, until all bubbles are expelled.

[0042] The mounting method is as follows: after cooling, add 1 drop of glycerin for mounting.

[0043] In microscopic imaging, the objective lens has a magnification of 40x, and the eyepiece has a magnification of 10x. The magnification of the objective lens can also be adjusted as needed, such as from 30x to 50x. The resolution of the resulting image is 3840*2160, which can also be adjusted as needed.

[0044] Preferably, the dosage is set at 1.0-1.5 mg. For example... Figure 4 The image shows the microscopic views under various powder concentrations. Experimental results show that when the powder concentration is 1.0 mg and 1.5 mg, the background of the microscopic image is clear and the cell features are complete and easily distinguishable, resulting in the highest AI recognition rate. When the powder concentration is <0.5 mg, there are too few features, and when the powder concentration is >2.0 mg, the cells overlap severely, leading to a decrease in the accuracy of AI recognition.

[0045] Preferably, the parameters for depth-of-field fusion are: 40-50 layers, with a scanning interval of 2μm between each layer. For example... Figure 5 The images shown are microscopic views at various depth-of-field levels. Compared to traditional single-layer imaging, the 40-50 layer fused images exhibit significantly higher clarity in the full-layer structure of the sample, outperforming the 30-layer and 35-layer images. This effectively resolves the issues of blurred and overlapping edges in thick-walled cells, such as stone cells. More preferably, the depth-of-field fusion layer is 50 layers.

[0046] Example 2 See Figure 1-3 Example 2 discloses an AI-based method for identifying the authenticity of traditional Chinese medicine powder using microscopic images, specifically for identifying Magnolia officinalis. The process is largely the same as in Example 1, except that the tested traditional Chinese medicine is Magnolia officinalis, and its microscopic features as specified in the pharmacopoeia are stone cells, oil cells, and fibers. Oil cell features are a rare microscopic identification feature. In step S102, the microscopic images of some standard samples contain a total of at least N1 stone cell features, at least N2 fiber features, and at least N3 oil cell features, where N1 ∈ [300, 1000], N2 ∈ [300, 1000], and N3 ∈ [100, 500]. In step S104, the corrected microscopic images of the standard samples that meet the identification requirements contain a total of at least M1 stone cell features, at least M2 fiber features, and at least M3 oil cell features, where M1 ∈ [500, 50000], M2 ∈ [500, 50000], and M3 ∈ [300, 10000]. The specific process is as follows: Step 1: Standardized quantitative preparation of Chinese herbal medicine powder. Powder particle size: The dried bark of the Chinese herbal medicine Magnolia officinalis Rehd. et Wils. was dried in a 60℃ electric hot air drying oven for 2 hours, then pulverized for 30 seconds and passed through an 80-mesh sieve. This step ensures uniform powder particle size and avoids large particles obscuring key microscopic features.

[0047] Powder weight: Accurately weigh 1.0-1.5 mg of Chinese herbal powder and place it in the center of a glass slide.

[0048] Standardized permeation: Add 20 μL of chloral hydrate solution and permeate over an alcohol lamp 5 times at intervals, each time for about 10 seconds, with an interval of 30 seconds, until all bubbles are expelled.

[0049] Sealing: After cooling, add 1 drop of glycerin to seal the slide, avoiding the formation of air bubbles.

[0050] Step 2: Multi-layer depth-of-field fusion image acquisition Using an Olympus BX43F smart microscope equipped with a high-definition camera, the objective magnification was set to 40x. Depth-of-field fusion acquisition mode was enabled (via the Z-stack driver), with 50 fusion layers and an inter-layer scanning distance of 2μm. The system automatically recorded focal length, exposure time, and white balance parameters, and the images were saved in TIFF format.

[0051] Step 3: Model Optimization Preliminary model training: The detection model is trained using a small number of manually labeled seed images to obtain a lightweight model.

[0052] The manually labeled references are as follows: Numerous fibers, 15-32 μm in diameter, with very thick walls, some wavy or serrated on one side, lignified, with indistinct pits. Sclereids are square, oval, ovoid, or irregularly branched, 11-65 μm in diameter, sometimes with visible lamellae; those with irregular branches are generally larger, reaching up to 326 μm in length. Oil cells are oval or sub-rounded, 50-100 μm in diameter, containing yellowish-brown oily substances.

[0053] AI candidate annotation generation: Applying a lightweight model to massive unlabeled images to automatically generate candidate polygon boxes for microstructures (sclereid features, fiber features, and oil cell features).

[0054] Manual review and correction: Chinese medicine identification experts can quickly verify candidate labels through a visual interface, eliminate errors and supplement omissions, and greatly reduce the workload of labeling from scratch.

[0055] Dataset Update and Composite Augmentation: The reviewed data is added to the training set. To improve the model's robustness under different microscopic conditions, this invention employs a composite data augmentation strategy, specifically including: Geometric transformations: random rotation, mirroring, translation / scaling, etc. Pixel perturbation: Illumination and color perturbation (HSV_h / s / v, etc., to simulate color differences under different microscope light sources; Advanced enhancements: Introducing strategies such as MixUp (image blending), Copy-Paste (instance copy and paste), and Erasing (random erasure) to artificially increase the complexity and diversity of samples, forcing the model to learn more fundamental texture features.

[0056] The aforementioned data augmentation strategy is a conventional process, and detailed description is omitted in this embodiment. Those skilled in the art will also know that data augmentation can be introduced in this process.

[0057] Step 4: Model Training The trained detection model is obtained by training the detection model with the reviewed data.

[0058] The following adjustments and settings were made during the training process of the detection model: The loss function needs to be adjusted.

[0059] Transfer learning strategy: Freeze the parameters of the first 10 convolutional layers of the backbone network in the early stage of training (freeze=10), and only fine-tune the high-level semantic network to adapt to small sample training and prevent overfitting.

[0060] Hyperparameter settings: The optimizer uses AdamW with weight decay; the learning rate scheduling uses the Cosine Warmup strategy (warmup_epochs=3); the input image size is 640×640, the batch size is 16, and the training lasts for 300 epochs.

[0061] Example 3: Authenticity Verification of Magnolia officinalis and its Adulterants To verify the practical effect of the AI-based method for identifying genuine and counterfeit Chinese medicine powders disclosed in Example 2, this example uses Magnolia officinalis as the model for performance testing. This example uses Magnolia officinalis and its common adulterants (Magnolia liliiflora, Magnolia x soulangeana, Magnolia officinalis, Eucommia ulmoides) as examples. Identifying Magnolia officinalis from adulterants is quite difficult, thus verifying the practical effect of the method described in Example 2.

[0062] The hardware configuration for this method is as follows: Standardized sample preparation module: Equipped with an 80-mesh standard sieve with an aperture of 0.180 mm and a precision electronic balance with a measurement range accuracy of 0.01 mg, used to perform the 1.0-1.5 mg quantitative sampling described in Example 1.

[0063] Microscopic imaging acquisition terminal: includes an Olympus BX43F digital microscope and a high-resolution camera E3ISPM08300KPD; built-in Z-stack driver for automatic acquisition of 50-layer depth-of-field fusion images.

[0064] Intelligent analysis workstation: Equipped with a detection model. It performs real-time inference on the acquired images and outputs the category of features (such as "Magnolia officinalis sclereids") and their confidence scores.

[0065] Human-computer interaction and reporting terminals: Visual calibration interface: such as Figure 12 As shown, the system adopts a "full pre-annotation display" mode. Human experts can directly annotate and browse the pre-annotation results on the interface, confirm the features marked on the model, or delete, modify, and supplement mis-annotated or missing features, realizing human annotation and human review and correction.

[0066] Feature Quantitative Statistics and Result Output: The system automatically performs global analysis on batches of images acquired in a single session. The interactive interface displays the detection count of various key features in real time (e.g., oil cells: XX; fiber bundles: XX). Based on the statistical distribution of these feature counts and a preset threshold model, the system comprehensively determines whether a sample is "genuine," "counterfeit," or "suspected adulteration," and generates an electronic quality inspection report containing microscopic feature maps. Authenticity verification based on microscopic technical characteristics and statistical methods is a conventional technique in this field, and detailed descriptions are omitted in this embodiment.

[0067] 1. Experimental setup Data Acquisition and Dataset Construction: Full-field microscopic scanning was performed on three different batches of Magnolia officinalis standards (10 slides prepared in each batch), resulting in approximately 12,000 high-resolution images. After image quality assessment, 2,379 high-quality images with typical microscopic features were selected to construct a Magnolia officinalis-specific annotation dataset.

[0068] Feature annotation statistics: After pharmaceutical experts performed detailed annotations on the above 2379 images, the dataset contained a total of 3806 instances of the three key microscopic identification features, distributed as follows (see details). Figure 10 ): Stone cells: 2138, which is the main characteristic; Fibers: 1195; Oil cells: 473, a rare feature.

[0069] 2. Quantitative analysis of model performance Input the test set into the trained model, and the output result is as follows: Figure 7 (PR curve) and Figure 8 As shown in the confusion matrix, the specific data analysis is as follows: Overall accuracy index: based on the PR curve ( Figure 7 The results show that, with an IoU of 0.5, the model's mean precision (mAP@0.5) across all classes is as high as 0.937. This indicates that the model maintains extremely high accuracy while ensuring high recall.

[0070] Feature classification effectiveness: Fibers: Optimal recognition performance, with an AP value of 0.970. The standardized fabrication process effectively disperses the fiber bundles, avoiding overlap and occlusion, allowing the model to fully capture the elongated texture features of the fibers.

[0071] Oil cells: AP value reached 0.966. With 50-layer depth-of-field fusion technology, the refractive properties and edge contours of oil cells are clearly visible in the image, with very few missed detections. The results show excellent performance in identifying scarce features.

[0072] Stone cells: AP value is 0.876. Although stone cells have branched and round shapes, which increases the difficulty of identification, the accuracy of 0.876 is sufficient to meet the needs of market quality inspection.

[0073] Confusion matrix analysis: such as Figure 8As shown in the confusion matrix, the model exhibits extremely high robustness on classification tasks: In the stone cell identification, there were 227 true positive samples, with only a very small number being misclassified as background.

[0074] In fiber identification, there were 159 true positive samples, with very little confusion with other cell types. This indicates that the model can effectively extract the specific texture features of various cell types, with very few misclassifications.

[0075] In oil cell identification, although the number of oil cells was relatively small, the model identified 48 true positives, maintaining a high level of accuracy. Only 9 background cells were misidentified as oil cells, which is attributed to the effective preservation of the refractive properties of oil cells by the multi-layer depth-of-field fusion technology.

[0076] 3. Judgment Criteria Setting According to the F1-Confidence curve ( Figure 9 Analysis showed that when the confidence threshold was set around 0.447, the overall F1 score for all categories reached a peak of 0.89. Based on this analysis, the default confidence threshold was set to 0.45 in the identification method described in Example 2. The system only displays and counts a microscopic feature in the report when the AI ​​model's prediction probability for that feature is >45%. This strategy effectively filters background noise and ensures the reliability of the final counting results.

[0077] 4. Specificity and Detection Verification of Counterfeit Products To verify the model's ability to detect adulterated products, this experiment used an independent validation method with a negative control: Experimental procedure: Five sets of standardized glass slides of Magnolia liliiflora, Magnolia x soulangeana, Magnolia denudata and Eucommia ulmoides were prepared respectively (as negative control groups), and their microscopic images were input into the trained detection model.

[0078] Detection logic and results: For closely related confused varieties (such as Magnolia liliiflora): the model accurately identifies its thinner sclereid walls and fewer branches through a multi-scale feature fusion mechanism, which is significantly different from the thick-walled, branched sclereids of Magnolia officinalis. This method has an extremely low detection rate of the "Magnolia officinalis characteristics" in this type of sample, successfully identifying it as "non-genuine".

[0079] For non-closely related confounding agents (such as Eucommia ulmoides): the model detected a large number of specific features (such as Eucommia ulmoides filaments and extremely thick-walled fibers) in Eucommia ulmoides slides, but did not detect the oil cells unique to Magnolia officinalis.

[0080] Conclusion: Experimental results show that even without genuine product references, the model can accurately identify independently produced counterfeit samples as "counterfeit," with a false positive rate of 0%. This demonstrates the system's extremely high specificity and its ability to effectively intercept the supply of purely counterfeit materials to the market.

[0081] 5. Real-world blind sample test: To further verify the applicability of this method in the actual market circulation process, this experiment designed a double-blind test of "AI vs. human expert". Sample source: Thirty samples of Magnolia officinalis powder were randomly purchased from professional Chinese medicinal herb markets in Bozhou, Anhui and Anguo, Hebei. Based on morphological and physicochemical gold standard identification, 6 samples were genuine Magnolia officinalis, and 4 samples were adulterated or counterfeit (including 2 samples adulterated with Magnolia officinalis var. purpurea, 1 sample adulterated with Eucommia ulmoides, and 1 sample adulterated with other tree bark). Experimental Groups: The expert panel consists of two Chinese herbal medicine identification experts with more than 10 years of experience, who conduct blind microscopic examinations.

[0082] AI System Group: The detection is performed using the method disclosed in this invention. Test results: Manual team: Correctly identified 25 genuine products and 3 counterfeit products, taking approximately 120 minutes. One sample with trace adulteration was missed, and one genuine product was questionable due to its unclear characteristics. The overall accuracy rate was 93.3%.

[0083] The AI ​​system correctly identified all 26 genuine products and 4 counterfeit products in just 15 minutes, achieving a 100% accuracy rate. Thanks to its panoramic deep fusion technology and highly sensitive feature capture capabilities, the AI ​​system successfully intercepted the trace adulterated sample that was missed by manual inspection. Conclusion: Experiments show that when faced with complex samples from real markets, this system not only significantly outperforms manual methods in detection efficiency (more than 8 times higher), but also demonstrates a significant advantage in accuracy (100% vs 93.3%), possessing the potential to replace manual methods for large-scale market screening. The gap is even greater and more significant if the human operator's experience is not at an expert level.

[0084] Example 4 Example 4 discloses an AI-based system for authenticating traditional Chinese medicine powder based on microscopic images. The system includes: Microscopic image acquisition module: used for microscopic imaging of the Chinese medicine to be tested and the standard.

[0085] The depth-of-field fusion module is used to perform depth-of-field fusion on the microscopic images obtained by the microscopic image acquisition module to obtain the microscopic image to be tested and the microscopic image of the standard.

[0086] The detection model creation module is used to build detection models based on deep learning recognition models with the detection Transformer architecture.

[0087] The detection model training module is used to select a portion of standard sample microscopic images and manually annotate the microscopic identification features to obtain manually annotated images. The detection model is trained using the manually annotated images to obtain a lightweight model. The lightweight model is then used to identify and annotate the microscopic identification features of all standard sample microscopic images, and after manual review and correction, corrected standard sample microscopic images are obtained. The detection model is then trained using the corrected standard sample microscopic images to obtain the trained detection model.

[0088] The identification module is used to input the microscopic image to be tested into the trained detection model for the identification of traditional Chinese medicine.

[0089] like Figure 3 As shown: The detection models include: Backbone network: The backbone network consists of multiple layers of convolutional units and feature aggregation modules, specifically ResNet-50; it is used to extract multi-level feature pyramids of microscopic images and is responsible for capturing local features such as edges and textures.

[0090] Transformer Feature Enhancement Module: A Transformer feature enhancement module is added to the mid-layer feature output of the backbone network. It utilizes a multi-head self-attention mechanism to establish long-distance dependencies between features, solving the challenge of recognizing fragmented and large-scale cells in microscopic images.

[0091] Multi-scale feature fusion network: used to upsample and splice together the backbone network and enhanced features to achieve a comprehensive expression of semantic and spatial information, ensuring that the model can recognize both large fiber bundles and tiny oil cells.

[0092] Detection and segmentation output network: Utilizing ensemble prediction methods, it is used to simultaneously generate the category, location, and confidence of multiple targets, achieving efficient identification and segmentation of microscopic structures.

[0093] Specifically, see Figure 13 The left side is the backbone network, the upper middle part is the Transformer feature enhancement module, the lower middle part is the multi-scale feature fusion network, and the right side is the detection head. All structures are conventional, and the data transmission methods for each structure are well known to those skilled in the art; therefore, detailed descriptions are omitted in this embodiment.

[0094] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. An AI-based method for authenticating traditional Chinese medicine powder based on microscopic images, characterized in that, Includes the following steps: S1: Perform microscopic imaging on the Chinese medicine to be tested and perform depth-of-field fusion to obtain the microscopic image of the medicine to be tested; S2: Input the microscopic image to be tested into the trained detection model for the identification of traditional Chinese medicine; The detection model is built upon a deep learning recognition model that detects Transformer architectures, and the detection model has the following adjustments: (1) Add a Transformer feature enhancement module and a multi-scale feature fusion network between the backbone network and the detection head; (2) Freeze the convolution parameters of the first 10 layers of the backbone network in the early stage of training, and only adjust the high-level semantic network. (3) For the loss function, increase the weight coefficient γ of the segmentation mask loss term L_mask, increase the weight ratio of scarce categories in the target classification loss term L_total, and introduce a constraint mechanism for small targets and structural boundary regions in the segmentation mask loss term L_mask. The training process of the detection model is as follows: S101: Obtain a microscopic image of the standard sample, wherein the microscopic image of the standard sample is obtained by performing microscopic imaging on the standard sample and performing depth-of-field fusion. S102: Select some standard sample microscopic images and manually annotate the microscopic identification features to obtain manually annotated images. Use the manually annotated images to train the detection model to obtain a lightweight model. S103: A lightweight model is used to identify and label the microscopic identification features of all standard microscopic images, and then the corrected standard microscopic images are obtained after manual review and correction. S104: The detection model is trained by using the corrected standard microscopic image to obtain the trained detection model; The microscopic identification features are those specified in the pharmacopoeia for the microscopic identification of traditional Chinese medicine.

2. The method according to claim 1, characterized in that, Before microscopic imaging, the traditional Chinese medicine was processed as follows: the medicine was dried in a 60℃ oven for 2 hours, pulverized, and then passed through an 80-mesh sieve; a set amount of powder was weighed and placed on a glass slide, and the slide was prepared using a standardized clearing and sealing method; the standardized clearing method was as follows: 20 μL of chloral hydrate solution was added, and the slide was cleared over an alcohol lamp at intervals of 5 times, each time for 8-12 seconds, with an interval of 30 seconds, until all air bubbles were removed; the sealing method was as follows: after cooling, 1 drop of glycerol was added for sealing; during microscopic imaging, the magnification of the objective lens was 40 times, and the resolution of the image obtained was 3840*2160.

3. The method according to claim 2, characterized in that, The set dosage is 1.0-1.5 mg.

4. The method according to claim 1, characterized in that, The parameters for depth-of-field fusion are: 40-50 layers, with a scanning interval of 2μm between each layer.

5. The method according to claim 1, characterized in that, The microscopic identification features include a variety of features such as stone cells, phloem fibers, wood fibers, vessels, cork cells, parenchyma cells, starch grains, oil cells, calcium oxalate crystals, secretory tissues, hyphae, spores, and irregular clumps.

6. The method according to claim 1, characterized in that, In step S101, the slides of 5-50 standard samples are subjected to microscopic imaging and depth-of-field fusion to obtain a corresponding number of microscopic images. Each microscopic image is segmented to obtain a large number of standard sample microscopic images. Each standard sample microscopic image contains 0-10 microscopic identification features. In step S102, during manual annotation, standard microscopic images with 1-4 microscopic identification features conforming to the pharmacopoeia are selected for manual annotation, and standard microscopic images that do not meet the requirements are discarded. For rare microscopic identification features, if the number of annotations for other microscopic identification features meets the requirements, standard microscopic images with rare microscopic identification features are selected for annotation, and only the rare microscopic identification features are annotated. In step S103, the manual review and correction includes adding annotations, reducing annotations, changing the annotation category, changing the annotation border, and determining whether the identification requirements are met. The detection model is trained using the corrected standard microscopic images that meet the identification requirements to obtain the trained detection model. In step S1, a glass slide of a Chinese medicine to be tested is subjected to microscopic imaging and depth-of-field fusion to obtain a microscopic image of the medicine to be tested, and the microscopic image of the medicine to be tested is segmented. In step S2, all segmented microscopic images to be tested are input into the trained detection model.

7. The method according to claim 6, characterized in that, The model's loss function L_total is: L_total=α*L_cls+β*L_box+γ*L_mask; Wherein, L_total is the target classification loss term, used to constrain the prediction results of the microstructure category; L_box is the bounding box regression loss term, used to constrain the localization accuracy of the target position and scale; L_mask is the segmentation mask loss term, used to constrain the segmentation accuracy of the microstructure at the pixel level; α, β, and γ are the weight coefficients of L_total, L_box, and L_mask, respectively.

8. The method according to claim 7, characterized in that, The Chinese herbal medicine to be tested is Magnolia officinalis. The microscopic identification features include stone cell features, fiber features and oil cell features. Oil cell features are rare microscopic identification features. In step S102, the microscopic images of the partial standard samples contain a total of at least N1 stone cell features, at least N2 fiber features, and at least N3 oil cell features, where N1∈[300,1000], N2∈[300,1000], and N3∈[100,500]; In step S104, the corrected standard microscopic image that meets the identification requirements contains a total of at least M1 stone cell features, at least M2 fiber features, and at least M3 oil cell features, where M1∈[500,50000], M2∈[500,50000], and M3∈[300,10000]; when calculating the loss function, α∈[0.2,0.5], β∈[0.2,0.5], and γ∈[0.2,0.6].

9. The method according to claim 2, characterized in that, The hyperparameters of the detection model are as follows: the optimizer uses AdamW with weight decay; the learning rate scheduling adopts the Cosine Warmup strategy with 3 warm-up rounds; the input image size is 640×640, the batch size is 16, and the training takes 300 rounds.

10. An AI-based system for authenticating traditional Chinese medicine powder based on microscopic images, characterized in that, include: Microscopic image acquisition module: used for microscopic imaging of the Chinese medicine to be tested and the standard; The depth-of-field fusion module is used to perform depth-of-field fusion on the microscopic images obtained by the microscopic image acquisition module to obtain the microscopic image of the test sample and the microscopic image of the standard sample respectively. The detection model creation module is used to build detection models based on deep learning recognition models with the Transformer architecture. The detection model training module is used to select a subset of standard sample microscopic images and manually annotate the microscopic identification features to obtain manually annotated images. The detection model is then trained using these manually annotated images to obtain a lightweight model. The lightweight model is then used to identify and annotate the microscopic identification features of all standard sample microscopic images, and after manual review and correction, corrected standard sample microscopic images are obtained. The detection model is then trained using these corrected standard sample microscopic images to obtain the trained detection model. The identification module is used to input the microscopic image to be tested into the trained detection model for the identification of traditional Chinese medicine.