Automatic Evaluation Method for Food Raw Material Quality Grade Based on Machine Learning

By employing dynamic grouping and conditional standardization, multimodal feature fusion, and process perception mechanisms, the problem of insufficient accuracy in food raw material quality assessment in existing technologies has been solved, enabling precise quality grade assessment in complex production environments.

CN121278231BActive Publication Date: 2026-04-03CHENGDU BIZ UNITED INFORMATION TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies fail to effectively integrate multimodal information and ignore process dynamic constraints, resulting in insufficient accuracy in food raw material quality assessment and an inability to accurately capture the boundaries of component effectiveness.

Method used

By collecting data on the composition indicators, process parameters, external environmental factors, and historical trends of food raw materials, dynamic grouping and conditional standardization are performed. Quality grade prediction is then carried out by combining multimodal feature fusion and process awareness mechanisms. Tensor product interaction modeling and adaptive weighting are used to capture nonlinear coupling relationships. Finally, quality grade evaluation is carried out by combining process awareness attention mechanisms and regularization loss.

Benefits of technology

It enables precise, stable, and automated quality grade assessment of food raw materials in complex production environments, improving the accuracy and stability of the assessment and adapting to the effective boundaries of components under process constraints.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121278231B_ABST
    Figure CN121278231B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of artificial intelligence and data processing technology, specifically to a machine learning-based automatic quality grade assessment method for food raw materials. By collecting multi-source data on composition, process, environment, and historical trends, the method first performs dynamic grouping and conditional standardization on the composition data based on process correlation. Then, it fuses multimodal features using tensor product-based interactive modeling and quality prior attention weighting. Finally, it combines a process-aware attention mechanism with comprehensive boundary regularization loss to predict the quality grade. This method effectively solves the problems of inaccurate assessments in existing technologies, such as static analysis neglecting the dynamic influence of the process, conventional standardization disrupting the process-component correlation, insufficient multimodal information fusion, and the inability to perceive component boundaries under process constraints. It achieves accurate, stable, and automated quality grade assessment of food raw materials in complex production environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and data processing technology, and in particular to an automatic evaluation method for the quality grade of food raw materials based on machine learning. Background Technology

[0002] The quality of food raw materials has a decisive impact on the quality and safety of the final product. Traditional methods for assessing the quality of food raw materials mainly rely on laboratory analysis of static component indicators such as starch content, moisture content, and protein content. However, these methods neglect the crucial role of dynamic changes in production process parameters such as fermentation temperature, yeast ratio, and distillation vapor pressure on raw material quality, making it difficult to meet the needs of accurate and real-time assessment of raw material quality in modern complex food processing procedures.

[0003] In existing technical solutions, some methods have attempted to introduce machine learning models for quality prediction. However, these methods typically have significant drawbacks: First, most methods employ simple global standardization methods (such as Z-score standardization) when processing component data. This approach easily disrupts the inherent nonlinear coupling between component indicators and process parameters, resulting in the evaluation model failing to effectively reflect the impact of real process constraints on raw material quality. Second, conventional models often rely on single-modal features, lacking comprehensive consideration and effective integration of multimodal information such as component data, process parameters, external environmental factors, and historical trend data, thus limiting the ability to comprehensively evaluate the quality of complex food raw materials. Furthermore, most existing technologies ignore the spatiotemporal variation characteristics of raw material components under different process configurations, failing to accurately capture the dynamic impact of process constraints on the effectiveness boundary of components, leading to insufficient stability and accuracy of prediction results in real industrial scenarios.

[0004] Therefore, there is an urgent need in this field for an automatic evaluation solution for the quality grade of food raw materials that can deeply integrate multimodal information, perceive dynamic constraints of the process, and accurately capture the boundaries of component effectiveness. Summary of the Invention

[0005] The purpose of this invention is to provide an automatic evaluation method for the quality grade of food raw materials based on machine learning, which solves the problem of insufficient evaluation accuracy caused by the failure of existing technologies to dynamically perceive process constraints and effectively integrate multimodal information.

[0006] To achieve the above objectives, this invention provides an automatic evaluation method for the quality grade of food raw materials based on machine learning, comprising the following steps:

[0007] Collect data on the composition indicators, process parameters, external environmental factors, and historical trends of food raw materials, and label the collected data samples with quality grade labels to construct a training dataset;

[0008] A quality grade assessment model is constructed and trained using the training dataset. The construction process of the quality grade assessment model includes: first, dynamic grouping and conditional standardization of the component data based on process correlation to preserve the effective boundary of components under process constraints; then, the processed features are fused and adaptively weighted with the features of process parameters, external environment and historical trend modes to capture the nonlinear coupling relationship between multimodal information; and finally, quality grade prediction is performed based on the process perception mechanism.

[0009] The multi-source data of the sample to be evaluated is input into the trained quality level evaluation model, which outputs the quality level probability distribution and takes the level with the highest probability as the final evaluation result.

[0010] This invention discloses an automatic quality grade assessment method for food raw materials based on machine learning. By collecting multi-source data on composition, process, environment, and historical trends, the method first performs dynamic grouping and conditional standardization on the composition data based on process correlation to preserve the effective boundaries of components under process constraints. Subsequently, it fuses multimodal features using tensor product-based interactive modeling and quality prior attention weighting to capture nonlinear coupling relationships. Finally, it combines a process-aware attention mechanism with comprehensive boundary regularization loss to predict the quality grade. This method effectively solves the problems of inaccurate assessments in existing technologies caused by static analysis neglecting the dynamic influence of the process, conventional standardization destroying the process-component correlation, insufficient multimodal information fusion, and the inability to perceive component boundaries under process constraints. It achieves accurate, stable, and automated quality grade assessment of food raw materials in complex production environments. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0012] Figure 1 This is a bar chart comparing the F1 scores of different technical solutions provided in the first embodiment of the present invention across five food ingredient quality grades.

[0013] Figure 2 This is a comparison chart showing the impact of different feature combinations on the performance of food raw material quality grade assessment, provided in the first embodiment of the present invention. Among them, 2(a) is a comparison chart of the assessment accuracy of different feature combinations; 2(b) is a comparison chart of the F1 scores of different feature combinations.

[0014] Figure 3 This is a flowchart of the steps of the automatic evaluation method for the quality grade of food raw materials based on machine learning according to the first embodiment of the present invention. Detailed Implementation

[0015] The embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, but should not be construed as limiting the present invention.

[0016] The first embodiment of this application is as follows:

[0017] Please see Figures 1 to 3 This invention provides an automatic evaluation method for the quality grade of food raw materials based on machine learning, comprising the following steps:

[0018] S101: Collect data on the composition indicators, process parameters, external environmental factors, and historical trends of food raw materials, and label the collected data samples with quality grade labels to construct a training dataset;

[0019] Specifically, the data collection includes component indicators, process parameters, external environmental factors, and historical trend data. Component data is acquired through laboratory measurements or online sensors, covering 18 component indicators: starch content, moisture content, protein content, fat content, fiber content, ash content, tannin content, amino acid content, sugar content, acidity, ester content, alcohol content, aldehyde content, ketone content, phenol content, vitamin content, mineral content, and microbial indicators. These indicators form a component vector to characterize the chemical and physical properties of the raw materials. Process parameter data comes from sensor monitoring and process records during actual production, including fermentation temperature, yeast ratio, and distillation vapor pressure. These parameters directly affect the quality changes of the raw materials during processing. External environmental data includes the origin of the raw materials, storage conditions, and storage time. The origin of the raw materials is processed through geocoding, storage temperature is obtained from warehouse sensor monitoring, and storage time is calculated based on inventory records. Historical trend data is obtained by collecting measurements of each component indicator at multiple recent time points and using linear regression to calculate the trend slope to capture the dynamic changes in the components. Furthermore, the collected data is labeled. The data labeling method is based on expert evaluation and historical quality records. Each sample is assigned a quality level label, and the labeling categories include five levels: excellent, good, medium, poor, and unqualified.

[0020] S102: Construct and train a quality grade assessment model using the training dataset. The construction process of the quality grade assessment model includes: first, performing dynamic grouping and conditional standardization on the component data based on process correlation to preserve the effective boundary of components under process constraints; then, fusing and adaptively weighting the processed features with process parameters, external environment and historical trend modal features to capture the nonlinear coupling relationship between multimodal information; and finally, predicting the quality grade based on the process perception mechanism.

[0021] Specifically, firstly, dynamic grouping of component data based on process correlation: In the task of evaluating the quality of raw materials for alcoholic beverages, there is a non-linear coupling relationship between components and process parameters. For example, the starch content of sorghum needs to match a specific fermentation temperature. However, conventional Z-score standardization methods can destroy the correlation between process and components, easily leading to the model's inability to learn the component effectiveness boundary under process constraints. This invention constructs a conditional probability distribution through process parameters, dynamically divides component data into subgroups to achieve process correlation standardization, and preserves the characteristics of component effectiveness boundaries. The specific steps are as follows:

[0022] 1) Discretization of Process Configuration Space: By discretizing the three process parameters—fermentation temperature, yeast ratio, and distillation vapor pressure—based on their respective means and standard deviations, and using the number of sub-bins to divide each process parameter into multiple intervals, the continuous process space is divided into a finite number of process units. Each process unit represents a local process configuration region, providing a context for component standardization, represented as:

[0023]

[0024] In the formula, Indicates the first Each process unit is a subset of the three-dimensional process parameter space. Each process unit represents a local process configuration region. By discretizing, the continuous process space is divided into a finite number of units, thereby providing a local context for component standardization. This represents a set builder, where the left side of the vertical line represents the elements and the right side represents the conditions, used to define a subset of process parameters that satisfy specific conditions; This represents the fermentation temperature, a process parameter that directly affects the fermentation process. It is derived from sensor monitoring data during actual production. The proportion of yeast starter is a process parameter that controls the fermentation rate and products, and is derived from process records. This represents the distillation vapor pressure, a process parameter that affects distillation efficiency and component extraction. It comes from sensor monitoring data during the actual production process. The mean fermentation temperature is calculated by taking the arithmetic mean of the fermentation temperature values ​​of all samples and is used to center the temperature data. The standard deviation of fermentation temperature is calculated by measuring the standard deviation of fermentation temperature values ​​for all samples and is used to measure the dispersion of temperature data. The number of fermentation chambers representing the fermentation temperature is preferably set to a value of [value to be filled in]. Divide the temperature range into Each interval is used for discretization. A discrete index representing fermentation temperature, with values ​​ranging from... This is used to map continuous temperature values ​​to discrete intervals; This represents the average proportion of yeast starter, calculated by averaging the yeast starter proportions of all samples, and is used to eliminate the dimension of proportion. The standard deviation of the proportion of yeast starter is obtained by calculating the standard deviation of the proportion values ​​of all samples, reflecting the volatility of the proportion data. The preferred value for the number of boxes representing the proportion of yeast is [value missing]. Divide the proportion range into Each interval is used for discretization. Discrete index representing the proportion of yeast, with a value range of [value missing]. , used to map continuous proportional values ​​to discrete intervals; This represents the mean of the distillation vapor pressure, calculated by averaging the distillation vapor pressure values ​​of all samples, and is used to standardize vapor pressure data. The standard deviation of distilled vapor pressure is obtained by calculating the standard deviation of distilled vapor pressure values ​​for all samples, and it characterizes the degree of variation in vapor pressure data. Discrete index representing distillation vapor pressure, with a value range of [value range missing]. This is used to map continuous vapor pressure values ​​to discrete intervals; Represents the process unit index, consisting of triples. Composition, uniquely identifying a process unit; The number of compartments representing the distillation vapor pressure is taken as a value. The steam pressure range is divided into Each interval is used for discretization. This represents the floor function, used to map continuous values ​​to discrete indices, thus achieving spatial discretization.

[0025] 2) Component Condition Standardization: Based on the process unit division results, each component index is standardized using local mean and standard deviation within its corresponding process unit. The standardized component values ​​are then dynamically adjusted using confidence weights and boundary compensation terms to obtain conditionally standardized values ​​that preserve the boundary characteristics of component validity under process constraints. This is expressed as:

[0026]

[0027] In the formula, Indicates the first The component index in the first Each process unit The standardized values ​​under the conditions are dynamically adjusted component characteristics used to preserve the effective boundaries under process constraints. Indicates the first The original values ​​of each component index are component vectors. One of the elements comes from actual test data; Represents a component vector. Each element represents a specific component index value, obtained through laboratory measurement or online sensors; Indicates the first The original values ​​of each component index, Indicates the first The original values ​​of each component index, Indicates the first The original values ​​of each component index; This indicates the number of component indicators, i.e., the dimension of the component vector; Index representing component indicators, ; Indicates the first Each process unit The Middle The mean of the component index is calculated by... Each process unit The arithmetic mean of the original values ​​of the component indices of all samples is used for local centering; Indicates the first Each process unit The Middle The standard deviation of the component index is calculated by... Each process unit The standard deviation of the original values ​​of the component indices of all samples is obtained and used for local scaling; Indicates the first The component index in the first Each process unit The confidence weights, by compensating for the difference between local and global means, ensure that the standardized component values ​​retain the boundary features under process constraints. The calculation method is expressed as follows: ; Indicates the first The component index in the first Each process unit The boundary compensation term, by compensating for the difference between the local and global means, ensures that the standardized component values ​​retain the boundary characteristics under process constraints. The calculation method is expressed as follows: ; Represents the natural exponential function; Represents the hyperbolic tangent function; Indicates the first The corresponding component index is the first Each process unit The Mahalanobis distance between the process parameters and the global process mean is used to measure the statistical deviation of a process unit, and is calculated as follows: ; Indicates for the first The process sensitivity parameters of each component index are trainable parameters used to control the sensitivity of the weights to distance. Indicates the first The global mean of the component index is calculated by taking the first component index from all samples. The arithmetic mean of the individual component indices is used for global reference. Indicates the first The global standard deviation of each component indicator is calculated by examining the global standard deviation of the first component indicator across all samples. The standard deviation of each component index is obtained and used for global scaling. Indicates the first Each process unit The central process parameter vector is calculated by... Each process unit The average of the process parameters for all samples is used to obtain a typical process configuration for this unit. The process parameters include fermentation temperature. , proportion of yeast and distillation vapor pressure ; Indicates the transpose operation; The covariance matrix representing the global process parameters is obtained by calculating the covariance matrix of the process parameters for all samples and is used to measure the linear relationship between process parameters. express The inverse matrix.

[0028] In one implementation, the default number of component indicators is... Specifically, it includes 18 indicators: starch content, moisture content, protein content, fat content, fiber content, ash content, tannin content, amino acid content, sugar content, acidity, ester content, alcohol content, aldehyde content, ketone content, phenol content, vitamin content, mineral content, and microbiological indicators. These component indicators are obtained through laboratory measurements or online sensors and constitute a component vector. .

[0029] Subsequently, multimodal feature fusion and adaptive weighting are performed: Since raw material quality is comprehensively influenced by multimodal information such as process parameters, external environmental factors including raw material origin and storage conditions, and historical data trends, in the task of evaluating the quality of raw materials for alcoholic beverages, simply relying on conditionally standardized component features is insufficient to fully capture quality variations. Conventional feature fusion methods typically ignore the nonlinear coupling relationships between modalities and process constraints, resulting in the model's inability to effectively perceive quality boundaries. This invention extracts process modal features, external environmental modal features, and historical trend modal features, and utilizes tensor product-based interactive modeling and a quality prior attention mechanism to achieve dynamic weighted fusion of multimodal features. This effectively captures the nonlinear coupling relationships between modalities and process synergistic effects, improving the accuracy of quality assessment. The specific steps are as follows:

[0030] 1) Multimodal Feature Extraction: Based on conditionally normalized component feature vectors, process parameter feature vectors, external environment feature vectors, and historical trend feature vectors, vectors are concatenated. After a nonlinear transformation using the hyperbolic tangent function, adaptive scaling is applied to adjust the feature values ​​through element-wise multiplication, thus obtaining the feature vector for each modality. This achieves enhanced representation of multimodal features and preservation of boundary information, represented as:

[0031]

[0032] In the formula, Indicates the first The feature vectors of each modality are fused features through nonlinear transformation and adaptive scaling, which have the characteristics of enhanced representation ability and preservation of boundary information; Indicates the first The feature extraction function for each modality is implemented through nonlinear transformation operations to enhance the expressive power of features and avoid the limitations of linear models. This represents the conditionally standardized component eigenvector. ; This indicates that the first component index is in the first... Each process unit Standardized values ​​under the following conditions This indicates that the second component index is in the... Each process unit Standardized values ​​under the following conditions This indicates that the Dth component index is in the... Each process unit Standardized values ​​under the following conditions; Represents the eigenvectors of process parameters. It can characterize the original features of fermentation temperature, yeast ratio and distillation vapor pressure; Represents the feature vector of the external environment. It is used to capture the long-term impact of environmental factors on quality; Indicates the transpose operation; This indicates the origin code of the raw material, processed through unique thermal coding. The dimension depends on the number of origins. For example, if there are three origins: Sichuan, Guizhou, and Jiangsu, then Sichuan corresponds to... Guizhou corresponds Jiangsu corresponds ; This represents the average storage temperature, a scalar value derived from continuous data monitored by warehouse sensors. For example, the average value is... ,but ; Storage time is a scalar value in days, derived from inventory records. For example, if stored for 30 days, then... ; Represents the historical trend feature vector. ; Indicates the first The historical trend slope of each component index is obtained by calculating the component values ​​at the most recent 10 time points through linear regression, which is used to characterize the dynamic law of component changes. This represents the historical trend slope of the first component indicator. This represents the historical trend slope of the second component indicator. This represents the historical trend slope of the Dth component index; This represents a vector concatenation operation; Indicates the first The weight matrix for each modality is a trainable parameter used for the linearly transformed and concatenated features, with dimensions of [missing information]. ; To represent the dimension of the modal feature vector, the default value is [value to be filled in]. ; Indicates the first The bias vectors of each modality are trainable parameters used to adjust the transformed features and ensure model flexibility. This represents element-wise multiplication, also known as the Hadamard product; Indicates the first An adaptive scaling vector for each modality is calculated using an attention mechanism to dynamically adjust the importance of features. The calculation method is as follows: ; Represents the Softmax function; Indicates the first The scaling weight matrix for each modality is a trainable parameter with dimension . This is used to calculate attention scores; No. The scaling transformation matrix for each modality is a trainable parameter with dimension 1. This is used to linearly transform the concatenated feature vectors to the hidden space; Indicates modal index, ; This represents the total number of modalities; the default value is [value missing]. These correspond to the component mode, process mode, and environmental history mode, respectively.

[0033] In practice, feature extraction is performed on the local process environment of a single sample, and each sample belongs to only one process unit in the process configuration space. Based on the specific process unit to which the current sample belongs The calculated conditional standardized values ​​ensure Preserve the component validity boundary features within the local process context.

[0034] In the specific implementation, in the first... Historical trend slope of each component indicator In the computational engineering, for each component index, its component values ​​at the most recent 10 time points are collected, such as 10 consecutive measurements. A linear regression is performed with the time points as independent variables and the component values ​​as dependent variables. The slope of the regression line is the historical trend slope of the component index. A positive slope indicates an upward trend in the component value, and a negative slope indicates a downward trend.

[0035] 2) Cross-modal interaction modeling: By calculating the outer product between feature vectors of different modes and adjusting the interaction strength using interaction weights, process deviations are penalized by combining reference process parameter vectors and process deviation sensitivity factors. Then, the linear interaction components are captured through the residual interaction matrix, and finally, the cross-modal interaction feature matrix is ​​obtained by summing. This realizes the modeling of nonlinear coupling relationships between multimodal features and the reflection of process synergy effects, expressed as:

[0036]

[0037] In the formula, The cross-modal interaction feature matrix is ​​represented by the feature interaction after tensor product, process deviation adjustment and residual interaction, and is used to capture the nonlinear relationship between multiple modes; Indicates the first The first mode and the first The interaction weights between modalities are trainable parameters used to control the interaction strength, with initial values ​​set based on historical correlations. This indicates the outer product operation, also known as the tensor product; Indicates the first Feature vectors of each modality; To distinguish from Modal index, , Represents the reference process parameter vector. , is the global process average, used for centralized process configuration; The global average fermentation temperature is obtained by calculating the arithmetic mean of the fermentation temperature values ​​of all training samples. The global mean of the yeast ratio is obtained by calculating the arithmetic mean of the yeast ratio values ​​of all training samples. The global mean of the distillation vapor pressure is obtained by calculating the arithmetic mean of the distillation vapor pressure values ​​of all training samples; This represents the L2 norm, also known as the Euclidean norm. This represents the process deviation sensitivity factor, a trainable parameter that controls the degree of influence of process deviations on the interaction. It is related to the temperature sensitivity of the fermentation process and is initially set to... ; The residual interaction matrix is ​​a trainable parameter with dimension O(n). It is used to capture linear interaction components not covered by tensor products, thereby enhancing model robustness.

[0038] 3) Adaptive Feature Weighting: Combining prior quality weights calculated based on historical quality data, an attention mechanism is used to dynamically calculate the adaptive weights of each modality feature. This achieves dynamic weighting of different modalities, giving important modalities a higher weight in the fusion process. Simultaneously, domain knowledge is incorporated to improve the accuracy of quality assessment. This is represented as:

[0039]

[0040] In the formula, Indicates the first The adaptive weights for each modality are scalars used to weight features from different modalities during fusion. The attention query vector is a trainable parameter used to calculate the attention score, and its dimension is [missing information]. ; for transpose; The attention key matrix is ​​a trainable parameter used for linearly transforming features, with dimensions of . C represents the attention bias vector, which is a trainable parameter used to adjust the transformed features. This represents the prior weight coefficients, which are trainable parameters that control the influence of prior information. The initial value is set to... ; Indicates the first The prior quality weights for each modality are calculated based on the Pearson correlation coefficient between past quality grades and modal characteristics, and are expressed as follows: ; The Pearson correlation coefficient is calculated by comparing historical quality grades with modal characteristics. It is used to incorporate domain knowledge and measure the linear correlation between modal characteristics and quality grades.

[0041] 4) Feature Fusion: The feature vector of each modality is weighted and summed with its corresponding adaptive weight to obtain a fused feature vector, thereby integrating multimodal information and capturing the nonlinear coupling relationship between modalities, as shown below:

[0042]

[0043] In the formula, To fuse feature vectors, it is possible to capture nonlinear coupling relationships.

[0044] Finally, we conducted a process-aware prediction of food ingredient quality grades: In the task of evaluating the quality of alcoholic beverage ingredients, the quality grade depends not only on the multimodal fusion characteristics, but also on the combined influence of process constraints, component effectiveness boundaries, and dynamic changes in historical trends. Conventional prediction models often ignore the spatiotemporal evolution of process-specific quality boundaries and component effectiveness, leading to prediction results that deviate from the actual quality grade under process constraints.

[0045] This invention achieves accurate quality level prediction based on process context by employing a process-aware attention mechanism, quality boundary regularization, and dynamic level adjustment, effectively capturing quality variations and boundary features under process constraints. The specific steps are as follows:

[0046] 1) Process-aware attention mechanism: An attention mechanism calculates attention weights based on the cosine similarity between the process parameter feature vector and the reference process vector. Then, a time decay factor is used to adjust for the influence of historical reference points. Finally, a weighted sum of the fused feature vectors is performed to obtain the process-aware feature vector, thereby enhancing the process context representation and improving the accuracy of quality prediction. This is represented as:

[0047]

[0048] In the formula, The process-aware feature vector represents the features adjusted through an attention mechanism to enhance the process context representation and improve the accuracy of quality prediction; S represents the process reference point index. ; Indicates the number of process reference points; the default value is [value missing]. Based on the historical process cluster center setting, it represents a typical process configuration; Indicates the first The attention weights for each process reference point are calculated using Softmax. ; Indicates difference from Process reference point index, ; Indicates the first A reference process vector is obtained from the historical process cluster centers by K-means clustering of historical process parameters; Indicates the first One reference process vector; Represents the eigenvectors of process parameters With the Reference process vectors The cosine similarity is used to measure the similarity of process configurations, and is calculated as follows: ; Represents the eigenvectors of process parameters With the Reference process vectors The cosine similarity is used to measure the similarity of process configurations; Indicates the first The bandwidth parameter of each process reference point is a trainable parameter that controls the similarity decay rate. The initial value is set based on the variance of historical process parameters. This represents the time decay factor, a trainable parameter that controls the decay of the influence of historical data over time. Its initial value is set to... ; Indicates the current time and the number of... The time difference between reference points, in days, is derived from the timestamps in the production records.

[0049] In specific implementation, the first Reference process vectors Specifically, the feature vectors of process parameters from all historical samples are obtained through cluster analysis of historical process parameters. A process parameter dataset is generated, and then the K-means clustering algorithm is used to cluster this dataset. The default number of clusters is set to 10, corresponding to the number of process reference points. By calculating the centroids of each cluster, these centroids become the reference process vectors. For example, if the first reference process vector after clustering is... This indicates that the reference process vector corresponds to a typical configuration with a fermentation temperature of 25℃, a yeast ratio of 15%, and a distillation pressure of 101.3 kPa.

[0050] In practical implementation, the current time and the [number]th [time] Time difference between reference points This is the difference between the current sample timestamp and the corresponding historical timestamp of the reference process vector (in days). Specifically, in the historical data, the latest timestamp corresponding to each reference process vector is recorded. For the current sample, its production timestamp is obtained, and then the difference between the current timestamp and the corresponding timestamp of each reference process vector is calculated. For example, if the current time is May 20, 2023, and the first reference process vector... The corresponding timestamp is May 10, 2023. sky.

[0051] 2) Quality Boundary Regularization: A quality boundary regularization loss is constructed by combining the boundary compensation term in the conditionally standardized values ​​and historical trend features. Boundary tolerance is used to define the allowable deviation threshold of the components. By aligning the predicted trend slope with the historical trend slope, the predicted values ​​are ensured to conform to the component validity boundary under process constraints, thereby enhancing the model's boundary awareness and robustness. This is expressed as:

[0052]

[0053] In the formula, This represents the quality boundary regularization loss, used to constrain the prediction model and ensure that the predicted values ​​conform to the component effectiveness boundary under process constraints. Indicates the first The boundary tolerance of each component index is a trainable parameter that defines the allowed boundary deviation threshold for a component, with an initial value set to 1.0. The trend regularization coefficient is a trainable parameter that controls the strength of historical trend alignment. Its initial value is set to... ; Indicates the first The predicted trend slope of each component index is obtained by linear regression to the predicted component values ​​at the most recent 5 time points, and is used to capture dynamic changes. This represents the function that takes the maximum value.

[0054] In specific implementation, the first Predictive trend slope of each component indicator It is the slope of the component trend predicted by linear regression. Specifically, for the... Each component index is used to obtain the component values ​​for the five most recent time points in the prediction, based on the time points. Using as the independent variable and the predicted component value as the dependent variable, linear regression is performed to obtain the predicted trend slope of the component index.

[0055] 3) Dynamic Quality Grade Prediction: A multilayer perceptron is used to perform a nonlinear transformation on the process-sensing feature vector. Temperature parameters are used to scale the Softmax output to control the prediction confidence. Label smoothing techniques are applied to prevent overfitting, thereby outputting a quality grade probability distribution. This improves the accuracy and generalization ability of the grade prediction, as shown below:

[0056]

[0057] In the formula, This represents a quality level probability vector, where each element corresponds to the probability of a quality level, used for the final level decision. Its dimension is... ; The weight matrix of the output layer represents trainable parameters with dimension 1. This linearly maps the hidden layer output to the quality level space. For the quantity of quality grades, the default value is [number]. These correspond to five levels: Excellent, Good, Average, Poor, and Unqualified. The weight matrix of the hidden layer is a trainable parameter with dimension O(n). A linear transformation is performed on the process-aware feature vector; This represents the bias vector of the hidden layer, which is a trainable parameter; This represents the bias vector of the output layer, which are trainable parameters; This represents the temperature parameter, which is a trainable parameter used to scale the Softmax output and control the prediction confidence. Its initial value is set to... ; This represents element-wise multiplication; The label smoothing coefficient is a trainable parameter used to prevent overfitting; its initial value is set to... .

[0058] In the task of evaluating the quality of raw materials for alcoholic beverages, the accuracy of model predictions depends not only on the characteristics of a single modality or the local process context, but also on the significant influence of the synergistic deviation between process parameters and component indicators. Conventional loss functions such as cross-entropy often ignore the dynamic boundary of component effectiveness under process constraints and the synergistic effect between multimodal features, resulting in insufficient generalization ability of the model in complex process environments.

[0059] This invention employs process-component collaborative deviation penalty, multimodal feature consistency constraint, and historical trend drift compensation to construct a comprehensive total loss function to fully capture quality variations under process-component interactions, thereby enhancing the robustness and accuracy of the model in real industrial scenarios. The specific steps are as follows:

[0060] 1) Process-component co-variance deviation loss: The deviation of each component index is calculated based on conditionally standardized component values ​​and process unit-specific reference means. The penalty intensity is dynamically adjusted using confidence weights and boundary compensation terms. Simultaneously, the process-component co-variance deviation loss is calculated by combining the global boundary compensation benchmark centering compensation term, thus penalizing the process-component co-variance deviation and ensuring that the model considers the component validity boundary during prediction. This is expressed as:

[0061]

[0062] In the formula, This represents the process-component synergistic deviation loss, used to penalize deviations between component values ​​and expected process values, and incorporates boundary compensation terms to enhance process constraint awareness; This indicates the indicator function, which states that if the sample belongs to the first... Each process unit If the value is 1, it is 0 otherwise, which is used to ensure that the loss calculation is only for the current process context; The total number of process units is determined by the number of boxes, for example, ,in , , Therefore ; Indicates the first Each process unit The Middle The reference mean of each component index is calculated by using the average component values ​​in the historical data of that process unit, and is used to define the process-specific component benchmark. Indicates the first The process sensitivity parameters of each component index are calculated by the variance of the component values ​​in historical data and are used to control the intensity of deviation penalty. Represents the boundary compensation regularization coefficient, preferably set as follows: This is used to balance deviation losses and boundary compensation terms; Indicates the first The global boundary compensation benchmark for each component index is calculated across all process units. The average value is obtained and used for centralized boundary compensation.

[0063] In specific implementation, the first Each process unit The Middle Reference mean of each component index Through historical data belonging to the first Each process unit The first of all samples The raw values ​​of each component index The arithmetic mean is calculated to obtain the typical value of the component index under the specific process configuration, which serves as a process-specific component benchmark to define the expected level of the component in the local process context.

[0064] In specific implementation, the first Process sensitivity parameters of each component index Through the first of all samples in historical data The standard deviation of each component index is calculated, but only the degree of variation of the component value itself is considered. It does not directly involve process parameters and is used to control the strength of deviation penalty. It reflects the sensitivity of the component index to process changes. The larger the standard deviation, the higher the volatility of the component value, and the penalty strength is adjusted accordingly.

[0065] In specific implementation, the first Global boundary compensation benchmark for each component index By calculating the first in all process units Boundary compensation terms for each component index The arithmetic mean is obtained, which represents the central value of the global boundary compensation. It is used to center the boundary compensation term and ensure that the compensation term remains consistent globally.

[0066] 2) Multimodal Feature Consistency Loss: This loss calculates the consistency between different modal features based on the cross-modal interaction feature matrix and the fused feature vector. It adjusts the constraint strength using interaction weights and quality prior weights, and aligns the residual interaction matrix with the reference residual interaction matrix and the reference feature vector to maintain multimodal feature consistency. This ensures that the feature fusion process conforms to historical interaction patterns, and is expressed as:

[0067]

[0068] In the formula, This represents the multimodal feature consistency loss, used to ensure consistency between cross-modal interactions and original features, and incorporates quality priors to enhance domain knowledge guidance; Represents the cross-modal interaction feature matrix The middle corresponds to the first The first mode and the first The submatrix of each modality is obtained through slicing, with dimensions of [missing information]. ; Denotes the Frobenius norm; Indicates the first The first mode and the first The interaction weights between the modalities are the same as those defined in the quality grade assessment model; Represents the residual regularization coefficient, with the preferred setting. , used to control the penalty strength of the residual interaction matrix; The reference residual interaction matrix is ​​calculated by the mean of cross-modal interactions in historical data and is used to centralize residual constraints. Represents the prior regularization coefficient, preferred setting. This is used to balance the influence of prior weights; Indicates the first The reference feature vector for each modality is calculated by the mean of the features of that modality in historical data and is used to define the feature benchmark.

[0069] In practical implementation, the cross-modal interaction feature matrix The middle corresponds to the first The first mode and the first Submatrices of each mode By from Extract the corresponding to the first The first mode and the first each modality The submatrix is ​​obtained, specifically, The shape is Therefore yes Index in the first dimension and the second dimension index The slices on are A matrix of dimension, used to represent the first dimension. The first mode and the first Interaction features between modalities.

[0070] In the specific implementation, refer to the residual interaction matrix. Using the residual interaction matrix of all samples in historical data The arithmetic mean was calculated during the training process. As a trainable parameter, its reference value is set based on the average interaction pattern of historical data and is used to centralize residual constraints, serving as a benchmark target for residual interactions.

[0071] In specific implementation, the first Reference eigenvectors of each modality Through the first of all samples in historical data Feature vectors of each modality The arithmetic mean is used to calculate the typical value that characterizes the modality feature, and is used as the feature benchmark to ensure that each modality maintains historical consistency during the feature fusion process.

[0072] 3) Historical Trend Drift Compensation Loss: The trend drift is calculated based on the historical trend feature vector and the predicted trend slope vector. The penalty intensity is adjusted using a time decay factor, and the trend covariance matrix is ​​combined to capture the coordinated changes of multiple trend components, thus compensating for historical trend drift and ensuring that the prediction model conforms to historical evolution patterns. This is expressed as:

[0073] In the formula, This represents the historical trend drift compensation loss, used to penalize deviations between the predicted trend and the historical trend, and incorporates trend covariance to capture multi-component collaborative drift. This represents the trend covariance regularization coefficient, with the preferred setting. This is used to control the strength of the covariance penalty; This represents the vector of predicted trend slope. , This is the d-th element of the predicted trend slope vector; This represents the slope of the predicted trend for the first component indicator. This represents the slope of the predicted trend for the second component indicator. This represents the slope of the predicted trend for the Dth component index; The covariance matrix representing historical trends is obtained by calculating the covariance matrix of the historical trend slopes of all component indicators, and is used to measure the linear relationship between trends. express The inverse matrix.

[0074] In practical implementation, the covariance matrix of historical trends Historical trend feature vectors of all samples in historical data Specifically, the covariance matrix is ​​calculated by collecting historical trend feature vectors from all samples. Then calculate the covariance matrix of these vectors to obtain A dimensional matrix is ​​used to measure the linear relationship between trends of different component indicators, reflecting the collaborative pattern of trend changes.

[0075] 4) Calculation of the total loss function: The total loss function is calculated by weighting and summing the cross-entropy loss, quality boundary regularization loss, process-component co-variance deviation loss, multimodal feature consistency loss, and historical trend drift compensation loss based on different loss weight coefficients. This comprehensively optimizes the model parameters and improves the performance of quality grade assessment, expressed as:

[0076]

[0077] In the formula, This represents the total loss function, used to optimize the parameters of the entire model; Represents cross-entropy loss, based on the quality level probability vector. The model calculates the true quality level labels, which are in one-hot vector format and represent the actual quality level of the sample. The cross-entropy loss measures the difference between the predicted probability distribution and the true distribution and is used to optimize the model's classification accuracy of quality levels. This represents the first loss weighting coefficient, used to balance the importance of quality boundary regularization loss in the total loss. It is preferably set to... This is to ensure that boundary constraints have a moderate impact on model training and to prevent predicted values ​​from deviating from the component validity boundary under process constraints. This represents the second loss weighting coefficient, used to balance the importance of process-component synergistic deviation losses in the total loss, and is preferably set to... This emphasizes the synergistic effect of process and composition, and penalizes deviations between component values ​​and expected process values. This represents the third loss weight coefficient, used to balance the importance of multimodal feature consistency loss in the total loss. A preferred setting is... To maintain the consistency of multimodal features and ensure that the feature fusion process conforms to historical interaction patterns; This represents the fourth loss weighting coefficient, used to balance the importance of historical trend drift compensation loss in the total loss. A preferred setting is... This is to ensure that trend drift is appropriately penalized and to maintain consistency between predicted trends and historical trends.

[0078] In one embodiment, the classification performance balance of different techniques across five quality levels is evaluated, with the F1 score comprehensively measuring the model's performance at each level. The techniques compared in the experiments include common machine learning methods such as random forests, support vector machines, logistic regression, and decision trees. For the experimental configuration, a complete dataset of 2000 samples was used to ensure sufficient representativeness for each quality level. The F1 score, the harmonic mean of precision and recall, reflects both the model's accuracy and coverage in identifying each class. Figure 1 The grouped bar chart clearly shows that the technology of this invention maintains a high F1 score across all five quality levels, particularly excelling in the critical levels of "Excellent" and "Unacceptable". The horizontal axis represents the five quality levels, and the vertical axis represents the F1 score; a higher score indicates better overall model performance at that level. At the "Excellent" level, the technology accurately identifies high-quality raw materials, crucial for ensuring product quality. At the "Unacceptable" level, a high F1 score means the system effectively identifies problematic raw materials, preventing inferior materials from entering the production process. This demonstrates that the invention, through quality boundary regularization and process-aware attention mechanisms, can adaptively adjust to the characteristics of different quality levels, thus achieving more balanced and reliable performance.

[0079] In this embodiment, the impact of different feature combinations on evaluation performance is analyzed to verify the effectiveness of the multimodal feature fusion and adaptive weighting mechanism in this invention. Six different feature combination configurations were set up in the experiment, and both accuracy and F1 score were examined to ensure the comprehensiveness of the evaluation. Experimental results show that as the number of feature modalities increases, the evaluation performance gradually improves. However, simple feature concatenation offers limited improvement, while this invention significantly enhances performance through an adaptive weighting mechanism. This demonstrates that multimodal features provide complementary information perspectives, and adaptive weighting can dynamically adjust the importance of different features, effectively capturing the nonlinear coupling relationship between modalities, thereby achieving optimal evaluation results.

[0080] During the iterative training of the model, the food ingredient quality grade assessment model is iteratively optimized multiple times using the training dataset, with the goal of minimizing the total loss function. At the start of training, all trainable parameters are initialized, set based on preset values ​​or random distributions. In each iteration, batch sample data is input, and the following steps are executed sequentially: dynamic grouping of component data, multimodal feature fusion and adaptive weighting, and process-aware quality grade prediction. The total loss function value is then calculated. Next, the gradient of the loss function with respect to each parameter is calculated using the backpropagation algorithm, and the parameters are updated using the Adam optimization algorithm. The learning rate is adjusted to control the update step size, ensuring stable convergence of the training. During training, the changes in loss and evaluation metrics, such as accuracy or F1 score, on the training and validation sets are monitored to assess model performance. The model stops iterating when the loss on the validation set no longer decreases significantly or reaches the preset maximum number of iterations. For example, training is terminated early when the validation loss does not improve or changes less than a threshold over several consecutive cycles to prevent overfitting. Finally, the trained model parameters are saved for subsequent automatic evaluation tasks.

[0081] S103: Input the multi-source data of the sample to be evaluated into the trained quality level evaluation model, output the quality level probability distribution, and take the level with the highest probability as the final evaluation result.

[0082] Specifically, after model training, the automatic quality assessment system for food raw materials can perform real-time quality assessments on newly input food raw material samples. The assessment process first collects multi-source data on the new samples, including component indicators, process parameters, external environmental factors, and historical trend data. Component data is acquired through laboratory measurements or online sensors, process parameters come from the production monitoring system, and external environmental data such as raw material origin and storage conditions are extracted from a database. Historical trends are calculated based on the slope of the component values ​​at the most recent time point. Then, the system preprocesses the input data, including spatial discretization of the process configuration and standardization of component conditions, dynamically dividing the process into units and calculating standardized values ​​to preserve the effective boundary of components under process constraints. Next, multimodal features are extracted and fused with adaptive weighting, and a fused feature vector is calculated using the trained model parameters. Finally, based on a process-aware mechanism, quality grade prediction is performed, outputting a probability distribution of quality grades, and the grade with the highest probability is selected as the final assessment result.

[0083] Dynamic grouping is achieved through the conditional probability distribution of process parameters, and conditional standardization of component data is performed for different process units, preserving the component validity boundary under process constraints and avoiding the destruction of process-component relationships by conventional standardization methods. Combining multimodal data such as process parameters, external environmental factors, and historical trends, dynamic weighted fusion using tensor product-based interactive modeling and a quality prior attention mechanism improves the perception of nonlinear coupling relationships and process synergistic effects, optimizing the accuracy of quality assessment. By calculating the similarity between process parameters and reference process vectors, and combining the influence of time decay factors and historical reference points, accurate process context awareness is achieved, enabling quality prediction to consider the timeliness and dynamic changes of process constraints. Employing quality boundary regularization loss aligned with historical trends ensures that component prediction results conform to the process validity boundary; combined with dynamic trend adjustment, this enhances the model's ability to perceive spatiotemporal changes and its robustness, thereby improving the accuracy of quality grade prediction.

[0084] The second embodiment of this application is as follows:

[0085] Based on the first embodiment, the machine learning-based automatic evaluation system for food raw material quality grades in this embodiment is used to implement the machine learning-based automatic evaluation method for food raw material quality grades.

[0086] The above-disclosed embodiments are merely one or more preferred embodiments of this application and should not be construed as limiting the scope of this application. Those skilled in the art can understand that all or part of the processes for implementing the above embodiments and equivalent changes made in accordance with the claims of this application still fall within the scope of this application.

Claims

1. A method for automatically evaluating the quality grade of food raw materials based on machine learning, characterized in that, Includes the following steps: Collect data on the composition indicators, process parameters, external environmental factors, and historical trends of food raw materials, and label the collected data samples with quality grade labels to construct a training dataset; A quality grade assessment model is constructed and trained using the training dataset. The construction process of the quality grade assessment model includes: first, dynamic grouping and conditional standardization of the component data based on process correlation to preserve the effective boundary of components under process constraints; then, the processed features are fused and adaptively weighted with the features of process parameters, external environment and historical trend modes to capture the nonlinear coupling relationship between multimodal information; and finally, quality grade prediction is performed based on the process perception mechanism. The multi-source data of the sample to be evaluated is input into the trained quality level evaluation model, the quality level probability distribution is output, and the level with the highest probability is taken as the final evaluation result. The first step involves dynamically grouping and conditionally standardizing the component data based on process correlation to preserve the effective boundaries of components under process constraints. Specifically, this includes: The continuous process space composed of multiple key process parameters is discretized based on its statistical characteristics and divided into multiple process units. For the component index within each process unit, the local mean and standard deviation within that unit are used for standardization. A confidence weight and a boundary compensation term are introduced to dynamically adjust the standardization results. The confidence weight is calculated based on the statistical distance between the process parameters of that process unit and the global process mean, and is used to adjust the standardization intensity according to the degree of deviation of the process configuration. The boundary compensation term is calculated based on the difference between the mean of the component within the local process unit and the global mean, and is used to preserve the validity boundary characteristics of the component. The validity boundary features are obtained and expressed as follows: In the formula, Indicates the first The component index in the first Each process unit The standardized values ​​under the conditions are dynamically adjusted component characteristics used to preserve the effective boundaries under process constraints. Indicates the first The original values ​​of each component index are component vectors. One of the elements comes from actual test data; Indicates the first Each process unit The Middle The mean of the component index is calculated by... Each process unit The arithmetic mean of the original values ​​of the component indices of all samples is used for local centering; Indicates the first Each process unit The Middle The standard deviation of the component index is calculated by... Each process unit The standard deviation of the original values ​​of the component indices of all samples is obtained and used for local scaling; Indicates the first The component index in the first Each process unit The confidence weights, by compensating for the difference between local and global means, ensure that the standardized component values ​​retain the boundary features under process constraints. Indicates the first The component index in the first Each process unit The boundary compensation term below.

2. The automatic evaluation method for food raw material quality grades based on machine learning as described in claim 1, characterized in that, Subsequently, the processed features are fused and adaptively weighted with features from process parameters, external environment, and historical trend modes to capture the nonlinear coupling relationships between multimodal information, specifically including: The characteristics of the components, process parameters, external environment, and historical trends after the extraction conditions were standardized; By calculating the tensor product between feature vectors of different modes and combining trainable interaction weights with an adjustment term based on the deviation of the current process parameters from the reference process vector, cross-modal interactions are modeled, thereby generating interaction features that characterize the nonlinear coupling relationship between multiple modes. Combining the prior quality weights calculated based on historical quality data, the adaptive weights of each modality feature are dynamically calculated through an attention mechanism. The adaptive weights are used to perform a weighted summation of the feature vectors of each modality to obtain a comprehensive fusion feature vector.

3. The automatic evaluation method for food raw material quality grades based on machine learning as described in claim 2, characterized in that, Finally, quality grade prediction is performed based on the process awareness mechanism, specifically including: Based on the similarity measurement between the current process parameter features and multiple historical reference process vectors, and combined with the time decay factor to calculate the attention weight, the fused feature vector is weighted using the attention weight to obtain a process-aware feature vector with enhanced process context representation. The process-aware feature vector is input into the prediction network, and processed by controlling the parameters of the output confidence and smoothing techniques, and finally outputs the probability distribution of the quality level.

4. The automatic evaluation method for food raw material quality grades based on machine learning as described in claim 3, characterized in that, The process of constructing and training a quality rating assessment model using the aforementioned training dataset also includes: The training process of the quality grade assessment model optimizes the model parameters by minimizing a comprehensive loss function, which includes: a basic loss for measuring the difference between the predicted grade and the true grade; a boundary regularization loss for constraining the predicted value to conform to the component validity boundary under process constraints; a co-deviation loss for penalizing the co-deviation between component values ​​and process expected values; a feature consistency loss for ensuring the consistency of cross-modal interaction and feature fusion process; and a trend drift compensation loss for penalizing the deviation between the predicted trend and the historical trend.

5. The automatic evaluation method for food raw material quality grades based on machine learning as described in claim 4, characterized in that, The boundary regularization loss used to constrain predicted values ​​to conform to the component validity boundary under process constraints includes: The calculation of the boundary regularization loss defines the allowable deviation threshold of the components by introducing a boundary tolerance parameter, and penalizes deviations exceeding the deviation threshold; at the same time, the boundary regularization loss ensures that the model prediction conforms to the dynamic change law of the components by keeping the predicted trend consistent with the historical trend.

6. The automatic evaluation method for food raw material quality grades based on machine learning as described in claim 2, characterized in that, By calculating the tensor product between feature vectors of different modes and combining it with trainable interaction weights and an adjustment term based on the deviation of the current process parameters from the reference process vector, cross-modal interactions are modeled, thereby generating interaction features that characterize the nonlinear coupling relationship between multiple modes, specifically including: In the process of modeling cross-modal interactions, a trainable residual interaction term is introduced, which is combined with tensor product interaction through linear interaction to enhance the expressive power and robustness of the model.

7. The automatic evaluation method for food raw material quality grades based on machine learning as described in claim 3, characterized in that, Based on the similarity measure between the current process parameter features and multiple historical reference process vectors, and combined with the time decay factor to calculate the attention weight, the fused feature vector is weighted using the attention weight to obtain a process-aware feature vector with enhanced process context representation, specifically including: The historical reference process vector is obtained by clustering analysis of historical process parameter datasets and is used to provide a representative typical process configuration benchmark for the process awareness attention mechanism.

8. The automatic evaluation method for food raw material quality grades based on machine learning as described in claim 1, characterized in that, Data on the composition indicators, process parameters, external environmental factors, and historical trends of food raw materials are collected, and quality grade labels are assigned to the collected data samples to construct a training dataset, specifically including: The external environmental factors include preprocessed origin information, monitored storage condition data, and calculated storage duration; The historical trend data is obtained by analyzing the variation patterns of component indicators at continuous time points, and is used to capture the dynamic change characteristics of components.

Citation Information

Patent Citations

  • Roast chicken eating quality grading intelligent judgment method based on multi-mode fusion

    CN120892948A