A method for predicting the production area of coptis based on a self-supervised gating expert network

CN122967263APending Publication Date: 2026-10-23CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611265571.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-20
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0005]本发明要解决的技术问题是:现有单一模型对全部候选产地统一判别,难以聚焦易混淆产地间的细微外观差异,易产生误判;而多模型无条件组合方案则导致所有模型均参与每次预测,计算开销大且缺乏清晰的条件分支机制

Benefits of technology

[0014]本发明通过采用经全卷积掩码自编码器自监督预训练的ConvNeXt V2-Tiny作为骨干网络,使主网络能够在无标注条件下学习黄连图像的色泽、纹理与形态层级视觉表征,从而增强对细微产地特征的提取能力;其次,通过设置易混淆类别集合和基于聚合响应概率的离散门控机制,仅在主网络预测存在不确定性时触发专家网络进行复判,避免了多模型无条件组合带来的冗余计算和干扰,显著降低了整体处理开销;再次,专家网络以主网络骨干参数初始化并仅在易混淆类别范围内进行精细化参数更新,使其专注于区分外观高度相近的产地类别,有效提升了易混淆产地的判别准确性;最终,主预测与专家复判之间形成清晰的条件分支关系,整体流程兼顾了常规样本的高效处理与困难样本的精准判别,为黄连产地快速、无损预测提供了可靠的技术方案。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122967263A_ABST
    Figure CN122967263A_ABST
Patent Text Reader

Abstract

The application provides a method for predicting the producing area of Coptis chinensis based on a self-supervised gating expert network, which performs preliminary prediction on normalized visible light images of Coptis chinensis through a main network, and generates a discrete gating state based on the aggregated response probability of a preset confused category set; when the gating is not triggered, the main prediction result is directly output, and when the gating is triggered, the expert network initialized by the main network parameters performs targeted re-trial within the confused category range, and finally outputs the producing area category. The method enhances the visual representation ability of the backbone network to color, texture and morphological details through self-supervised pre-training, avoids redundant calculation and interference caused by unconditional combination of multiple models through the gating mechanism, and makes the expert network focus on fine discrimination of confused categories, thereby effectively improving the discrimination accuracy of confused producing areas while maintaining the overall recognition efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image recognition technology, specifically relating to a method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network. Background Technology

[0002] Coptis chinensis, a commonly used traditional Chinese medicine, has its origin directly affecting the content of its effective components and clinical efficacy. Coptis chinensis from different producing areas exhibits significant differences in market demand and medicinal value. Therefore, establishing a rapid and accurate method for identifying the origin of medicinal materials is of great importance for quality control. With the development of computer vision and deep learning technologies, using visible light images to identify the origin of medicinal materials has become a non-destructive, low-cost, and easily promoted technical means.

[0003] Currently, methods for identifying the origin of Chinese medicinal herbs based on visible light images generally employ a single convolutional neural network model as the feature extractor, with a unified classifier covering all candidate origins at its top. Preprocessed images of the medicinal herbs are input into this model, and after global feature extraction and mapping through fully connected layers, the probability distribution of each candidate origin is directly output. The category with the highest probability is used as the final identification result. While these methods can achieve some differentiation between origins with significant differences in appearance, their feature learning and classification decisions are completed under the same network structure and unified parameter constraints, meaning all candidate origins share the same feature space and classification boundaries.

[0004] However, the same medicinal material often exhibits only subtle and localized differences in color, texture, and root morphology across different production areas. Furthermore, variations in lighting, angle, and individual variations during photography can lead to significant intra-class fluctuations. Existing single-model approaches need to simultaneously differentiate across all production areas, making it difficult to focus feature representation specifically on subtle discriminative cues between easily confused production areas. Moreover, unified classifiers lack mechanisms for secondary, refined discrimination of difficult samples. If multiple models are combined, existing solutions typically unconditionally fuse or probabilistically weight all model results, causing all models to participate in each prediction. This not only increases computational overhead but may also introduce interference from models irrelevant to the current sample. Furthermore, there is a lack of clear conditional branching relationships between the main classification, re-judgment conditions, and the final output. Therefore, there is an urgent need for a method for predicting the origin of Coptis chinensis that can maintain overall efficiency in identifying common production areas while automatically triggering targeted, refined re-judgment when easily confused categories appear. Summary of the Invention

[0005] The technical problem that this invention aims to solve is that existing single models uniformly distinguish all candidate origins, making it difficult to focus on subtle appearance differences between easily confused origins and easily leading to misjudgments; while multi-model unconditional combination schemes result in all models participating in each prediction, resulting in large computational costs and a lack of clear conditional branching mechanisms.

[0006] To address the aforementioned technical problems, one aspect of the present invention provides a method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network, comprising:

[0007] S1: Obtain visible light image data of Coptis chinensis, and perform normalized preprocessing on the visible light image of Coptis chinensis to obtain a standard visible light image of Coptis chinensis;

[0008] S2: Input the standard Coptis chinensis visible light image into the main network based on ConvNeXtV2-Tiny for prediction, obtain the initial probability of Coptis chinensis belonging to each candidate production area, and determine the candidate production area with the highest probability as the primary prediction production area; wherein, the backbone network of the main network is loaded with self-supervised pre-trained weights, and the classification head of the main network covers all candidate production area categories.

[0009] S3: Pre-set a set of easily confused categories in the candidate origin category set, add the initial probabilities of each candidate origin in the easily confused category set of the main network to obtain the aggregate response probability; compare the aggregate response probability with the gating threshold to generate the gating state;

[0010] S4: When the gating state is not triggered, the primary predicted origin is output as the final origin of Coptis chinensis; when the gating state is triggered, the standard Coptis chinensis visible light image is input into the expert network for re-judgment, and the re-judgment result of the expert network is output as the final origin of Coptis chinensis; wherein, the expert network has the same network structure as the main network, the backbone network parameters of the expert network are initialized by the backbone network parameters of the main network, and the classification head of the expert network only covers the candidate origin categories in the easily confused category set.

[0011] Another aspect of the present invention provides a Coptis chinensis origin prediction system based on a self-supervised gated expert network. The system includes a memory and a processor. The memory is used to store an application program. The processor is used to run the application program and execute the Coptis chinensis origin prediction method based on a self-supervised gated expert network.

[0012] Another aspect of the present invention provides a computer storage medium storing a computer-readable storage medium, which, when executed by a processor, implements the aforementioned method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network.

[0013] The present invention has at least the following beneficial effects

[0014] This invention employs ConvNeXt V2-Tiny, a fully convolutional masked autoencoder pre-trained under self-supervised conditions, as the backbone network. This enables the main network to learn the color, texture, and morphological hierarchical visual representations of Coptis chinensis images under unlabeled conditions, thereby enhancing the ability to extract subtle origin features. Secondly, by setting a set of easily confused categories and a discrete gating mechanism based on aggregated response probabilities, the expert network is triggered for re-judgment only when there is uncertainty in the main network's prediction. This avoids redundant computation and interference caused by unconditional combination of multiple models, significantly reducing the overall processing overhead. Thirdly, the expert network is initialized with the backbone parameters of the main network and only performs refined parameter updates within the range of easily confused categories, allowing it to focus on distinguishing origin categories with highly similar appearances, effectively improving the accuracy of easily confused origins. Finally, a clear conditional branching relationship is formed between the main prediction and the expert re-judgment. The overall process balances efficient processing of regular samples with accurate discrimination of difficult samples, providing a reliable technical solution for rapid and non-destructive prediction of Coptis chinensis origin. Attached Figure Description

[0015] Figure 1 This is a schematic diagram of the process of the present invention;

[0016] Figure 2 This is a schematic diagram of the model framework structure of the present invention;

[0017] Figure 3 This is a schematic diagram of Coptis chinensis from various producing areas. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Please see Figure 3 , Figure 3Typical visible light images of Coptis chinensis rhizomes from different origins are presented, corresponding to five candidate origins: Sichuan, Chongqing, Hubei, Yunnan, and Shaanxi. The images show that while maintaining common characteristics of Coptis chinensis, the rhizomes from different origins exhibit varying degrees of combination differences in overall extension, thickness ratio, number and aggregation of branches, degree of curvature, distribution of nodules and fibrous root remnants, surface texture, and color. Specifically, Coptis chinensis from Chongqing and Hubei are quite similar in rhizome curvature and surface color, creating some visual confusion. Coptis chinensis from Sichuan has relatively thicker rhizomes with more branches, Coptis chinensis from Yunnan has a lighter color and slender rhizomes, and Coptis chinensis from Shaanxi has more prominent rhizome nodules. These visual differences provide identifiable phenotypic evidence for origin prediction based on visible light images.

[0020] Please see Figure 1 One aspect of the present invention provides a method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network, comprising:

[0021] S1: Obtain visible light image data of Coptis chinensis, and perform normalized preprocessing on the visible light image of Coptis chinensis to obtain a standard visible light image of Coptis chinensis;

[0022] Preferably, the normalization preprocessing of the visible light image of Coptis chinensis includes:

[0023] S11: Cropping the target region of interest containing the Coptis chinensis body in the visible light image of Coptis chinensis to obtain the cropped target Coptis chinensis visible light image;

[0024] S12: Scale the cropped target Coptis chinensis visible light image to the target size, and then normalize the channels of the scaled target Coptis chinensis visible light image to obtain a standard Coptis chinensis visible light image.

[0025]

[0026] in, This indicates the spatial location of a standard Coptis chinensis visible light image. and the Pixel values ​​on each color channel; This indicates the spatial location of the target Coptis chinensis visible light image scaled to the target size. and the Pixel values ​​on each color channel; This represents the scaling factor, used to scale pixel values ​​to the range of 0 to 1; and They represent the first number obtained from pre-statistics based on the training sample set. The mean and standard deviation of global pixel values ​​for each color channel.

[0027] In this embodiment, an industrial color camera or high-resolution scanner is used to vertically photograph a single Coptis chinensis rhizome sample under constant lighting conditions (color temperature 5500K, illuminance 1000 lux) in a standard light source box, acquiring an RGB color visible light image with a resolution of 3000×4000 pixels, and saving it in a lossless format (such as TIFF). During the shooting, the main body of the Coptis chinensis rhizome is positioned in the central area of ​​the image, with a uniform gray background.

[0028] A deep learning-based instance segmentation model (such as Mask R-CNN) is used to segment the mask region of Coptis chinensis root in the original image. The minimum bounding rectangle of this mask is calculated and extended outward by 10 pixels to form a bounding box, thus determining the target region of interest (ROI) containing the Coptis chinensis body. Then, this ROI is cropped from the original image to obtain the cropped visible light image of the target Coptis chinensis. If there are multiple Coptis chinensis samples in the image, each sample is processed individually.

[0029] The cropped target image is scaled to the target size using a bicubic interpolation algorithm. In this embodiment, the target size is set to 224×224 pixels. The original aspect ratio is maintained during scaling, and any insufficient parts are padded with zeros (i.e., zero-padding at the boundaries).

[0030] Channel normalization is performed on the scaled image using the following formula:

[0031]

[0032] in, This maps pixel values ​​from an integer range (0~255) to a range of 0~1. and These are the mean and standard deviation of the RGB three-channel global pixel values, respectively, obtained in advance based on the training sample set.

[0033] In this embodiment, based on statistics from 10,000 collected images of Coptis chinensis (training set), the following results were obtained:

[0034] For the zero-value regions filled in the scaled image, the normalization is still calculated using the formula above, but these regions do not affect subsequent feature extraction (because the network can ignore background interference). After this step, the normalized image tensor is finally input into the subsequent ConvNeXt V2-Tiny backbone network.

[0035] In this embodiment, the cropping method, scaling size, and statistical parameters can all be adjusted according to the actual device and sample distribution. However, it should be ensured that the processed image retains the morphology, color, and texture information of the Coptis chinensis rhizome, and that the preprocessing method used in the testing and training phases remains consistent.

[0036] Please see Figure 2S2: Input the standard Coptis chinensis visible light image into the main network based on ConvNeXtV2-Tiny for prediction, obtain the initial probability of Coptis chinensis belonging to each candidate production area, and determine the candidate production area with the highest probability as the primary prediction production area; wherein, the backbone network of the main network is loaded with self-supervised pre-trained weights, and the classification head of the main network covers all candidate production area categories.

[0037] Preferably, the self-supervised pre-training weights are obtained in the following manner:

[0038] Standard Coptis chinensis visible light images are used as training samples. The training samples are divided into multiple spatial units. Masks are applied to some spatial units randomly selected according to a preset mask ratio to obtain masked samples.

[0039] Construct a fully convolutional mask autoencoder, wherein the network structure of the encoder of the fully convolutional mask autoencoder is the same as the backbone network of the main network;

[0040] The mask sample is input into a fully convolutional mask autoencoder. The encoder of the fully convolutional mask autoencoder encodes the mask sample to obtain the encoded features of the mask sample. The decoder of the fully convolutional mask autoencoder reconstructs pixels based on the encoded features of the mask sample to obtain the reconstructed sample.

[0041] A self-supervised reconstruction loss is constructed based on the reconstructed samples and the unmasked training samples:

[0042]

[0043] in, Indicates losses from self-monitoring and reconstruction; Represents the set of spatial units of a mask; Indicates the first The real pixel vector of each spatial unit of the mask; Indicates the decoder for the first Reconstructed pixel vectors of spatial units of a mask; Represents the square of the L2 norm;

[0044] The fully convolutional mask autoencoder is pre-trained using self-supervised reconstruction loss. After pre-training, the encoder parameters of the fully convolutional mask autoencoder are used as self-supervised pre-training weights, and the backbone network of the main network is initialized according to the self-supervised pre-training weights.

[0045] In this embodiment, a main network based on the ConvNeXt V2-Tiny structure is constructed. Its backbone network consists of a convolutional backbone (4×4 convolutions, stride 4), four feature stages, and a global average pooling layer. The number of residual blocks in the four feature stages are 3, 3, 9, and 3, respectively, and the channel dimensions are 96, 192, 384, and 768, respectively. Following the backbone network is a main classification head covering all candidate origins. This classification head contains a linear layer, and the number of output nodes equals the total number of candidate origin categories. In this embodiment, the candidate origin category set Y = {Sichuan, Chongqing, Hubei, Yunnan, Shaanxi}, that is... .

[0046] The parameters of the encoder portion are extracted from a pre-trained fully convolutional masked autoencoder (FCMA) and used as the initial weights of the backbone network. These self-supervised pre-trained weights have been learned on a large number of unlabeled Coptis chinensis images through a masked region pixel reconstruction task, and can characterize the color, texture, and morphological hierarchical visual features of Coptis chinensis images. During loading, all trainable parameters of the backbone network, including convolutional layers, layer normalization, and global response normalization, are initialized using these pre-trained weights, while the linear layer parameters of the main classification head are randomly initialized (e.g., using a Kaiming uniform distribution).

[0047] The standard Coptis chinensis visible light image obtained in step S1 is input into the main network. Specifically: First, a 96-channel, 56×56 feature map is obtained through convolution; then, it goes through four feature stages, in which semantic features are extracted step by step by ConvNeXt V2 residual blocks (containing 7×7 depthwise convolution, channel expansion, global response normalization, and residual connections), with the spatial resolution decreasing to 28×28, 14×14, and 7×7 respectively, and the number of channels increasing to 192, 384, and 768 respectively; the 7×7×768 feature map output from the fourth stage is subjected to global average pooling to obtain a 768-dimensional global feature vector. ;Will Input the main classification head (linear layer, weight matrix size 5×768) to obtain a 5-dimensional original output vector. Softmax normalization is performed on the output vector of the main classification head to obtain the initial probability of each candidate origin.

[0048] S3: Pre-set a set of easily confused categories in the candidate origin category set, add the initial probabilities of each candidate origin in the easily confused category set of the main network to obtain the aggregate response probability; compare the aggregate response probability with the gating threshold to generate the gating state;

[0049] Preferably, the aggregation response probability includes:

[0050]

[0051] The gated states include:

[0052]

[0053] in, Indicates the probability of the aggregate response; Represents a set of easily confused categories; This indicates that the main network predicts the standard visible light image of Coptis chinensis as the first... The initial probability of each candidate origin; This indicates the preset gate threshold. Indicates the characteristic function; when Time-gated state trigger Conversely, the gating state is not triggered. .

[0054] In this embodiment, based on prior knowledge or the confusion matrix between categories in the training set, the most similar appearance features and easily misjudged origins are selected from the entire candidate origin category set to form the easily confused category set C. In this embodiment, C is set as {Chongqing, Hubei}, because the Coptis chinensis from these two origins are similar in root curvature and surface color, making them common confusion pairs. The probability values ​​corresponding to the categories belonging to set C are extracted from the probability distribution output by the main network in step S2. The initial probabilities of each candidate origin in set C are summed to obtain the aggregated response probability. This value reflects the overall confidence level of the main network in believing that the tested Coptis chinensis belongs to an easily confused origin. Preset gating threshold. In this embodiment, the performance tuning settings are based on the validation set. The aggregate response probability is compared with a gating threshold, and the gating state is triggered. This indicates that the main network has a high overall response to easily confused categories, making reliable differentiation difficult, and an expert network needs to be activated for re-evaluation. If the gating is not triggered... The system directly uses the primary predicted production location as the final result, eliminating the need to call upon expert networks and saving computational resources.

[0055] Gating threshold During the model training phase, the selection is made through the validation set. Specifically, different thresholds (e.g., 0.5~0.9, step size 0.05) are traversed on the validation set. The overall accuracy and the frequency of expert network calls are calculated under different thresholds. The threshold with a low expert call rate is selected while ensuring that the overall accuracy does not decrease, so as to balance efficiency and accuracy.

[0056] S4: When the gating state is not triggered, the primary predicted origin is output as the final origin of Coptis chinensis; when the gating state is triggered, the standard Coptis chinensis visible light image is input into the expert network for re-judgment, and the re-judgment result of the expert network is output as the final origin of Coptis chinensis; wherein, the expert network has the same network structure as the main network, the backbone network parameters of the expert network are initialized by the backbone network parameters of the main network, and the classification head of the expert network only covers the candidate origin categories in the easily confused category set.

[0057] In this embodiment, discrete gating signals are obtained. ,like If the main network has a low aggregation response to the easily confused category set, meaning the current sample to be tested does not belong to the easily confused scenario, then the primary predicted origin obtained in step S2 is directly adopted. The process ends when the product is finally exported from its place of origin. If If so, it will proceed to the expert review process.

[0058] The same standard visible light image of Coptis chinensis is input into the ConvNeXt V2-Tiny expert network. This expert network has the exact same backbone structure as the main network (convolutional backbone, four feature stages, global average pooling). Its backbone network parameters are initialized by the trained backbone parameters of the main network and fine-tuned only on the easily confused category set C={Chongqing, Hubei} during subsequent training. The classification head of the expert network is a linear layer, and the number of output nodes is equal to... The parameters of the classification head are randomly initialized and then trained on a set of easily confused samples using a second classification loss. Images are processed through convolutional processing and four feature extraction stages to obtain the fourth-stage output feature map. Global average pooling and layer normalization are then applied to the feature map to obtain 768-dimensional expert visual features. ;Will Input the expert classification head to obtain a 2D raw output vector. The softmax operation is performed on the output vector of the expert network to obtain the conditional probability distribution within the easily confused category set C. The category indices output by the expert network are assigned to categories within set C and can be determined through a pre-defined mapping relationship. The internal category with the highest expert conditional probability is mapped back to the label in the original candidate origin set Y.

[0059] It is important to emphasize that when the gating is triggered, the expert network's re-judgment completely replaces the main prediction, without any probability weighting or fusion, to avoid interference from irrelevant models. The entire process requires only one main network forward pass and one expert network forward pass (at triggering) during the inference phase, keeping computational costs manageable. Because the expert network is trained only on easily confused categories, its parameters focus more on distinguishing subtle differences between Chongqing and Hubei production areas, thus effectively correcting potential misjudgments from the main network.

[0060] Preferably, the training process for the main network and the expert network includes:

[0061] Obtain standard visible light images of Coptis chinensis with origin category labeling information to construct a training sample set;

[0062] The training samples in the training sample set are input into the main network loaded with self-supervised pre-training weights for prediction. The first classification loss is constructed based on the prediction results of the training samples and the annotation information. The parameters of the main network are updated using the first classification loss to obtain the trained main network.

[0063] From the training sample set, samples whose place of origin category labeling information belongs to the easily confused category set are selected to construct an expert training set; the parameters of the expert network are initialized according to the parameters of the trained main network, and the training samples in the expert training set are input into the expert network for prediction. Based on the prediction results of the training samples and the labeling information, a second classification loss is constructed. The parameters of the expert network are updated using the second classification loss to obtain the trained expert network.

[0064] In this embodiment, rhizome samples of Coptis chinensis from five producing areas—Sichuan, Chongqing, Hubei, Yunnan, and Shaanxi—were collected. At least 2000 color visible light images were collected from each producing area, totaling over 10,000 images. Images were acquired under various lighting conditions and shooting angles, and included individuals of different sizes and shapes to enhance the model's generalization ability. Each image was labeled with its place of origin by a Chinese medicinal herb identification expert to ensure label accuracy. Following the preprocessing method in step S1 (ROI cropping, scaling to 224×224, channel normalization), each original image was converted into a standard Coptis chinensis visible light image and combined with the corresponding place of origin label to form training samples. All samples were randomly divided into training, validation, and test sets in an 8:1:1 ratio.

[0065] The backbone network of the main network (ConvNeXt V2-Tiny) is loaded with self-supervised pre-trained weights (obtained by pre-training on unlabeled Coptis chinensis images using a fully convolutional masked autoencoder). The weight matrix and biases of the main classification head (covering all K=5 categories) are randomly initialized using a Kaiming normal distribution.

[0066] A Fully Convolutional Masked Autoencoder (FCMA) is a neural network architecture for self-supervised visual representation learning. Its core lies in the fact that both the encoder and decoder employ fully convolutional structures, enabling them to accept input images of arbitrary sizes while preserving the integrity of spatial information. During pre-training, the input image is divided into multiple spatial units (e.g., 4×4 or 8×8 patches). A portion of these units is randomly masked according to a preset masking ratio (typically 50%–75%). The encoder processes only the visible, unmasked units, extracting their high-level semantic features through convolutional operations. The decoder then performs pixel-level reconstruction of the full-resolution space based on the encoded features and learnable mask tokens, outputting a reconstructed image of the same size as the original image. The training objective is to minimize the reconstruction loss (e.g., mean squared error) calculated only on the masked regions, forcing the encoder to learn a strong representational ability capable of inferring complete visual content from locally visible information. Unlike ViT-based masked autoencoders, fully convolutional structures naturally preserve spatial relationships, and the encoder is completely consistent with the backbone network (ConvNeXt V2-Tiny) of the main network. Therefore, after pre-training, the encoder parameters can be directly transferred to the backbone network to achieve efficient representation initialization under unlabeled data.

[0067] The AdamW optimizer was used, with an initial learning rate of 1e-4, a batch size of 64, and 100 training epochs. The learning rate was decayed to 1e-6 using cosine annealing. Weight decay coefficients were also used. Set it to 0.05. Use an adaptive moment estimator optimizer with decoupled weight decay.

[0068] Using first-class loss Specifically, it takes the form of cross-entropy loss with category weights and a focus factor. In this embodiment, category weights are set based on the differences in the number of samples among the five origin categories. It is proportional to the reciprocal of the number of samples in each class to mitigate class imbalance. Focusing factor Set to 2.0. Simultaneously employ label smoothing (smoothing coefficient). To reduce the risk of overfitting, a batch of standard Coptis chinensis images is input into the main network in each iteration to obtain the predicted probability vector for each sample, and then the prediction is calculated. The backbone network and classifier head parameters are updated via backpropagation using AdamW. After each epoch, accuracy is evaluated on the validation set, and the best-performing model parameters on the validation set are saved. After training, the trained main network (including the backbone network and all-class classifier head) is obtained. Based on prior knowledge and the confusion matrix on the validation set, a set of easily confused classes, C={Chongqing, Hubei}, is selected. All samples labeled "Chongqing" or "Hubei" are selected from the complete training set to form the candidate pool for the expert training set. To ensure sample balance, oversampling or data augmentation (such as random rotation, flipping, color jitter, etc.) can be performed on the class with fewer samples to balance the number of samples from both classes. The final expert training set contains approximately 4000 images (approximately 2000 images per class). It is also divided into an expert training subset, validation subset, and test subset in an 8:1:1 ratio. The preprocessing method for the expert training set is completely consistent with that of the main network, requiring no additional operations.

[0069] The expert network's backbone (with the same structure as the main network) directly loads the trained main network backbone parameters (i.e., the weights obtained in step (2)), while the expert classification head (with the number of output nodes is...) Random initialization (Kaiming normal distribution) is used. Similar to the main network, the AdamW optimizer is used, with an initial learning rate of 5e-5 (slightly lower than the main network training to prevent excessive destruction of learned general features), a batch size of 32, and 50 training epochs. Cosine annealing learning rate decay and weight decay are also used. ).

[0070] Using second-class loss Its form is the same as the first classification loss, but the category range only covers the two categories within C. It also uses category weights (based on the sample size ratio of Chongqing and Hubei) and a focusing factor ( ) and label smoothing ( ).

[0071] Input the samples from the expert training subset into the expert network, and calculate... The backbone network and expert classification head parameters are updated using AdamW. Accuracy is evaluated on the expert validation set in each round, and the best model is saved. After training, an expert network that accurately distinguishes between Chongqing and Hubei is obtained. During the training of the main network and expert networks, random horizontal flipping, random rotation (±15°), random scaling and cropping (0.9~1.1x), and color jittering (brightness, contrast, and saturation adjustment) are applied online to the training samples to improve model robustness. If the validation set loss is 10 consecutive... If the value does not decrease, stop training and revert to the optimal model. Gating threshold. After training, the threshold is searched using the validation set, as described above.

[0072] Preferably, the first classification loss includes:

[0073]

[0074] in, Indicates the first category loss. Indicates the number of training samples in the input batch; Indicates the first The true origin category of each training sample; Indicates the true country of origin category The corresponding category weights, Indicates the main network to the first The training sample belongs to the first... Predicted probability for each origin category Indicates the main network to the first The training samples belong to the category of real place of origin. The predicted probability; Indicates the focus factor. This indicates the total number of candidate origin categories.

[0075] In this embodiment, when training the main network, the real labels are first smoothed: let the batch sample size be... Total number of candidate origin categories Smoothing coefficient For the true category of each sample Convert its hard labels to smooth target values , Indicates the first in the batch The sample at the th The label value for each of the first and second categories is 0.9 + 0.02 = 0.92, representing the true class probability, with the remaining categories each assigned a probability of 0.02. For each sample, the class weight is calculated based on its true class. (Using the inverse normalization of the sample size for each category), Focusing Factor The predicted probabilities output by the main network Substitute into the formula Calculate the batch average loss. This loss is backpropagated through the AdamW optimizer, simultaneously updating the backbone parameters of the main network and the parameters of the all-class classifier head. This allows the model to focus on hard-to-classify samples while avoiding overconfidence in the training labels, thus enhancing its generalization ability.

[0076] Preferably, the second classification loss includes:

[0077]

[0078] in, This represents the second category loss. Indicates the number of training samples in the input batch; Indicates the first The true origin category of each training sample in the easily confused category set; Indicates the true country of origin category The corresponding category weights, Indicates expert network on the first The training sample belongs to the set of easily confused categories. Predicted probability for each origin category Indicates expert network on the first The training samples belong to the category of real place of origin. The predicted probability; Indicates the focus factor. Represents a set of easily confused categories; This indicates the number of place of origin categories in the set of easily confused categories.

[0079] In this embodiment, when training the expert network, the number of input batch samples B is set to 32, and the easily confused category set C = {Chongqing, Hubei}. First, perform the same label smoothing process as described above on the real labels belonging to the easily confused categories in this batch of samples (smoothing coefficient). The true class assignment probability is 0.92, and the other easily confused class assignment probability is 0.08. Class weights are set to account for the difference in the number of samples from Chongqing and Hubei in the expert training set. The focus factor is the normalized value of the reciprocal of the number of samples in each category. The conditional probabilities output by the expert network Substitute into the formula Calculate the batch average loss. This loss is backpropagated through the AdamW optimizer, updating only the backbone parameters and expert classification head parameters of the expert network. This allows the expert network to focus on improving the subtle discrimination accuracy between the Chongqing and Hubei production areas, without having to consider other production categories.

[0080] Preferably, both the first classification loss and the second classification loss use an adaptive moment estimation optimizer with decoupled weight decay to update parameters, and the parameter update relationship is as follows:

[0081]

[0082] in, This indicates the updated network parameters; This indicates the network parameters before the update; Indicates the parameter update step size; and These represent the first-order momentum and second-order momentum after bias correction, respectively; This represents the stabilizing constant to prevent the denominator from being zero; This represents the decoupling weight attenuation coefficient.

[0083] In this embodiment, the AdamW optimizer is used to perform parameter updates during both the main network and expert network training. Specifically, an initial learning rate is set... (main network) or (Expert Network), First-order momentum decay coefficient Second-order momentum decay coefficient Decoupling weight attenuation coefficient Stable terms After calculating the classification loss for each batch, the gradient of the loss with respect to the parameters is first calculated, and then the first-order momentum estimate is updated. and second-order momentum estimation (All initial zero biases have been corrected for deviations), and then the formula is followed. Execute parameter update, where the last item This represents independent weight decay decoupled from gradient updates. It does not participate in adaptive scaling calculations, thus avoiding inconsistencies in actual decay intensity due to differences in the second-order momentum of various parameters. This optimization strategy, combined with cosine annealing learning rate decay over 50-100 training epochs, enables the model to achieve good generalization performance while maintaining stable convergence.

[0084] Let the first The parameters to be updated are The current batch loss is First, calculate the gradient of the loss with respect to the parameters:

[0085]

[0086] First-order momentum The desired direction for estimating the gradient is calculated using the following formula:

[0087]

[0088] in, It is the first-order momentum decay coefficient (usually taken as 0.9). The first-order momentum of the previous step (initial) This formula indicates that the current momentum is a weighted synthesis of the historical momentum and the current gradient, which serves to smooth the gradient direction.

[0089] Second momentum The formula used to estimate the variance of each component of the gradient is as follows:

[0090]

[0091] in, It is the second-order momentum decay coefficient (usually taken as 0.999). The second momentum of the previous step (initial) ), This represents the square of each element of the gradient (by element-wise square). This formula reflects the fluctuation of the gradient magnitude and is used to adaptively adjust the learning rate of each parameter.

[0092] because and In the initial stages of the update, the momentum estimate will be biased towards zero, therefore bias correction is required:

[0093]

[0094]

[0095] in, and These represent the attenuation coefficients respectively. The power of. With As the correction factor increases, it approaches 1, and the correction effect gradually weakens.

[0096] Another aspect of the present invention provides a Coptis chinensis origin prediction system based on a self-supervised gated expert network. The system includes a memory and a processor. The memory is used to store an application program. The processor is used to run the application program and execute the Coptis chinensis origin prediction method based on a self-supervised gated expert network.

[0097] Another aspect of the present invention provides a computer storage medium storing a computer-readable storage medium, which, when executed by a processor, implements the aforementioned method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network.

[0098] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0099] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network, characterized in that, include: S1: Obtain visible light image data of Coptis chinensis, and perform normalized preprocessing on the visible light image of Coptis chinensis to obtain a standard visible light image of Coptis chinensis; S2: Input the standard Coptis chinensis visible light image into the main network based on ConvNeXtV2-Tiny for prediction, obtain the initial probability of Coptis chinensis belonging to each candidate production area, and determine the candidate production area with the highest probability as the primary prediction production area; wherein, the backbone network of the main network is loaded with self-supervised pre-trained weights, and the classification head of the main network covers all candidate production area categories. S3: Pre-set a set of easily confused categories in the candidate origin category set, add the initial probabilities of each candidate origin in the easily confused category set of the main network to obtain the aggregate response probability; compare the aggregate response probability with the gating threshold to generate the gating state; S4: When the gating state is not triggered, the primary predicted origin is output as the final origin of Coptis chinensis; when the gating state is triggered, the standard Coptis chinensis visible light image is input into the expert network for re-judgment, and the re-judgment result of the expert network is output as the final origin of Coptis chinensis; wherein, the expert network has the same network structure as the main network, the backbone network parameters of the expert network are initialized by the backbone network parameters of the main network, and the classification head of the expert network only covers the candidate origin categories in the easily confused category set.

2. The method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network according to claim 1, characterized in that, The normalization preprocessing of the visible light image of Coptis chinensis includes: S11: Cropping the target region of interest containing the Coptis chinensis body in the visible light image of Coptis chinensis to obtain the cropped target Coptis chinensis visible light image; S12: Scale the cropped target Coptis chinensis visible light image to the target size, and then normalize the channels of the scaled target Coptis chinensis visible light image to obtain a standard Coptis chinensis visible light image. in, This indicates the spatial location of a standard Coptis chinensis visible light image. and the Pixel values ​​on each color channel; This indicates the spatial location of the target Coptis chinensis visible light image scaled to the target size. and the Pixel values ​​on each color channel; This represents the scaling factor, used to scale pixel values ​​to the range of 0 to 1; and They represent the first number obtained from pre-statistics based on the training sample set. The mean and standard deviation of global pixel values ​​for each color channel.

3. The method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network according to claim 1, characterized in that, The self-supervised pre-training weights are obtained in the following way: Standard Coptis chinensis visible light images are used as training samples. The training samples are divided into multiple spatial units. Masks are applied to some spatial units randomly selected according to a preset mask ratio to obtain masked samples. Construct a fully convolutional mask autoencoder, wherein the network structure of the encoder of the fully convolutional mask autoencoder is the same as the backbone network of the main network; The mask sample is input into a fully convolutional mask autoencoder. The encoder of the fully convolutional mask autoencoder encodes the mask sample to obtain the encoded features of the mask sample. The decoder of the fully convolutional mask autoencoder reconstructs pixels based on the encoded features of the mask sample to obtain the reconstructed sample. A self-supervised reconstruction loss is constructed based on the reconstructed samples and the unmasked training samples: in, Indicates losses from self-monitoring and reconstruction; Represents the set of spatial units of a mask; Indicates the first The real pixel vector of each spatial unit of the mask; Indicates the decoder for the first Reconstructed pixel vectors of spatial units of a mask; Represents the square of the L2 norm; The fully convolutional mask autoencoder is pre-trained using self-supervised reconstruction loss. After pre-training, the encoder parameters of the fully convolutional mask autoencoder are used as self-supervised pre-training weights, and the backbone network of the main network is initialized according to the self-supervised pre-training weights.

4. The method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network according to claim 1, characterized in that, The aggregate response probability includes: The gated states include: in, Indicates the probability of the aggregate response; Represents a set of easily confused categories; This indicates that the main network predicts the standard visible light image of Coptis chinensis as the first... The initial probability of each candidate origin; This indicates the preset gate threshold. Indicates the characteristic function; when Time-gated state trigger Conversely, the gating state is not triggered. .

5. The method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network according to claim 1, characterized in that, The training process for the main network and the expert network includes: Obtain standard visible light images of Coptis chinensis with origin category labeling information to construct a training sample set; The training samples in the training sample set are input into the main network loaded with self-supervised pre-training weights for prediction. The first classification loss is constructed based on the prediction results of the training samples and the annotation information. The parameters of the main network are updated using the first classification loss to obtain the trained main network. From the training sample set, samples whose place of origin category labeling information belongs to the easily confused category set are selected to construct an expert training set; the parameters of the expert network are initialized according to the parameters of the trained main network, and the training samples in the expert training set are input into the expert network for prediction. Based on the prediction results of the training samples and the labeling information, a second classification loss is constructed. The parameters of the expert network are updated using the second classification loss to obtain the trained expert network.

6. The method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network according to claim 5, characterized in that, The first classification loss includes: in, Indicates the first category loss. Indicates the number of training samples in the input batch; Indicates the first The true origin category of each training sample; Indicates the true country of origin category The corresponding category weights, Indicates the main network to the first The training sample belongs to the first... Predicted probability for each origin category Indicates the main network to the first The training samples belong to the category of real place of origin. The predicted probability; Indicates the focus factor. This indicates the total number of candidate origin categories.

7. The method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network according to claim 5, characterized in that, The second category of loss includes: in, This represents the second category loss. Indicates the number of training samples in the input batch; Indicates the first The true origin category of each training sample in the easily confused category set; Indicates the true country of origin category The corresponding category weights, Indicates expert network on the first The training sample belongs to the set of easily confused categories. Predicted probability for each origin category Indicates expert network on the first The training samples belong to the category of real place of origin. The predicted probability; Indicates the focus factor. Represents a set of easily confused categories; This indicates the number of place of origin categories in the set of easily confused categories.

8. The method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network according to claim 5, characterized in that, Both the first classification loss and the second classification loss use an adaptive moment estimate optimizer with decoupled weight decay to update parameters. The parameter update relationship is as follows: in, This indicates the updated network parameters; This indicates the network parameters before the update; Indicates the parameter update step size; and These represent the first-order momentum and second-order momentum after bias correction, respectively; This represents the stabilizing constant to prevent the denominator from being zero; This represents the decoupling weight attenuation coefficient.

9. A Coptis chinensis origin prediction system based on a self-supervised gated expert network, the system comprising a memory and a processor; characterized in that, The memory is used to store the application program; the processor is used to run the application program and execute the Coptis chinensis origin prediction method based on a self-supervised gated expert network as described in any one of claims 1 to 8.

10. A computer storage medium, characterized in that, The computer storage medium stores a computer-readable storage medium, which, when executed by a processor, implements a method for predicting the origin of Coptis chinensis based on a self-supervised gated expert network as described in any one of claims 1 to 8.