Traditional Chinese medicine abnormal state recognition method, system, device and storage medium

By using a deep learning model that combines image and spectral data to automatically identify abnormal states of traditional Chinese medicine, this technology solves the problems of standardization and automation in the quality testing of traditional Chinese medicine, and achieves efficient and accurate identification of abnormal states of traditional Chinese medicine.

CN119622603BActive Publication Date: 2026-04-21CONITECH (BEIJING) MANAGEMENT SOFTWARE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CONITECH (BEIJING) MANAGEMENT SOFTWARE CO LTD
Filing Date
2025-02-12
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing methods for testing the quality of traditional Chinese medicine rely on manual operation and experience-based judgment, which are highly subjective, difficult to standardize and automate, have long testing cycles, and cannot meet the needs for rapid testing.

Method used

This method combines image and spectral data, and through preprocessing, feature extraction and fusion, utilizes a deep learning model to automatically identify abnormal states of traditional Chinese medicine, including image anomaly detection model and spectral anomaly detection model, and combines them with an anomaly state discrimination model for judgment.

Benefits of technology

It has enabled automated and intelligent identification of abnormal states of traditional Chinese medicine, improved the accuracy and efficiency of detection, reduced the subjectivity and instability of manual detection, enhanced the discriminative power and robustness of features, and improved the reliability and applicability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119622603B_ABST
    Figure CN119622603B_ABST
Patent Text Reader

Abstract

This application provides a method, system, device, and storage medium for identifying abnormal states of traditional Chinese medicine (TCM), relating to the field of anomaly identification. The method includes: acquiring product information of the TCM to be detected, and determining data acquisition standards for the TCM based on the product information and preset detection rules; inputting image data into a preset image anomaly detection model based on the data acquisition standards to obtain preliminary image anomaly regions; fusing visual feature data and spectral feature data to obtain anomaly feature vectors; inputting the anomaly feature vectors into a preset anomaly state discrimination model to output anomaly state data, and determining the anomaly state based on the anomaly state data and a preset anomaly state judgment threshold to obtain the anomaly state detection result of the TCM to be detected. This method enables timely and accurate identification of abnormal states in TCM.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of anomaly identification, specifically to a method, system, device, and storage medium for identifying abnormal states of traditional Chinese medicine. Background Technology

[0002] Traditional Chinese medicine (TCM) is a treasure of my country's traditional medicine, playing a vital role in disease prevention and treatment. However, due to the complexity and variability of the planting, harvesting, processing, and storage of TCM herbs, products are prone to inconsistencies in quality and adulteration. Therefore, quality testing and anomaly identification of TCM products are of great significance for ensuring the quality of TCM and the safety of clinical use.

[0003] Currently, commonly used methods for quality testing of traditional Chinese medicine mainly include microscopic examination, physicochemical identification, and chromatographic analysis. Although these methods can reflect certain characteristics of Chinese medicinal materials from different perspectives, most of them rely on manual operation and experience-based judgment, are highly subjective, difficult to standardize and automate, and have long testing cycles. Summary of the Invention

[0004] This application provides a method, system, device, and storage medium for identifying abnormal states of traditional Chinese medicine, which can identify abnormal states of traditional Chinese medicine in a timely and accurate manner.

[0005] Firstly, this application provides a method for identifying abnormal states of traditional Chinese medicine, the method comprising:

[0006] Obtain product information of the Chinese herbal medicine to be tested, and determine the data acquisition standards of the Chinese herbal medicine to be tested based on the product information and the preset testing rules;

[0007] Based on the data acquisition standards of the Chinese herbal medicine to be tested, standard image data and standard spectral data of the Chinese herbal medicine to be tested are acquired, and the standard image data and standard spectral data are preprocessed to obtain image data and spectral data.

[0008] Input image data and spectral data into a preset image anomaly detection model to obtain image anomaly regions and spectral anomaly regions;

[0009] Visual feature data is obtained by extracting features from abnormal regions of the image, and spectral feature data is obtained by extracting features from abnormal regions of the spectrum.

[0010] Feature fusion is performed on visual feature data and spectral feature data to obtain anomaly feature vectors;

[0011] The abnormal feature vector is input into the preset abnormal state discrimination model, the abnormal state data is output, and the abnormal state is judged based on the abnormal state data and the preset abnormal state judgment threshold to obtain the abnormal state detection result of the Chinese medicine to be detected.

[0012] By adopting the above technical solution, the product information of the Chinese herbal medicine (TCM) to be tested is first obtained. Based on the product information and preset testing rules, the data acquisition standards for the TCM to be tested are determined. This allows for the development of appropriate data collection schemes according to the characteristics of different TCMs, improving data quality and testing accuracy. Then, based on the data acquisition standards for the TCM to be tested, standard image data and standard spectral data are acquired. These standard image and spectral data are then preprocessed to obtain image data and spectral data. Using both image and spectral data formats allows for a more comprehensive characterization of the TCM's features. Preprocessing eliminates data noise and interference, improving data consistency and comparability. Next, the image and spectral data are input into a preset image anomaly detection model to obtain image anomaly regions and spectral anomaly regions. The preset anomaly detection model can automatically and intelligently detect abnormal states of TCMs, avoiding the subjectivity and instability of manual detection. Feature extraction is performed on the image anomaly regions to obtain visual feature data, and feature extraction is performed on the spectral anomaly regions to obtain spectral feature data. Extracting feature data from anomaly regions highlights key information about the abnormal state, reducing feature dimensionality and computational complexity. Visual and spectral feature data are fused to obtain anomaly feature vectors. Feature fusion comprehensively utilizes both image and spectral anomaly information, enhancing the discriminative power and robustness of the features, and improving the accuracy and generalization ability of anomaly recognition. Finally, the anomaly feature vectors are input into a preset anomaly state discrimination model, which outputs anomaly state data. Based on the anomaly state data and a preset anomaly state judgment threshold, anomaly state determination is performed to obtain the anomaly state detection result for the Chinese medicine to be detected. Using the anomaly state discrimination model for classification decision-making can automatically identify the specific anomaly type of the Chinese medicine. The sensitivity of the discrimination is controlled by the anomaly state judgment threshold, improving the reliability and applicability of the detection.

[0013] A second aspect of this application provides a method system for identifying abnormal states of traditional Chinese medicine, comprising:

[0014] The data acquisition module is used to acquire product information of the Chinese medicine to be tested, and to determine the data acquisition standards of the Chinese medicine to be tested based on the product information and the preset testing rules.

[0015] The preprocessing module acquires standard image data and standard spectral data of the Chinese herbal medicine to be tested based on the data acquisition standards of the Chinese herbal medicine to be tested, and preprocesses the standard image data and standard spectral data to obtain image data and spectral data.

[0016] The first preliminary anomaly region detection module is used to input image data and spectral data into a preset image anomaly detection model to obtain image anomaly regions and spectral anomaly regions.

[0017] The second preliminary anomaly detection module is used to extract features from anomaly regions in the image to obtain visual feature data, and to extract features from spectral anomaly regions to obtain spectral feature data.

[0018] The feature fusion module is used to fuse visual feature data and spectral feature data to obtain anomaly feature vectors.

[0019] The state determination module is used to input the abnormal feature vector into the preset abnormal state discrimination model, output abnormal state data, and perform abnormal state determination based on the abnormal state data and the preset abnormal state determination threshold to obtain the abnormal state detection result of the Chinese medicine to be detected.

[0020] A third aspect of this application provides a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method steps described above.

[0021] A fourth aspect of this application provides an electronic device including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the methods described above.

[0022] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

[0023] 1. This application first obtains product information of the traditional Chinese medicine (TCM) to be tested, and based on this product information and pre-defined testing rules, determines the data acquisition standards for the TCM. This allows for the development of appropriate data collection schemes based on the characteristics of different TCMs, improving data quality and testing accuracy. Then, based on the data acquisition standards for the TCM to be tested, standard image data and standard spectral data are acquired. These standard image and spectral data are then preprocessed to obtain the final image and spectral data. Using both image and spectral data formats allows for a more comprehensive characterization of the TCM's features. Preprocessing eliminates data noise and interference, improving data consistency and comparability.

[0024] 2. This application inputs image data and spectral data into a pre-defined image anomaly detection model to obtain image anomaly regions and spectral anomaly regions. Using the pre-defined anomaly detection model, abnormal states of traditional Chinese medicine can be automatically and intelligently detected, avoiding the subjectivity and instability of manual detection. Feature extraction is performed on the image anomaly regions to obtain visual feature data, and feature extraction is performed on the spectral anomaly regions to obtain spectral feature data. Extracting feature data from anomaly regions can highlight key information about the abnormal state and reduce feature dimensionality and computational complexity. Feature fusion is performed on the visual feature data and spectral feature data to obtain an anomaly feature vector. Through feature fusion, both image and spectral anomaly information can be comprehensively utilized, enhancing the discriminative power and robustness of the features, and improving the accuracy and generalization ability of anomaly recognition.

[0025] 3. This application inputs the abnormal feature vector into a preset abnormal state discrimination model, outputs abnormal state data, and performs abnormal state judgment based on the abnormal state data and a preset abnormal state judgment threshold to obtain the abnormal state detection result of the Chinese medicine to be detected. By using the abnormal state discrimination model for classification decision-making, the specific abnormal type of Chinese medicine can be automatically identified. The sensitivity of the discrimination can be controlled by the abnormal state judgment threshold, thereby improving the reliability and applicability of the detection. Attached Figure Description

[0026] Figure 1 A flowchart illustrating a method for identifying abnormal states of traditional Chinese medicine provided in this application embodiment;

[0027] Figure 2 This application provides an architecture diagram of a traditional Chinese medicine abnormality identification system.

[0028] Figure 3 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation

[0029] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0030] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0031] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0032] To facilitate understanding of the methods and systems provided in the embodiments of this application, the background of the embodiments of this application will be introduced before introducing the embodiments of this application.

[0033] Traditional Chinese medicine (TCM) is a treasure of my country's traditional medicine, playing an irreplaceable role in disease prevention and treatment. However, due to the complexity of medicinal materials and the variability in planting, harvesting, processing, and storage, quality control of TCM products is challenging, easily leading to inconsistent quality and adulteration. Therefore, establishing a scientific, efficient, and accurate system for TCM quality testing and abnormal condition identification is of paramount importance for ensuring TCM quality, guaranteeing clinical medication safety, and promoting the healthy development of TCM.

[0034] Currently, commonly used methods for quality testing of traditional Chinese medicine (TCM) mainly include microscopic examination, physicochemical identification, and chromatographic analysis. Microscopic examination identifies and assesses the quality of TCM materials by observing their external morphological characteristics, such as color, texture, and cross-sectional features. Physicochemical identification detects certain physicochemical properties of TCM materials, such as moisture content, ash content, and extract content, through chemical reactions and physical constant determination. Chromatographic analysis, such as thin-layer chromatography and high-performance liquid chromatography, can be used to separate and identify the chemical components of TCM materials for qualitative and quantitative analysis. These traditional methods have played an important role in TCM quality testing, but they also have some limitations. For example, these methods largely rely on manual operation and experience-based judgment, and are greatly affected by the quality and subjective factors of the testing personnel, making it difficult to achieve standardization, automation, and quantification of the testing process and results. Furthermore, sample processing and testing steps are cumbersome, time-consuming, and labor-intensive, failing to meet the growing demand for rapid testing and restricting the efficiency and timeliness of TCM quality control.

[0035] After the background introduction above, those skilled in the art can understand the problems existing in the prior art. The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0036] Based on the aforementioned background technology, further please refer to... Figure 1 , Figure 1 This is a flowchart illustrating a method for identifying abnormal states of traditional Chinese medicine provided in this application embodiment. The system can be implemented using a computer program or run as an independent utility application. Specifically, in this application embodiment, the method can be applied to a server, but it can also be applied to electronic devices such as servers. A method for identifying abnormal states of traditional Chinese medicine includes the following steps:

[0037] S101, Obtain product information of the Chinese medicine to be tested, and determine the data acquisition standard of the Chinese medicine to be tested based on the product information of the Chinese medicine to be tested and the preset testing rules;

[0038] Specifically, based on the product information of the Chinese medicinal materials to be tested, this invention establishes data acquisition standards for these materials. The formulation of these standards fully considers the diversity and complexity of Chinese medicinal materials. For different varieties of Chinese medicinal materials, corresponding image acquisition parameters (such as light source, resolution, field of view, etc.) and spectral acquisition parameters (such as wavelength range, scanning interval, integration time, etc.) are specified at both macroscopic and microscopic levels. This aims to comprehensively collect information on the morphology, color, tissue structure, chemical composition, and other aspects of the Chinese medicinal material samples, providing reliable data support for subsequent quality evaluation and anomaly identification. It is worth mentioning that the data acquisition standards also fully consider the balance between detection efficiency and cost. While meeting the necessary information requirements, the standards prioritize rapid and simple acquisition methods, reducing sample preparation and manual operation steps, and improving detection throughput and automation levels.

[0039] S102, Based on the data acquisition standard of the Chinese medicine to be tested, acquire the standard image data and standard spectral data of the Chinese medicine to be tested, and preprocess the standard image data and standard spectral data to obtain image data and spectral data;

[0040] Specifically, after determining the data acquisition standards for the Chinese herbal medicine to be tested, the method of this invention further acquires the required image and spectral data based on these standards. Specifically, for image data acquisition, a high-resolution digital camera or microscope can be used to capture the surface and cross-sectional morphological features of the Chinese herbal medicine sample from multiple angles under standard light source conditions, obtaining standard image data reflecting its color, texture, and tissue structure. For spectral data acquisition, a suitable spectroscopic instrument for the Chinese herbal medicine to be tested, such as a near-infrared spectrometer or a Raman spectrometer, can be selected. According to predetermined parameter settings, such as wavelength range, number of scans, and resolution, the Chinese herbal medicine sample is spectrally scanned to obtain standard spectral data containing its chemical composition and structural information.

[0041] It should be noted that raw images and spectral data often contain noise and background interference, making them difficult to use directly for subsequent analysis. Therefore, necessary preprocessing is required. Preprocessing of standard image data mainly includes image denoising, enhancement, segmentation, and correction. The aim is to remove image noise, improve contrast, segment regions of interest, and eliminate the influence of factors such as shooting angle and lighting conditions, making the image clearer and more standardized, facilitating the extraction of key morphological features. Preprocessing of standard spectral data includes spectral denoising, baseline correction, spectral normalization, and feature extraction. The aim is to eliminate spectral noise and background drift, highlight key absorption peaks, and extract characteristic spectra that reflect the chemical properties of traditional Chinese medicine, preparing for spectral interpretation and quantitative analysis.

[0042] Based on the above embodiments, as an optional embodiment, before acquiring the standard image data of the Chinese herbal medicine to be tested, the following is also included:

[0043] S201, Based on the data acquisition standard of the Chinese medicine to be tested, acquire multi-view image data of the Chinese medicine to be tested, and preprocess the multi-view image data to obtain standardized images to be tested;

[0044] Specifically, multiple high-resolution digital cameras or a rotating camera platform are used, and reasonable shooting angles and paths are designed according to the shape characteristics of the medicinal herbs. Generally, for tuberous herbs, images can be taken from different angles such as the front, back, side, top, and bottom; for strip-stemmed herbs, images can be taken from different positions along the axial and radial directions; for spherical or irregularly shaped herbs, images can be taken by rotating around their outer surface at equal angles. During the collection process, camera parameters such as aperture, shutter speed, and white balance are adjusted to obtain multi-view image data with uniform brightness, true color, and clear details under standard lighting conditions. At the same time, key parameters such as shooting angle and distance should be recorded as the basis for image registration and 3D reconstruction.

[0045] Acquired multi-view image data is inevitably affected by factors such as uneven lighting, lens distortion, and depth-of-field blurring. Therefore, necessary image preprocessing is required to improve image quality and comparability. Specifically, this can be divided into the following steps: First, distortion correction is performed on the multi-view images to eliminate image distortion caused by radial and tangential lens distortion. Second, image enhancement techniques such as histogram equalization and Gaussian filtering are used to improve image contrast and smooth noise. Third, threshold segmentation and morphological processing are employed to segment the target region of the traditional Chinese medicine from the background, eliminating interference from impurities. Finally, the segmented images of the traditional Chinese medicine are calibrated according to a known scale to ensure that pixel distance corresponds to the actual size. After the above preprocessing, a standardized image for inspection with uniform perspective, standard color, and accurate size can be obtained.

[0046] Compared to conventional single-view or limited random-view shooting methods, the multi-view image acquisition and standardized preprocessing of this invention can more comprehensively and precisely record the morphological characteristics of Chinese medicinal materials, reducing information omissions caused by improper angle selection. By fusing and optimizing image information from different perspectives, data quality is improved, overcoming the problems of high noise and low clarity in single images. Furthermore, image scale and color uniformity are achieved, facilitating comparative analysis of images from different batches and varieties of Chinese medicinal materials. In addition, appropriate preprocessing of multi-view images can filter out background and noise interference, highlighting the unique characteristics of the Chinese medicinal materials themselves, thereby improving the speed and accuracy of subsequent feature extraction and anomaly detection.

[0047] S202, using a preset image segmentation model to extract the foreground from the standardized image to be inspected, and obtain standard image data.

[0048] Specifically, a pre-defined image segmentation model is employed: a semantic segmentation network based on deep learning. Unlike traditional methods such as thresholding and edge detection, the semantic segmentation network can fully exploit the contextual relationships between pixels in an image. Through end-to-end feature learning and multi-scale inference, it directly predicts the semantic category (e.g., foreground, background) of each pixel, thereby achieving pixel-level image annotation. Specifically, leading-edge semantic segmentation network architectures such as SegNet and the DeepLab series can be used, and the network can be trained and optimized on massive amounts of Chinese medicinal herb image data to develop robust and accurate foreground extraction capabilities.

[0049] When using an image segmentation model, a standardized image to be inspected is input into a pre-trained semantic segmentation network. After downsampling by the encoder and upsampling by the decoder, a pixel category probability map of the same size as the original image is generated. By setting a certain confidence threshold, the probability map is converted into a binary mask, that is, the target area of ​​Chinese medicinal herbs is marked as 1, and the background area is marked as 0. Finally, the original image is subjected to a pixel-level AND operation using the mask, which can accurately segment the foreground area of ​​Chinese medicinal herbs, and obtain standard image data containing only the target Chinese medicinal herbs after removing background interference.

[0050] Compared with manual annotation and traditional segmentation methods, the deep learning-based image segmentation model used in this invention has significant advantages. First, the semantic segmentation network, through end-to-end feature extraction and contextual reasoning, can accurately grasp the morphological boundaries of Chinese medicinal materials from a global perspective, overcoming the difficulties in segmentation caused by insufficient contrast and blurred edges in traditional methods. Second, because the network model can automatically learn the diverse characteristics of Chinese medicinal materials from large datasets, it has better adaptability and robustness to samples of different varieties and forms, greatly reducing the need for manual adjustment of segmentation parameters. Furthermore, the image segmentation computation process is highly parallelized; with GPU acceleration, near real-time foreground extraction of Chinese medicinal materials can be achieved, providing an efficient solution for batch processing of massive amounts of Chinese medicinal material images.

[0051] By extracting the foreground from standardized images and eliminating redundant information in the background region, subsequent feature analysis and anomaly detection are focused on the key quality attributes of the Chinese medicinal materials. This improves computational efficiency while further enhancing the accuracy and reliability of anomaly detection. Notably, the standardized image data obtained by this invention not only includes the two-dimensional foreground region of the Chinese medicinal materials but can also further reconstruct their three-dimensional morphological model. By spatially registering and fusing the multi-view segmentation results, complete and accurate three-dimensional point cloud or mesh data of the Chinese medicinal materials can be obtained, providing a new data foundation for higher-level quality characterization and artificial intelligence analysis.

[0052] Based on the above embodiments, as an optional embodiment, before obtaining the standard spectral data of the Chinese herbal medicine to be tested, the following is also included:

[0053] S301, based on the data acquisition standard of the Chinese medicine to be tested, acquire the visible light-near infrared full-band spectral data of the Chinese medicine to be tested, and preprocess the visible light-near infrared full-band spectral data to obtain a standardized spectral curve;

[0054] Specifically, this application employs a high-sensitivity visible-near-infrared spectrometer to perform full-spectrum scanning of traditional Chinese medicine samples under standard light source and temperature control conditions. The scanning wavelength range generally covers 350-2500 nm, encompassing the visible light region and near-infrared regions I and II, with a resolution of 1-2 nm to ensure complete acquisition and detailed characterization of the spectral features of traditional Chinese medicine. During the spectral acquisition process, instrument parameters such as the number of scans, integration time, and slit width are strictly controlled, and reflectance correction is performed using a standard white plate to minimize spectral differences introduced by instrument factors. Furthermore, for traditional Chinese medicine samples of different dosage forms and forms, the spectral acquisition mode and sampling method need to be optimized according to their physical characteristics, such as transmission method, diffuse reflectance method, and fiber optic probe method, to obtain original spectral data with high signal-to-noise ratio and good reproducibility.

[0055] Acquired visible-near-infrared full-band spectral data are inevitably affected by factors such as scattering, noise, and baseline drift. Therefore, necessary spectral preprocessing is required to improve spectral quality and comparability. Specifically, this involves the following steps: First, scattering correction is performed on the full-band spectrum to eliminate scattering effects caused by differences in particle size and surface condition. Second, methods such as detrending and standard normalization are used to eliminate spectral baseline drift and amplification errors. Third, moving average smoothing and wavelet transform denoising are employed to improve the spectral signal-to-noise ratio and highlight the characteristic absorption peaks of active pharmaceutical ingredients and indicator substances. Finally, the corrected spectral data is normalized to ensure uniformity in the scale of spectral curves measured by different batches and instruments. After the above preprocessing, standardized visible-near-infrared full-band spectral curves can be obtained.

[0056] Compared to conventional single-band or narrow-band spectral acquisition methods, the full-band spectral acquisition and standardized preprocessing of this invention can more comprehensively and precisely characterize the chemical properties of Chinese medicinal materials, reducing information omissions caused by improper acquisition conditions or band selection. Through the correction and optimization of the full-band spectral data, on the one hand, the spectral quality is improved, overcoming the problems of high noise and severe baseline drift in the original spectra; on the other hand, standardization of spectral measurements under different instruments and conditions is achieved, facilitating comparative analysis of the spectra of different batches and origins of Chinese medicinal materials. Furthermore, denoising and feature enhancement of the full-band spectral data can effectively reduce background interference and highlight the spectral characteristics of key pharmacodynamic components of Chinese medicinal materials, thereby providing more reliable data support for subsequent chemometric modeling and anomaly detection.

[0057] S302, based on the prior component information of the Chinese medicine to be tested, the standardized spectral curve is screened for characteristic wavelengths to obtain characteristic bands, and the spectral data of the characteristic bands are used as standard spectral data.

[0058] Specifically, when screening characteristic wavelengths, it is necessary to fully utilize the prior information on the components of the Chinese herbal medicine to be tested, namely its known chemical composition and quality attributes. By reviewing literature, quality standards, and historical testing data, the effective components, indicator components, and characteristic components that are prone to quality problems and play a decisive role in the quality of Chinese herbal medicines are summarized. Based on this, the physicochemical properties and spectral response characteristics of these key components are analyzed to preliminarily determine their characteristic absorption ranges in the visible-near-infrared spectrum. Then, spectral analysis and correlation studies are conducted on standardized spectral curves. By using indicators such as spectral resolution, signal-to-noise ratio, and characteristic absorption peak intensity, the sensitive characteristic bands and their width ranges of each component are further optimized. After selecting several candidate characteristic bands, methods such as cross-validation and independent test sets are used to evaluate the actual predictive effect and modeling robustness of each band, and finally, the optimal combination of characteristic bands with good stability, good effect, and strong representativeness is selected. The spectral data of one or more selected characteristic bands are combined in sequence to obtain the standard spectral data input.

[0059] Compared to using full-band spectral data, selecting characteristic wavelengths based on prior component information has significant advantages. First, characteristic wavelength selection fully utilizes background knowledge of the analyte, transforming empirical information and historical data into targeted spectral selection strategies. This ensures a high correlation between the selected bands and key quality attributes, reducing the introduction of irrelevant information. Second, through multiple evaluation and optimization criteria, characteristic wavelength selection reduces data dimensionality while maximizing the preservation of information content in the spectral data. This overcomes the multicollinearity problem in full-band spectra, improving data information density and modeling efficiency. Furthermore, the dimensionality and combination of characteristic bands can be flexibly adjusted according to actual needs. A single globally optimal band can be selected, or multiple locally optimal bands can be combined, facilitating subsequent spectral analysis and quality factor analysis.

[0060] S103, input the image data and spectral data into the preset image anomaly detection model to obtain the image anomaly region and the spectral anomaly region;

[0061] Specifically, in the abnormal traditional Chinese medicine (TCM) state identification method provided by this invention, a key step is to input image data and spectral data into a preset image anomaly detection model to obtain image anomaly regions and spectral anomaly regions. Image data refers to data obtained by preprocessing standard image data of the TCM to be detected, reflecting the visual characteristics of the TCM sample, such as color, shape, and texture. Spectral data refers to data obtained by preprocessing standard spectral data of the TCM to be detected, reflecting the chemical composition and structural information of the TCM sample, such as absorption peaks and reflectivity. The reason for inputting both image data and spectral data into the anomaly detection model is that a single data source often cannot comprehensively reflect the quality state of TCM and is easily affected by local anomalies or interference. By fusing image and spectral data sources, the characteristics of TCM can be characterized from different perspectives, complementing and verifying each other, thus improving the reliability and accuracy of anomaly detection.

[0062] In practical implementation, pre-trained deep learning models, such as Convolutional Neural Networks (CNNs) and Autoencoders (AEs), can be used as image anomaly detection models. Image and spectral data are input into different branches of the model, and multi-level features of the image and spectrum are extracted through operations such as convolution, pooling, and activation. Then, anomaly scores of the features are calculated using an anomaly metric function, and normal and abnormal regions are divided according to a preset threshold. Convolution operations can extract local features from the image and spectrum, pooling operations can reduce feature dimensionality and computational cost, and activation functions can increase the nonlinearity and expressive power of the features. Anomaly metrics can measure the degree to which features deviate from normal samples; commonly used metrics include Euclidean distance, Mahalanobis distance, and KL divergence. Anomaly regions refer to image patches or spectral segments whose anomaly scores exceed the threshold, reflecting potential abnormal parts or components of the traditional Chinese medicine sample.

[0063] S104, extract features from abnormal regions of the image to obtain visual feature data, and extract features from abnormal spectral regions to obtain spectral feature data;

[0064] Specifically, after obtaining the abnormal regions in the image and the spectral anomaly regions, the abnormal traditional Chinese medicine (TCM) state recognition method provided by this invention also needs to extract features from the abnormal regions to obtain visual feature data and spectral feature data. Visual feature data refers to data reflecting the visual attributes of TCM extracted from the abnormal regions in the image, such as color histograms, local binary patterns, and scale-invariant features. Spectral feature data refers to data reflecting the component attributes of TCM extracted from the spectral anomaly regions, such as the position, intensity, and width of characteristic absorption peaks. The reason for feature extraction from the abnormal regions is that although these regions reflect potential abnormal parts or components of TCM, their original data is high-dimensional and redundant, which is not conducive to subsequent analysis and judgment. Through feature extraction, the key information of the abnormal regions can be condensed and refined to obtain more discriminative feature representations, reducing storage and computational overhead and improving the efficiency and accuracy of abnormal state recognition.

[0065] In practice, feature extraction of anomalous regions in an image can employ traditional image feature descriptors, such as color histograms to characterize the color distribution of the anomalous region, local binary patterns to characterize its texture structure, and scale-invariant features to characterize salient points and edges. These features exhibit a certain degree of invariance to image translation, rotation, and scale changes, thus improving the robustness of the anomalous region representation. Furthermore, deep learning methods, such as convolutional neural networks, can be utilized to input the anomalous region into a pre-trained feature extraction network, automatically learning hierarchical visual features.

[0066] Feature extraction from spectral anomalies can employ common spectral analysis techniques, such as characteristic absorption peak detection, baseline correction, and spectral curve fitting. Characteristic absorption peaks are local maxima on the spectral curve, corresponding to specific chemical groups or structural fragments of the analyte and closely related to its composition and content. By detecting parameters such as the position, intensity, and width of characteristic absorption peaks in anomaly regions, the anomalous component properties can be revealed. Baseline correction and spectral curve fitting can eliminate background noise and artifacts during spectral measurements, improving the signal-to-noise ratio of characteristic absorption peak extraction.

[0067] S105, perform feature fusion on visual feature data and spectral feature data to obtain anomaly feature vector;

[0068] Specifically, various strategies can be employed to achieve feature fusion. One approach is to first perform feature selection on visual and spectral feature data separately, filtering out the most discriminative key features, and then performing simple concatenation or linear combination of these features to obtain the fused feature vector. This method is simple to implement and computationally efficient, but there may be information redundancy between features. Another more advanced fusion strategy utilizes machine learning methods such as multi-kernel learning and manifold learning to explore the intrinsic correlation between different features in a high- or low-dimensional space while preserving their physical meaning, forming a new unified feature representation. For example, multi-kernel support vector machines (MK-SVM) extract pattern information at different scales from visual and spectral features by setting different kernel functions, and perform optimal fusion at the classification boundary; multi-view manifold learning maps the original multi-source heterogeneous features to a common low-dimensional manifold space through nonlinear transformation, achieving dimensionality reduction and collaborative representation of features. After feature fusion, not only is the size of the feature data greatly reduced, and the subsequent computational load decreased, but the complementary and synergistic relationships between visual and spectral features are also uncovered, resulting in a more accurate and comprehensive characterization of the sample state.

[0069] Based on the above embodiments, as an optional embodiment, feature fusion is performed on visual feature data and spectral feature data to obtain an anomaly feature vector, including:

[0070] S401, feature alignment processing is performed on the visual feature data and spectral feature data to obtain aligned visual feature data and aligned spectral feature data. Then, a multi-view representation learning method is used to fuse the aligned visual feature data and aligned spectral feature data to obtain multi-view representation data. Figure 1 Integrated characteristics;

[0071] Specifically, when implementing feature fusion, this application first requires aligning the visual feature data and spectral feature data. Since visual images and spectral curves differ in acquisition process, signal source, and data format, necessary alignment is required before fusion, including preprocessing operations such as spatial registration, temporal synchronization, and data correspondence. Taking spatial registration as an example, since the acquisition perspective and resolution of visual images and spectral signals are usually inconsistent, geometric transformations (such as projection transformations and affine transformations) and interpolation calculations are needed to map spectral sampling points to image pixels one-to-one, ensuring accurate spatial matching of the two types of data. Similarly, batch correction and temporal alignment are required for data acquired in different batches and at different times. Furthermore, for visual and spectral detection data of the same batch of samples, one-to-one matching based on sample codes and other index information is required to ensure data correspondence in subsequent fusion analysis. Through a series of alignment processes, spatially registered and temporally synchronized aligned visual feature data and aligned spectral feature data can be obtained.

[0072] Building upon this foundation, a multi-view representation learning method is further employed to fuse the aligned visual-spectral multi-source data. Multi-view learning is an effective approach for heterogeneous data fusion. Its core idea is to map different view data to a common subspace, optimizing the consistency and complementarity of different views within this subspace to obtain a unified and compact representation. Common multi-view learning methods include canonical correlation analysis (CCA), multi-view spectral embedding (MSE), and multi-view dictionary learning (MDL). Taking CCA as an example, by finding the linear transformations of different view features, the maximum correlation of visual-spectral features in the common space is constructed, thereby achieving effective alignment of heterogeneous features. Similarly, MSE, through manifold learning and local preservation projection, maps visual-spectral features to a low-dimensional manifold space, achieving consistency constraints on the nearest neighbor relationships of different view samples. Generally, multiple representation learning methods can be comprehensively employed, using strategies such as weighted fusion or cascaded decomposition to mine the consistency and differences of visual-spectral data from a complementary perspective, constructing a scale-normalized, distributionally consistent, and information-complete multi-view representation. Figure 1 Integrated feature expression.

[0073] Through feature alignment and multi-view representation learning, this invention achieves a deep fusion of visual and spectral information, enabling a three-dimensional characterization of the quality status of traditional Chinese medicine (TCM) samples from both macroscopic morphology and microscopic composition dimensions. Compared to single visual or spectral detection, multi-source fusion can capture multiple aspects of TCM quality issues, providing a more comprehensive and reliable integrated criterion. On one hand, the alignment mechanism eliminates redundancy in the original multi-source data, highlighting the complementary correlation between different view signals and laying a solid foundation for data fusion. On the other hand, multi-view representation learning can adaptively extract unified fusion features from massive amounts of data, preserving complementary information from different data sources while overcoming the blindness of manually designed features, providing a low-redundancy, high-discrimination decision basis for anomaly detection. Furthermore, the aligned and fused multi-view... Figure 1 The integrated characteristics are consistent in scale and compatible in distribution, which facilitates the quality comparison of different batches and varieties of Chinese medicine samples, and also provides data support for subsequent anomaly location and source tracing analysis.

[0074] Based on the above embodiments, as an optional embodiment, a multi-view representation learning method is used to fuse aligned visual feature data and aligned spectral feature data to obtain multi-view representations. Figure 1 Integrated features, including:

[0075] S501, construct a visual feature view based on aligned visual feature data, and construct a spectral feature view based on aligned spectral feature data;

[0076] Specifically, in constructing multi-view representations, independent feature views are built for both aligned visual feature data and spectral feature data. For visual feature data, a set of original visual features, such as morphological features, color features, and texture features, are obtained through feature extraction and feature selection, and these are organized into a unified visual feature vector to form a visual feature view. Similarly, for spectral feature data, a set of original spectral features, such as reflectance peak positions, absorption intensity, and spectral curvature, are obtained through spectral preprocessing and feature extraction, and these are organized into a unified spectral feature vector to form a spectral feature view. When constructing each view, to fully exploit the discriminative information of the original data, a multi-level, multi-scale feature representation framework is typically adopted. This involves extracting high-level semantic features at the region and global levels based on pixel-level features, and constructing hierarchical features for the views through feature combination optimization and other methods. Furthermore, considering that multi-view learning is sensitive to the balance of different view dimensions, the original features are usually appropriately filtered and transformed during view construction to ensure that the features of different views are as balanced as possible in terms of dimensionality and scale.

[0077] Multi-view representation offers a novel perspective for fusing heterogeneous data. Compared to simple feature concatenation, multi-view representation avoids forcibly combining features from different sources. Instead, it achieves feature mapping and correlation analysis at a higher semantic space, which helps to fundamentally eliminate the distribution differences and modal fragmentation of heterogeneous features. On the one hand, by constructing visual, spectral, and other feature views separately, the uniqueness of heterogeneous data is fully reflected, and the discriminative information of different modalities is fully mined. On the other hand, by achieving the fusion mapping of different views in a common semantic space, the complementarity and consistency of heterogeneous data are fully utilized, and multi-source information can achieve deeper interaction and fusion. It is worth mentioning that the method of this invention fully utilizes empirical knowledge and data-driven analysis when constructing multi-view representations. While exploring the inherent discriminative features of visual and spectral data, it can introduce expert knowledge in the field of traditional Chinese medicine to assist in multi-level and multi-scale feature extraction, making the constructed feature views more in line with the professional needs of quality assessment of traditional Chinese medicine materials, and more targeted and interpretable.

[0078] S502, construct a visual feature view and a spectral feature view, and apply a manifold learning method to maintain the local neighborhood structure of the features within the visual feature view and the spectral feature view to obtain the first visual feature view and the first spectral feature view;

[0079] Specifically, when optimizing each view using manifold learning methods, manifold structure mining and preservation are performed separately for the visual feature view and the spectral feature view. Taking the visual feature view as an example, a nearest neighbor graph reflecting the initial association between samples is constructed by calculating the original similarity matrix between samples, such as Euclidean distance and cosine similarity. Based on the nearest neighbor graph, the influence of nonlinear distortion on the similarity metric is corrected by reconstructing the geodesic distance between samples, resulting in the manifold similarity matrix of the visual view. Finally, the visual feature view reconstructs the features of each sample by optimizing the objective function, achieving intra-view discriminative structure enhancement while satisfying criteria such as local linear embedding and Laplacian eigenmaps, thus obtaining the first visual feature view. Similarly, the above manifold learning steps are repeated in the spectral feature view to preserve the local neighborhood structure of the spectral view, resulting in the first spectral feature view. In practical applications, representative manifold learning algorithms such as equimetric learning, equidistant mapping, and local linear embedding can be comprehensively adopted, and personalized manifold mapping criteria can be constructed through collaborative optimization to improve the accuracy and robustness of feature learning.

[0080] By applying manifold learning within each view, this invention further enhances the discriminative power of each view, building upon the construction of different modal views and laying a more solid feature foundation for subsequent fusion learning. On one hand, manifold learning can extract deep-seated intrinsic structural information from high-dimensional nonlinear data, correcting distortions and redundancies in the original feature space, and learning a more compact and smooth manifold representation. This makes similar samples more clustered and dissimilar samples further separated, avoiding isolated points and short-circuit connectivity problems. As a result, subsequent fusion learning can more accurately extract common features from different views, effectively avoiding nonlinear interference and overfitting risks. On the other hand, by optimizing the manifolds of the visual and spectral views respectively, the discriminative power of different modal views is enhanced, and differential features and detailed information are further highlighted, creating conditions for exploring the complementarity of multiple views. It is foreseeable that, based on the first visual feature view and the first spectral feature view after manifold optimization, multi-view fusion will achieve a synergistic enhancement of "1+1>2," significantly improving the recall and precision of traditional Chinese medicine anomaly detection.

[0081] S503, learn the joint representation of the first visual feature view and the first spectral feature view through a bilinear mapping function to obtain the second visual feature view and the second spectral feature view;

[0082] Specifically, in implementing bilinear mapping for collaborative representation learning, a joint semantic space is constructed by optimizing the parameters of the bilinear model, using the first visual feature view and the first spectral feature view as input. First, the projection matrix of the bilinear mapping function is randomly initialized, mapping the visual view features and spectral view features to a shared subspace, obtaining initial collaborative representations. Then, the parameters of the bilinear mapping function are optimized by minimizing the similarity error between the collaborative representations of different views, such as geodesic distance and manifold ordering error, to make the collaborative representations of different views as close as possible. Simultaneously, to avoid overfitting and enhance model generalization, a regularization term is typically introduced into the optimization objective to constrain and smooth the parameters of the bilinear model. Finally, the bilinear model is iteratively optimized until the collaborative representations of the visual and spectral views converge to the optimal solution, yielding the second visual feature view and the second spectral feature view, respectively. In practical applications, efficient algorithms such as alternating optimization and gradient descent can be used to solve the bilinear model, and strategies such as early stopping mechanisms and multi-view joint loss can be introduced to enhance the robustness and convergence speed of learning.

[0083] By employing bilinear mapping to achieve multi-view collaborative representation learning, this invention, based on independent optimization across different modalities, further establishes the association and interaction between visual and spectral views, realizing the semantic fusion of multi-source data. On one hand, the bilinear model can learn the collaborative relationships between different views, transforming visual and spectral features into a common implicit space through mapping, enabling different views to obtain a consistent representation, overcoming the "heterogeneous gap," and realizing the transfer of multimodal features from specific domains to a common domain. In the collaborative representation that has learned mutual knowledge, the differences between modalities are smoothed out, and complementary characteristics are stimulated, creating conditions for subsequent feature-level fusion. On the other hand, the bilinear mapping incorporates manifold structure information, maintaining intra-view discriminability while learning the associations between views. The collaborative representation not only inherits the advantages of the original views but also learns new modal fusion characteristics, possessing stronger semantic expressive power than a single view. Under the collaborative representation of the second visual feature view and the second spectral feature view, the abnormal features of Chinese medicinal material samples will be more significant, the advantages of different modal data will be concentrated, and the effectiveness of multi-view fusion will be fully realized.

[0084] Based on the above embodiments, as an optional embodiment, a second visual feature view and a second spectral feature view are obtained by learning a joint representation of the first visual feature view and the first spectral feature view through a bilinear mapping function, including:

[0085] S601, initialize the parameters of the bilinear mapping function, and construct the visual mapping matrix and spectral mapping matrix based on the parameters of the bilinear mapping function respectively;

[0086] Specifically, when initializing the parameters and constructing the mapping matrix of the bilinear model, the weight matrix and bias vector of the bilinear mapping function are first initialized based on the dimensions of the first visual feature view and the first spectral feature view. Common initialization strategies include all-zero initialization, random initialization, and Xavier initialization. Among these, Xavier initialization, which makes the variance of the output of each layer as equal as possible, is a commonly used initialization method. After obtaining the initialization parameters, the visual mapping matrix and the spectral mapping matrix are constructed based on the weight matrix and the original dimensions of the visual and spectral features, respectively. Let the feature dimension of the first visual feature view be m, the feature dimension of the first spectral feature view be n, and the target dimension of the collaborative representation space be d. Then, the dimension of the visual mapping matrix is ​​m×d, and the dimension of the spectral mapping matrix is ​​n×d. The bilinear model achieves a linear transformation from the original feature space to the collaborative representation space by multiplying the visual features with the visual mapping matrix and the spectral features with the spectral mapping matrix. In practical applications, different parameter initialization strategies and mapping matrix construction methods can be flexibly selected, and combined with mechanisms such as regularization and parameter sharing, to enhance the adaptability and generalization of the bilinear model learning.

[0087] By appropriately initializing the parameters of the bilinear model and constructing feature mapping matrices for different views, this invention lays a solid foundation for collaborative representation learning. On one hand, reasonable initial parameter values ​​accelerate the optimization of the bilinear model, enabling it to converge to the optimal solution more quickly and alleviating the difficulty of model training. This is particularly important for high-dimensional, sparse multimodal data related to traditional Chinese medicine. While the initial mapping matrices may not be optimal, they effectively respond to the original feature distributions of different views, providing a favorable starting point for subsequent parameter fine-tuning. On the other hand, the construction of the visual and spectral mapping matrices directly affects the quality of multi-view collaborative representation. By multiplying the features of each view with their corresponding mapping matrices, the original visual and spectral features are transformed into a common semantic space, achieving the convergence and fusion of discriminative information from different views in the new space. Even in the initial stage, this feature transformation carried by the mapping matrices can alleviate the "heterogeneous gap" to some extent, creating conditions for exploring the complementarity between views. Therefore, using the mapping matrices constructed with the initial parameters as a bridge, multi-view collaborative representation learning will inevitably be more efficient and robust, laying a solid foundation for subsequent parameter optimization and extraction of integrated fusion features.

[0088] S602 maps the visual mapping matrix and spectral mapping matrix from the original feature space to a common subspace, and solves the optimization problem of collaborative representation learning in the common subspace to obtain the optimal inter-view mapping matrix;

[0089] Specifically, in implementing the mapping of visual and spectral mapping matrices to the common subspace, and solving the collaborative representation learning optimization problem, based on the initially constructed visual and spectral mapping matrices, the transformation mapping from the original space to the common subspace is learned by optimizing and minimizing the representational differences of features after different view mappings. Common optimization objectives include cross-entropy loss and mean squared error, used to measure the semantic similarity of features from different view mappings. Taking mean squared error as an example, by minimizing the reconstruction error between visual and spectral mapping features, they are made as close as possible in the common subspace. At the same time, by constraining the low-rank of each view mapping matrix, a more compact collaborative representation can be learned. After constructing the optimization objective function, gradient descent is used to iteratively optimize and solve it, alternately updating the visual mapping matrix, spectral mapping matrix, and basis vectors of the common representation space, and finally obtaining the optimal collaborative mapping matrix between views in the common subspace. It is worth mentioning that, in order to further enhance the discriminativeness and generalization of collaborative representation, prior constraints such as regularization terms and multi-view label consistency can be introduced into the optimization objective, and the convergence speed and generalization ability of model training can be controlled by strategies such as learning rate adjustment and early stopping.

[0090] By mapping visual and spectral mapping matrices to a common subspace and solving the optimization problem of collaborative representation learning within this space, this invention further enhances the consistency of discriminative information across different views, building upon multi-view semantic alignment and achieving in-depth mining of multimodal complementary characteristics. On one hand, the introduction of the common subspace addresses the significant differences in the spatial distribution of the original visual and spectral features, achieving effective semantic alignment of different views through feature transformation, providing a unified optimization platform for collaborative learning. The nonlinear mapping from the original space to the common subspace essentially achieves consistent matching of the multi-view discriminative structure, maintaining the discriminative power of each view while mitigating the "heterogeneous gap" between them. On the other hand, within the framework of the common subspace, optimizing the representational differences of multi-view mapping features through methods such as cross-entropy loss maximizes the mining of complementary synergies between different views. The optimization process iteratively refines the semantic relationships between views, weakening the impact of view redundancy and noise, and to a certain extent achieving the "complementary" aggregation of discriminative information. Therefore, multi-view collaborative learning in the public subspace will inevitably make the extracted integrated features more complete in representation and more accurate in discrimination, thus providing a more reliable basis for the precise detection of abnormalities in traditional Chinese medicine.

[0091] S603, using the optimal inter-view mapping matrix, maps the first visual feature view and the first spectral feature view to a common subspace to obtain the second visual feature view and the second spectral feature view.

[0092] Specifically, when mapping the first visual feature view and the first spectral feature view to a common subspace using the optimal inter-view mapping matrix, the learned optimal visual mapping matrix and optimal spectral mapping matrix serve as a bridge, achieving a linear transformation from the original feature space to the common subspace through matrix multiplication. Let the number of samples in the first visual feature view be x, and the feature dimension be d1; let the number of samples in the first spectral feature view be y, and the feature dimension be d2; and let the dimension of the common subspace be k. Then, the dimension of the optimal visual mapping matrix is ​​d1×k, and the dimension of the optimal spectral mapping matrix is ​​d2×k. For each sample in the first visual feature view, multiplying its feature vector by the optimal visual mapping matrix transforms it to the k-dimensional common subspace, thus obtaining the representation of that sample in the second visual feature view. Similarly, using the optimal spectral mapping matrix, the sample features of the first spectral feature view can be transformed to the common subspace to obtain the second spectral feature view. It is worth noting that, in order to ensure the comparability of the common representations after mapping different views, the original features of each view are usually normalized before mapping, such as z-score normalization, L2 normalization, etc., to eliminate the influence of differences in feature dimensions and scales.

[0093] By utilizing the optimal inter-view mapping matrix to map the first visual feature view and the first spectral feature view to a common subspace, a second visual feature view and a second spectral feature view are obtained. This invention, based on personalized view discrimination mining, further achieves effective semantic fusion of multi-view features. On one hand, the mapping transformation of the common subspace achieves consistent calibration of discriminative information from different views, preserving the original view discrimination structure while bridging the "heterogeneous gap" between views. The common representation, bridged by the optimal mapping matrix, integrates multi-source discriminative information from visual and spectral perspectives, continuing the inherent manifold structure of each view while learning higher-level semantic representations, which will undoubtedly provide more comprehensive and refined quality features for anomaly detection. On the other hand, the distribution of the second visual feature view and the second spectral feature view obtained from mapping different views in the common space will become more consistent. While discrimination differences are amplified, complementary characteristics are also fused to a certain extent. Compared to a single perspective, the multi-view fusion representation formed in the common space will undoubtedly possess stronger semantic expression capabilities, providing a more reliable basis for characterizing the overall quality of Chinese medicinal materials and identifying local anomalies. Subsequent multi-view learning will build upon this foundation to achieve a leapfrog improvement from fusion to aggregation, and from consistency to complementarity.

[0094] S504, introducing multi-view Figure 1 Consistency constraints are used to optimize the consistency between the second visual feature view and the second spectral feature view, resulting in multi-view... Figure 1 Integrated characteristics.

[0095] Specifically, in implementing multi-view Figure 1During consistency constraint optimization, based on the collaborative representation of the second visual feature view and the second spectral feature view, a unified multi-view structure is constructed by introducing criterion functions such as inter-view similarity regularization and intra-view discriminative constraints. Figure 1 Consistency optimization model. Taking inter-view similarity regularization as an example, by minimizing the differences in similarity matrices of collaborative representations of different views, such as the L2 norm and nuclear norm, the semantic distance between visual and spectral views is explicitly reduced, ensuring that they consistently reflect the abnormal features of traditional Chinese medicine. Simultaneously, within each view, discriminant criteria functions such as intra-class clustering and inter-class separation are used to maximize the feature similarity of samples of the same class and minimize the feature similarity of samples of different classes, further strengthening the discriminative power and mutual exclusivity of each view. In multi-view... Figure 1 In the consistency model, different criterion functions are weighted and combined to collaboratively mine commonalities among views and individual characteristics within views. An alternating iterative optimization strategy is used to update the collaborative representations of each view, ultimately achieving full alignment between visual and spectral views in the semantic space. Redundant information is reduced to the greatest extent, complementary characteristics are highlighted, and a unified multiview model is obtained. Figure 1 Integrated feature representation. In practical applications, methods such as graph regularization, kernel space alignment, and manifold reconstruction can be flexibly used to construct personalized consistency constraint terms, and strategies such as adaptive weighting and kernel function selection can be introduced to enhance the adaptability and generalization of the model.

[0096] By introducing multi-view Figure 1 By optimizing the collaborative representation through consistency constraints, this invention significantly enhances the discriminativeness and mutual exclusivity of multi-view fusion features, achieving a comprehensive and accurate characterization of abnormal information in traditional Chinese medicine. On one hand, the inter-view similarity regularization explicitly models the consistency of discriminative features across different views. By narrowing the semantic space distance between visual and spectral views, the collaborative representation produces consistent discrimination for the same traditional Chinese medicine sample, overcoming the "semantic gap" in view representations and enabling the synchronous presentation of multi-view discriminative information. On the other hand, intra-view discriminative constraints maximize the individual characteristics of each view representation. Through intra-class aggregation and inter-class separation, it ensures that the fusion features inherit the discriminative advantages of different perspectives such as visual and spectral, fully reflecting complementary characteristics and capturing details that are difficult to characterize with a single view. In a unified multi-view... Figure 1 In integrated features, discriminative information from different modalities achieves "complementary advantages," minimizing data redundancy while maximizing mutual exclusion. The fused feature representation is compact and robust, more accurately reflecting the intrinsic quality of Chinese medicinal materials than a single view. Therefore, based on integrated features, the recall and precision of anomaly detection in Chinese medicinal materials will be significantly improved, and practical difficulties such as missing labeled data and small sample sizes will be alleviated.

[0097] S402, for fused multi-view Figure 1The integrated features are dimensionality reduced to obtain low-dimensional abnormal feature vectors. Then, an L1 regularization-based feature selection method is adopted. By introducing a sparsity penalty term, the low-dimensional abnormal feature vectors are automatically searched to obtain sparse abnormal feature vector representations.

[0098] Specifically, when implementing feature dimensionality reduction and selection, the classic dimensionality reduction method is first used for multi-view... Figure 1 Dimensionality reduction is achieved by integrating features. Common dimensionality reduction methods include principal component analysis (PCA), linear discriminant analysis (LDA), and kernel-based dimensionality reduction. Taking PCA as an example, this method maps the original high-dimensional features to a set of low-dimensional orthogonal bases through linear transformation, preserving the main variance information of the samples while filtering out noise and redundant components, thus obtaining compact low-dimensional anomaly feature vectors. In practical applications, PCA decomposes the covariance matrix by eigenvalue decomposition and selects the eigenvectors corresponding to the first few largest eigenvalues ​​as principal components, achieving a linear mapping from high to low dimensions. It is worth noting that this invention fully considers the class structure information of the samples during dimensionality reduction, introducing supervised information to guide the process, such as supervised PCA and discriminant analysis. Compared with unsupervised dimensionality reduction, supervised dimensionality reduction can maximize the separability of anomaly samples and normal samples in the low-dimensional subspace, which is more conducive to subsequent anomaly detection and classification decisions.

[0099] Building upon this, a feature selection method based on L1 regularization is further utilized to search for the most discriminative sparse feature subset from low-dimensional anomaly feature vectors. L1 regularization is a structured sparse representation method based on the L1 norm. By introducing an L1 norm penalty term into the optimization objective, it adaptively compresses the weights of irrelevant features to zero, thereby obtaining a sparse representation of key features. Common L1 regularized feature selection methods include Lasso regression and L1 regularized support vector machines. Taking Lasso regression as an example, this method, while minimizing the empirical risk of the anomaly detection model, incorporates an L1 norm penalty term, causing the learning algorithm to favor sparse weight solutions, automatically achieving feature selection. When the regularization coefficient is appropriate, only the weights corresponding to a few features most relevant to anomaly detection are non-zero, while the rest are compressed to zero. Specifically, Lasso regression iteratively optimizes the weight coefficients of each feature by solving a least-squares problem containing an L1 regularization term until it converges to the sparse optimal solution. Therefore, the optimal combination of abnormal features can be searched from the low-dimensional feature vector, realizing the automatic extraction and sparse coding of key abnormal information.

[0100] By employing dimensionality reduction and L1 regularized feature selection, this invention achieves automatic extraction and optimized representation of anomalous features from high to low dimension and from redundancy to simplification. Compared to the original high-dimensional multi-view features, the resulting sparse anomalous feature vectors not only have significantly reduced dimensionality but also eliminate a large amount of redundant information irrelevant to anomaly detection, highlighting the key features most discriminative for anomalous samples. On one hand, feature dimensionality reduction effectively controls the "curse of dimensionality," making subsequent anomaly detection model training simpler and more efficient, while supervised dimensionality reduction incorporating category information further enhances the prominence of anomalous information. On the other hand, the introduction of L1 regularization embeds the feature selection process into the anomaly discrimination model learning, adaptively determining the optimal discriminative features through learning sparse representations, overcoming the blindness of manually designed features, and providing a solid foundation for fast and accurate anomaly detection. Furthermore, the low-dimensional sparse features after dimensionality reduction and feature selection are more concise and efficient, significantly reducing subsequent transmission, storage, and computation costs, which is beneficial for achieving lightweight and real-time operation of traditional Chinese medicine anomaly detection systems.

[0101] S403 utilizes a supervised dimensionality reduction method based on the Fisher criterion to optimize the inter-class and intra-class divergence of the abnormal feature vector representation, thereby obtaining the abnormal feature vector.

[0102] Specifically, after obtaining the sparse anomaly feature vector representation, the abnormal Chinese medicine state recognition method provided by this invention further utilizes a supervised dimensionality reduction method based on the Fisher criterion to optimize the inter-class and intra-class divergence of the anomaly feature vector representation, resulting in a more discriminative anomaly feature vector. The Fisher criterion is a classic linear supervised dimensionality reduction method that maximizes the separability of samples in the feature space by explicitly modeling the mean vectors and covariance matrices of different classes, achieving a transfer from an unsupervised feature subspace to a supervised discriminative subspace. The reason for embedding the Fisher criterion for supervised dimensionality reduction optimization on top of the sparse anomaly feature representation is that while unsupervised sparse representation can filter out most of the redundancy and noise and highlight key anomaly patterns, it does not directly utilize the category information of the anomaly state to constrain and enhance the feature semantics. By introducing category priors through Fisher's criterion, the feature space can be reconstructed from a discriminative perspective, making the abnormal and normal classes as separate as possible in statistical distribution, while clustering within each class as much as possible. This avoids feature ambiguity caused by inter-class confusion and intra-class multimodality, further improving the discriminability and robustness of abnormal features.

[0103] In practical implementation, an iterative optimization approach can be used to find the optimal discriminative projection direction of the Fisher criterion. Using the current sparse anomaly feature vector as the initial feature, in each iteration, the mean vectors and within-class covariance matrices of the anomaly and normal classes are first calculated to characterize the distribution of the two classes in the current feature space. Then, a Fisher discriminative objective function is constructed based on the Euclidean distance of the mean vectors and the weighted trace of the covariance matrix. By maximizing the inter-class distance and minimizing the intra-class divergence, the anomaly and normal classes are ensured to be most separated in the projected feature space. Next, the generalized eigenvalue problem of this objective function is solved to obtain the eigenvector with the largest Fisher discriminant criterion. The original sparse features are then mapped to the optimal discriminative space defined by this vector, completing one supervised dimensionality reduction. This process is iterated multiple times until the anomaly feature vector converges, thus obtaining the optimal anomaly feature representation.

[0104] S106, input the abnormal feature vector into the preset abnormal state discrimination model, output abnormal state data, and perform abnormal state judgment based on the abnormal state data and the preset abnormal state judgment threshold to obtain the abnormal state detection result of the Chinese medicine to be detected.

[0105] Specifically, the construction of anomaly detection models can employ common machine learning classification algorithms such as Support Vector Machines (SVM), Random Forests (RF), and Neural Networks (NN). Taking SVM as an example, firstly, based on expert experience and quality standards, a batch of representative traditional Chinese medicine samples are labeled with abnormal states, serving as the training set. Then, the abnormal feature vectors of these samples are input into the SVM, and through kernel function transformation, they are mapped to a high-dimensional space. The hyperplane with the largest margin between samples of different categories is then searched as the optimal classification boundary. During this process, key parameters of the SVM, such as the kernel function type, penalty factor, and slack variables, are continuously optimized through methods such as cross-validation and grid search to improve the model's generalization performance. After training, a stable and reliable anomaly detection model is obtained. When a new sample to be detected is submitted, its abnormal feature vector is input into the model, and through a series of nonlinear transformations and classification decisions, output data representing the abnormal state of the sample can be obtained.

[0106] To further clarify whether a sample is abnormal and the degree of abnormality, this invention introduces a preset abnormality judgment threshold. By comparing the abnormality data output by the SVM with this threshold, a more accurate abnormality judgment can be made on the sample. If the abnormality data is greater than the threshold, it indicates that the abnormal characteristics of the sample exceed the range of normal samples and is judged as abnormal; conversely, it indicates that the various indicators of the sample are still within the normal range and is judged as qualified. In addition, based on the degree of deviation between the abnormality data and the threshold, the abnormality can be further quantified into different levels such as slight, moderate, and severe, providing an intuitive basis for quality grading control.

[0107] By employing both an anomaly discrimination model and threshold checks, the objectivity and consistency of detection results are ensured, while also providing a qualitative and quantitative description of the degree of anomaly. This represents a significant improvement over traditional empirical manual identification. Because the discrimination model fully utilizes prior knowledge of known abnormal samples and summarizes and extracts key feature patterns that distinguish between normal and abnormal samples through machine learning methods, it possesses a strong ability to summarize patterns and predict anomalies in unknown samples. Furthermore, based on holistic discrimination using fused features, compared to threshold comparisons of single indicators, it can more accurately and comprehensively assess the overall quality of traditional Chinese medicine, reducing misjudgments caused by overgeneralization and borderline ambiguity. In addition, thanks to the automatic learning function of the discrimination model and the dynamic adjustment function of the threshold, the judgment rules and boundaries can be continuously optimized as the abnormal sample database is continuously accumulated and improved, thereby continuously enhancing the anomaly detection capability and adapting to dynamic changes in different varieties, origins, and even production processes.

[0108] Based on the above embodiments, as an optional embodiment, anomaly determination is performed based on abnormal state data and a preset abnormal state determination threshold to obtain the abnormal state detection result of the Chinese medicine to be tested, including:

[0109] S701, calculate the confidence level of the abnormal state data to obtain the confidence scores of various abnormal states;

[0110] Specifically, when calculating the confidence score for anomalous data, the output probability or anomaly score of the classification model can be used as a basis. By designing a reasonable confidence calculation function, the anomalous state can be mapped to a confidence score between 0 and 1. Taking the Softmax classifier as an example, the model's output vector represents the probability of a sample belonging to each category, with the sum of each dimension being 1. The probability value of the dimension corresponding to the anomalous state can be directly used as its confidence score; the higher the score, the more likely the sample is to belong to that anomalous category. Considering the class imbalance characteristic of traditional Chinese medicine anomaly detection tasks, a prior distribution of the categories can be introduced when calculating the confidence score, giving sparse classes higher weights to correct the confidence bias caused by uneven sample distribution. In addition, some detection models, such as support vector machines, do not directly output probabilities. In this case, methods such as Platt calibration can be used to convert the anomaly score into a confidence score. Common calibration methods include sigmoid transformation and isotonic regression. It is worth mentioning that anomalous data usually has structured characteristics; for example, mold is often accompanied by abnormal color, and insect infestation often causes shape changes. Therefore, when calculating anomaly confidence, graph-based reasoning and multi-instance learning methods can be incorporated to fully explore the correlations and dependencies between anomalies, achieve joint confidence calculation, and comprehensively improve the interpretability and accuracy of the judgment.

[0111] By calculating the confidence scores of abnormal state data, this invention, based on the accurate localization of abnormalities in traditional Chinese medicine (TCM), further achieves a quantitative assessment of the severity of abnormalities, providing an intuitive and interpretable basis for quality grading decisions. On one hand, as a fine-grained characterization of abnormality, anomaly confidence scores more accurately reflect the continuous variation characteristics of TCM material quality than discrete categories. Mapping detected multidimensional anomalies to a unified confidence score not only facilitates comparability analysis between anomalies but also makes the anomaly judgment results easier for non-experts to understand, improving the usability of the detection model. On the other hand, combining the data-driven characteristics of deep learning with confidence score calculation fully explores the discriminative information inherent in the model, reducing the subjectivity of manually setting thresholds. Classification probabilities and anomaly scores indirectly reflect the model's confidence level, while confidence score calculation externalizes this uncertainty in a more intuitive form, providing a tool for automatically adjusting detection thresholds. Furthermore, anomaly confidence scores also facilitate the introduction of prior knowledge and the fusion of discriminative criteria. Through methods such as prior distribution correction and multi-instance constraints, the confidence estimation level in complex scenarios can be further improved. With its advantages of being intuitive, flexible, and interpretable, anomaly confidence will play an increasingly important role in the quality grading of Chinese medicinal materials, driving the detection model from experience-driven to data-driven, and ultimately achieving an intelligent upgrade from "detecting anomalies" to "managing risks".

[0112] S702, compare the confidence scores of various abnormal states with the preset abnormal state judgment thresholds. If the confidence scores exceed the preset abnormal state judgment thresholds, the abnormal state detection result of the Chinese medicine to be tested is determined to be an abnormal state; if the confidence scores of all abnormal states do not exceed the preset abnormal state judgment thresholds, the abnormal state detection result of the Chinese medicine to be tested is determined to be a normal state.

[0113] Specifically, when comparing the confidence score of an abnormal state with the judgment threshold, a pre-set abnormal state judgment threshold is used as the benchmark, and the confidence score is compared with the threshold one by one through programming statements. Taking mold abnormality as an example, assuming its judgment threshold is set to 0.6, when the confidence score of mold of a certain Chinese herbal medicine to be tested is 0.8, then the confidence score exceeds the preset threshold, and the final abnormal state detection result of the sample can be determined as mold abnormality; conversely, if the confidence score of mold of the sample is only 0.4, and the confidence scores of other abnormalities such as insect infestation and impurities do not exceed the corresponding judgment thresholds, then the final state of the sample can be determined as normal. Considering the diversity and complexity of abnormalities in Chinese herbal medicines, in practical applications, it is also necessary to set the judgment threshold for various abnormalities individually. For abnormalities with greater harm, such as mold, the threshold can be set lower to improve the risk detection rate; while for abnormalities with less harm, such as slight browning, the threshold can be appropriately increased to reduce the false judgment rate. Furthermore, it is essential to adaptively adjust the anomaly thresholds for different Chinese medicinal materials based on prior knowledge. For example, the threshold for judging insect infestation can be lowered for materials prone to insect damage, while the threshold for judging mold growth can be raised for materials prone to mold. In summary, by setting personalized thresholds, quality assessment strategies can be tailored to individual needs, fully considering the characteristics and usage requirements of Chinese medicinal materials, and striking a balance between automation and flexibility.

[0114] By comparing the confidence scores of various abnormal states with preset abnormal state judgment thresholds, the final abnormal state detection result of the Chinese medicinal materials to be tested is obtained. This invention forms an automated and personalized quality grading strategy for Chinese medicinal materials, going a step further than simple anomaly identification and achieving a leap from "discovering problems" to "guiding decision-making." On the one hand, it transforms continuous confidence scores into discrete anomaly judgments, directly outputting clear quality assessment results. This retains the fine-grained advantage of confidence representation while significantly reducing the difficulty of automatic sorting and manual verification, laying the foundation for the application of medicinal material quality grading. On the other hand, by using preset thresholds as a bridge to integrate data-driven and knowledge-driven approaches, it can fully absorb expert experience, realize personalized customization and real-time adjustment of detection strategies, and improve the system's adaptability to complex application environments. Compared to a uniform threshold, a personalized threshold scheme can finely balance the risk and benefit of different Chinese medicinal materials and different anomaly types, which is of great significance for improving the comprehensiveness and accuracy of the system. It is worth mentioning that threshold comparison, as the last checkpoint for judging anomalies, directly affects whether medicinal materials can be inspected and stored and put into production. Therefore, the setting of threshold limits needs to be based on the verification of a large number of real scenarios, carefully balancing the detection rate and the false judgment rate, and introducing auxiliary mechanisms such as multi-level thresholds and confidence backtracking when necessary to cope with more complex and ever-changing application needs.

[0115] Please see Figure 2 , Figure 2This application provides an embodiment of a traditional Chinese medicine abnormality identification system architecture diagram, which may include:

[0116] Data acquisition module 1 is used to acquire product information of the Chinese medicine to be tested, and to determine the data acquisition standard of the Chinese medicine to be tested based on the product information and the preset testing rules.

[0117] Preprocessing module 2 acquires standard image data and standard spectral data of the Chinese medicine to be tested based on the data acquisition standard of the Chinese medicine to be tested, and preprocesses the standard image data and standard spectral data to obtain image data and spectral data;

[0118] The first preliminary anomaly region detection module 3 is used to input image data and spectral data into a preset image anomaly detection model to obtain image anomaly regions and spectral anomaly regions.

[0119] The second preliminary anomaly detection module 4 is used to extract features from the abnormal regions of the image to obtain visual feature data, and to extract features from the spectral anomaly regions to obtain spectral feature data.

[0120] Feature fusion module 5 is used to fuse visual feature data and spectral feature data to obtain anomaly feature vectors;

[0121] The state determination module 6 is used to input the abnormal feature vector into the preset abnormal state discrimination model, output the abnormal state data, and perform abnormal state determination based on the abnormal state data and the preset abnormal state determination threshold to obtain the abnormal state detection result of the Chinese medicine to be detected.

[0122] It should be noted that the system provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0123] Please refer to Figure 3 This application also discloses an electronic device. Figure 3 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. The electronic device 300 may include: at least one processor 301, at least one network interface 304, a user interface 303, a memory 305, and at least one communication bus 302 or end-to-end wireless communication.

[0124] The communication bus 302 is used to enable communication between these components.

[0125] The user interface 303 may include a display screen and a camera. Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.

[0126] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0127] The processor 301 may include one or more processing cores. The processor 301 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 305, and by calling data stored in memory 305. Optionally, the processor 301 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 301 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 301.

[0128] The memory 305 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 305 may include a non-transitory computer-readable medium. The memory 305 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 305 may also be at least one storage system located remotely from the aforementioned processor 301. (Refer to...) Figure 3The memory 305, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for identifying abnormal states of traditional Chinese medicine.

[0129] exist Figure 3 In the illustrated electronic device 300, the user interface 303 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 301 can be used to call the application program storing the method for identifying abnormal states of traditional Chinese medicine in the memory 305. When executed by one or more processors 301, the electronic device 300 performs one or more methods as described in the above embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simplicity, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily necessary for this application. In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0130] In the various embodiments provided in this application, it should be understood that the disclosed system can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interfaces; the indirect coupling or communication connection between systems or modules may be electrical or other forms.

[0131] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0132] This application also provides a computer storage medium that can store multiple instructions, which are adapted to be loaded and executed by a processor as described above. Figure 1 The method for identifying abnormal states of traditional Chinese medicine shown in the embodiment can be found in the following description for its specific execution process. Figure 1 The specific details of the illustrated embodiments will not be elaborated here.

[0133] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0134] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0135] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will be readily apparent to those skilled in the art upon consideration of the specification and the disclosure of practical truths.

[0136] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. A method for identifying abnormal states of traditional Chinese medicine, characterized in that, The method includes: Obtain product information of the Chinese herbal medicine to be tested, and determine the data acquisition standard of the Chinese herbal medicine to be tested based on the product information of the Chinese herbal medicine to be tested and the preset testing rules; Based on the data acquisition standard of the Chinese medicine to be tested, standard image data and standard spectral data of the Chinese medicine to be tested are acquired, and the standard image data and standard spectral data are preprocessed to obtain image data and spectral data. The image data and the spectral data are input into a preset image anomaly detection model to obtain image anomaly regions and spectral anomaly regions. Visual feature data is obtained by extracting features from the abnormal regions of the image, and spectral feature data is obtained by extracting features from the abnormal regions of the spectrum. The visual feature data and the spectral feature data are fused to obtain an anomaly feature vector; The abnormal feature vector is input into a preset abnormal state discrimination model, and abnormal state data is output. Based on the abnormal state data and the preset abnormal state judgment threshold, the abnormal state is judged to obtain the abnormal state detection result of the Chinese medicine to be detected. The step of fusing the visual feature data and the spectral feature data to obtain an anomaly feature vector includes: The visual feature data and the spectral feature data are subjected to feature alignment processing to obtain aligned visual feature data and aligned spectral feature data. Then, a multi-view representation learning method is used to fuse the aligned visual feature data and the aligned spectral feature data to obtain multi-view integrated features. The dimensionality of the fused multi-view integrated features is reduced to obtain a low-dimensional anomaly feature vector. Then, an L1 regularization-based feature selection method is adopted. By introducing a sparsity penalty term, the low-dimensional anomaly feature vector is automatically searched to obtain a sparse anomaly feature vector representation. The anomaly feature vector is obtained by optimizing the inter-class and intra-class divergence of the anomaly feature vector representation using a supervised dimensionality reduction method based on Fisher's criterion. The method employs a multi-view representation learning approach to fuse the aligned visual feature data and the aligned spectral feature data to obtain a unified multi-view feature, including: A visual feature view is constructed based on the aligned visual feature data, and a spectral feature view is constructed based on the aligned spectral feature data. A visual feature view and a spectral feature view are constructed, and a manifold learning method is applied within the visual feature view and the spectral feature view to preserve the local neighborhood structure of the features, thereby obtaining a first visual feature view and a first spectral feature view; The second visual feature view and the second spectral feature view are obtained by learning the joint representation of the first visual feature view and the first spectral feature view through a bilinear mapping function. By introducing a multi-view consistency constraint, the consistency between the second visual feature view and the second spectral feature view is optimized to obtain the multi-view integrated feature; The step of learning the joint representation of the first visual feature view and the first spectral feature view through a bilinear mapping function to obtain the second visual feature view and the second spectral feature view includes: Initialize the parameters of the bilinear mapping function, and construct the visual mapping matrix and the spectral mapping matrix based on the parameters of the bilinear mapping function, respectively; The visual mapping matrix and the spectral mapping matrix are mapped from the original feature space to a common subspace, and the optimization problem of collaborative representation learning is solved in the common subspace to obtain the optimal inter-view mapping matrix. Using the optimal inter-view mapping matrix, the first visual feature view and the first spectral feature view are mapped to the common subspace to obtain the second visual feature view and the second spectral feature view.

2. The method according to claim 1, characterized in that, Before acquiring the standard image data of the Chinese herbal medicine to be tested, the process also includes: Based on the data acquisition standard of the Chinese medicine to be tested, multi-view image data of the Chinese medicine to be tested is acquired, and the multi-view image data is preprocessed to obtain a standardized image to be tested. The standardized image to be examined is extracted using a preset image segmentation model to obtain the standard image data.

3. The method according to claim 1, characterized in that, Before obtaining the standard spectral data of the Chinese herbal medicine to be tested, the process also includes: Based on the data acquisition standard of the Chinese herbal medicine to be tested, the visible light-near infrared full-band spectral data of the Chinese herbal medicine to be tested are acquired, and the visible light-near infrared full-band spectral data are preprocessed to obtain a standardized spectral curve. Based on the prior component information of the Chinese herbal medicine to be tested, the standardized spectral curve is screened for characteristic wavelengths to obtain characteristic bands, and the spectral data of the characteristic bands are used as the standard spectral data.

4. The method according to claim 1, characterized in that, The step of determining the abnormal state based on the abnormal state data and a preset abnormal state determination threshold to obtain the abnormal state detection result of the Chinese herbal medicine to be tested includes: The confidence level of the abnormal state data is calculated to obtain the confidence scores of various abnormal states; The confidence scores of the various abnormal states are compared with the preset abnormal state determination threshold. If the confidence score exceeds the preset abnormal state determination threshold, the abnormal state detection result of the Chinese medicine to be tested is determined to be abnormal. If the confidence scores of all abnormal states do not exceed the preset abnormal state determination threshold, the abnormal state detection result of the Chinese medicine to be tested is determined to be normal.

5. A system for identifying abnormal states of traditional Chinese medicine, characterized in that, The system includes: The data acquisition module is used to acquire product information of the Chinese medicine to be tested, and to determine the data acquisition standard of the Chinese medicine to be tested based on the product information of the Chinese medicine to be tested and the preset testing rules. The preprocessing module acquires standard image data and standard spectral data of the Chinese herbal medicine to be tested based on the data acquisition standard of the Chinese herbal medicine to be tested, and preprocesses the standard image data and standard spectral data to obtain image data and spectral data. The first preliminary anomaly region detection module is used to input the image data and the spectral data into a preset image anomaly detection model to obtain image anomaly regions and spectral anomaly regions. The second preliminary anomaly detection module is used to extract features from the image anomaly region to obtain visual feature data, and to extract features from the spectral anomaly region to obtain spectral feature data. The feature fusion module is used to fuse the visual feature data and the spectral feature data to obtain an abnormal feature vector. The state determination module is used to input the abnormal feature vector into a preset abnormal state discrimination model, output abnormal state data, and perform abnormal state determination based on the abnormal state data and the preset abnormal state determination threshold to obtain the abnormal state detection result of the Chinese medicine to be detected. The step of fusing the visual feature data and the spectral feature data to obtain an anomaly feature vector includes: The visual feature data and the spectral feature data are subjected to feature alignment processing to obtain aligned visual feature data and aligned spectral feature data. Then, a multi-view representation learning method is used to fuse the aligned visual feature data and the aligned spectral feature data to obtain multi-view integrated features. The dimensionality of the fused multi-view integrated features is reduced to obtain a low-dimensional anomaly feature vector. Then, an L1 regularization-based feature selection method is adopted. By introducing a sparsity penalty term, the low-dimensional anomaly feature vector is automatically searched to obtain a sparse anomaly feature vector representation. The anomaly feature vector is obtained by optimizing the inter-class and intra-class divergence of the anomaly feature vector representation using a supervised dimensionality reduction method based on Fisher's criterion. The method employs a multi-view representation learning approach to fuse the aligned visual feature data and the aligned spectral feature data to obtain a unified multi-view feature, including: A visual feature view is constructed based on the aligned visual feature data, and a spectral feature view is constructed based on the aligned spectral feature data. A visual feature view and a spectral feature view are constructed, and a manifold learning method is applied within the visual feature view and the spectral feature view to preserve the local neighborhood structure of the features, thereby obtaining a first visual feature view and a first spectral feature view; The second visual feature view and the second spectral feature view are obtained by learning the joint representation of the first visual feature view and the first spectral feature view through a bilinear mapping function. By introducing a multi-view consistency constraint, the consistency between the second visual feature view and the second spectral feature view is optimized to obtain the multi-view integrated feature; The step of learning the joint representation of the first visual feature view and the first spectral feature view through a bilinear mapping function to obtain the second visual feature view and the second spectral feature view includes: Initialize the parameters of the bilinear mapping function, and construct the visual mapping matrix and the spectral mapping matrix based on the parameters of the bilinear mapping function, respectively; The visual mapping matrix and the spectral mapping matrix are mapped from the original feature space to a common subspace, and the optimization problem of collaborative representation learning is solved in the common subspace to obtain the optimal inter-view mapping matrix. Using the optimal inter-view mapping matrix, the first visual feature view and the first spectral feature view are mapped to the common subspace to obtain the second visual feature view and the second spectral feature view.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted to be loaded by a processor and executed as described in any one of claims 1 to 4.

7. An electronic device, characterized in that, The device includes a processor, a memory, and a transceiver. The memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Government affair item dialogue recommendation method based on multi-dimensional vector fusion

    CN118227894A

  • Electronic cigarette defect detection method and device based on machine visual perception

    CN118411352A

  • Traditional Chinese medicine quality detection system based on image recognition

    CN118674954A