A neural network-based method and system for tracing the source of raw materials for traditional Chinese medicine beverages
By collecting multi-dimensional feature data of Chinese medicinal materials, identifying key surface morphological regions and correcting the neural network model, the accuracy and reliability of the traceability method for Chinese medicinal materials were solved. This enabled the determination of the authenticity of the origin and quality compliance of Chinese medicinal materials, ensuring the quality safety and management efficiency of raw materials for Chinese herbal beverages.
Patent Information
- Application Number
- CN202511140950.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-08-15
AI Technical Summary
Existing methods for tracing the origin of Chinese medicinal materials are easily influenced by human experience, resulting in low accuracy. Labels are easily counterfeited, and the physicochemical testing capabilities are limited, making it difficult to meet the needs for rapid and accurate identification during large-scale procurement. Furthermore, existing neural network methods are not accurate enough in distinguishing between Chinese medicinal materials from similar production areas.
By collecting multi-dimensional characteristic data of Chinese medicinal materials, identifying and determining key morphological regions on the surface, generating morphological characteristic parameters through geometric configuration, correcting the neural network model, and combining it with the origin database for traceability analysis, the authenticity of the origin and the conformity of quality can be determined.
It improves the accuracy and reliability of traceability analysis of Chinese medicinal materials, effectively distinguishes Chinese medicinal materials with similar morphology, ensures the quality and safety of raw materials for Chinese herbal beverages, and improves management efficiency.
Smart Images

Figure CN120765272B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method and system for tracing and analyzing the source of raw materials for traditional Chinese medicine beverages based on neural networks. Background Technology
[0002] Traditional methods for tracing the origin of Chinese medicinal materials often rely on manual experience-based identification, labeling, or simple physicochemical testing, which face numerous challenges in practical application. Manual identification is easily affected by the professional level and subjective differences of the personnel involved, and its efficiency is low, making it difficult to meet the needs of rapid and accurate identification during large-scale procurement. Labeling is susceptible to tampering or forgery, potentially distorting traceability information. While physicochemical testing can obtain some component data, its ability to reflect the potential correlation between the growth environment, quality characteristics, and origin of Chinese medicinal materials is relatively limited.
[0003] With the expanding application of deep learning and computer vision technologies in the traceability of agricultural products and food, traceability analysis technologies based on neural networks are also gradually being applied to the field of traditional Chinese medicine. However, existing technologies still have some problems that urgently need to be solved in practical applications. Some methods focus on single-dimensional feature analysis, such as relying solely on appearance image recognition or component data comparison. When distinguishing traditional Chinese medicine varieties with similar origins and morphologies, the accuracy is easily affected. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method and system for tracing the source of raw materials for traditional Chinese medicine beverages based on neural networks, so as to improve the accuracy and reliability of tracing the source of traditional Chinese medicine materials.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0006] Firstly, a method for tracing and analyzing the raw materials of traditional Chinese medicine beverages based on neural networks, the method comprising:
[0007] Step 1: In the procurement of Chinese medicinal materials, collect multi-dimensional characteristic data of the batch of Chinese medicinal materials to be tested. The multi-dimensional characteristic data includes appearance morphology data, physicochemical property data and growth environment data.
[0008] Step 2: Based on the appearance morphology data, identify and determine three key morphological regions on the surface of the Chinese medicinal materials, where the first region is located at the protrusion, the second region is located at the depression, and the third region is located at the crack.
[0009] Step 3: Based on the three key morphological regions, a closed geometric configuration is formed by connecting the center points of the regions, and spatial structural characteristics are extracted based on the geometric configuration to generate a morphological feature parameter.
[0010] Step 4: Use morphological feature parameters to modify the preset neural network source tracing model to obtain the modified neural network source tracing model.
[0011] Step 5: Based on multi-dimensional feature data and the corrected neural network traceability model, generate the raw material traceability analysis results for the batch of Chinese medicinal materials to be tested. The traceability analysis results include the determination of the authenticity of the place of origin and the determination of quality compliance.
[0012] Step 6: Based on the raw material traceability analysis results, perform the Chinese medicinal material quality monitoring operation. When the traceability analysis results do not meet the preset standards, trigger a quality alarm or interception command for that batch of raw materials; when the traceability analysis results meet the preset standards, authorize that batch of raw materials to enter the production process.
[0013] Furthermore, based on morphological data, three key morphological regions on the surface of the medicinal materials were identified and determined. The first region is located at the protrusions, the second region at the depressions, and the third region at the cracks, including:
[0014] Based on the appearance morphology data, a three-dimensional gradient field model of the surface is constructed, and the three-dimensional gradient vector at each spatial location is calculated.
[0015] Based on the distribution characteristics of the three-dimensional gradient vector magnitude, spatial point clusters with gradient magnitudes exceeding a preset threshold are selected.
[0016] The convex cluster with the largest connected domain area in the spatial point cluster is identified as the first region; the concave cluster with the largest connected domain area in the spatial point cluster is identified as the second region; linear feature clusters whose rate of change of three-dimensional gradient vector direction exceeds a preset threshold are identified, and the longest continuous crack cluster in the linear feature cluster is identified as the third region.
[0017] Output the spatial distribution range identifiers of the first, second, and third regions.
[0018] Furthermore, based on the three key morphological regions, a closed geometric configuration is formed by connecting the center points of the regions. Spatial structural characteristics are then extracted based on this geometric configuration to generate a morphological feature parameter, including:
[0019] Based on the spatial distribution range identifier of the first region, extract the geometric center coordinates of the first region; based on the spatial distribution range identifier of the second region, extract the geometric center coordinates of the second region; based on the topological identifier data of the third region, extract the coordinates of the central axis point of the third region.
[0020] Connect the coordinates of the geometric center of the first region, the coordinates of the geometric center of the second region, and the coordinates of the central point of the third region to form a set of spatial reference points;
[0021] The sum of the Euclidean distances between any two points in the spatial reference point set is calculated to generate morphological characteristic parameters that characterize the surface structure dispersion.
[0022] Furthermore, the preset neural network source tracing model is modified using morphological feature parameters to obtain a modified neural network source tracing model, including:
[0023] Obtain a standard database of medicinal materials containing samples of Chinese medicinal materials from different origins in order to construct an initial neural network traceability model;
[0024] Using multi-dimensional feature data from the standard medicinal materials database as input data, and the origin labels corresponding to the multi-dimensional feature data in the standard medicinal materials database as training targets, the parameters of the initial neural network traceability model are iteratively optimized until the difference between the output predicted origin and the training target meets the preset convergence condition, thus obtaining the trained neural network traceability model.
[0025] The morphological feature parameters are compared with the mean of the standard feature parameters of the corresponding medicinal material category in the standard medicinal material database associated with the trained neural network traceability model, and the morphological feature deviation value, which represents the degree of difference between the current batch of medicinal materials and the standard sample, is calculated.
[0026] Based on the deviation value of morphological features and the preset mapping rule of correction coefficients, the weight correction coefficients used to adjust the sensitivity of the initial neural network source tracing model are dynamically determined.
[0027] The weight correction coefficients are applied to a specified convolutional layer of the trained neural network tracing model to adjust the weight parameters of the convolutional layer element by element, thereby completing the adaptive adjustment of the parameters of the trained neural network tracing model.
[0028] After adaptively adjusting the parameters of the neural network tracing model after training, a corrected neural network tracing model containing adaptive parameters is obtained.
[0029] Furthermore, based on the morphological feature deviation value and the preset correction coefficient mapping rule, the weight correction coefficients used to adjust the sensitivity of the initial neural network source tracing model are dynamically determined, including:
[0030] The deviation value of the morphological feature is input into the preset correction coefficient mapping rule, and a nonlinear transformation operation is performed, that is:
[0031] When the deviation value of the morphological feature is less than the first preset threshold, the first fixed value is output as the weight correction coefficient;
[0032] When the deviation value of the morphological feature is greater than or equal to the first threshold and less than or equal to the second threshold, the corresponding weight correction coefficient is calculated based on the relative position ratio of the deviation value between the first threshold and the second threshold, combined with the preset ratio coefficient.
[0033] When the deviation value of the morphological feature is greater than the second preset threshold, the second fixed value is output as the weight correction coefficient.
[0034] Furthermore, based on multi-dimensional feature data and the corrected neural network traceability model, the raw material traceability analysis results for the tested batch of Chinese medicinal materials are generated. These traceability analysis results include determination of the authenticity of the place of origin and determination of quality compliance, including:
[0035] The multi-dimensional feature data of the batch of Chinese medicinal materials to be tested are input into the modified neural network traceability model to perform hierarchical feature abstraction and fusion of the multi-dimensional feature data, and output a deep feature vector that represents the essential characteristics of the batch of Chinese medicinal materials to be tested.
[0036] Input the deep feature vector into the preset origin classifier, calculate the probability distribution of the deep feature vector on each origin category defined by the standard medicinal material database associated with the modified neural network traceability model; determine the predicted origin based on the probability distribution, and calculate the confidence level characterizing the reliability of the predicted origin.
[0037] Input the deep feature vector into the preset quality evaluator, calculate the similarity value between the deep feature vector and the benchmark feature vector of the same category of standard medicinal materials in the standard medicinal material database, and use it as the quality compliance score.
[0038] By integrating predicted origin and confidence level, as well as quality compliance score, raw material traceability analysis results are generated, which include conclusions on the authenticity of origin and the quality grade.
[0039] Furthermore, the multi-dimensional feature data of the batch of Chinese medicinal materials to be tested is input into the modified neural network traceability model to perform hierarchical feature abstraction and fusion of the multi-dimensional feature data, and output a deep feature vector representing the essential characteristics of the batch of Chinese medicinal materials to be tested, including:
[0040] The system receives multi-dimensional feature data of the batch of Chinese medicinal materials to be tested, and extracts spatial features from the appearance morphology data in the multi-dimensional feature data through the first-level convolutional module of the modified neural network traceability model, generating a first-level output that characterizes the surface structure properties.
[0041] The second-level fusion module of the modified neural network tracing model concatenates the first-level output representing surface structure characteristics with the physicochemical property data in the multi-dimensional feature data to obtain the concatenated features.
[0042] Convolution and nonlinear activation operations are performed on the spliced features to generate a second-level output that integrates morphology and physicochemical properties.
[0043] The third-level abstraction module of the modified neural network source tracing model concatenates the second-level output with the growth environment data in the multi-dimensional feature data, and uses deep convolutional layers to perform deep semantic abstraction on the concatenated features to generate the third-level output that integrates multi-dimensional features.
[0044] By using the global pooling layer and fully connected layer of the modified neural network source tracing model, dimensionality reduction and compression operations are performed on the third-level output to output a fixed-dimensional deep feature vector.
[0045] Secondly, a traceability analysis system for raw materials of traditional Chinese medicine beverages based on neural networks includes:
[0046] The data acquisition module is used to collect multi-dimensional characteristic data of the batch of Chinese medicinal materials to be tested during the procurement process. The multi-dimensional characteristic data includes appearance morphology data, physicochemical property data and growth environment data.
[0047] The key area identification module is used to identify and determine the first area located on the protrusion, the second area located on the depression, and the third area located on the crack on the surface of Chinese medicinal materials based on appearance morphology data.
[0048] The morphological parameter generation module is used to form a closed geometric configuration by connecting the center points of three key morphological regions, and to extract spatial structural characteristics based on the geometric configuration to generate a morphological feature parameter.
[0049] The model correction module is used to correct the preset neural network tracing model using morphological feature parameters to obtain the corrected neural network tracing model.
[0050] The traceability analysis module is used to generate raw material traceability analysis results for the batch of Chinese medicinal materials to be tested, including the determination of the authenticity of the place of origin and the determination of the quality compliance, based on multi-dimensional feature data and the corrected neural network traceability model.
[0051] The quality monitoring module is used to perform quality monitoring operations on Chinese medicinal materials based on the traceability analysis results of raw materials. When the traceability analysis results do not meet the preset standards, a quality alarm or interception command is triggered for that batch of raw materials; when the traceability analysis results meet the preset standards, the corresponding batch of raw materials is authorized to enter the production process.
[0052] Thirdly, a computing device includes:
[0053] One or more processors;
[0054] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method.
[0055] Fourthly, a computer-readable storage medium storing a program that, when executed by a processor, implements the method.
[0056] The above-described solution of the present invention has at least the following beneficial effects:
[0057] At the data acquisition level, by collecting multi-dimensional characteristic data on appearance, physicochemical properties, and growth environment, comprehensive information on Chinese medicinal materials, from their external appearance to their internal components and growth background, is comprehensively covered. Compared with single-dimensional data acquisition, this approach can more accurately and comprehensively characterize the properties of Chinese medicinal materials. Regarding key morphological region identification and feature extraction, three key morphological regions—protrusions, depressions, and cracks—are identified on the surface of Chinese medicinal materials. Based on these regions, geometric configurations are constructed to generate morphological feature parameters, deeply mining the microstructural information of the surface of Chinese medicinal materials. This unique feature extraction method enhances the ability to distinguish Chinese medicinal materials from different origins and of different qualities, effectively identifying varieties of Chinese medicinal materials with similar morphologies and improving the accuracy of traceability analysis.
[0058] For neural network models, morphological feature parameters are used to modify the preset model, enabling the model to dynamically adjust parameters based on the characteristic differences of different batches of Chinese medicinal materials. This overcomes the insufficient generalization ability of traditional fixed-parameter training models and improves the model's adaptability to different batches of Chinese medicinal materials. In practical applications, this method can simultaneously determine the authenticity of the place of origin and the conformity of quality, outputting comprehensive raw material traceability analysis results, and enabling precise quality monitoring. When quality problems are found in the medicinal materials, alarms or interception are triggered in a timely manner; when they are qualified, they are quickly authorized to enter the production process. This not only ensures the quality and safety of raw materials for Chinese herbal beverages but also improves the management efficiency of the procurement and production of Chinese medicinal materials. Attached Figure Description
[0059] Figure 1 This is a flowchart illustrating a method for tracing and analyzing the raw materials of traditional Chinese medicine beverages based on neural networks, provided by an embodiment of the present invention.
[0060] Figure 2 This is a schematic diagram of a traceability analysis system for raw materials of traditional Chinese medicine beverages based on neural networks, provided by an embodiment of the present invention. Detailed Implementation
[0061] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0062] like Figure 1As shown in the figure, an embodiment of the present invention proposes a method for tracing and analyzing the raw materials of traditional Chinese medicine beverages based on neural networks. The method includes the following steps:
[0063] Step 1: In the procurement of Chinese medicinal materials, collect multi-dimensional characteristic data of the batch of Chinese medicinal materials to be tested. The multi-dimensional characteristic data includes appearance morphology data, physicochemical property data and growth environment data.
[0064] Step 2: Based on the appearance morphology data, identify and determine three key morphological regions on the surface of the Chinese medicinal materials, where the first region is located at the protrusion, the second region is located at the depression, and the third region is located at the crack.
[0065] Step 3: Based on the three key morphological regions, a closed geometric configuration is formed by connecting the center points of the regions, and spatial structural characteristics are extracted based on the geometric configuration to generate a morphological feature parameter.
[0066] Step 4: Use morphological feature parameters to modify the preset neural network source tracing model to obtain the modified neural network source tracing model.
[0067] Step 5: Based on multi-dimensional feature data and the corrected neural network traceability model, generate the raw material traceability analysis results for the batch of Chinese medicinal materials to be tested. The traceability analysis results include the determination of the authenticity of the place of origin and the determination of quality compliance.
[0068] Step 6: Based on the raw material traceability analysis results, perform the Chinese medicinal material quality monitoring operation. When the traceability analysis results do not meet the preset standards, trigger a quality alarm or interception command for that batch of raw materials; when the traceability analysis results meet the preset standards, authorize that batch of raw materials to enter the production process.
[0069] In this embodiment of the invention, multi-dimensional feature data is collected, breaking through the limitations of traditional single detection. The data on appearance, physicochemical properties and growth environment are integrated to comprehensively capture the characteristics of medicinal materials and provide a rich information foundation for traceability analysis. The microstructure of the surface of medicinal materials is focused on to identify key morphological areas such as protrusions, depressions and cracks, and geometric configurations are constructed to extract morphological feature parameters, thereby enhancing the ability to differentiate similar medicinal materials and improving the precision of feature analysis.
[0070] By dynamically correcting the neural network traceability model using morphological feature parameters, the traditional fixed parameter mode is changed, enabling the model to adapt to the fluctuations in the characteristics of different batches of medicinal materials, thereby enhancing its generalization ability and prediction accuracy. Step 5 combines multi-dimensional data with the corrected model to simultaneously determine the authenticity of the place of origin and assess the quality compliance, outputting comprehensive traceability results and providing a scientific basis for quality control. Based on the traceability results, quality monitoring is automatically executed to promptly intercept unqualified medicinal materials and release high-quality raw materials, ensuring the safety of the source of Chinese herbal beverage production and optimizing the efficiency of supply chain management.
[0071] In a preferred embodiment of the present invention, step 1 above, in the procurement of Chinese medicinal materials, involves collecting multi-dimensional characteristic data of the batch of Chinese medicinal materials to be tested. The multi-dimensional characteristic data includes appearance morphology data, physicochemical property data, and growth environment data, and may include:
[0072] In this embodiment of the invention, the process of acquiring appearance morphology data is as follows:
[0073] Using non-contact 3D imaging technology, industrial-grade structured light scanners or LiDAR equipment are used to perform omnidirectional scanning of Chinese medicinal materials, acquiring high-precision point cloud data to construct a 3D surface model and record the overall outline, texture details, surface undulations, and other morphological features of the medicinal materials. Simultaneously, high-resolution image acquisition equipment is used to capture high-definition images of the medicinal materials from multiple angles. Image enhancement and noise reduction algorithms are applied to process the original images, highlighting subtle features such as surface cracks and color distribution.
[0074] Physicochemical property data acquisition: High-performance liquid chromatography (HPLC) and gas chromatography-mass spectrometry (GC-MS) are used to separate and qualitatively and quantitatively analyze the components of Chinese medicinal materials, obtaining data on the types and contents of active ingredients such as alkaloids, flavonoids, and polysaccharides. Infrared or near-infrared spectrometers are used to rapidly determine the component fingerprint spectrum of the medicinal materials through spectral reflection or transmission principles. Atomic absorption spectrometry is used to detect the content of heavy metal elements, ensuring the safety indicators of the medicinal materials. The results of various instrument tests are standardized and integrated into a physicochemical property dataset.
[0075] Data Collection on Growing Environment: For information on the growing environment, real-time meteorological data (such as temperature, humidity, sunshine duration, and rainfall) and soil parameters (including pH value, organic matter content, and nitrogen, phosphorus, and potassium nutrient concentrations) are acquired by connecting to the IoT monitoring system of the medicinal herb planting base. Simultaneously, management information during the planting process is collected, such as fertilizer types and amounts, irrigation methods, and pest and disease control measures. Furthermore, spatial data such as geographical location, altitude, and topography of the growing area are obtained using Geographic Information System (GIS) technology to comprehensively construct a database of the medicinal herb growing environment. Finally, the three types of data—appearance, physicochemical properties, and growing environment—are structured and integrated, and metadata such as sample batch and collection time are labeled to form a complete multi-dimensional feature dataset.
[0076] The collected appearance, physicochemical properties, and growth environment data are uniformly encoded and converted into a format, a database index is established, and metadata information such as sample batch, collection time, and collection location is labeled, ultimately forming a structured and standardized multi-dimensional feature dataset.
[0077] In a preferred embodiment of the present invention, step 2 above, based on appearance morphology data, identifies and determines three key morphological regions on the surface of the medicinal material, wherein the first region is located at the protrusion, the second region is located at the depression, and the third region is located at the crack, and may include:
[0078] Step 200: Based on the appearance morphology data, construct a three-dimensional gradient field model of the surface and calculate the three-dimensional gradient vector at each spatial location;
[0079] Step 201: Based on the distribution characteristics of the three-dimensional gradient vector magnitude, filter the spatial point clusters whose gradient magnitude exceeds a preset threshold.
[0080] Step 202: The convex cluster with the largest connected domain area in the spatial point cluster is identified as the first region; the concave cluster with the largest connected domain area in the spatial point cluster is identified as the second region; the linear feature clusters whose rate of change of the three-dimensional gradient vector direction exceeds a preset threshold are identified, and the longest continuous crack cluster in the linear feature clusters is identified as the third region.
[0081] Step 203: Output the spatial distribution range identifiers of the first region, the second region, and the third region.
[0082] In this embodiment of the invention, after acquiring the appearance morphology data of Chinese medicinal materials, data denoising is performed first. A spherical area with a radius of 5 mm is defined centered on each data point, and the straight-line distance from that point to other points within the area is calculated. These distance data are statistically analyzed, and the average and standard deviation are calculated. If the distance from a point to other points within the area exceeds the average plus three times the standard deviation, that point is determined to be a noise point and removed from the dataset, thus ensuring data accuracy. After denoising, a surface model is constructed using the moving least squares method. A target point is selected, and a circular influence area with a radius of 3 mm is defined centered on it. All points within this area are collected. When assigning weights, the weight is determined based on the distance from the point to the target point using an inverse proportional relationship. When the distance from the point to the target point is less than 1 mm, a weight value between 0.8 and 1 is assigned; when the distance is 1-2 mm, the weight value is 0.5-0.8; when the distance is 2-3 mm, the weight value is 0.2-0.5; and for points more than 3 mm, the weight value is close to 0. Thus, the closer a point is to the target point, the higher its weight, and the greater its influence on the calculation of the new position of the target point. By using a weighted average, the coordinates of each point within the influence area are calculated along with their corresponding weights to obtain the new position coordinates of the target point on the fitted surface. This operation is repeated for each point in the dataset to progressively build a continuous triangular mesh model, and a normal vector is calculated for each mesh vertex to obtain a 3D surface model with directional information.
[0083] Based on the constructed triangular mesh model, the appearance morphology data of Chinese medicinal materials (such as 3D point clouds or stereo images) are preprocessed. A spherical area with a radius of 5 mm is defined centered on each data point, and the straight-line distance from this point to all other points within the area is calculated. By statistically analyzing the average and standard deviation of these distances, points whose distances exceed the average plus three times the standard deviation are identified as noise and removed to ensure data purity.
[0084] The surface model is reconstructed using the moving least squares method. A target point is selected in the point cloud data, and a circular influence region with a radius of 3 mm is delineated centered on this point. Points within this region are collected. Weights are assigned based on the distance from the target point: points less than 1 mm are weighted at 0.8-1.0, 1-2 mm at 0.5-0.8, 2-3 mm at 0.2-0.5, and points greater than 3 mm are weighted close to 0. The new coordinates of the target point on the fitted surface are calculated using a weighted average. After point-by-point processing, a triangular mesh model with normal vectors is generated. The 3D gradient vector of each mesh vertex is calculated. By comparing the coordinate differences of a vertex with its adjacent vertices along the X, Y, and Z axes, the height change rate is obtained. Combined with the normal vector direction, the magnitude and direction of the gradient vector are determined, forming a 3D gradient field model covering the entire surface.
[0085] Step 201: Calculate the magnitude of all vectors in the 3D gradient field, and then calculate their mean and standard deviation. Set a threshold of the mean plus three times the standard deviation (e.g., if the mean is 8 and the standard deviation is 2, then the threshold is set to 14). Iterate through all gradient vectors and mark points whose magnitude exceeds the threshold as salient points. Use the density clustering algorithm (DBSCAN) to group the salient points, setting a neighborhood radius of 2 mm and a minimum number of points of 10. If a point's neighborhood contains at least 10 points, it is classified into a cluster. After clustering, remove clusters with fewer than 20 points and retain valid clusters (e.g., clusters containing more than 30 points).
[0086] Step 202: For each valid cluster, calculate the angle between its average normal vector and the global surface normal vector. If the angle is less than 45° and the curvature is greater than 0.1 / mm (outward convexity), it is classified as a convex cluster; if the angle is greater than 135° and the curvature is less than -0.1 / mm (inward concavity), it is classified as a concave cluster. The convex cluster with the largest connected region area is selected as the first region (convexity), and the concave cluster with the largest area is selected as the second region (concavity). For unclassified clusters, calculate the rate of change of the gradient vector direction of adjacent points; if it exceeds 15° per millimeter, it is marked as a linear feature point. Connect these points into a curve, and select the curve cluster with the longest length (more than 5 mm) and fewer than 3 breakpoints as the third region (crack).
[0087] Step 203: Use a 3D edge detection algorithm to determine the region boundary. If a point has adjacent points that do not belong to the current region, it is marked as a boundary point, forming a boundary point set. Calculate the region's geometric center coordinates (average of each axis coordinate), volume (triangular mesh integral), surface area, and other parameters. Convert the boundary points into a spatial mask (marking points within the region as 1 and the rest as 0 in a 3D matrix) or a polygonal mesh, store them in association with the original model, assign a unique identifier, and record the region's location, size, and other information.
[0088] By employing gradient field analysis and geometric morphology classification, this method accurately locates raised, recessed, and cracked areas on the surface of medicinal herbs. These microstructural features are often closely related to factors such as the growth environment and harvesting time, providing more sensitive morphological indicators for traceability analysis. Combining gradient modulus thresholding and spatial clustering algorithms effectively filters out noise points and false features, ensuring the reliability of key area identification, especially suitable for medicinal herb samples with uneven surfaces and natural defects. Decomposing morphological features into three key regions facilitates differentiated analysis based on the biological significance of different regions. For example, raised areas may be enriched with specific secondary metabolites, recessed areas may reflect environmental stress during growth, and cracked areas may be related to harvesting and processing methods, enhancing the dimensionality and depth of traceability analysis. This method provides a systematic processing flow from raw data to feature regions, facilitating the establishment of unified analytical standards across different batches and varieties of medicinal herbs, enhancing the comparability and repeatability of traceability results. The extracted regional spatial identifiers can be directly input as morphological feature parameters into the neural network model, improving the model's ability to perceive the morphological features of medicinal herbs.
[0089] In a preferred embodiment of the present invention, step 3 above, which involves forming a closed geometric configuration by connecting the center points of three key morphological regions, and extracting spatial structural characteristics based on the geometric configuration to generate a morphological feature parameter, may include:
[0090] Step 300: Based on the spatial distribution range identifier of the first region, extract the geometric center coordinates of the first region; based on the spatial distribution range identifier of the second region, extract the geometric center coordinates of the second region; based on the topological identifier data of the third region, extract the coordinates of the central axis point of the third region.
[0091] Step 301: Connect the coordinates of the geometric center of the first region, the coordinates of the geometric center of the second region, and the coordinates of the central point of the third region to form a spatial reference point group;
[0092] Step 302: Calculate the sum of the Euclidean distances between any two points in the spatial reference point group to generate morphological characteristic parameters that characterize the surface structure dispersion.
[0093] In this embodiment of the invention, after obtaining the spatial distribution range identifier of the first region, the identifier form is first determined. If it is a set of boundary points, all points in the set are listed one by one. For example, if there are 100 points in the set, the X coordinate value of each point is read sequentially, and these 100 X coordinate values are added together to obtain the sum of the X coordinates; then, in the same way, the sum of the Y coordinates and the sum of the Z coordinates of the 100 points are calculated respectively. Finally, the sum of the X coordinates is divided by the total number of points, 100, to obtain the average coordinates in the X direction; the sum of the Y coordinates is divided by 100 to obtain the average coordinates in the Y direction; and the sum of the Z coordinates is divided by 100 to obtain the average coordinates in the Z direction. These three average coordinates together constitute the geometric center coordinates of the first region.
[0094] If the spatial distribution range of the first region is identified by a spatial mask, this is a three-dimensional matrix where points within the region are marked as 1 and points outside the region are marked as 0. The process begins by traversing the entire three-dimensional matrix to find all points marked as 1. Assuming 200 points are found, the X, Y, and Z coordinates of these 200 points are calculated in the same way as the boundary point set. The sum of these values is then divided by 200 to obtain the average coordinates in the three directions, thus determining the coordinates of the geometric center.
[0095] When the identifier is a polygonal mesh, first obtain the coordinates of all vertices of the polygon. Assuming the polygon has 50 vertices, add the X coordinates of these 50 vertices together and divide by 50 to obtain the average coordinate in the X direction; perform the same operation on the Y and Z coordinates, calculate the average value for each, and finally determine the coordinates of the geometric center of the first region.
[0096] The process of extracting the geometric center coordinates of the second region is exactly the same as that of the first region. Depending on the specific form of the spatial distribution range identifier for the second region—whether it's a set of boundary points, a spatial mask, or a polygonal mesh—the corresponding calculation method described above is used. The geometric center coordinates of the second region are determined by statistically analyzing the coordinate values of the points and calculating their average.
[0097] For the third region, its topological identification data records detailed crack-related information, including a series of linear feature points. First, the start and end points of the crack are identified. For example, the identification data determines that the crack starts at point A and ends at point B. Then, starting from point A, points are selected sequentially along the crack's direction at intervals of a certain step size (e.g., 0.1 mm), and the sum of the distances from each point to points A and B is calculated. This process of selecting points and calculating distances continues until a point is found whose sum of distances to points A and B is equal; this point is then designated as the central axis point. Alternatively, the X-coordinates of all linear feature points are summed and divided by the total number of points to obtain the average X-coordinate. The Y and Z coordinates are calculated in the same way. By calculating the average of the coordinates of all linear feature points, the coordinates of the central axis point are determined.
[0098] Step 301: After successfully extracting the geometric center coordinates of the first region, the second region, and the central axis coordinates of the third region, these three coordinates are considered as three specific points in three-dimensional space. Imagine that in a three-dimensional coordinate system, the geometric center coordinates of the first region correspond to a point P1 in space, the geometric center coordinates of the second region correspond to point P2, and the central axis coordinates of the third region correspond to point P3. These three points P1, P2, and P3 are combined to form a set, which is the spatial reference point set. These three points have a clear relative positional relationship in three-dimensional space, and their positional distribution reflects the spatial distribution of the three key morphological regions on the surface of the medicinal material.
[0099] Step 302: For the three points P1, P2, and P3 in the spatial reference point group, calculate the pairwise Euclidean distances between them. Taking the distance between points P1 and P2 as an example, first obtain the X, Y, and Z coordinates of points P1 and P2 respectively. Assume the coordinates of point P1 are (X1, Y1, Z1) and the coordinates of point P2 are (X2, Y2, Z2). Calculate the coordinate difference X2-X1 in the X direction, the coordinate difference Y2-Y1 in the Y direction, and the coordinate difference Z2-Z1 in the Z direction. Square these three differences to obtain (X2-X1). 2 (Y2-Y1) 2 (Z2-Z1) 2 Then add these three squared values together to get (X2 - X1). 2 +(Y2-Y1) 2 +(Z2-Z1) 2 Finally, the square root of this sum is taken to obtain the Euclidean distance D12 between points P1 and P2.
[0100] Using the same method, calculate the Euclidean distance D13 between points P1 and P3, and the Euclidean distance D23 between points P2 and P3. Finally, add these three distances D12, D13, and D23 together, i.e., D12 + D13 + D23. The sum is the morphological characteristic parameter characterizing the dispersion of the surface structure. The larger the value, the more dispersed the three key morphological regions are on the surface of the medicinal material; the smaller the value, the more concentrated the distribution of these regions on the surface. This parameter can quantitatively describe the spatial structural characteristics of the key morphological regions on the surface of the medicinal material.
[0101] The generated morphological feature parameters provide unique and effective quantitative indicators for the traceability analysis of Chinese medicinal materials. First, these parameters comprehensively reflect the distribution characteristics of key morphological regions on the surface of Chinese medicinal materials from a spatial structure perspective. Compared to a single morphological description, they can more comprehensively and accurately depict the appearance characteristics of Chinese medicinal materials, improving the ability to distinguish between Chinese medicinal materials from different origins and of different qualities, and helping to accurately determine the authenticity of the origin of Chinese medicinal materials. Second, the calculation of morphological feature parameters is based on rigorous geometric configuration analysis, possessing high objectivity and stability, reducing errors and subjectivity in human judgment, and enhancing the reliability of traceability analysis results. Third, these parameters can be used as important features input into neural network traceability models, helping the models better learn and identify the morphological characteristics of Chinese medicinal materials, optimizing model performance, thereby improving the accuracy of determining the quality compliance of Chinese medicinal materials, providing strong data support for the quality monitoring of Chinese medicinal materials, and ensuring the quality and safety of raw materials for Chinese herbal beverages.
[0102] In a preferred embodiment of the present invention, step 4 above, which uses morphological feature parameters to modify the preset neural network source tracing model to obtain a modified neural network source tracing model, may include:
[0103] Step 400: Obtain a standard medicinal material database containing samples of Chinese medicinal materials from different origins in order to construct an initial neural network traceability model;
[0104] Step 401: Use the multi-dimensional feature data in the standard medicinal materials database as input data, and use the origin labels in the standard medicinal materials database corresponding to the multi-dimensional feature data as training targets. Iteratively optimize the parameters of the initial neural network traceability model until the difference between the output predicted origin and the training target meets the preset convergence condition, and obtain the trained neural network traceability model.
[0105] Step 402: Compare the morphological feature parameters with the mean of the standard feature parameters of the corresponding medicinal material category in the standard medicinal material database associated with the trained neural network traceability model, and calculate the morphological feature deviation value that represents the degree of difference between the current batch of medicinal materials and the standard sample.
[0106] Step 403: Based on the morphological feature deviation value and the preset correction coefficient mapping rule, dynamically determine the weight correction coefficients used to adjust the sensitivity of the initial neural network source tracing model, specifically including:
[0107] Step 404: Input the morphological feature deviation value into the preset correction coefficient mapping rule, and perform a nonlinear transformation operation, that is:
[0108] When the deviation value of the morphological feature is less than the first preset threshold, the first fixed value is output as the weight correction coefficient;
[0109] When the deviation value of the morphological feature is greater than or equal to the first threshold and less than or equal to the second threshold, the corresponding weight correction coefficient is calculated based on the relative position ratio of the deviation value between the first threshold and the second threshold, combined with the preset ratio coefficient.
[0110] When the deviation value of the morphological feature is greater than the second preset threshold, the second fixed value is output as the weight correction coefficient.
[0111] The weight correction coefficients are applied to a specified convolutional layer of the trained neural network tracing model to adjust the weight parameters of the convolutional layer element by element, thereby completing the adaptive adjustment of the parameters of the trained neural network tracing model.
[0112] Step 405: After completing the adaptive adjustment of the parameters of the trained neural network tracing model, a corrected neural network tracing model containing adaptive parameters is obtained.
[0113] In this embodiment of the invention, firstly, samples of Chinese medicinal herbs (such as common varieties like Astragalus membranaceus and Angelica sinensis) covering more than 20 different origins are collected. Each sample contains 500+ multi-dimensional feature data (appearance morphology data, physicochemical property data, and growth environment data), forming a standard medicinal herb database. Each sample in the database is labeled with its precise origin (e.g., "Longxi, Gansu" or "Wenshan, Yunnan"). During the model construction phase, ResNet50 is selected as the basic architecture. First, the input layer design is determined: the 3D point cloud data is converted into a voxel grid and concatenated with image data, physicochemical values, and environmental parameters to form a 1024-dimensional vector. Then, four residual blocks are set, each containing three convolutional layers with a kernel size of 3×3 and a stride of 1. The same padding method is used to maintain the feature map size. A global average pooling layer is added to reduce the dimensionality of the features. Finally, a fully connected layer is connected, and the number of output nodes matches the number of origin categories in the database (assuming a total of 50 origins). Parameter initialization uses the Kaiming initialization method, assigning appropriate initial values to each convolutional kernel and connection weight.
[0114] Step 401: Divide the standard medicinal material database into training and validation sets at an 8:2 ratio. Preprocess the training set data: normalize the 3D point cloud data to the [-1, 1] interval; scale the image data to 224×224 pixels and standardize it; normalize the physicochemical and environmental values using Z-score. Input the processed data into the model in batches, with each batch containing 32 samples. During the model's forward propagation, the data first enters the input layer, and then within the residual blocks, the convolutional layer extracts features using sliding convolution kernels, such as identifying texture patterns in medicinal material images and capturing shape features in point cloud data; the pooling layer uses max pooling, with a 2×2 window and a stride of 2 to reduce the dimensionality of the feature maps and decrease computation. After processing through multiple residual blocks, the global average pooling layer summarizes the features, and the fully connected layer outputs a 50-dimensional vector, with each dimension corresponding to the predicted probability of a specific origin.
[0115] Calculate the cross-entropy loss between the predicted results and the actual origin labels (one-hot encoding). Assuming a sample's actual origin is class 10, and the model's predicted vector is [0.02, 0.03, ..., 0.8, ..., 0.01], substitute the predicted vector and [0, 0, ..., 1, ..., 0] into the cross-entropy formula to calculate the loss value. Use the Adam optimizer with an initial learning rate of 0.001. Adjust the model parameters based on the loss gradient, dynamically adjusting the first and second moment estimates during the update process. Test the model performance on the validation set after every 5 epochs of training. Calculate metrics such as accuracy (number of correctly predicted samples / total number of samples), precision, and recall. Stop training when the validation set accuracy increases by less than 0.3% for three consecutive epochs, or when the loss value drops below 0.2. Save the model parameters at this point to obtain the trained neural network origin tracing model.
[0116] Step 402: For the current batch of medicinal materials, obtain its morphological characteristic parameters. Assume this parameter is the surface structure dispersion value obtained through key region analysis, denoted as X. Filter data on the same variety of medicinal materials as the current batch in the standard medicinal material database, assuming 300 records are selected. Extract the morphological characteristic parameters from each of these records and calculate their mean. Add the 300 parameter values together and then divide by 300; simultaneously calculate the standard deviation. This reflects the degree of data dispersion. The morphological feature deviation value D is calculated. The larger the value, the more significant the difference.
[0117] Steps 403-404: Preset correction parameters, namely, first preset threshold = 0.8, second preset threshold = 1.8, first fixed value = 0.85, second fixed value = 1.4, and proportional coefficient = 0.7. Compare the calculated deviation value with the preset thresholds:
[0118] If the deviation value is less than the first preset threshold (e.g., deviation value = 0.6), a fixed value of 0.85 is directly used as the weight correction coefficient; if the first preset threshold is less than or equal to the deviation value and less than or equal to the second preset threshold (e.g., deviation value = 1.2), the relative position ratio is calculated first. Then calculate the correction factor = If the deviation value is greater than the second preset threshold (e.g., deviation value = 2.0), output the second fixed value = 1.4 as the correction coefficient.
[0119] After determining the correction coefficient, find the second convolutional layer (the empirically selected key feature extraction layer) in the third residual block of the trained model. Adjust each weight parameter of this convolutional layer. Assuming a certain weight value is 0.3, the correction coefficient is 1.07, and the adjusted value is 0.3 × 1.07. Iterate through all weights to complete the element-wise weighted adjustment.
[0120] Step 405: After adjusting the convolutional layer weights, save the updated model parameters. The neural network at this point is the corrected traceability model. This model dynamically adjusts the parameter sensitivity of key layers based on the morphological differences of the current batch of medicinal materials.
[0121] By dynamically adjusting the neural network traceability model based on the morphological differences of different batches of Chinese medicinal materials, the limitations of traditional fixed-parameter models are overcome, improving the model's adaptability and generalization ability to various complex situations. Even when faced with medicinal materials whose morphological characteristics differ significantly from standard samples, the corrected model can accurately identify and analyze them, improving the accuracy of origin traceability. Secondly, this correction method based on morphological feature deviation values fully utilizes the morphological information of Chinese medicinal materials, providing the model with richer and more targeted adjustment criteria. Compared to the uncorrected model, the corrected model can uncover more key information hidden in morphological features when dealing with the traceability of Chinese medicinal materials, thereby enhancing the model's ability to judge the origin and quality of Chinese medicinal materials. This helps to more reliably determine the authenticity of the origin and the conformity of the quality of Chinese medicinal materials, providing strong technical support for the quality monitoring of raw materials for Chinese herbal beverages and ensuring the quality and safety of Chinese herbal beverages. At the same time, this correction method also provides a reference for the optimization of similar models in the future, promoting the development and improvement of Chinese medicinal material traceability technology.
[0122] In a preferred embodiment of the present invention, step 5 above generates the raw material traceability analysis results of the batch of Chinese medicinal materials to be tested based on multi-dimensional feature data and the corrected neural network traceability model. The traceability analysis results include the determination of the authenticity of the place of origin and the determination of quality compliance, and may include:
[0123] Step 500: Input the multi-dimensional feature data of the batch of Chinese medicinal materials to be tested into the modified neural network traceability model to perform hierarchical feature abstraction and fusion of the multi-dimensional feature data, and output a deep feature vector representing the essential characteristics of the batch of Chinese medicinal materials to be tested, specifically including:
[0124] Step 5050: Receive multi-dimensional feature data of the batch of Chinese medicinal materials to be tested, and extract spatial features from the appearance morphology data in the multi-dimensional feature data through the first-level convolutional module of the modified neural network traceability model to generate a first-level output characterizing the surface structure properties.
[0125] Step 5051: The first-level output representing the surface structure characteristics is spliced with the physicochemical property data in the multi-dimensional feature data through the second-level fusion module of the modified neural network tracing model to obtain the spliced features.
[0126] Step 5052: Perform convolution and nonlinear activation operations on the spliced features to generate a second-level output that integrates morphology and physicochemical properties;
[0127] Step 5053: Through the third-level abstraction module of the modified neural network source tracing model, the second-level output is channel-concatenated with the growth environment data in the multi-dimensional feature data, and the deep convolutional layer is used to perform deep semantic abstraction on the concatenated features to generate the third-level output that integrates multi-dimensional features.
[0128] Step 5054: Through the global pooling layer and fully connected layer of the modified neural network source tracing model, perform dimensionality reduction and compression operations on the third-level output to output a fixed-dimensional depth feature vector.
[0129] Step 501: Input the deep feature vector into the preset origin classifier, calculate the probability distribution of the deep feature vector on each origin category defined by the standard medicinal material database associated with the modified neural network traceability model; determine the predicted origin based on the probability distribution, and calculate the confidence level characterizing the reliability of the predicted origin.
[0130] Step 502: Input the deep feature vector into the preset quality evaluator, calculate the similarity value between the deep feature vector and the benchmark feature vector of the same category of standard medicinal materials in the standard medicinal material database, and use it as the quality compliance score.
[0131] Step 503: Integrate the predicted origin and confidence level, as well as the quality compliance score, to generate a raw material traceability analysis result that includes the conclusion on the authenticity of the origin and the conclusion on the quality grade.
[0132] In this embodiment of the invention, multi-dimensional feature data of the batch of Chinese medicinal materials to be tested are acquired, including appearance morphology data, physicochemical property data, and growth environment data. The three-dimensional point cloud data in the appearance morphology data undergoes noise reduction processing: with each point as the center, the distance between it and other points within a 3 mm radius is calculated. The distance data of all points are statistically analyzed to obtain the average value and standard deviation. Points whose distance exceeds the average value plus three times the standard deviation are considered noise and discarded. High-resolution image data is uniformly adjusted to a 224×224 pixel size and then grayscale processed. The red, green, and blue channel values of each pixel are converted to grayscale values according to a specific conversion formula. Then, through normalization, all pixel values are mapped to the range of 0 to 1.
[0133] Regarding physicochemical property data, the units of the content data for different components were standardized, converting all component content data to the same unit. Next, a normalization method was used to identify the maximum and minimum values in the data, and the formula "(data value - minimum value) ÷ (maximum value - minimum value)" was used to normalize all physicochemical data to a range of 0 to 1. The growth environment data, including indicators such as temperature, humidity, and soil pH, were also normalized using the same method, ensuring that all data were within the 0 to 1 scale range.
[0134] After preprocessing, multi-dimensional feature data is input into the corrected neural network source tracing model. The data first enters the first-level convolutional module. For 3D point cloud data, the convolutional kernel slides in the point cloud space with a stride of 1 mm. During the sliding process, the height change rate is calculated by comparing the coordinate differences of adjacent points in the X, Y, and Z directions, thereby extracting structural features such as surface protrusions, depressions, and cracks. For example, if the Z-coordinate difference of points in a certain area continuously increases, it indicates the presence of a protrusion feature; if the Z-coordinate difference continuously decreases, it may indicate a depression region; and when the coordinate differences of adjacent points show regular changes in multiple directions, and the point distribution exhibits linear discrete characteristics, it is determined to be a crack feature. For high-resolution image data, a 3×3 convolutional kernel slides on the image pixel matrix with a stride of 1. By calculating the changes in pixel values within the area covered by each convolutional kernel, features such as texture and color distribution are extracted. For example, when the pixel grayscale value changes drastically within the convolution kernel, texture edges can be identified; if the pixel color value exhibits a specific distribution pattern, the corresponding color features are extracted, and finally, a first-level output containing surface structure characteristics is generated.
[0135] The first-level output enters the second-level fusion module, where it is concatenated with the physicochemical property data. Assuming the first-level output is a feature vector of length 128, and the physicochemical property data contains the content of 10 components, this content data is converted into a numerical vector of length 10. The two vectors are then concatenated sequentially to form a new vector of length 138, which is the concatenated feature. A convolution operation is performed on the concatenated feature using 64 3×3 convolution kernels on the new vector to extract the fused new features. During the convolution operation, each convolution kernel is weighted and summed with the corresponding vector segment to obtain new feature values. After the convolution operation, the ReLU nonlinear activation function is applied, setting all feature values less than 0 to 0, while leaving feature values greater than 0 unchanged, enhancing the discriminative power of the features and generating the second-level output that fuses the morphology and physicochemical properties.
[0136] The second-level output enters the third-level abstraction module, where it is channel-concatenated with the growth environment data. Assuming the second-level output is a 16×16×64 feature matrix, and the growth environment data contains 8 dimensions of information, these 8 dimensions are treated as new channels and added to the feature matrix, forming a 16×16×72 cascaded feature matrix. Subsequently, a deep convolutional layer with three convolutional layers processes the cascaded features. The first convolutional layer uses 32 3×3 kernels with a stride of 1, performing a weighted summation operation between the kernels and corresponding elements of the cascaded feature matrix to extract preliminary deep features. The second convolutional layer uses 16 3×3 kernels with a stride of 1 to further extract and integrate the features from the first layer output. The third convolutional layer uses 8 3×3 kernels with a stride of 1 to perform further deep abstraction of the features. Through multiple convolutional operations, deep semantic information is continuously extracted, generating a third-level output that integrates multi-dimensional features.
[0137] The third-level output passes through a global pooling layer and a fully connected layer. The global pooling layer compresses the 16×16×8 feature matrix into a vector of length 8. Specifically, it calculates the average or maximum value of all elements in each channel of the feature matrix to obtain a single value for each channel, thereby removing spatial dimensional information and retaining only the most critical features. The fully connected layer further processes this vector through two layers of neurons. The first layer has 32 neurons, each receiving an 8-dimensional vector as input. The input is weighted and summed with preset weights, a bias is added, and then processed by an activation function to output a new value. The second layer has 16 neurons, receiving the 32-dimensional vector output from the first layer. It also undergoes weighted summation, bias addition, and activation operations, ultimately outputting a fixed-dimensional deep feature vector. This vector encapsulates the comprehensive essential characteristics of the tested batch of medicinal materials, from appearance to internal components and growth environment.
[0138] Step 501: Input the generated deep feature vector into the preset origin classifier. Assume the deep feature vector is a vector containing 128 values, representing the characteristics of the tested batch of Chinese medicinal materials after fusing information from multiple dimensions, including appearance, internal components, and growth environment. The standard medicinal material database defines 50 origin categories, so the origin classifier has 50 independent classification units, each corresponding to one origin and responsible for calculating the probability that the Chinese medicinal material belongs to that origin. When the deep feature vector enters the first classification unit (corresponding to a specific origin), it undergoes a multiplication operation with the preset weight matrix within that unit. The weight matrix is a specially designed numerical table with the same number of rows as the deep feature vector (128 rows); the number of columns is determined by the classifier design, assumed to be 10 columns. During the multiplication operation, the first value of the deep feature vector is multiplied by the 10 values in the first row of the weight matrix, the second value is multiplied by the 10 values in the second row, and so on, until all 128 values have been multiplied. Then, the results of each multiplication are summed, resulting in a new vector containing 10 values. After the multiplication operation yields the new vector, a bias vector is added. The bias vector is also a vector containing 10 values, with the same dimensions as the multiplication results. The addition operation adjusts the distribution of values in the new vector, making the values more consistent with the actual classification requirements. For example, some values that were originally small may become more prominent after adding the values from the bias vector.
[0139] The processed results are then transformed using the Softmax activation function. The Softmax function first performs an exponential operation on each of the 10 input values, calculating the exponent value for each value. For example, if one of the values is 2, its exponent value is e² (e is the natural constant, approximately 2.718). Then, all the exponent values are summed to obtain a total. Finally, each exponent value is divided by this sum, thus transforming the original 10 values into a probability distribution such that the sum of these 10 new values equals 1. Each new value represents the probability that the tested batch of medicinal materials belongs to this origin.
[0140] Following the above process, the deep feature vector sequentially enters 50 classification units. In each unit, the operations of multiplying with the weight matrix, adding a bias vector, and transforming using the Softmax function are repeated. Ultimately, this yields the probability distribution of the deep feature vector across the 50 origin categories—50 values representing the probability of belonging to different origins. When determining the predicted origin based on the probability distribution, the largest of these 50 probability values is directly selected. For example, in the probability distribution of the 50 origins, the probability value corresponding to "Yunnan Wenshan" is 0.7, which is higher than the probability values corresponding to the other 49 origins. Therefore, "Yunnan Wenshan" is determined as the predicted origin. Calculating the confidence score is even more direct; the probability value corresponding to the predicted origin is directly used as the confidence score. In this example, the probability value of 0.7 for "Yunnan Wenshan" is the confidence score value for this predicted origin. The higher the confidence score value, the more confident the model is in its judgment of this predicted origin, and the stronger the reliability of the predicted origin.
[0141] Step 502: Input the deep feature vector into the preset quality evaluator. In the standard medicinal material database, each category of standard medicinal material corresponds to a benchmark feature vector. This benchmark feature vector is obtained through statistical analysis and feature extraction of multi-dimensional feature data of a large number of similar high-quality medicinal materials. The quality evaluator uses cosine similarity to calculate the similarity value between the deep feature vector and the benchmark feature vector of the same category of standard medicinal materials. During calculation, first, the product of corresponding elements of the two vectors is calculated, and then all product results are added together to obtain the dot product of the two vectors. Next, the magnitudes of the deep feature vector and the benchmark feature vector are calculated separately. The calculation method is to add the squares of each dimension element of the vectors and then take the square root of the sum. Finally, the dot product result is divided by the product of the magnitudes of the two vectors, and the resulting value is the cosine similarity. The closer the cosine similarity value is to 1, the more similar the directions of the two vectors are, meaning the quality of the batch of medicinal materials to be tested is closer to that of the standard medicinal materials. The calculated cosine similarity value is used as the quality compliance score; the higher the score, the more the quality of the batch of medicinal materials to be tested conforms to the standard.
[0142] Step 503 involves integrating and analyzing the predicted origin, confidence level, and quality compliance score. A confidence level threshold of 0.8 is pre-set to determine the authenticity of the origin. If the calculated confidence level is greater than or equal to 0.8, such as a predicted origin of "Wenshan, Yunnan" with a confidence level of 0.85, the origin of the tested batch of Chinese medicinal materials is determined to be authentic. If the confidence level is less than 0.8, the origin is deemed questionable, and the analysis results will explicitly indicate the potential risk of origin falsification.
[0143] Regarding quality grading, a standard for quality compliance score is set: a score of 0.9 or higher is "Excellent," indicating that the quality of this batch of medicinal materials far exceeds the standard for similar products; a score between 0.7 and 0.9 is "Good," indicating that the quality meets the standard and performs well; a score less than 0.7 is "Average," meaning that the quality differs somewhat from the standard. For example, if the quality compliance score is 0.85, the quality grade of this batch of medicinal materials is determined to be "Good" according to the standard.
[0144] Finally, the conclusions regarding the authenticity of the place of origin and the quality grade are compiled into a detailed raw material traceability analysis report. The report clearly lists the predicted place of origin, specific confidence levels, quality compliance scores, and the corresponding conclusions regarding the authenticity of the place of origin and the quality grade. It also includes a summary of key information from multi-dimensional characteristic data, including descriptions of the main features of the appearance, the content range of key components in the physicochemical properties, and key indicators of the growth environment. This allows users to comprehensively and intuitively understand the traceability of the tested batch of Chinese medicinal materials, providing a reliable basis for decision-making in production, sales, and use.
[0145] In determining the authenticity of the origin of medicinal materials, a modified neural network model is used to conduct in-depth analysis of multi-dimensional features. Combined with an origin classifier and confidence calculation, the true origin of medicinal materials can be accurately determined, effectively identifying products from counterfeit origins, protecting the rights and interests of consumers and enterprises, and maintaining the normal order of the medicinal material market. Regarding quality compliance determination, by calculating the similarity between the deep feature vector and the benchmark feature vector of standard medicinal materials, the quality of medicinal materials can be objectively and comprehensively evaluated, avoiding errors caused by judgments based on single indicators. This evaluation method based on multi-dimensional feature fusion can capture the comprehensive characteristics of medicinal materials in terms of appearance, composition, and growth environment, providing a scientific basis for the quality control of medicinal materials, helping to improve the overall quality of medicinal materials, and promoting the healthy development of the traditional Chinese medicine industry. At the same time, the complete traceability analysis results provide traceable information for the production, processing, and sales of medicinal materials, enhancing the transparency and credibility of the supply chain.
[0146] In a preferred embodiment of the present invention, step 6 above, which involves performing a quality monitoring operation for Chinese medicinal materials based on the raw material traceability analysis results, triggering a quality alarm or interception command for the batch of raw materials when the traceability analysis results do not meet preset standards, and authorizing the batch of raw materials to enter the production process when the traceability analysis results meet preset standards, may include:
[0147] In this embodiment of the invention, the specific content of the preset standards is clearly defined. For the authenticity of the place of origin, a confidence threshold of 0.8 is set; that is, when the confidence level of the predicted place of origin is greater than or equal to 0.8, the place of origin is considered authentic; less than 0.8 indicates the place of origin is not authentic. For quality compliance, the quality compliance score is divided into three levels: a score greater than or equal to 0.9 is considered excellent and compliant; a score between 0.7 and 0.9 is considered good and compliant; and a score less than 0.7 is considered average and non-compliant. Only when the place of origin is authentic and the quality compliance score is at or above the good level is the overall preset standard met. After obtaining the raw material traceability analysis results, the conclusion of the authenticity of the place of origin and the corresponding confidence level value are checked first. If the confidence level is less than 0.8, for example, the confidence level of the predicted place of origin for a batch of Chinese medicinal materials is 0.7, it does not meet the standard for authentic place of origin, directly triggering a quality alarm for that batch of raw materials, sending a message to relevant quality management personnel, indicating that there may be a risk of falsification of the place of origin. Simultaneously, an interception command is generated to prevent this batch of raw materials from entering the subsequent production process, avoiding the mixing of potentially problematic raw materials into the production stage. If the confidence level of the origin is greater than or equal to 0.8, the quality compliance score is then checked. If the quality compliance score is less than 0.7, for example, a score of 0.6, it indicates that the quality of this batch of medicinal materials does not meet the standards, triggering a quality alarm, informing quality management personnel that there is a problem with the quality of the medicinal materials, and issuing an interception command, prohibiting this batch of raw materials from entering the production process. Only when the confidence level of the origin is greater than or equal to 0.8, and the quality compliance score is 0.7 or higher, for example, a confidence level of 0.85 and a quality compliance score of 0.8, is the traceability analysis result of this batch of raw materials considered to meet the preset standards. At this time, an authorization command is generated, allowing this batch of raw materials to enter the production process and be used in subsequent processing and manufacturing stages, ensuring that the raw materials entering production meet the requirements in terms of both origin and quality.
[0148] like Figure 2 As shown, embodiments of the present invention also provide a neural network-based traceability analysis system for raw materials of traditional Chinese medicine beverages, comprising:
[0149] The data acquisition module is used to collect multi-dimensional characteristic data of the batch of Chinese medicinal materials to be tested during the procurement process. The multi-dimensional characteristic data includes appearance morphology data, physicochemical property data and growth environment data.
[0150] The key area identification module is used to identify and determine the first area located on the protrusion, the second area located on the depression, and the third area located on the crack on the surface of Chinese medicinal materials based on appearance morphology data.
[0151] The morphological parameter generation module is used to form a closed geometric configuration by connecting the center points of three key morphological regions, and to extract spatial structural characteristics based on the geometric configuration to generate a morphological feature parameter.
[0152] The model correction module is used to correct the preset neural network tracing model using morphological feature parameters to obtain the corrected neural network tracing model.
[0153] The traceability analysis module is used to generate raw material traceability analysis results for the batch of Chinese medicinal materials to be tested, including the determination of the authenticity of the place of origin and the determination of the quality compliance, based on multi-dimensional feature data and the corrected neural network traceability model.
[0154] The quality monitoring module is used to perform quality monitoring operations on Chinese medicinal materials based on the traceability analysis results of raw materials. When the traceability analysis results do not meet the preset standards, a quality alarm or interception command is triggered for that batch of raw materials; when the traceability analysis results meet the preset standards, the corresponding batch of raw materials is authorized to enter the production process.
[0155] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0156] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0157] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0158] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for tracing and analyzing the raw materials of traditional Chinese medicine beverages based on neural networks, characterized in that, The method includes: Step 1: In the procurement of Chinese medicinal materials, collect multi-dimensional characteristic data of the batch of Chinese medicinal materials to be tested. The multi-dimensional characteristic data includes appearance morphology data, physicochemical property data and growth environment data. Step 2: Based on the appearance morphology data, identify and determine three key morphological regions on the surface of the Chinese medicinal materials, where the first region is located at the protrusion, the second region is located at the depression, and the third region is located at the crack. Step 3: Based on the three key morphological regions, a closed geometric configuration is formed by connecting the center points of the regions. Spatial structural characteristics are extracted based on this geometric configuration to generate a morphological feature parameter. This includes: extracting the geometric center coordinates of the first region based on its spatial distribution range identifier; extracting the geometric center coordinates of the second region based on its spatial distribution range identifier; extracting the coordinates of the central axis point of the third region based on its topological identifier data; connecting the geometric center coordinates of the first region, the second region, and the central axis point coordinates of the third region to form a spatial reference point group; and calculating the sum of the Euclidean distances between any two points in the spatial reference point group to generate a morphological feature parameter characterizing the surface structure dispersion. Step 4: Using morphological feature parameters, the pre-set neural network traceability model is modified to obtain a modified neural network traceability model. This includes: acquiring a standard medicinal material database containing samples of medicinal materials from different origins to construct an initial neural network traceability model; using multi-dimensional feature data from the standard medicinal material database as input data, and using the origin labels corresponding to the multi-dimensional feature data in the standard medicinal material database as training targets, iteratively optimizing the parameters of the initial neural network traceability model until the difference between the output predicted origin and the training target satisfies the pre-set convergence condition, thus obtaining the trained neural network traceability model; and associating the morphological feature parameters with the standard... The average standard feature parameters of the corresponding medicinal material category in the medicinal material database are compared to calculate the morphological feature deviation value, which represents the degree of difference between the current batch of medicinal materials and the standard sample. Based on the morphological feature deviation value and the preset correction coefficient mapping rule, the weight correction coefficients used to adjust the sensitivity of the initial neural network traceability model are dynamically determined. The weight correction coefficients are applied to the specified convolutional layer of the trained neural network traceability model, and the weight parameters of the convolutional layer are adjusted element-wise to complete the adaptive adjustment of the parameters of the trained neural network traceability model. After the adaptive adjustment of the parameters of the trained neural network traceability model is completed, the corrected neural network traceability model containing adaptive parameters is obtained. Step 5: Based on multi-dimensional feature data and the corrected neural network traceability model, generate the raw material traceability analysis results for the batch of Chinese medicinal materials to be tested. The traceability analysis results include the determination of the authenticity of the place of origin and the determination of quality compliance. Step 6: Based on the raw material traceability analysis results, perform the Chinese medicinal material quality monitoring operation. When the traceability analysis results do not meet the preset standards, trigger a quality alarm or interception command for that batch of raw materials; when the traceability analysis results meet the preset standards, authorize that batch of raw materials to enter the production process.
2. The method for tracing and analyzing the source of raw materials for traditional Chinese medicine beverages based on neural networks according to claim 1, characterized in that, Based on morphological data, three key morphological regions on the surface of Chinese medicinal materials were identified and determined. The first region is located at protrusions, the second region is located at depressions, and the third region is located at cracks. These regions include: Based on the appearance morphology data, a three-dimensional gradient field model of the surface is constructed, and the three-dimensional gradient vector at each spatial location is calculated. Based on the distribution characteristics of the three-dimensional gradient vector magnitude, spatial point clusters with gradient magnitudes exceeding a preset threshold are selected. The convex cluster with the largest connected domain area in the spatial point cluster is identified as the first region; the concave cluster with the largest connected domain area in the spatial point cluster is identified as the second region; linear feature clusters whose rate of change of three-dimensional gradient vector direction exceeds a preset threshold are identified, and the longest continuous crack cluster in the linear feature cluster is identified as the third region. Output the spatial distribution range identifiers of the first, second, and third regions.
3. The method for tracing and analyzing the source of raw materials for traditional Chinese medicine beverages based on neural networks according to claim 2, characterized in that, Based on the morphological feature deviation value and the preset correction coefficient mapping rule, the weight correction coefficients used to adjust the sensitivity of the initial neural network source tracing model are dynamically determined, including: The deviation value of the morphological feature is input into the preset correction coefficient mapping rule, and a nonlinear transformation operation is performed, that is: When the deviation value of the morphological feature is less than the first preset threshold, the first fixed value is output as the weight correction coefficient; When the deviation value of the morphological feature is greater than or equal to the first threshold and less than or equal to the second threshold, the corresponding weight correction coefficient is calculated based on the relative position ratio of the deviation value between the first threshold and the second threshold, combined with the preset ratio coefficient. When the deviation value of the morphological feature is greater than the second preset threshold, the second fixed value is output as the weight correction coefficient.
4. The method for tracing and analyzing the source of raw materials for traditional Chinese medicine beverages based on neural networks according to claim 3, characterized in that, Based on multi-dimensional feature data and a modified neural network traceability model, the raw material traceability analysis results for the tested batch of Chinese medicinal materials are generated. These results include determinations of the authenticity of the place of origin and quality compliance, including: The multi-dimensional feature data of the batch of Chinese medicinal materials to be tested are input into the modified neural network traceability model to perform hierarchical feature abstraction and fusion of the multi-dimensional feature data, and output a deep feature vector that represents the essential characteristics of the batch of Chinese medicinal materials to be tested. Input the deep feature vector into the preset origin classifier, calculate the probability distribution of the deep feature vector on each origin category defined by the standard medicinal material database associated with the modified neural network traceability model; determine the predicted origin based on the probability distribution, and calculate the confidence level characterizing the reliability of the predicted origin. Input the deep feature vector into the preset quality evaluator, calculate the similarity value between the deep feature vector and the benchmark feature vector of the same category of standard medicinal materials in the standard medicinal material database, and use it as the quality compliance score. By integrating predicted origin and confidence level, as well as quality compliance score, raw material traceability analysis results are generated, which include conclusions on the authenticity of origin and the quality grade.
5. The method for tracing and analyzing the source of raw materials for traditional Chinese medicine beverages based on neural networks according to claim 4, characterized in that, The multi-dimensional feature data of the batch of Chinese medicinal materials to be tested are input into the modified neural network traceability model to perform hierarchical feature abstraction and fusion of the multi-dimensional feature data, and output a deep feature vector representing the essential characteristics of the batch of Chinese medicinal materials to be tested, including: The system receives multi-dimensional feature data of the batch of Chinese medicinal materials to be tested, and extracts spatial features from the appearance morphology data in the multi-dimensional feature data through the first-level convolutional module of the modified neural network traceability model, generating a first-level output that characterizes the surface structure properties. The second-level fusion module of the modified neural network tracing model concatenates the first-level output representing surface structure characteristics with the physicochemical property data in the multi-dimensional feature data to obtain the concatenated features. Convolution and nonlinear activation operations are performed on the spliced features to generate a second-level output that integrates morphology and physicochemical properties. The third-level abstraction module of the modified neural network source tracing model concatenates the second-level output with the growth environment data in the multi-dimensional feature data, and uses deep convolutional layers to perform deep semantic abstraction on the concatenated features to generate a third-level output that integrates multi-dimensional features. By using the global pooling layer and fully connected layer of the modified neural network source tracing model, dimensionality reduction and compression operations are performed on the third-level output to output a fixed-dimensional deep feature vector.
6. A neural network-based traceability analysis system for raw materials of traditional Chinese medicine beverages, wherein the system implements the method as described in any one of claims 1 to 5, characterized in that, include: The data acquisition module is used to collect multi-dimensional characteristic data of the batch of Chinese medicinal materials to be tested during the procurement process. The multi-dimensional characteristic data includes appearance morphology data, physicochemical property data and growth environment data. The key area identification module is used to identify and determine the first area located on the protrusion, the second area located on the depression, and the third area located on the crack on the surface of Chinese medicinal materials based on appearance morphology data. The morphological parameter generation module is used to form a closed geometric configuration by connecting the center points of three key morphological regions, and to extract spatial structural characteristics based on the geometric configuration to generate a morphological feature parameter. The model correction module is used to correct the preset neural network tracing model using morphological feature parameters to obtain the corrected neural network tracing model. The traceability analysis module is used to generate raw material traceability analysis results for the batch of Chinese medicinal materials to be tested, including the determination of the authenticity of the place of origin and the determination of the quality compliance, based on multi-dimensional feature data and the corrected neural network traceability model. The quality monitoring module is used to perform quality monitoring operations on Chinese medicinal materials based on the traceability analysis results of raw materials. When the traceability analysis results do not meet the preset standards, a quality alarm or interception command is triggered for that batch of raw materials; when the traceability analysis results meet the preset standards, the corresponding batch of raw materials is authorized to enter the production process.
7. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method for tracing to production places of market saffron via ATR-FTIR in combination with RBF neural network
CN110376153A
Hyperspectral spectrograph for geo-authentic crude drug identification and application
CN113567356A