Artificial intelligence-based dairy product quality safety detection method and system

By deploying multi-source sensors and artificial intelligence algorithms on dairy production lines, a multi-core Gaussian process regression model is built, and a false alarm and omission problem of dairy quality monitoring system in the existing technology is solved, and accurate monitoring and real-time response to dairy product quality is achieved.

CN120375969APending Publication Date: 2025-07-25YOUNUO DAIRY CO LTD
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202510462759.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing quality monitoring systems in the field of dairy production and storage are difficult to accurately identify extreme situations under multi-source observation and dynamic environmental conditions, resulting in false positives or missed reports, and lack of fusion analysis methods for multi-source information, which cannot fully reflect the impact of key process parameters.

Method used

Using artificial intelligence-based dairy quality and safety detection methods, a multi-source element matrix is built by deploying near-infrared spectral sensors, temperature and humidity monitoring modules, and combining wavelet denoising, multi-core Gaussian process regression and bitter fish algorithms to realize real-time monitoring and model optimization of multi-dimensional sensing data, dynamically adjust the threshold to identify high-risk segments, and conduct pollutant alarms and model feedback.

Benefits of technology

It realizes accurate monitoring of dairy product quality in complex production environments, reduces false alarms and missed reports, improves the ability to identify burst noise and real risks, and ensures product quality stability and real-time response speed of the production process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120375969A_ABST
    Figure CN120375969A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of dairy product production, and discloses a dairy product quality safety detection method and system based on artificial intelligence. The detection method comprises the following steps: S10, sensor layout and initial process mapping; s20, carrying out data preprocessing and wavelet denoising; s30, regression scene construction and model prior; s40, multi-core collaborative optimization of the bitter fish algorithm; s50, carrying out online monitoring and distributed drift correction; s60, pollutant alarm and model feedback are carried out; and S70, at the end of each production stage or cycle, performing global evaluation on the method in the aspects of accuracy, real-time performance, system compatibility and the like. The core innovation of the invention lies in constructing a dynamic frequency domain processing framework and a multi-core self-adaptive modeling mechanism fusing process prior, and effectively solves the problems of incomplete signal noise reduction, risk feature coupling modeling deficiency and the like of a traditional method in a complex production environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of dairy product production, and particularly to a method and system for detecting the quality and safety of dairy products based on artificial intelligence. Background Art

[0002] In the daily monitoring of industries such as food, the prior art usually monitors key environmental parameters with sensors such as temperature and humidity, and collects data at fixed time intervals. Such solutions mostly install basic probes in the production area or storage area, and form basic materials for subsequent reference by recording various measured values in a local or remote database. The overall idea focuses on stability, and uses relatively mature components to reduce the installation and maintenance difficulties.

[0003] In terms of system composition, the common practice is to disperse several temperature and humidity detection devices in the workshop or warehouse, and supplement simple gas concentration sensors for some nodes to detect potential abnormalities. Most solutions will transmit these readings to the host through wired or wireless networks, and then the software program will make a preliminary judgment on the indicators. If the temperature or humidity exceeds the preset range, the system will issue a prompt for the staff to intervene in time.

[0004] Such technical implementation methods mostly rely on rule-based judgments, and set fixed upper and lower limit thresholds or reference ranges. When the temperature and humidity deviate from the set value, the monitoring interface will display a warning message, and the management personnel can take control measures according to experience or corresponding regulations. Since this mode has been verified by multiple applications, the operation process is relatively simple, and it can also meet the daily needs of many conventional occasions, providing a basic condition for further upgrading in the future.

[0005] Currently, in the field of food production and storage, basic sensors such as temperature and humidity are generally used for periodic monitoring, and their data processing mostly stays in the stage of rule-based judgment and fixed threshold warning. However, due to the different environmental conditions in different industries or batches, the existing systems often have difficulty in accurately identifying environmental interferences and extreme situations such as high humidity and high temperature. Once the sensor noise soars or fluctuates short-term, simple upper and lower limit thresholds are likely to cause false alarms or missed alarms. In addition, the conventional monitoring solutions lack means for fusing and analyzing multi-source information, and it is difficult to reveal the evolution law of microbial or chemical risks in complex time series, nor can they fully reflect the influence of key process parameters during the production cycle.

[0006] Therefore, although some of the prior art integrates multiple measurement modules on the data acquisition terminal, in the subsequent analysis method, it is still limited to the single-point judgment of the preset range, and cannot adaptively correct the threshold or segmentation strategy according to the real-time data change, which limits the accuracy of the troubleshooting process and the decision-making response speed. Summary of the Invention

[0007] The technical problem to be solved by the present invention is: aiming at the deficiencies of the above-mentioned prior art, to provide an artificial intelligence-based dairy product quality and safety detection method and system, so as to establish a more flexible production process quality monitoring and pollution risk assessment mechanism under multi-source observation and dynamic environmental conditions, and break through the limitation that a single threshold setting cannot cope with diverse interferences.

[0008] Especially in the face of rapid changes in temperature and humidity or data anomalies within individual short time periods, the present invention is committed to more accurately distinguishing sudden noise from real risks in the time series dimension, and taking into account the comprehensive consideration of key process parameters and environmental variables.

[0009] In order to achieve accurate capture of risk characteristics under the synergistic effect of climate and complex processes, the key technical problem solved by the present invention lies in how to fuse multi-dimensional sensing data and multi-stage process elements, and continuously optimize the model performance under the pressure of small-batch updates and real-time monitoring to ensure the stability of product quality.

[0010] To achieve the above object, the present invention adopts the following technical solutions:

[0011] The first aspect of the present invention is to provide an artificial intelligence-based dairy product quality and safety detection method, including the following steps:

[0012] S10. Sensor layout and initial process mapping: Divide the production line into several continuous time periods, and deploy near-infrared spectroscopy sensors, temperature monitoring modules and humidity monitoring modules at each key node to obtain the sensor output values within each time period; synchronously collect the sterilization time, sterilization temperature and storage period to form process parameters and environmental variables; based on the sensor set and process parameters of each time period, construct a multi-source element matrix, and introduce a process mapping function to generate spectral and environmental correlation features under the initial production process;

[0013] S20. Data preprocessing and wavelet denoising: For the multi-source element matrix, select each row of data vector as the multi-dimensional observation value corresponding to the time period, and perform multi-level discrete wavelet decomposition using an improved wavelet function; after obtaining the wavelet decomposition coefficients, identify high-frequency environmental noise based on an adaptive threshold function adjusted by temperature and humidity; perform inverse transformation on the threshold-processed coefficient matrix to obtain a denoised sequence, and use a time window smoothing strategy to enhance the smoothing effect during extreme temperature and humidity periods; finally, perform unified normalization on all denoised dimensions to obtain preprocessed multi-dimensional feature data;

[0014] S30. Regression scenario construction and model prior: According to the dairy product quality requirements, discrete time indices are formed by combining high-temperature and high-humidity stages, and the scenario demand function and small-batch data limit are defined with the microbial contamination concentration or chemical risk index as the target; based on a multi-type kernel function library, the non-linear interactions of different temperature and humidity changes and various process parameters are characterized; on this basis, a Gaussian process regression prior is introduced to perform posterior inference on the current small-batch data. If a high-risk section is monitored, the kernel parameters and corresponding hyperparameters are dynamically adjusted to meet the requirements of fast convergence and accuracy;

[0015] S40. Multi-core collaborative optimization of the bitter fish algorithm: Construct the individual coding vector of the bitter fish algorithm. Through initial population construction and uncertainty assessment, an objective function is formed by integrating errors, temporal compliance, and the weighted coefficient of the key section; for individuals with higher fitness, local search and migration operator fine-tuning are first performed, and then global search is executed when the fitness is low or the individual falls into an unstable section; the kernel function is adaptively adjusted according to the small-batch sample error and noise intensity until the optimal band combination and kernel function parameters are obtained;

[0016] S50. Online monitoring and distribution drift correction: During the new batch production period, sensor data is collected, and the previously trained multi-core Gaussian process regression model is used to predict the pollution risk and output the credibility; if a large difference from the original training distribution is monitored, the bitter fish algorithm is triggered to perform differential optimization on the bands and kernel parameters, and secondary training and deployment are quickly completed without destroying the existing model;

[0017] S60. Pollutant alarm and model feedback: The predicted concentration and uncertainty of each pollutant are output in real time, and corresponding alarm levels are triggered after comparison with the safety threshold matrix; when multiple pollutants or uncertainties exceed the limit, production suspension and maintenance as well as batch traceability are performed, and suspicious samples are sent to the laboratory for testing; if the test results deviate significantly, the difference data is added to the model training set and the bands and kernel parameters are updated synchronously to achieve continuous adaptation to new pollution characteristics or more stringent thresholds;

[0018] S70. Finally, at the end of each production stage or cycle, a global evaluation of this method is carried out in terms of accuracy, real-time performance, and system compatibility, etc.; compared with the scheme that only uses single-core Gaussian process regression or single-spectrum analysis, the advantages of the multi-core fusion plus bitter fish optimization algorithm in small-sample and high-noise scenarios are verified; combined with the abnormal cases and process change records that appear in the evaluation, the individual search strategy of the bitter fish algorithm and the initial hyperparameter allocation of multi-core GPR are dynamically revised.

[0019] Preferably, the step S10 includes the following sub-steps:

[0020] S11. Sensor layout and production period setting

[0021] Divide the production line into several consecutive time periods and denote them as T = {t1, t2,..., t n}, where t i represents the i-th time period and n represents the total number of time periods;

[0022] Deploy near-infrared spectroscopy sensors, temperature monitoring modules, and humidity monitoring modules to key nodes of the production line to form a sensor set S = {s1, s2,..., s r}, where s j represents the j-th sensor and r represents the total number of sensors;

[0023] The output values of the sensors within each time period t i are denoted as x ij ;

[0024] S12. Process Parameter Aggregation and Environmental Variable Identification

[0025] During the time period t i , synchronously collect the sterilization time, sterilization temperature, and storage period, and denote them as p, q, d respectively, and align them with x ij through a unified time index; use the temperature T(t1) and humidity H(t1) to characterize the environmental variables of this time period;

[0026] Synchronously integrate p, q, d with T(t1), H(t1) into the records of each time period t i to obtain an aggregated description of the time period information and process status;

[0027] S13. Multi-Source Element Data Matrix Construction

[0028] Based on the sensor outputs, process parameters, and environmental variables obtained in sub-step S11 and sub-step S12, construct a multi-source element matrix X:

[0029]

[0030] where x ij represents the value quantified by the sensor s i during the time period t j ;

[0031] Append columns of T(t1), H(t1), p, q, d to X to obtain a comprehensive feature matrix;

[0032] Use the vector P = [p, q, d] to represent the process parameters and the vector E(t1) = [T(t1), H(t1)] to represent the environmental variables;

[0033] S14. Initial Process Mapping Generation

[0034] Based on the matrix X generated in sub-step S13, introduce the process mapping function φ(·);

[0035] Determine the mapping coefficient by combining the process parameter vector P with the environmental variable E(t1), and construct the mapping matrix M to retain the dynamic influence of process characteristics during the fermentation or processing stage:

[0036] M = X·Ω,

[0037] where Ω is the diagonal expansion matrix based on process and environmental variables, α1, α2, α3 are the weight coefficients for the sterilization time p, sterilization temperature q, and storage period d, and f(E(t i )) represents the scale adjustment function for environmental variables, which is used to highlight the significant influence of spectral changes during high-temperature and high-humidity periods; the matrix M characterizes the spectral and environmental correlation characteristics under the initial production process.

[0038] 3. The detection method according to claim 1, wherein the step S20 specifically includes the following sub-steps:

[0039] S21. Data preprocessing and initialization of wavelet decomposition

[0040] Based on the multi-source factor matrix X output in step S10, select each row of data vector X(t i ) = [x i,1 , x i,2 ,..., x i,r as the multi-dimensional observation value corresponding to the time period t i ;

[0041] Construct an improved wavelet function ψ(t) to implement the discrete wavelet decomposition of X(t i );

[0042] Let D be the number of wavelet decomposition layers, and let c j,k represent the wavelet coefficient of the j-th dimension at the k-th layer, and define the discrete wavelet transform relationship:

[0043]

[0044] where represents the coefficient matrix obtained by performing multi-layer wavelet decomposition on each dimension x i during the time period t ij , r represents the number of data dimension quantities, and D represents the number of wavelet decomposition layers; each c j,k reflects the energy distribution of features in different frequency bands;

[0045] S22. Adaptive threshold strategy and high-frequency environmental parameter identification

[0046] After obtaining the wavelet decomposition coefficients, an adaptive threshold strategy is constructed to locate the noise regions caused by high-frequency environmental parameters; the temperature T(t1) and humidity H(t1) are regarded as dynamic adjustment variables, and let σ k represent the mean square error of the coefficients at the k-th layer over the entire time period, and use γ k to represent the adjustment coefficient based on T(t i ) and H(t i ), and construct an adaptive threshold function T a (k):

[0047]

[0048] where represents the energy accumulation at the k-th layer, and γ k is determined by the mean fluctuations of T(t1) and H(t1), and σ k represents the global standard deviation of the k-th layer;

[0049] S23. Time window smoothing and extreme data segment processing

[0050] Perform an inverse transform on the coefficient matrix after wavelet threshold processing to obtain the denoised observation sequence Y(t1); on this basis, in view of the problem that the residual noise is still relatively large in the key frequency bands or extreme temperature and humidity segments, construct a time window smoothing method; let δ represent the smoothing window radius, and let ω m represent the weighting coefficients for different time periods within the window, and define the smoothed output S(t1):

[0051]

[0052] where Y(m) represents the denoised observation value at time period m, and ω m is determined by the differences in the adjacent time periods and t i in the temperature and humidity dimensions, and Λ is the sum for normalizing the weights within the window. Dynamically adjust δ and ω m , and can perform enhanced smoothing on extreme time periods to reduce the uncertainty caused by random interference during mass production;

[0053] S24. Multidimensional feature normalization

[0054] After denoising and smoothing, unify the detection dimensions of each dimension, and perform normalization processing on all dimensions of the denoised output S(t1), and record the normalized matrix as Z.

[0055] Preferably, the step S30 includes the following sub-steps:

[0056] S31. Scene requirements and regression target determination

[0057] Obtain the actual operation cycle T of the production line, and highlight the high-temperature stage and high-humidity stage during the cycle to form discrete-time indices {t1, t2, ..., t n}; Let n represent the number of sampling moments; For each t i , obtain the multi-dimensional feature vector obtained in S20 Construct a feature matrix

[0058] Let m represent the feature dimension, including spectral features and temperature and humidity observation values;

[0059] Record the microbial contamination concentration or chemical risk index as y i , corresponding to the time index t i , to form a target vector

[0060] Regard {Z, y} as a modeling data set, reflecting the rapid fluctuation characteristics of microbial or chemical risks under high-temperature and high-humidity conditions;

[0061] Based on the dairy product quality and safety requirements, define the scenario demand function J1 to measure the stability of the regression accuracy in different time periods; Let w i represent the coefficient of the importance of the production line at time t1, represent the predicted value of the model at time t i moment, w i > 0 is used to highlight the importance of high-temperature and high-humidity conditions:

[0062]

[0063] Set an upper limit k < n for the small batch data sample size k, restricting the use of only a small amount of data for each training;

[0064] Define H(k) to measure the model convergence speed in the small batch scenario. Let A represent the kernel covariance matrix obtained after training with k data, let σ represent the noise level, let B represent the diagonal matrix related to σ, and det(·) represent the determinant operation:

[0065]

[0066] The smaller H(k) is, the easier it is for the model to converge under small batch data;

[0067] S32, Construction of multi-type kernel function library

[0068] To express the instantaneous drastic change of microorganisms caused by high temperature, define the kernel function k1(·, ·); Let θ1 represent the scale hyperparameter, let d1 represent the distance metric method, and the high-frequency kernel function is specifically:

[0069]

[0070] To track the risk accumulation caused by the slow changes in temperature and humidity, the kernel function k2(·, ·) is defined; let θ2 be the hyperparameter and γ be the smoothing factor. The specific form of the low-frequency kernel function is as follows:

[0071]

[0072] This kernel function still maintains a strong correlation between long-distance sampling points and is used to accurately represent the low-frequency changes brought about by the slow drift of temperature and humidity;

[0073] Define the kernel function k3(·, ·); let p, q, and d represent the weight factors of the sterilization intensity, process temperature, and storage duration label features respectively:

[0074] k3(z i ,z j )=(pz i +qz j +d) 2

[0075] This kernel function reflects the non-linear interaction between various process parameters and microbial and chemical risk characteristics;

[0076] Construct the kernel function library {k1, k2, k3} by combining k1(·, ·), k2(·, ·), and k3(·, ·);

[0077] S33. Target Weight Division and High-Sensitivity Band Identification

[0078] Let λ1, λ2, and λ3 represent the weighting coefficients for k1, k2, and k3 respectively, and maintain λ1 + λ2 + λ3 = 1; let K represent the fused kernel function:

[0079] K(z i ,z j )=λ1k1(z i ,z j )+λ2k2(z i ,z j )+λ3k3(z i ,z j )

[0080] Let s i represent the incremental ratio of microbial or chemical risk at time t i , and let r i represent the instantaneous change rate of temperature and humidity;

[0081] Locate the high-sensitivity interval through the following threshold judgment method:

[0082] s i >ɑ1 and r i >ɑ2

[0083] where ɑ1 and ɑ2 are preset thresholds, and the high-sensitivity band is susceptible to severe fluctuations under high-temperature and high-humidity conditions;

[0084] Within the identified high-sensitivity segment, an additional increment β is applied to λ1 to give the high-frequency kernel function k1 higher attention:

[0085] λ1←λ1+β

[0086] In the non-high-sensitivity segments, the initial weighting coefficients are maintained unchanged to accurately track slow risk changes;

[0087] S34. Process Information Embedding and Initial Parameter Configuration

[0088] Obtain the sterilization duration G, the critical temperature H, and the process information Q from sub-step S10 to form the process vector c = [G, H, Q]. In the kernel function calculation, c i is combined with the feature z i for use, so that process differences are fully incorporated into the model;

[0089] Perform an initial mapping on p, q, d in k3(·, ·) and c = [G, H, Q] to enable the model to have process priors before there is sufficient data; let f1, f2, f3 be functions based on practical experience:

[0090] p = f1(G), q = f2(H), d = f3(Q)

[0091] Let θ2′ be the new scaling coefficient in the low-frequency kernel function k2, which is determined by θ2′ = θ2·(1 + δ1H + δ2Q) after being coupled with the process information c, where δ1 and δ2 represent the sensitivity weights for temperature and other process information;

[0092] Record {θ1, θ2′, p, q, d, λ1, λ2, λ3} as the initial parameter set;

[0093] S35. Prior and Posterior Inference of Gaussian Process Regression

[0094] Define the Gaussian process prior p(f) ∼ GP(0, K) for the fused kernel function K, let f represent the function to be predicted, let the mean function be taken as 0, and the covariance function is superimposed according to the fused kernel function;

[0095] Let D k = {(z1, y1)|i = 1,..., k} represent the current mini-batch data set, and correct the prior distribution p(f) through the observed value y1 to obtain the posterior distribution p(f|D k );

[0096] Let K k represent the kernel covariance matrix constructed using D k and let yk Denote the target vector corresponding to k samples, let σ denote the noise level, and I denote the identity matrix; correct the kernel matrix:

[0097] K′ k = K k + σ 2 I

[0098] Substitute K k ′ into the Gaussian process posterior inference equation to obtain the predictive distribution of the new input z*;

[0099] S36. Parameter adjustment and dynamic optimization

[0100] Based on J1 in sub-step S31, regularly calculate the value of J1 after the current mini-batch training; if J1 is greater than the threshold, the hyperparameters λ1, λ2, λ3 and θ1, θ2′ need to be updated to ensure that the model maintains the expected accuracy in the high-risk section;

[0101] While ensuring that J1 keeps decreasing, monitor the mini-batch convergence speed through H(k); let α3, α4 be weighting coefficients, and construct the multi-objective function J2:

[0102] J2 = α3J1 + α4H(k)

[0103] When H(k) is too large, it means that the mini-batch data has a large interference on the model training, and it is necessary to increase the dependence on the process prior;

[0104] First, through the gradient descent strategy, iteratively update λ1, λ2, λ3 and θ1, θ2′, p, q, d; let η denote the learning rate; after each round of iteration, determine the size of the next round of η according to the decrease amplitude of J2, and maintain the balance between sudden risks and slow risks.

[0105] Preferably, the step S40 includes the following sub-steps:

[0106] S41. Individual coding and temporal feature embedding

[0107] Obtain the kernel function parameters θ0 of the preliminary multi-kernel GPR modeling output and the optional band set B0, and define the individual coding vector of the bitter fish algorithm:

[0108] v m = [W m , θ m

[0109] where m represents the m-th bitter fish individual, W m represents the band combination index vector, and θ m represents the kernel scale, smoothness and multi-kernel weights of the multi-kernel model;

[0110] ​S42. Initial population construction

[0111] Based on the multi - core model parameters θ0 and the band prior B0 output by sub - step S30, construct an initial population of size M:

[0112]

[0113] Among them, W m (Q) Randomly select several band indices from B0 to cover the high - temperature and high - humidity risk sections; θ m (Q) Perform perturbation sampling in the neighborhood of θ0;

[0114] Substitute each individual into the calculation If it exceeds the agreed threshold, it is regarded as not matching the process stage, and the elimination operation is performed;

[0115] In addition, calculate the prediction error of the individual on the small - scale training set. If the error is too large, additional elimination is carried out to ensure that the initial population meets the qualified level in terms of process adaptability and prediction performance;

[0116] S43. Objective function and uncertainty evaluation

[0117] Let N represent the number of training samples, y1 represent the true pollution value at the i - th moment, be the multi - core GPR prediction value under the condition of band W and kernel parameter θ, σ1 2 (W, θ) be the corresponding uncertainty; additionally, let α1 represent the weighting coefficient for the key section, and introduce the kernel matrix K(W, θ) and the noise covariance ∑ to form the total covariance matrix:

[0118] Ω(W, θ)=K(W, θ)+∑

[0119] Combining the error, uncertainty, and temporal compliance, define the objective function:

[0120]

[0121] Among them, β, γ, ρ are trade - off coefficients, ||·|| F represents the F - norm; the last term ρΨ(v) incorporates the temporal compliance into the positive incentive, making individuals with a high degree of matching in the key stage more dominant in fitness;

[0122] Calculate J(W m (0) , θ m (0) ) for all individuals in the initial population, and sort them in ascending order according to the objective function values;

[0123] Select the top T individuals to enter sub-step S44 to enhance the adaptability to high-risk sections and high-noise scenarios;

[0124] Perform eigenvalue decomposition on the kernel matrix Ω(W m ,θ m ) to assist in locating high-uncertainty sections during subsequent local search and global search;

[0125] S44. Individual Migration and Local Search

[0126] In the g-th generation iteration, perform a migration operation based on the behavior of bitter fish aggregation on the T individuals with the best fitness, and define the migration operator Γ(·);

[0127] During migration, if an individual finds that a specified band segment presents high-risk features, then make a small-step adjustment to the band index in combination with the time series information to deepen the search within the key section:

[0128]

[0129] where λ is the local learning rate, and Q(W m ,θ m ,t) is the search probability vector constructed by combining the sterilization stage t with the current band W m , the kernel parameter θ m . The band will be constrained to move, and the kernel function parameters will be updated in a fine-tuning manner;

[0130] Obtain the migrated individuals Continue to introduce a gradient correction mechanism to reduce the search time in the local area. Perform gradient operation on J(W,θ) for the individual encoding , and then update it to

[0131]

[0132] where η is the adaptive step size, which is appropriately reduced in the high-noise interval to avoid overshoot;

[0133] After the local search is completed, re-rank the individual fitness, and select the better-performing ones to enter the global search stage;

[0134] S45. Global Search and Individual Update

[0135] Perform global search on the individuals with poor fitness or those trapped in unstable sections after local search; define a random perturbation matrix R(g), whose size is the same as the encoding, and is used for large-range random jumps in the band and kernel parameter dimensions:

[0136]

[0137] where Δ represents the global search radius;

[0138] For random exploration during high-risk periods or across multiple segments, avoid getting trapped in local optima, and seek a better band-kernel combination among multiple process stages;

[0139] Calculate the objective function J(W, θ) for all individuals generated by local search and global search together;

[0140] After the final combination, select the top M individuals with the best fitness to enter the next generation; eliminate individuals with relatively high fitness;

[0141] S46, Adaptive adjustment of kernel function

[0142] To enable the multi-core GPR to have accurate prediction capabilities during different periods of storage and sterilization, introduce the eigenvalue decomposition of the kernel matrix Ω(W, θ):

[0143] Ω(W, θ) = UΛU T

[0144] where Λ is the diagonal eigenvalue matrix and U is the corresponding eigenvector matrix; let N(g) be the noise intensity matrix observed in the g-th generation, and update θ by defining the kernel parameter correction function φ m as:

[0145] θ′ m (g + 1) = θ m (g) + Φ(Λ, N(g))

[0146] φ scales the kernel scale during high-noise periods and enhances the smoothness during relatively stable phases, enabling the model to adapt to sudden changes in pollution sources in the short term and weak changes during long-term storage, thus maintaining high accuracy and low false alarm rates throughout the tracking;

[0147] S47, Output of optimal band and kernel parameters

[0148] When the iteration reaches the maximum number of generations or the objective function J(W, θ) is lower than the pre-set threshold, extract the individual encoding with the minimum fitness

[0149] v * = [W * , θ *

[0150] where W is the optimal band combination and θ is the corresponding kernel parameter;

[0151] Push this result to the online detection link and replace the initial parameters, enabling the multi-core GPR to focus on monitoring high-risk sections.

[0152] More preferably, in the sub-step S41, to ensure the collaborative optimization of the waveband and the kernel function, a normalization transformation is performed on all dimensions of the vector, so that all coding components satisfy the interval [0, 1], which is compatible with the binarization operation and the continuous kernel parameter tuning;

[0153] In the context of the dairy product sterilization and storage stage, a time sequence interval [τ0, τ1] is set to represent the key stage from sterilization to the end of storage; this time sequence information is embedded in the feasible region of the individual coding, and a time sequence compliance function is defined as:

[0154]

[0155] where λ Q and λ1 represent the constraint weights for waveband selection and kernel parameters in the sterilization and storage stages, and φ are penalty terms or fitness gain terms associated with the time sequence;

[0156] For wavebands or inappropriate kernel parameters that cannot match the current process stage within the time sequence interval, the integral value will deviate from the target range; this function is used to eliminate individuals that do not match the current time period during actual iteration, so as to avoid consuming search resources for irrelevant segments.

[0157] Preferably, the step S50 includes the following sub-steps:

[0158] S51. Online monitoring data acquisition and credibility measurement

[0159] Obtain the sensor data generated during the sterilization and storage of a new batch of dairy products, denoted as X t , which includes temperature, humidity, and spectral readings in the current waveband data;

[0160] Assume that this real-time data corresponds to the moment t in the time series, forming an online data sequence X t ={x1(t), x2(t),..., x a (t)}, where a represents the size of the sensor feature dimension;

[0161] For the optimal waveband W and kernel parameter θ obtained in the sub-step S40, input X t into the multi-kernel Gaussian process regression model that has been trained twice, and predict the pollution risk estimate and the corresponding uncertainty σ 2 (t);

[0162] Construct an online model credibility function D(t), which is defined as:

[0163]

[0164] where x1(t) represents the i-th dimensional input data of the sensor, represents the mean value of the same dimension in the training data of step 4, |W * | represents the length of the optimal band vector W*, represents the predicted variance for the w-th band, and κ is the balance coefficient;

[0165] When the value of D(t) decreases, it indicates that the difference between the new environmental data and the original training distribution is large or the uncertainty increases;

[0166] S52. Distribution drift detection and band-kernel parameter correction trigger

[0167] Define the distribution drift metric function Γ(τ) to calculate the difference between the current data distribution P(y|x, τ) and the previous training distribution P0(y|x) within the time period τ; perform a global evaluation based on the distance metric:

[0168]

[0169] where P(y|x, τ) represents the pollution risk distribution at the current time period τ, and P0(y|x) represents the original distribution in which the model in step S40 is located, is the input space; when Γ(τ) is greater than a pre-set threshold, it is considered that a distribution drift has occurred;

[0170] Calculate D(t) and Γ(τ). If D(t) is less than the lower limit of credibility or Γ(τ) is greater than the drift threshold, it is determined that the prediction reliability of the existing model for the new environmental data has decayed;

[0171] Trigger the bitter fish optimization algorithm to perform targeted correction on W and θ output in the previous step to avoid band failure or kernel weight imbalance;

[0172] S53. Secondary training and rapid deployment

[0173] After triggering the correction, perform differential optimization on the original W and θ based on the bitter fish algorithm to construct the corrected W' and θ'; define the differential terms ΔW and Δθ, and record them in matrix form as:

[0174]

[0175] where ΔW and Δθ are obtained by the bitter fish algorithm in the band subspace and the kernel parameter subspace, M is a diagonal weighted matrix, and is scaled according to the redundancy and temporal priority to control the correction amplitude;

[0176] Through the above differential update, reduce the damage to the previous results during secondary training and find a new combination of bands and kernel parameters in the shortest time.

[0177] Preferably, the step S60 includes the following sub-steps:

[0178] S61, Pollutant Prediction Output and Uncertainty Acquisition

[0179] Obtain the pollutant concentration vector output by the real-time model in step S50

[0180]

[0181] where, c k (t) represents the multi-kernel Gaussian process regression predicted concentration of the k-th pollutant at time t, and u k (t) represents the corresponding upper limit of prediction uncertainty, and p is the number of detectable pollutant types;

[0182] Synchronize c(t) and u(t) to the on-site monitoring system, and associate the production batch with the current process section information to ensure complete detection input during the sterilization or storage stage;

[0183] S62, Threshold Decision Matrix and Alarm Trigger

[0184] Set a safety threshold vector for each pollutant

[0185] T = [T1, T2,..., T p T , G = [G1, G2,..., G p T

[0186] where, T k represents the concentration threshold of the k-th pollutant, and G k represents the corresponding threshold for the upper limit of uncertainty; T and G can be set in combination with regulatory requirements and historical detection experience to map the different sensitivities of dairy products to microbial or chemical residues;

[0187] Compare the predicted concentration c(t) and uncertainty u(t) with T and G element by element respectively to construct an alarm decision matrix M alarm (t), defined as:

[0188]

[0189] where, is the step function, which outputs 1 when x > 0, otherwise outputs 0, represents the operation process of cascading in sequence to form a block diagonal matrix;

[0190] If there is a 1 in the matrix M alarm (t), it means that the pollutant concentration or uncertainty exceeds the corresponding threshold, and subsequent hierarchical alarms need to be triggered;

[0191] S63, Pollutant Hierarchical Alarm and Emergency Decision ​​

[0192] Analysis matrix M alarm For the output values of all block diagonal entries in (t), if only a very small number of pollutants are 1 and other pollutants do not exceed the threshold, a first-level warning is triggered to prompt the production line personnel to perform stricter treatment during the current sterilization process;

[0193] If multiple pollutants exceed the threshold or the uncertainty increases significantly, a second-level warning is triggered and production is suspended, and the sterilization system and raw materials are quickly inspected to prevent the spread of contamination;

[0194] After the second-level warning is completed, the on-site personnel perform disposal steps such as stopping production, replacing raw materials, and increasing the sterilization intensity, and count the suspicious sample numbers or batch information according to the system prompt, and enter the next sub-step laboratory testing process;

[0195] In addition, the warning information is transmitted back to the higher-level supervision to ensure that the subsequent batches can obtain risk warnings when they are initially put into production;

[0196] S64, Manual verification and model feedback update

[0197] Send the suspicious batch or single-point sample to the laboratory for high-precision analysis, and record the final test value as c lab (s) and its standard deviation δ(s), where s represents the sample number;

[0198] Compare the difference between the test result and the predicted value of the multi-kernel Gaussian process regression model for the same batch previously;

[0199] If c lab (s) has a significant difference from the online model prediction, perform the "detection, optimization, deployment" loop described in step S50, add this difference data to the training sample pool, and fine-tune the band and kernel weights according to the changed safety threshold to make the model have higher adaptability to new pollution characteristics or more stringent thresholds.

[0200] The second aspect of the present invention is to provide an artificial intelligence-based dairy product quality and safety detection system for the method described in any one of the above, including the following modules:

[0201] Sensor layout and multi-source data acquisition module: This module divides the production line into several continuous time periods, deploys near-infrared spectroscopy sensors, temperature monitoring modules, and humidity monitoring modules; through indexing and alignment methods, synchronously summarizes the sensor output values, sterilization time, sterilization temperature, and storage period of each time period, realizes the unified collection and recording of process parameters and environmental variables, and constructs a multi-source element data matrix;

[0202] Data Preprocessing and Wavelet Denoising Module: Based on the multi-source feature data matrix, this module performs improved wavelet decomposition on the multi-dimensional observation values for each time period; identifies high-frequency noise caused by high-temperature and high-humidity environments through an adaptive threshold strategy and performs denoising processing; on this basis, adopts a time-window smoothing method to reduce the remaining noise interference in key bands or extreme temperature and humidity segments; finally, normalizes all dimensions to obtain consistent and stable input data;

[0203] Regression Scenario Requirement Configuration and Multi-Type Kernel Function Construction Module: Combining the key attention of dairy production to high-temperature and high-humidity links, this module clarifies the regression target and defines a small-batch scenario to measure the model robustness in different time periods; for sudden risks and slow risks, high-frequency kernel functions and low-frequency kernel functions are established respectively, and a process kernel function is constructed by combining information such as sterilization time, sterilization temperature, and storage period to form a multi-type kernel function library; at the same time, by identifying high-sensitivity intervals, the weight attention of the model in high-temperature or high-humidity stages is improved, so that the kernel function can more accurately express environmental or process changes.

[0204] Multi-Kernel Gaussian Process Regression and Dynamic Optimization Module: On the basis of integrating multi-type kernel functions, this module generates a Gaussian process prior for each small-batch data and corrects it in time when there are observation values to obtain a posterior distribution; by monitoring indicators such as regression accuracy and convergence speed in high-risk sections, adaptively updates the hyperparameters of each kernel function and the prior dependence of the process to ensure high prediction accuracy and stability under sudden environmental changes and slow process influences;

[0205] Band-Kernel Cooperative Optimization Module Driven by the Bitter Fish Algorithm: This module constructs the bitter fish algorithm to perform cooperative search and iteration on the optimal band and kernel parameter combination; after the band and kernel parameters are compiled into individuals, it realizes the refined search of key bands through swarm behavior and combines global jumps to avoid local optima; at the same time, according to the noise distribution and time series compliance, dynamically adjusts the scale and smoothness of the kernel function to ensure that high-risk or high-uncertainty time periods can be identified and monitored in a timely manner, and finally outputs the optimal band and kernel parameters.

[0206] Online Monitoring and Distribution Drift Detection Module: Using the trained multi-kernel Gaussian process regression model, this module performs real-time pollution risk prediction and uncertainty output on a new batch of production data; at the same time, monitors the consistency between the current environmental data and the original training distribution, and if obvious drift or insufficient confidence is found, triggers a differential correction of the band and kernel parameters; this process is completed in the shortest time to provide timely prediction calibration for continuously changing temperature and humidity conditions and maintain the effectiveness and accuracy of online monitoring;

[0207] Pollutant Alarm and Emergency Decision-making Module: This module determines the model prediction values based on the safety thresholds and upper limits of uncertainty for each pollutant; when any index or uncertainty exceeds the threshold, it triggers an alarm in a timely manner; it makes early warning classification decisions of different severity levels, including measures such as strengthening treatment, suspending production and inspecting raw materials or sterilization systems, etc.; in addition, it sends key batches or single-point samples to the laboratory for high-precision detection. If there is a large deviation from the model prediction value, the differential data is fed back into the model training set, and the re-optimization of wavebands and kernel parameters is triggered to continuously improve the adaptability of the model to new pollution characteristics or more stringent thresholds.

[0208] The present invention adopts the above technical solutions, and compared with the prior art, has the following technical effects:

[0209] (1) The solution of the present invention shows advantages in aspects such as data processing architecture, model construction mechanism, and online optimization method. The traditional method uses a combination of fixed-threshold wavelet denoising and static kernel functions, and its limitation is that it is difficult to adapt to the coupled characteristics of dynamic fluctuations in production line temperature and humidity and multi-risk modes. This solution constructs an adaptive threshold function based on environmental parameter feedback, introduces the temporal gradient change amounts of temperature and humidity into the inter-layer energy calculation of wavelet decomposition, and realizes the dynamic adjustment of the high-frequency noise suppression intensity, overcoming the defect that the high-frequency signal is overly attenuated in the traditional fixed-threshold strategy during sudden temperature rise or rapid humidity change. At the same time, by constructing a ternary composite kernel structure embedded with process parameters, an explicit mapping relationship between the process variables of sterilization intensity and sterilization temperature and risk characteristics is established in the kernel function space. Compared with the existing single radial basis kernel or static multi-kernel combination method, it can more accurately characterize the dual risk modes of instantaneous microbial outbreak and chemical residue accumulation.

[0210] (2) In terms of model optimization and deployment, the prior art generally adopts offline global tuning and fixed waveband selection mechanisms, and it is difficult to cope with the input distribution drift caused by raw material batch differences or equipment aging. The solution of the present invention designs an improved fish school BFO evolutionary algorithm with time-series compliance constraints, embeds the process stage characteristics into the feasible domain search space of individual coding, so that the waveband selection and kernel parameter optimization processes preferentially match the core monitoring requirements of the current sterilization or storage stage. Combining with a drift detector and a differential parameter update rule, when it is detected that the statistical characteristics of the input data deviate from the benchmark, only the scale factor and waveband weight of the affected kernel function are locally fine-tuned. Compared with the traditional global re-training method, it significantly reduces the consumption of computing resources while ensuring the generalization ability of the model.

[0211] (3)Regarding the uncertainty control in the online monitoring scenario, existing technologies mostly rely on static threshold determination and manual review mechanisms, and cannot achieve the closed-loop linkage of risk warning and model update. The solution of the present invention constructs a matrix determination system for the predicted value of pollution concentration and uncertainty, conducts multi-dimensional coupling analysis on the safety thresholds of different pollutants and the model confidence interval, and designs a differential model fine-tuning mechanism based on laboratory test feedback. When a statistically significant difference is detected between the predicted value and the laboratory analysis result, directional correction is performed through a restricted domain local search and feature band reweighting strategy. Compared with the traditional full-parameter retraining method, the model prediction accuracy can be quickly restored while retaining historical effective features, forming a more robust dynamic monitoring closed loop. Description of the Drawings

[0212] Figure 1 It is the overall flowchart of the dairy product quality and safety detection method based on artificial intelligence of the present invention;

[0213] Figure 2 It is the schematic diagram of the data detection and response process in the actual business scenario of dairy product production based on the dairy product quality and safety detection method based on artificial intelligence of the present invention when problems occur. Detailed Embodiment

[0214] The core innovation of the technical solution of the present invention lies in constructing a dynamic frequency domain processing framework and a multi-core adaptive modeling mechanism that integrate process priors, effectively solving problems such as incomplete signal denoising and missing risk feature coupling modeling in traditional methods in complex production environments. In the data preprocessing stage, a wavelet threshold function based on dynamic adjustment of environmental parameters is used to replace the traditional fixed threshold strategy. By calculating the temperature and humidity gradient in real time to weight and evaluate the noise energy, combined with the time window heteroscedasticity smoothing algorithm, the filtering intensity of high-frequency signals is reduced and the smoothing strength of local weighted average is enhanced during high-temperature and high-humidity periods, realizing noise suppression and effective signal retention in environmentally sensitive areas. Compared with the existing technology that only relies on statistical variance to set global thresholds, this method introduces process time series information and sensor physical characteristics, making the denoising process have working condition self-adaptability, and solving the problem of key risk feature loss caused by over-filtering in traditional wavelet decomposition during sudden temperature rise or humidity change.

[0215] In the multi-core risk modeling stage, a ternary composite structure of a high-frequency transient core, a low-frequency cumulative core, and a process coupling core is designed, and decoupled expression of different risk modes is achieved through a dynamic weight division mechanism. Among them, the high-frequency core adopts a combination of an exponential squared basis function and local linear constraints to capture the mutation characteristics of microbial contamination; the low-frequency core introduces a periodic decay factor and long-range correlation constraints to depict the slow accumulation process of chemical residues; the process core encodes parameters such as sterilization time and sterilization temperature into the bias term of the kernel matrix through a non-linear mapping function, enhancing the robustness of the model to process parameter perturbations. Compared with existing single kernel functions or static multi-core fusion methods, this solution constructs a weight adjustment function linked to the process stage, automatically increasing the contribution of the high-frequency core and suppressing the response of the low-frequency core during high-sensitivity periods, solving the problem of feature confusion in traditional models in scenarios where sudden risks and chronic risks coexist.

[0216] At the optimization and deployment level, an improved bitter fish evolutionary algorithm and an online drift compensation mechanism are proposed. By jointly encoding the band selection variables and kernel parameters after normalization and designing a time-series compliance function to constrain the search space, it is ensured that the optimization process preferentially matches the key monitoring requirements of the current production process stage. Aiming at the distribution drift problem during the online application of the model, a differential parameter update rule is established. When it is detected that the statistical characteristics of the input data deviate from the training benchmark, only the scale factor and band weight of the affected kernel function are locally fine-tuned, avoiding the waste of computing resources caused by global retraining. Compared with traditional offline optimization and static deployment solutions, this method solves the problem of the decline in the model generalization ability caused by changes in production line working conditions or differences in raw material batches by introducing process time-series constraints and an incremental learning mechanism.

[0217] The present invention will be described in detail and specifically through specific embodiments below to better understand the present invention. However, the following embodiments do not limit the scope of the present invention.

[0218] Embodiment 1

[0219] A dairy product quality and safety detection system based on artificial intelligence is provided, mainly including the following modules:

[0220] (1) Sensor layout and multi-source data acquisition module: This module divides the production line into several continuous time periods, and deploys near-infrared spectroscopy sensors, temperature monitoring modules, and humidity monitoring modules. Through indexing and alignment methods, the sensor output values, sterilization time, sterilization temperature, and storage period of each time period are synchronously summarized, realizing the unified collection and recording of process parameters and environmental variables, and constructing a multi-source element data matrix.

[0221] (2) Data preprocessing and wavelet denoising module: Based on the multi-source factor data matrix, this module performs improved wavelet decomposition on the multi-dimensional observed values for each time period; identifies high-frequency noise caused by high-temperature and high-humidity environments through an adaptive threshold strategy and performs denoising processing; on this basis, uses a time-window smoothing method to reduce the remaining noise interference in key bands or extreme temperature and humidity segments; finally, normalizes all dimensions to obtain consistent and stable input data.

[0222] (3) Regression scenario requirement configuration and multi-type kernel function construction module: Combining the key attention of dairy production to high-temperature and high-humidity links, this module clarifies the regression target and defines a small-batch scenario to measure the model robustness within different time periods. For sudden risks and slow risks, high-frequency kernel functions and low-frequency kernel functions are established respectively. Additionally, a process kernel function is constructed by combining information such as sterilization time, sterilization temperature, and storage period to form a multi-type kernel function library. At the same time, by identifying highly sensitive intervals, the weight attention of the model in high-temperature or high-humidity stages is increased, enabling the kernel function to more accurately express environmental or process changes.

[0223] (4) Multi-kernel Gaussian process regression and dynamic optimization module: Based on the integration of multi-type kernel functions, this module generates a Gaussian process prior for each small-batch data and corrects it in a timely manner when there are observed values to obtain the posterior distribution. By monitoring indicators such as regression accuracy and convergence speed in high-risk sections, the hyperparameters of each kernel function and the prior dependence of the process are adaptively updated to ensure high prediction accuracy and stability under sudden environmental changes and slow process impacts.

[0224] (5) Band-kernel collaborative optimization module driven by the bitter fish algorithm: This module constructs the bitter fish algorithm to perform collaborative search and iteration on the optimal band and kernel parameter combination. After the band and kernel parameters are compiled into individuals, a refined search for key bands is achieved through swarm behavior, and global jumps are combined to avoid local optima. At the same time, according to the noise distribution and temporal compliance, the scale and smoothness of the kernel function are dynamically adjusted to ensure that high-risk or high-uncertainty time periods can be identified and monitored in a timely manner, and finally the optimal band and kernel parameters are output.

[0225] (6) Online monitoring and distribution drift detection module: Using the trained multi-kernel Gaussian process regression model, this module performs real-time pollution risk prediction and uncertainty output on a new batch of production data. At the same time, it monitors the consistency between the current environmental data and the original training distribution. If obvious drift or insufficient confidence is found, a differential correction of the band and kernel parameters is triggered. This process is completed in the shortest time to provide timely prediction calibration for continuously changing temperature and humidity conditions and maintain the effectiveness and accuracy of online monitoring.

[0226] (7) Pollutant Alarm and Emergency Decision-making Module: This module determines the model prediction values based on the safety thresholds and upper limits of uncertainty for each pollutant. When any index or uncertainty exceeds the threshold, an alarm is triggered in a timely manner; decision-making on early warning grading of different severity levels is carried out, including measures such as strengthening treatment, suspending production and inspecting raw materials or sterilization systems. In addition, key batches or single-point samples are sent to the laboratory for high-precision detection. If there is a large deviation from the model prediction values, the difference data is fed back into the model training set, and re-optimization of the waveband and kernel parameters is triggered to continuously improve the adaptability of the model to new pollution characteristics or more stringent thresholds.

[0227] Example 2

[0228] Based on the detection system described in Example 1, as Figure 1 shown, a method for detecting the quality and safety of dairy products based on artificial intelligence is provided, including the following steps:

[0229] S10. Sensor Deployment and Initial Process Mapping: Divide the production line into several continuous time periods, and deploy near-infrared spectroscopy sensors, temperature monitoring modules and humidity monitoring modules at each key node to obtain the sensor output values within each time period; synchronously collect the sterilization time, sterilization temperature and storage period to form process parameters and environmental variables; based on the sensor set and process parameters of each time period, construct a multi-source element matrix, and introduce a process mapping function to generate the spectral and environmental correlation characteristics under the initial production process.

[0230] S20. Data Preprocessing and Wavelet Denoising: For the multi-source element matrix, select each row of data vectors as the multi-dimensional observation values corresponding to the time period, and perform multi-level discrete wavelet decomposition using an improved wavelet function; after obtaining the wavelet decomposition coefficients, identify high-frequency environmental noise based on an adaptive threshold function with dynamic adjustment of temperature and humidity; perform inverse transformation on the threshold-processed coefficient matrix to obtain the denoised sequence, and use a time window smoothing strategy to enhance the smoothing effect during extreme temperature and humidity periods; finally, perform unified normalization on all denoised dimensions to obtain the preprocessed multi-dimensional feature data.

[0231] S30. Regression Scenario Construction and Model Priors: According to the quality requirements of dairy products, form discrete time indexes by combining high-temperature and high-humidity stages, and define the scenario demand function and small-batch data limit with the microbial pollution concentration or chemical risk index as the target; based on a multi-type kernel function library, characterize the non-linear interactions of different temperature and humidity changes and various process parameters; on this basis, introduce a Gaussian process regression prior, perform posterior inference on the current small-batch data, and dynamically adjust the kernel parameters and corresponding hyperparameters if a high-risk section is monitored to meet the requirements of fast convergence and accuracy.

[0232] S40. Multi-core collaborative optimization of the bitter fish algorithm: Construct the individual coding vector of the bitter fish algorithm. Through the construction of the initial population and uncertainty evaluation, a target function is formed by integrating the error, temporal compliance, and weighted coefficient of the key section. First, perform local search and fine-tuning of the migration operator on individuals with higher fitness, and then execute global search when the fitness is low or the algorithm falls into an unstable section. Adaptively adjust the kernel function according to the small batch sample error and noise intensity until the optimal band combination and kernel function parameters are obtained.

[0233] S50. Online monitoring and distribution drift correction: Collect sensor data during the new batch production period. Use the previously trained multi-core Gaussian process regression model to predict the pollution risk and output the credibility. If a significant difference from the original training distribution is detected, trigger the bitter fish algorithm to perform differential optimization on the bands and kernel parameters, and quickly complete the secondary training and deployment without damaging the existing model.

[0234] S60. Pollutant warning and model feedback: Real-time output the predicted concentration and uncertainty of each pollutant. After comparing with the safety threshold matrix, trigger the corresponding warning level. When multiple pollutants or uncertainties exceed the limit, execute production suspension for maintenance and batch traceability, and send suspicious samples to the laboratory for testing. If the test results deviate significantly, add the difference data to the model training set and synchronously update the bands and kernel parameters to continuously adapt to new pollution characteristics or more stringent thresholds.

[0235] S70. Finally, at the end of each production stage or cycle, conduct a global evaluation of this method in terms of accuracy, real-time performance, and system compatibility. Compare with the scheme that only uses single-core Gaussian process regression or single spectral analysis to test the advantages of the multi-core fusion plus bitter fish optimization algorithm in small sample and high-noise scenarios. Combine the abnormal cases and process change records that appear in the evaluation to dynamically revise the individual search strategy of the bitter fish algorithm and the initial hyperparameter allocation of the multi-core GPR.

[0236] Among them, step S10 includes the following sub-steps:

[0237] S11. Sensor layout and production period setting

[0238] Divide the production line into several consecutive periods and denote them as T = {t1, t2,..., t n}, where t i represents the i-th period, and n represents the total number of periods.

[0239] Deploy near-infrared spectroscopy sensors, temperature monitoring modules, and humidity monitoring modules to key nodes of the production line to form a sensor set S = {s1, s2,..., s r}, where s j represents the j-th sensor, and r represents the total number of sensors.

[0240] The sensor output value within each time period t i is denoted as x ij .

[0241] S12, Process Parameter Aggregation and Environmental Variable Identification

[0242] During time period t i , the sterilization time, sterilization temperature, and storage period are synchronously collected, denoted as p, q, d respectively, and are aligned with x ij through a unified time index. The environmental variables of this time period are characterized by temperature T(t1) and humidity H(t1).

[0243] p, q, d and T(t i ), H(t i ) are synchronously integrated into the record of each time period t i to obtain an aggregated description of the time period information and process status.

[0244] S13, Multi-source Element Data Matrix Construction

[0245] Based on the sensor output, process parameters, and environmental variables obtained in sub-step S11 and sub-step S12, construct a multi-source element matrix X:

[0246]

[0247] where x ij represents the value quantized by sensor s i in time period t j .

[0248] T(t1), H(t1), p, q, d are incorporated into X as additional columns to obtain a comprehensive feature matrix.

[0249] The process parameters are represented by the vector P = [p, q, d], and the environmental variables are represented by the vector E(t1) = [T(t1), H(t1)].

[0250] S14, Initial Process Mapping Generation

[0251] Based on the matrix X generated in sub-step S13, introduce the process mapping function φ(·).

[0252] Determine the mapping coefficients by combining the process parameter vector P with the environmental variable E(t1), and construct the mapping matrix M to retain the dynamic influence of process characteristics during the fermentation or processing stage:

[0253] M = X·Ω,

[0254] where, Ω is a diagonal expansion matrix based on process and environmental variables, α1, α2, and α3 are weight coefficients for the sterilization time p, sterilization temperature q, and storage period d, and f(E(t i )) represents a scaling function for environmental variables, which is used to highlight the significant impact of spectral changes during high-temperature and high-humidity periods. The matrix M characterizes the spectral and environmental correlation characteristics under the initial production process.

[0255] Among them, step S2 includes the following sub-steps:

[0256] S21. Data preprocessing and initialization of wavelet decomposition

[0257] Based on the multi-source factor matrix X output in step S10, select each row of data vector X(t i ) = [x i,1 , x i,2 ,..., x i,r as the multi-dimensional observation value corresponding to the time period t i .

[0258] Construct an improved wavelet function ψ(t) to implement the discrete wavelet decomposition of X(t1).

[0259] Let D be the number of wavelet decomposition layers, and let c j,k represent the wavelet coefficient of the j-th dimension at the k-th layer. Define the discrete wavelet transform relationship:

[0260]

[0261] where represents the coefficient matrix obtained by performing multi-layer wavelet decomposition on each dimension x i during the time period t, r represents the number of data dimension quantities, and D represents the number of wavelet decomposition layers. Each c ij reflects the energy distribution of features in different frequency bands. j,k

[0262] S22. Adaptive threshold strategy and identification of high-frequency environmental parameters

[0263] After obtaining the wavelet decomposition coefficients, construct an adaptive threshold strategy for locating the noise regions caused by high-frequency environmental parameters. Regard the temperature T(t i ) and humidity H(t i ) as dynamically adjustable variables. Let σ k represent the mean square error of the k-th layer coefficients over the entire time period, and use γ k to represent the adjustment coefficient based on T(t i ) and H(t i ). Construct an adaptive threshold function T a (k):

[0264]

[0265] Among them represents the energy accumulation at the k-th layer, γ k is determined by the mean fluctuation of T(t i ) and H(t i ), and σ k represents the global standard deviation of the k-th layer.

[0266] S23, Time Window Smoothing and Extreme Data Segment Processing

[0267] Perform an inverse transform on the coefficient matrix after wavelet threshold processing to obtain the denoised observation sequence Y(t i ). On this basis, to address the problem of still relatively large residual noise in key frequency bands or extreme temperature and humidity segments, a time window smoothing method is constructed. Let δ represent the smoothing window radius, and let ω m represent the weighting coefficients for different time periods within the window. Define the smoothed output S(t i ):

[0268]

[0269] where Y(m) represents the denoised observation value at time period m, and ω m is determined by the difference between adjacent time periods and t i in the temperature and humidity dimensions, and Λ is the sum for normalizing the weights within the window. Dynamically adjusting δ and ω m can enhance the smoothing of extreme time periods and reduce the uncertainty brought by random interference during mass production.

[0270] S24, Multidimensional Feature Normalization

[0271] After denoising and smoothing, unify the detection dimensions of each dimension and perform normalization processing on all dimensions of the denoised output S(t1). Denote the normalized matrix as Z;

[0272] Among them, step S30 includes the following sub-steps:

[0273] S31, Determine Scenario Requirements and Regression Targets

[0274] Obtain the actual operation cycle T of the production line, and during the cycle, focus on marking the high-temperature stage and the high-humidity stage to form discrete time indices {t1, t2,... t n}}. Let n represent the number of sampling times. For each t i , obtain the multidimensional feature vector obtained in step S20 Construct the feature matrix

[0275] Let m represent the feature dimensions, including spectral features and temperature and humidity observation values.

[0276] Record the microbial contamination concentration or chemical risk index as y1, corresponding to the time index t1, to form a target vector

[0277] Regard {Z, y} as a modeling data set, which reflects the rapid fluctuation characteristics of microbial or chemical risks under high temperature and high humidity conditions.

[0278] Based on the dairy product quality and safety requirements, define the scenario demand function J1 to measure the stability of the regression accuracy in different time periods. Let w i represent the coefficient of the importance of the production line at time t i and represent the predicted value of the model at time t i . w1>0 is used to highlight the importance of high temperature and high humidity conditions:

[0279]

[0280] Set an upper limit k < n for the small batch data sample size k to limit the use of only a small amount of data for each training.

[0281] Define H(k) to measure the model convergence speed in the small batch scenario. Let A represent the kernel covariance matrix obtained after training with k data, let σ represent the noise level, let B represent the diagonal matrix related to σ, and det(·) represent the determinant operation:

[0282]

[0283] The smaller H(k) is, the easier it is for the model to converge under small batch data.

[0284] S32. Construction of multi-type kernel function library

[0285] To express the instantaneous and drastic changes of microorganisms caused by high temperature, define the kernel function k1(·, ·). Let θ1 represent the scale hyperparameter and d1 represent the distance metric. The high-frequency kernel function is specifically:

[0286]

[0287] To track the risk accumulation caused by the slow changes of temperature and humidity, define the kernel function k2(·, ·). Let θ2 be the hyperparameter and γ be the smoothing factor. The low-frequency kernel function is specifically:

[0288]

[0289] This kernel function still maintains a strong correlation between long-distance sampling points and is used to accurately express the low-frequency changes brought about by the slow drift of temperature and humidity.

[0290] Define the kernel function k3(·, ·). Let p, q, and d represent the weight factors of the sterilization intensity, process temperature, and storage duration label features respectively:

[0291] k3(z i , z j ) = (pz i +qz j +d) 2

[0292] This kernel function reflects the non - linear interaction of various process parameters with microbial and chemical risk characteristics.

[0293] Construct the kernel function library {k1, k2, k3} with k1(·, ·), k2(·, ·), and k3(·, ·).

[0294] S33. Target Weight Division and High - Sensitivity Band Identification

[0295] Let λ1, λ2, and λ3 represent the weighting coefficients for k1, k2, and k3 respectively, and keep λ1 + λ2 + λ3 = 1. Let K represent the fused kernel function:

[0296] K(z i , z j ) = λ1k1(z i , z j )+λ2k2(z i , z j )+λ3k3(z i , z j )

[0297] Let s i represent the value - added ratio of microbial or chemical risk at time t i , and let r i represent the instantaneous change rate of temperature and humidity.

[0298] Locate the high - sensitivity interval through the following threshold judgment method:

[0299] s i >α1 and r i >α2

[0300] where α1 and α2 are preset thresholds, and the high - sensitivity band is vulnerable to severe fluctuations under high - temperature and high - humidity conditions.

[0301] Within the identified high - sensitivity segment, add an additional increment β to λ1 to make the high - frequency kernel function k1 receive more attention:

[0302] λ1←λ1 + β

[0303] Maintain the initial weighting coefficients unchanged in the non - high - sensitivity segment to accurately track the slow risk changes.

[0304] S34. Process Information Embedding and Initial Parameter Configuration

[0305] Obtain the sterilization duration G, the key temperature H, and the process information Q from step S10 to form a process vector c = [G, H, Q]. In the kernel function calculation, combine c i with the feature z i for combined use to fully incorporate process differences into the model.

[0306] Perform an initial mapping on p, q, d in k3(·, ·) and c = [G, H, Q] so that the model has process priors before sufficient data is available. Let f1, f2, f3 be functions based on practical experience:

[0307] p = f1(G), q = f2(H), d = f3(Q)

[0308] Let θ2′ be the new scaling coefficient in the low-frequency kernel function k2, which is determined by θ2′ = θ2·(1 + δ1H + δ2Q) after coupling with the process information c, where δ1 and δ2 represent the sensitivity weights for temperature and other process information.

[0309] Record {θ1, θ2′, p, q, d, λ1, λ2, λ3} as the initial parameter set.

[0310] S35. Prior and Posterior Inference of Gaussian Process Regression

[0311] Define a Gaussian process prior p(f) ∼ GP(0, K) for the fused kernel function K, where f represents the function to be predicted, the mean function is taken as 0, and the covariance function is superimposed according to the fused kernel function.

[0312] Let D k = {(z i , y i )|i = 1,..., k} represent the current mini-batch data set. Modify the prior distribution p(f) through the observed values y i to obtain the posterior distribution p(f|D k ).

[0313] Let K k represent the kernel covariance matrix constructed using D k , let y k represent the target vector corresponding to k samples, and let σ represent the noise level and I represent the identity matrix. Modify the kernel matrix:

[0314] K′ k = K k + σ 2 I

[0315] Let K kSubstitute it into the Gaussian process posterior inference equation to obtain the predictive distribution of the new input z*.

[0316] S36, Parameter adjustment and dynamic optimization

[0317] Based on J1 in sub-step S31, regularly calculate the value of J1 after the current mini-batch training. If J1 is greater than the threshold, the hyperparameters λ1, λ2, λ3 and θ1, θ2' need to be updated to ensure that the model maintains the expected accuracy in the high-risk section.

[0318] While ensuring that J1 continues to decline, monitor the mini-batch convergence rate through H(k). Let α3 and α4 be the weighting coefficients and construct the multi-objective function J2:

[0319] J2 = α3J1 + α4H(k)

[0320] When H(k) is too large, it means that the mini-batch data has a large interference on the model training, and it is necessary to increase the dependence on the process prior.

[0321] First, through the gradient descent strategy, iteratively update λ1, λ2, λ3 and θ1, θ2', p, q, d. Let η represent the learning rate. After each round of iteration, determine the size of η in the next round according to the decrease amplitude of J2, maintaining the balance between sudden risks and slow risks.

[0322] Among them, step S40 includes the following sub-steps:

[0323] S41, Individual coding and temporal feature embedding

[0324] Obtain the kernel function parameters θ0 of the preliminary modeling output of the multi-core GPR and the optional band set B0, and define the individual coding vector of the bitter fish algorithm

[0325] v m = [W M , θ m

[0326] where m represents the m-th bitter fish individual, W m represents the band combination index vector, and θ m represents the kernel scale, smoothness and multi-core weight of the multi-core model.

[0327] To ensure the collaborative optimization of the band and the kernel function, perform a normalization transformation on all dimensions of the vector, so that all coding components satisfy the interval [0, 1], compatible with the binarization operation and the continuous kernel parameter tuning.

[0328] In the context of the dairy product sterilization and storage stage, set the time series interval [τ0, τ1] to represent the critical stage from sterilization to the end of storage. Embed this time series information into the feasible domain of the individual coding and define the time series compliance function:

[0329]

[0330] Where λ0 and λ1 represent the constraint weights for band selection and kernel parameters in the sterilization and storage stages, and φ are penalty terms or fitness gain terms associated with time series.

[0331] For bands or inappropriate kernel parameters that cannot match the current process stage within the time series interval, the integral value will deviate from the target range. This function is used to eliminate individuals that do not match the current time period in actual iterations to avoid wasting search resources on irrelevant segments.

[0332] S42. Initial population construction

[0333] Based on the multi-kernel model parameters θ0 and band prior B0 output in step 3, construct an initial population of size M:

[0334]

[0335] Where W m (0) Randomly select several band indices from B0 to cover the high-temperature and high-humidity risk sections; θ m (0) Perform perturbation sampling in the neighborhood of θ0.

[0336] Substitute each individual into the calculation If it exceeds the agreed threshold, it is considered not to match the process stage, and the elimination operation is performed.

[0337] In addition, calculate the prediction error of the individual on the small-scale training set. If the error is too large, additional elimination is performed to ensure that the initial population meets the qualified level in terms of process adaptability and prediction performance.

[0338] S43. Objective function and uncertainty evaluation

[0339] Let N represent the number of training samples, and y1 represent the true contamination value at the i-th moment. is the multi-kernel GPR prediction value under the conditions of band W and kernel parameter θ, and σ1 2 (W, θ) is the corresponding uncertainty; another set α1 represents the weighting coefficient for the key section, and introduce the kernel matrix K(W, θ) and noise covariance ∑ to form the total covariance matrix

[0340] Ω(W, θ) = K(W, θ) + ∑

[0341] Combining the error, uncertainty, and time series compliance, define the objective function:

[0342]

[0343] where β, γ, and ρ are trade-off coefficients, and ||·|| F represents the Frobenius norm. The last term ρΨ(v) incorporates the temporal compliance into the positive incentive, making the individuals with a high matching degree in the critical stage more dominant in terms of fitness.

[0344] Calculate J(W m (0) , θ m (0) ) for all individuals in the initial population, and sort them in ascending order according to the objective function values.

[0345] Select the top T individuals to enter sub-step S44 to improve the adaptation ability to high-risk sections and high-noise scenarios.

[0346] Perform eigenvalue decomposition on the kernel matrix Ω(W m , θ m ) to assist in locating high-uncertainty sections during subsequent local search and global search.

[0347] S44, Individual Migration and Local Search

[0348] In the g-th generation iteration, perform a migration operation based on the behavior of bitter fish aggregation on the top T individuals in terms of fitness, and define the migration operator Γ(·).

[0349] During migration, if an individual finds that a specified band segment presents high-risk features, make a small-step adjustment to the band index in combination with the temporal information to deepen the search within the critical section:

[0350]

[0351] where λ is the local learning rate, and Q(W m , θ m , t) is a search probability vector constructed by combining the sterilization stage t with the current band W m , the kernel parameter θ m , and perform a constrained movement on the band and update the kernel function parameters in a fine-tuning manner.

[0352] Obtain the individuals after migration Continue to introduce a gradient correction mechanism to reduce the search time in the local area. Perform gradient operation on J(W, θ) for the individual encoding and then update it to

[0353]

[0354] where η is the adaptive step size, which is appropriately reduced in the high-noise interval to avoid overshoot.

[0355] After the local search is completed, sort the individual fitness again, and select the better-performing ones to enter the global search stage.

[0356] S45, Global Search and Individual Update

[0357] Perform global search on individuals with poor fitness or those trapped in unstable sections after local search. Define a random perturbation matrix R(g), whose size is consistent with the encoding, for large-scale random jumps in the band and kernel parameter dimensions:

[0358]

[0359] where Δ represents the global search radius.

[0360] For random exploration during high-risk periods or across multiple segments, avoid being trapped in local optima and seek a better band-kernel combination among multiple process stages.

[0361] Calculate the objective function J(W, θ) for all individuals generated by local search and global search together.

[0362] After the final merger, select the top M individuals with the best fitness to enter the next generation. Eliminate individuals with relatively high fitness.

[0363] S46, Adaptive Adjustment of Kernel Function

[0364] To enable the multi-core GPR to have accurate prediction capabilities at different times of storage and sterilization, introduce the eigenvalue decomposition of the kernel matrix Ω(W, θ):

[0365] Ω(W, θ) = UΛU T

[0366] where Λ is the diagonal eigenvalue matrix and U is the corresponding eigenvector matrix. Let N(g) be the noise intensity matrix observed in the g-th generation. Update θ by defining the kernel parameter correction function Φ m For

[0367] θ′ m (g + 1) = θ m (g) + Φ(Λ, N(g))

[0368] Φ scales the kernel scale during high-noise periods and enhances the smoothness during relatively stable phases, enabling the model to adapt to sudden changes in pollution sources in the short term and weak changes during long-term storage, thereby maintaining high accuracy and low false alarm rates throughout the tracking process.

[0369] S47, Output of Optimal Band and Kernel Parameters

[0370] When the iteration reaches the maximum number of generations or the objective function J(W, θ) is lower than the predefined threshold, extract the encoding of the individual with the minimum fitness

[0371] v * = [W * , θ*

[0372] Where W is the optimal band combination and θ is the corresponding kernel parameter.

[0373] Push the result to the online detection link and replace the initial parameters to enable the multi-core GPR to focus on monitoring high-risk sections.

[0374] Among them, step S50 includes the following sub-steps:

[0375] S51, Online monitoring data collection and credibility measurement

[0376] Obtain the sensor data generated during the sterilization and storage of a new batch of dairy products, denoted as X t , which includes temperature, humidity, and spectral readings in the current band data.

[0377] Assume that the real-time data corresponds to time t in the time series to form an online data sequence X t ={x1(t), x2(t),..., x a (t)}, where a represents the size of the sensor feature dimension.

[0378] For the optimal band W and kernel parameter θ obtained in step S40, input X t into the multi-core Gaussian process regression model after secondary training to predict the pollution risk estimate and the corresponding uncertainty σ 2 (t).

[0379] Construct an online model credibility function D(t), defined as:

[0380]

[0381] Among them, x i (t) represents the i-th dimensional input data of the sensor, represents the mean value of the same dimension in the training data of step S40, |W * | represents the length of the optimal band vector W*, represents the prediction variance for the w-th band, and κ is a balance coefficient.

[0382] When the value of D(t) decreases, it indicates that the new environmental data is quite different from the original training distribution or the uncertainty increases.

[0383] S52, Distribution drift detection and band-kernel parameter correction trigger

[0384] ​Define the distribution drift metric function Γ(τ) to calculate the difference between the current data distribution P(y|x, τ) and the previous training distribution P0(y|x) within the time period τ. Global evaluation is based on a distance metric:

[0385]

[0386] where P(y|x, τ) represents the pollution risk distribution at the current time period τ, and P0(y|x) represents the original distribution of the model in step S40. is the input space. When Γ(τ) is greater than a pre-set threshold, it is considered that a distribution drift has occurred.

[0387] Calculate D(t) and Γ(t). If D(t) is less than the lower confidence limit or Γ(τ) is greater than the drift threshold, it is determined that the prediction reliability of the existing model for new environmental data has decayed.

[0388] Trigger the bitter fish optimization algorithm to perform targeted corrections on W and θ output in the previous step to avoid band failure or kernel weight imbalance.

[0389] S53. Secondary training and rapid deployment

[0390] After triggering the correction, perform differential optimization on the original W and θ based on the bitter fish algorithm to construct the corrected W′ and θ′. Define the differential terms ΔW and Δθ, which are recorded in matrix form as:

[0391]

[0392] where ΔW and Δθ are obtained by the bitter fish algorithm in the wavelet subspace and the kernel parameter subspace, and M is a diagonal weighted matrix, which is scaled according to the redundancy and temporal priority to control the correction amplitude.

[0393] Through the above differential update, the destruction of the previous results during secondary training is reduced, and a new combination of wavebands and kernel parameters is found in the shortest time.

[0394] Among them, step S60 includes the following sub-steps:

[0395] S61. Pollutant prediction output and uncertainty acquisition

[0396] Obtain the pollutant concentration vector output by the real-time model in step 5

[0397]

[0398] where c k (t) represents the predicted concentration of the kth pollutant at time t by the multi-kernel Gaussian process regression, and u k (t) represents the corresponding upper limit of the prediction uncertainty, and p is the number of detectable pollutant types.

[0399] Synchronize c(t) and u(t) to the on-site monitoring system, and associate the production batch with the current process section information to ensure complete detection inputs during both the sterilization and storage stages.

[0400] S62. Threshold Judgment Matrix and Alarm Trigger

[0401] Set a safety threshold vector for each pollutant

[0402] T = [T1, T2,..., T p T , G = [G1, G2,..., G p T

[0403] where T k represents the concentration threshold of the Ψ-th pollutant, and G k represents the corresponding threshold for the upper limit of uncertainty. T and G can be set in combination with regulatory requirements and historical detection experience to map the different sensitivities of dairy products to microorganisms or chemical residues.

[0404] Compare the predicted concentration c(t) and the uncertainty u(t) with T and G element by element respectively to construct an alarm judgment matrix M alarm (t), defined as

[0405]

[0406] where is the step function that outputs 1 when x > 0 and 0 otherwise, represents the operation process of cascading to form a block diagonal matrix in sequence.

[0407] If there is a 1 in the matrix M alarm (t), it indicates that the pollutant concentration or uncertainty exceeds the corresponding threshold, and subsequent hierarchical alarms need to be triggered.

[0408] S63. Pollutant Hierarchical Alarm and Emergency Decision

[0409] Analyze the output values of all block diagonal entries in the matrix M alarm (t). If only a very small number of pollutants are 1 and other pollutants do not exceed the threshold, trigger a first-level warning to prompt the production line personnel to perform stricter processing during the current sterilization link.

[0410] If multiple pollutants exceed the threshold or the uncertainty increases significantly, trigger a second-level alarm and suspend production, and quickly check the sterilization system and raw materials to prevent the spread of pollution.

[0411] ​​After completing the secondary alarm, on-site personnel perform disposal steps such as stopping production, replacing raw materials, and increasing the sterilization intensity, and count the suspicious sample numbers or batch information according to the system prompts, and enter the next sub-step of the laboratory testing process.

[0412] In addition, the alarm information is transmitted back to the superior supervision to ensure that subsequent batches can obtain risk warnings when they are initially put into production.

[0413] S64, Manual Verification and Model Feedback Update

[0414] Send the suspicious batch or single-point sample to the laboratory for high-precision analysis, and record the final test value as c lab (s) and its standard deviation δ(s), where s represents the sample number.

[0415] Compare the difference between the test result and the predicted value of the multi-core Gaussian process regression model for the same batch previously.

[0416] If c lab (s) has a significant difference from the online model prediction, perform the "detection, optimization, deployment" loop described in step S50, add this difference data to the training sample pool, and fine-tune the band and kernel weights according to the changed safety threshold to make the model have higher adaptability to new pollution characteristics or more stringent thresholds.

[0417] Application Example

[0418] In order to verify the feasibility of the present invention in the process of dairy product batch production, the experimenter conducted multiple experiments based on the multi-source element data of the real production line. When problems occurred, the data detection and response process as shown in Figure 2 was adopted. The data used came from the production line operation records of a dairy product enterprise from January 2022 to January 2023, covering five key nodes of pasteurization, ultra-high temperature sterilization, canning, low-temperature storage, and cleaning and maintenance, corresponding to different processing requirements respectively. The data set contains both near-infrared spectra, temperature and humidity observation values, as well as detailed process parameters such as sterilization time, sterilization temperature, and multi-batch storage cycle information. The experimenter performed unified preprocessing on the original data and divided it into a training set and a test set according to a ratio of 8:2 to further verify the actual detection effect of the method while maintaining the generalization ability of the model.

[0419] Under this experimental framework, the five nodes come from different links of the production line respectively: the pasteurization node has the largest historical sampling volume, about 3.5 million period records, involving various process combinations; while the low-temperature storage node has a relatively small sampling volume, about 500,000 observations. Based on the multi-source factor matrix constructed in Steps 1 and 2, as well as the wavelet denoising and adaptive threshold strategies, the experimenter first independently trains the multi-core Gaussian process regression model proposed in the present invention at each node, and gradually optimizes the detection of pollutants in high-temperature and high-humidity periods through process prior and high-sensitivity interval identification. Subsequently, the trained initial models and parameters of each node are uploaded to the central server, and global optimization is carried out by combining restricted domain search and bitter fish algorithm, and the optimization results are sent down again, so that each node completes fine-tuning locally according to the actual waveband and kernel parameters.

[0420] To compare the present invention with the traditional monitoring method based on fixed threshold and single kernel function, the experimenter evaluated indicators such as average pollution risk, false alarm rate and detection time on the test set. Table 1 shows the comparison results:

[0421] Table 1 Experimental data of the automatic monitoring method for dairy product production process

[0422]

[0423] It can be seen from the experimental data in Table 1 above that the method of the present invention significantly reduces the average pollution risk at each node. At the same time, the false alarm rate decreases by about 30% to 40% on average, and the detection time is also shortened. Especially at the pasteurization and ultra-high temperature sterilization nodes, when the environmental temperature and humidity are close to extreme values, the traditional method has problems of increased false alarms and detection delays. However, the method of the present invention can accurately identify pollution risks during sharp fluctuations in temperature and humidity through the collaborative optimization of the adaptive threshold strategy and the multi-core model. Therefore, it can be known that the present invention can achieve more reliable and efficient dairy product safety monitoring at different stages

[0424] The present invention relates to an online pollution risk monitoring technology in the dairy product production process. The core innovation is to realize accurate risk prediction under complex working conditions through a dynamic frequency domain processing framework and a multi-core modeling mechanism coupled with processes. The key technical features include: a wavelet threshold denoising algorithm based on dynamic adjustment of temperature and humidity gradients, a ternary composite kernel structure integrating high-frequency transient kernel / low-frequency cumulative kernel / process-coupled kernel, and an evolutionary optimization method combined with time-series compliance constraints.

[0425] Potential avoidance solutions may be designed as alternatives at two levels: the signal processing architecture and the model structure. In the signal preprocessing stage, a third party may use an independent environmental compensation module to replace the dynamic noise reduction mechanism that links the temperature and humidity gradient with the wavelet threshold in this solution. For example, by constructing a piecewise function of temperature and humidity to pre-divide the noise reduction intensity range. Although such methods can avoid real-time calculation of gradient parameters, they decouple the discretization process from the signal frequency domain characteristics, resulting in an inability to accurately match the noise energy distribution when the temperature and humidity fluctuate rapidly, which may cause misinterception of effective signals in the high-frequency band or insufficient suppression of low-frequency residual noise.

[0426] In contrast, the continuous adjustment mechanism established by the frequency domain energy weighted evaluation in this solution can still maintain the dynamic balance between the noise reduction intensity and the signal characteristics in the event of sudden environmental changes. In terms of kernel function design, the avoidance solution may attempt to use a dual-core combination (such as the weighted superposition of a periodic kernel and a linear kernel) to replace the ternary composite kernel structure, simplifying the model complexity by reducing the number of kernel types. However, such a design is difficult to capture both the transient burst characteristics of microbial contamination and the slow-changing accumulation effect of chemical residues at the same time, and lacks an explicit encoding mechanism for process variables such as sterilization temperature and sterilization duration under process parameter perturbations, resulting in significantly weaker adaptability of the model to production parameter changes than the process-coupled kernel embedding method of this solution.

[0427] At the optimization and deployment level, the alternative solution may use a traditional genetic algorithm to replace the evolutionary strategy, simplifying the parameter search process by removing the time series compliance constraint. However, when selecting bands and optimizing kernel parameters, such methods cannot effectively identify the different requirements of the current process stage (such as sterilization and storage) for the characteristics of sensor data, and are prone to falling into local optimal solutions during cross-stage optimization. The optimization process of this solution can be automatically focused on the key risk characteristics of the current highly sensitive process section through the time series constraint function, thereby improving the stability of the model when the production line working conditions change. In addition, for the differential parameter correction mechanism for online update, the avoidance solution may adopt alternative strategies such as full parameter retraining or fixed threshold trigger update. The former can ensure model consistency, but will cause a computational resource bottleneck in high-frequency update scenarios; the latter is difficult to cope with the non-linear distribution drift caused by raw material batch differences due to the lack of adaptive ability in threshold setting. In comparison, the combined design of this solution based on drift detection and limited domain local fine-tuning achieves a better balance between update efficiency and model robustness.

[0428] After comprehensive evaluation, although the above avoidance solution can achieve function substitution in specific technical links, there are significant shortcomings in core performance indicators such as the decoupling accuracy of multi-risk modes, the adaptability to dynamic environments, and the cross-stage optimization efficiency. Especially in complex scenarios where high-temperature and high-humidity working conditions are superimposed with sudden pollution risks, due to the lack of a deep coupling mechanism between process parameters and frequency-domain characteristics, the monitoring sensitivity and false alarm suppression ability of the alternative solution will be significantly lower than those of the patent solution of the present invention. These technical limitations make the core innovation of the present invention still have an irreplaceable competitive advantage in the field of industrial monitoring.

[0429] The specific embodiments of the present invention have been described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications and substitutions to the present invention are also within the scope of the present invention. Therefore, all equivalent transformations and modifications made without departing from the spirit and scope of the present invention should be covered within the scope of the present invention.

Claims

1. An artificial intelligence-based dairy product quality and safety detection method, characterized in that, It includes the following steps: S10. Sensor layout and initial process mapping: Divide the production line into several consecutive time periods, and deploy near-infrared spectroscopy sensors, temperature monitoring modules, and humidity monitoring modules at each key node to obtain the sensor output values within each time period; Synchronously collect the sterilization time, sterilization temperature, and storage period to form process parameters and environmental variables; Based on the sensor set and process parameters of each time period, construct a multi-source element matrix, and introduce a process mapping function to generate the spectral and environmental correlation characteristics under the initial production process; S20. Data preprocessing and wavelet denoising: For the multi-source element matrix, select each row of data vectors as the multi-dimensional observation values corresponding to the time period, and perform multi-level discrete wavelet decomposition using an improved wavelet function; After obtaining the wavelet decomposition coefficients, identify high-frequency environmental noise based on the adaptive threshold function of temperature and humidity dynamic adjustment; Perform inverse transformation on the coefficient matrix after threshold processing to obtain the denoised sequence, and use the time window smoothing strategy to enhance the smoothing effect during extreme temperature and humidity time periods; Finally, perform unified normalization on all denoised dimensions to obtain the preprocessed multi-dimensional feature data; S30. Regression scenario construction and model prior: According to the quality requirements of dairy products, combine the high-temperature and high-humidity stages to form a discrete time index, and define the scenario demand function and small-batch data limit with the microbial contamination concentration or chemical risk index as the target; Based on the multi-type kernel function library, characterize the non-linear interaction of different temperature and humidity changes and various process parameters; On this basis, introduce the Gaussian process regression prior, perform posterior inference on the current small-batch data, and dynamically adjust the kernel parameters and corresponding hyperparameters if high-risk sections are monitored to meet the requirements of fast convergence and accuracy; S40. Multi-core collaborative optimization of the bitter fish algorithm: Construct the individual coding vector of the bitter fish algorithm, and form the objective function by combining the initial population construction and uncertainty evaluation, comprehensive error, time series compliance, and key section weighting coefficient; First perform local search and migration operator fine-tuning on individuals with higher fitness, and then perform global search when the fitness is low or in an unstable section; Adaptively adjust the kernel function according to the small-batch sample error and noise intensity until the optimal band combination and kernel function parameters are obtained; S50. Online monitoring and distribution drift correction: Collect sensor data during the new batch production period, use the previously trained multi-core Gaussian process regression model to predict the pollution risk and output the credibility; If a large difference from the original training distribution is detected, trigger the bitter fish algorithm to perform differential optimization on the band and kernel parameters, and quickly complete secondary training and deployment without destroying the existing model; S60. Pollutant warning and model feedback: Real-time output the predicted concentration and uncertainty of each pollutant, trigger the corresponding warning level after comparing with the safety threshold matrix; When multiple pollutants or uncertainties exceed the limit, perform production suspension maintenance and batch traceability, and send suspicious samples to the laboratory for testing; If the test result deviation is large, add the difference data to the model training set and synchronously update the band and kernel parameters to achieve continuous adaptation to new pollution characteristics or more stringent thresholds; S70. Finally, at the end of each production stage or cycle, conduct a global evaluation of this method in terms of accuracy, real-time performance, system compatibility, etc.; compare with the solutions that only use single-core Gaussian process regression or single-spectral analysis to test the advantages of the multi-core fusion plus bitter fish optimization algorithm in small-sample and high-noise scenarios; combine the abnormal cases and process change records that appear in the evaluation to dynamically revise the individual search strategy of the bitter fish algorithm and the initial hyperparameter allocation of multi-core GPR.

2. The detection method according to claim 1, characterized in that The step S10 includes the following sub-steps: S11. Sensor layout and production period setting Divide the production line into several consecutive time periods and denote them as T = {t1, t2,..., t n}, where t i represents the i-th time period and n represents the total number of time periods; Deploy near-infrared spectroscopy sensors, temperature monitoring modules, and humidity monitoring modules to key nodes of the production line to form a sensor set S = {s1, s2,..., s r}, where s j represents the j-th sensor, and r represents the total number of sensors; For each time period t i the sensor output value within is denoted as x ij ; S12. Process parameter collection and environmental variable identification During time period t i Synchronously collect the sterilization time, sterilization temperature, and storage period within it, denoted as p, q, d respectively, and align them with x through a unified time index ij ; Use the temperature T(t i ) and humidity H(t i ) to characterize the environmental variables of this time period; Synchronously integrate p, q, d with T(t i ), H(t i ) into the record of each period t i to obtain an aggregated description of the period information and the process state; S13. Construction of multi-source element data matrix Based on the sensor outputs, process parameters, and environmental variables obtained in sub-step S11 and sub-step S12, construct a multi-source element matrix X: where x ij represents the value i quantified by sensor s j in time period t; Incorporate T(t i ), H(ti), p, q, and d into X as additional columns to obtain a comprehensive feature matrix; Use the vector P = [p, q, d] to represent the process parameters, and use the vector E(t1) = [T(t1), H(t1)] to represent the environmental variables; S14. Generation of initial process mapping Based on the matrix X generated in sub-step S13, introduce the process mapping function Φ(·); Determine the mapping coefficient by combining the process parameter vector P with the environmental variable E(t1), and construct the mapping matrix M to retain the dynamic influence of process characteristics during the fermentation or processing stage: where, Ω is a diagonal expansion matrix based on process and environmental variables, α1, α2, and α3 are weight coefficients for the sterilization time p, sterilization temperature q, and storage period d, and f(E(t i )) represents a scaling function for environmental variables, which is used to highlight the significant influence of spectral changes during high-temperature and high-humidity periods; The matrix M characterizes the spectral and environmental correlation characteristics under the initial production process.

3. The detection method according to claim 1, wherein The step S20 specifically includes the following sub-steps: S21. Data preprocessing and initialization of wavelet decomposition Based on the multi-source feature matrix X output in step S10, select each row data vector X(t i ) = [x i,1 , x i,2 ,..., x i,r as the multi-dimensional observation value corresponding to time period t i ; Construct an improved wavelet function ψ(t) to achieve the discrete wavelet decomposition of X(t i ) Let D be the number of wavelet decomposition levels, and let c j,k represent the wavelet coefficients of the j-th dimension at the k-th layer. Define the discrete wavelet transform relationship: which represents in time period t i for each dimension x ij is the coefficient matrix obtained after multi-level wavelet decomposition, r represents the number of data dimensions, and D represents the number of wavelet decomposition levels; each c j,k reflects the energy distribution of features in different frequency bands; S22. Adaptive threshold strategy and high-frequency environmental parameter identification After obtaining the wavelet decomposition coefficients, an adaptive threshold strategy is constructed to locate the noise regions caused by high-frequency environmental parameters; considering the temperature T(t i ) and humidity H(t1) as dynamically adjustable variables, let σ k represent the mean square error of the k-th layer coefficients over the entire time period, and use γ k to represent the adjustment coefficient based on T(t i ) and H(t i ), and construct the adaptive threshold function T a (k): Among them represents the energy accumulation at the k-th layer, γ k is determined by the mean fluctuation of T(t i ) and H(t i ), and σ k represents the global standard deviation of the k-th layer; S23. Time window smoothing and extreme data segment processing Inverse transform the coefficient matrix after wavelet threshold processing to obtain the denoised observation sequence Y(t i ); On this basis, in view of the problem that the residual noise is still relatively large in the key frequency bands or extreme temperature and humidity sections, construct a time window smoothing method; Let δ denote the smoothing window radius, and let ω m denote the weighting coefficients for different time periods within the window, and define the smoothed output S(t i ): where Y(m) represents the denoised observation value in time period m, ω m is determined by the differences in adjacent time periods and t i in the temperature and humidity dimensions, and Λ is the sum for normalizing the weights within the window. Dynamically adjusting δ and ω m can enhance the smoothing for extreme time periods and reduce the uncertainties caused by random interference during mass production; S24. Multidimensional feature normalization After denoising and smoothing are completed, unify the detection dimensions of each dimension, and perform normalization processing on all dimensions of the denoised output S(t i ). Denote the normalized matrix as Z.

4. The detection method according to claim 1, wherein The step S30 includes the following sub-steps: S31. Determination of scenario requirements and regression targets Obtain the actual operation cycle T of the production line, and mark the high-temperature stage and the high-humidity stage during the cycle as key points to form discrete time indices {t1, t2,..., t n}; Let n represent the number of sampling moments. For each t i , obtain the multi-dimensional feature vector obtained in S20 Construct a feature matrix Let m represent the feature dimension, including spectral features and temperature and humidity observation values; Let the microbial contamination concentration or chemical risk index be denoted as y i , corresponding to the time index t i , to form a target vector Regard {Z, y} as the modeling data set, reflecting the rapid fluctuation characteristics of microbial or chemical risks under high-temperature and high-humidity conditions; Based on the dairy product quality and safety requirements, define the scenario requirement function J1 to measure the stability of the regression accuracy at different time periods; Let w i represent the coefficient of the importance of the production line at time t i , and let i represent the predicted value of the model at time t. w i > 0 is used to highlight the importance of high temperature and high humidity conditions: Set an upper limit k < n for the small batch data sample size k to limit the use of only a small amount of data for each training; Define H(k) to measure the model convergence speed in the small batch scenario; let A represent the kernel covariance matrix obtained after training with k data, let σ represent the noise level, B represent the diagonal matrix related to σ, and det(·) represent the determinant operation: The smaller H(k) is, the easier it is for the model to converge under small batch data; S32. Construction of multi-type kernel function library To express the instantaneous and drastic changes of microorganisms caused by high temperature, define the kernel function k1(·, ·); let θ1 represent the scale hyperparameter, let d1 represent the distance metric method, and the high-frequency kernel function is specifically: To track the risk accumulation caused by the slow changes in temperature and humidity, define the kernel function k2(·, ·); let θ2 be the hyperparameter and γ be the smoothing factor, and the low-frequency kernel function is specifically: This kernel function still maintains a strong correlation between long-distance sampling points and is used to accurately express the low-frequency changes brought about by the slow drift of temperature and humidity; Define the kernel function k3(·, ·); let p, q, and d represent the weight factors of the sterilization intensity, process temperature, and storage duration label characteristics respectively: k3(z i , z j ) = (pz i + qz j + d) 2 This kernel function reflects the non - linear interaction between various process parameters and microbial and chemical risk characteristics; Construct the kernel function library {k1, k2, k3} by combining k1(·, ·), k2(·, ·), and k3(·, ·); S33. Target weight division and highly sensitive band identification Let λ1, λ2, and λ3 represent the weighting coefficients for k1, k2, and k3 respectively, and keep λ1 + λ2 + λ3 = 1; Let K represent the fused kernel function: K(z i ,z j ) = λ1k1(z i ,z j ) + λ2k2(z i ,z j ) + λ3k3(z i ,z j ) Let s i represent the value-added ratio of the microbial or chemical risk at time t i Let r i represent the instantaneous change rate of temperature and humidity; Locate the highly sensitive interval through the following threshold judgment method: s i > α1 and r i > α2 Where α1 and α2 are preset thresholds, and highly sensitive bands are easily affected by drastic fluctuations under high - temperature and high - humidity conditions; Within the identified highly sensitive segment, add an additional increment β to λ1 to give the high - frequency kernel function k1 more attention: λ1←λ1 + β Maintain the initial weighting coefficients unchanged in non - highly sensitive segments to accurately track slow risk changes; S34. Process information embedding and initial parameter configuration Obtain the sterilization duration G, the critical temperature H, and the process information Q from the sub-step S10 to form a process vector c = [G, H, Q]; in the kernel function calculation, combine c i with the feature z i for combined use to fully incorporate process differences into the model; Perform an initial mapping on p, q, d, and c = [G, H, Q] in k3(·, ·) so that the model has process priors before sufficient data; Let f1, f2, and f3 be functions based on practical experience: p = f1(G), q = f2(H), d = f3(Q) Let θ2′ be the new scaling coefficient in the low - frequency kernel function k2, which is determined by θ2′ = θ2·(1 + δ1H+δ2Q) after coupling with the process information c, where δ1 and δ2 represent the sensitivity weights to temperature and other process information; Record {θ1, θ′2, p, q, d, λ1, λ2, λ3} as the initial parameter set; S35. Prior and posterior inferences of Gaussian process regression Define the Gaussian process prior p(f)~GP(0, K) for the fused kernel function K, let f represent the function to be predicted, let the mean function be taken as 0, and the covariance function is superimposed according to the fused kernel function; Let D k ={(z i , y i ) | i = 1, ..., k} denote the current mini - batch dataset, and the prior distribution p(f) is corrected through the observed values y i to obtain the posterior distribution p(f|D k ); Let K k denote the kernel covariance matrix constructed using D k Let y k denote the target vector corresponding to k samples, let σ denote the noise level, and I denote the identity matrix; correct the kernel matrix: K′ k = K k + σ 2 I Substitute K k ′ into the Gaussian process posterior inference equation to obtain the predictive distribution of the new input z*; S36. Parameter adjustment and dynamic optimization Based on J1 in sub - step S31, regularly calculate the value of J1 after the current mini - batch training; If J1 is greater than the threshold, then the hyperparameters λ1, λ2, λ3, θ1, and θ2′ need to be updated to ensure that the model maintains the expected accuracy in high - risk sections; While ensuring that J1 continues to decline, monitor the mini - batch convergence speed through H(k); Let α3 and a4 be weighting coefficients, and construct the multi - objective function J2: J2 = α3J1+α4H(k) When H(k) is too large, it means that the mini - batch data has a large interference on model training, and the dependence on process priors needs to be increased. First, through the gradient - descent strategy, iteratively update λ1, λ2, λ3, θ1, θ2′, p, q, and d, let η represent the learning rate; After each round of iteration, determine the size of η in the next round according to the decline amplitude of J2, maintaining the balance between sudden risks and slow risks.

5. The detection method according to claim 1, characterized in that The step S40 includes the following sub - steps: S41. Individual coding and temporal feature embedding Obtain the kernel function parameters θ0 of the preliminary multi - kernel GPR modeling output and the optional band set B0, and define the individual coding vector of the bitter fish algorithm: v m = [W m , θ m ​ where m represents the m-th bitter fish individual, W m represents the band combination index vector, θ m represents the kernel scale, smoothness and multi-kernel weights of the multi-kernel model; S42. Initial population construction Based on the multi - kernel model parameters θ0 and band prior B0 output by sub - step S30, construct an initial population of size M: Among which W m (0) Randomly extract several band indexes from B0 to cover the high-temperature and high-humidity risk sections; θ m (0) Perform perturbation sampling in the neighborhood of θ0; Substitute each individual for calculation If it exceeds the agreed threshold, it is regarded as not matching the process stage, and the rejection operation is performed; In addition, calculate the prediction error of the individual on the small-scale training set. If the error is too large, the individual will be additionally eliminated to ensure that the initial population meets the qualified level in terms of process adaptability and prediction performance; S43. Objective Function and Uncertainty Evaluation Let \(N\) denote the number of training samples, and \(y_{i}\) denote the true contamination value at the \(i\)-th moment. is the predicted value of the multi-kernel GPR under the waveband \(W\) and kernel parameter \(\theta\), and \(\sigma_{i}\) 2 (W, θ) is the corresponding uncertainty; additionally, let \(\alpha_{i}\) denote the weighting coefficient for the key section, and introduce the kernel matrix \(K(W, \theta)\) and noise covariance \(\sum\) to form the total covariance matrix: Ω(W, θ) = K(W, θ) + ∑ Define the objective function by integrating the comprehensive error, uncertainty, and temporal compliance: where β, γ, ρ are trade-off coefficients, and ||·|| F denotes the Frobenius norm; the last term ρΨ(v) incorporates the temporal compliance into the positive incentive, making the individuals with a high matching degree in the critical stage more dominant in fitness; Calculate J(W m (0) , θ m (0) ) for all individuals in the initial population, and sort them in ascending order according to the objective function values; Select the top T individuals to enter sub-step S44 to enhance the adaptability to high-risk sections and high-noise scenarios; Perform eigen decomposition on the kernel matrix Ω(W m , θ m ) to assist in the localization of highly uncertain sections during subsequent local search and global search; S44. Individual Migration and Local Search In the g-th generation iteration, perform a migration operation based on the behavior of bitter fish aggregation on the top T individuals with the highest fitness, and define the migration operator Γ(·); During migration, if an individual discovers that a specified band segment presents high-risk characteristics, make a small-step adjustment to the band index in combination with the temporal information to deepen the search within the key section: where λ is the local learning rate, and Q(W m , θ m , t) is the search probability vector constructed by combining the sterilization stage t with the current band W m , the kernel parameter θ m . It will perform a constrained movement on the band and update the kernel function parameter in a fine-tuning manner; Obtain the migrated individuals Continue to introduce a gradient correction mechanism to reduce the search time in local areas. Encode J(W, θ) for individual encoding Perform gradient operations and then update to where η is the adaptive step size, which is appropriately reduced in the high-noise interval to avoid overshoot; After the local search is completed, re-rank the individual fitness and select the individuals with better performance to enter the global search stage; S45. Global Search and Individual Update Perform global search on the individuals with poor fitness or those trapped in unstable sections after local search; define a random perturbation matrix R(g), whose size is consistent with the encoding, for large-range random jumps in the dimensions of the band and kernel parameters: where Δ represents the global search radius; Perform random exploration on high-risk time periods or across multiple segments to avoid being trapped in local optima and seek a better band-kernel combination among multiple process stages; Calculate the objective function J(W, θ) for all individuals generated by local search and global search; After the final merger, select the top M individuals with the best fitness to enter the next generation; eliminate the individuals with too high fitness; S46. Adaptive Adjustment of Kernel Function To enable the multi-kernel GPR to have accurate prediction capabilities at different time periods of storage and sterilization, introduce the eigenvalue decomposition of the kernel matrix Ω(W, θ): Ω(W, θ) = UΛU T where Λ is the diagonal eigenvalue matrix and U is the corresponding eigenvector matrix; Let \(N(g)\) be the noise intensity matrix observed in the \(g\)-th generation. By defining the kernel parameter correction function \(\varphi\), update \(\theta\). m It is as follows: θ′ m (g + 1)=θ m (g)+φ(Λ, N(g)) φ scales the kernel scale during high-noise time periods and enhances the smoothness during relatively stable stages, enabling the model to adapt to sudden changes in pollution sources in the short term and weak changes during long-term storage, thereby maintaining high accuracy and low false alarm rates for full-process tracking; S47. Output of Optimal Band and Kernel Parameters When the iteration reaches the maximum number of generations or the objective function J(W, θ) is lower than the pre-set threshold, extract the encoding of the individual with the minimum fitness v * = [W * , θ * ​ where W is the optimal band combination and θ is the corresponding kernel parameter; Push this result to the online detection link and replace the initial parameters to enable the multi-kernel GPR to focus on monitoring high-risk sections.

6. The dairy fermentation regulation method according to claim 1, wherein In the sub-step S41, to ensure the collaborative optimization of the band and kernel function, perform a normalization transformation on all dimensions of the vector, making all encoding components satisfy the interval [0, 1], compatible with binary operation and continuous kernel parameter tuning; In the context of the dairy product sterilization and storage stages, set the time sequence interval [τ0, τ1] to represent the key stage from sterilization to the end of storage; embed this time sequence information into the feasible domain of the individual encoding and define the time sequence compliance function: where λ0 and λ1 represent the constraint weights for band selection and kernel parameters during the sterilization and storage phases, and φ is a penalty term or fitness gain term associated with the time series; For bands that cannot match the current process stage or inappropriate kernel parameters within the time series interval, the integral value will deviate from the target range; this function is used to eliminate individuals that do not match the current period in actual iterations to avoid wasting search resources on irrelevant segments.

7. The detection method according to claim 1, wherein The step S50 includes the following sub-steps: S51, Online monitoring data collection and credibility measurement Obtain the sensor data generated during the sterilization and storage of a new batch of dairy products, denoted as X t , which includes temperature, humidity, and spectral readings in the current band data; Let the real-time data correspond to the moment t in the time series, forming an online data sequence X t ={x1(t), x2(t),..., x a (t)}, where a represents the size of the sensor feature dimension; For the optimal band W and kernel parameter θ obtained in sub-step S40, input X t into the multi-kernel Gaussian process regression model that has been trained twice, and predict the pollution risk estimate and the corresponding uncertainty σ 2 (t); Construct an online model credibility function D(t), defined as: where x i (t) represents the input data of the i-th dimension of the sensor, represents the mean value of the same dimension in the training data of step 4, |W * | represents the length of the optimal band vector W * , represents the prediction variance for the w-th band, and κ is the balance coefficient; When the value of D(t) decreases, it indicates that the new environmental data has a large difference from the original training distribution or the uncertainty increases; S52, Distribution drift detection and band-kernel parameter correction trigger Define a distribution drift measurement function Γ(τ) to calculate the difference between the current data distribution P(y|x, τ) and the previous training distribution P0(y|x) within the time period τ; perform a global evaluation based on the distance metric: Among them, P(y|x, τ) represents the pollution risk distribution at the current time period τ, and P0(y|x) represents the original distribution of the model in step S40. is the input space; when Γ(τ) is greater than a preset threshold, it is considered that a distribution drift has occurred. Calculate D(t) and Γ(τ). If D(t) is less than the credibility lower limit or Γ(τ) is greater than the drift threshold, it is determined that the prediction reliability of the existing model for the new environmental data decays; Trigger the bitter fish optimization algorithm to perform targeted corrections on W and θ output in the previous step to avoid band failure or kernel weight imbalance; S53, Secondary training and rapid deployment After triggering the correction, perform differential optimization on the original W and θ based on the bitter fish algorithm to construct the corrected W′ and θ′; define the differential terms ΔW and Δθ, which are recorded in matrix form as: Among them, ΔW and Δθ are obtained by the bitter fish algorithm in the band subspace and the kernel parameter subspace. M is a diagonal weighted matrix, which is scaled according to the redundancy and time series priority to control the correction amplitude; Through the above differential update, the damage to the previous results during secondary training is reduced, and a new combination of bands and kernel parameters can be found in the shortest time.

8. The detection method according to claim 1, wherein The step S60 includes the following sub-steps: S61, Pollutant prediction output and uncertainty collection Obtain the pollutant concentration vector output by the real-time model in step S50 Among them, c k (t) represents the multi-core Gaussian process regression predicted concentration of the k-th pollutant at time t, and u k (t) represents the corresponding upper limit of prediction uncertainty, and p is the number of detectable pollutant species; Synchronize c(t) and u(t) to the on-site monitoring system, and associate the production batch and the current process section information to ensure that complete detection inputs are available during the sterilization or storage stage; S62, Threshold decision matrix and alarm trigger Set a safety threshold vector for each pollutant T = [T1, T2, ..., T p T , G = [G1, G2, ..., G p T ​​ Among them, T k represents the concentration threshold of the k-th pollutant, and G k represents the corresponding threshold for the upper limit of uncertainty; T and G can be set in combination with regulatory requirements and historical detection experience to map the different sensitivities of dairy products to microbial or chemical residues; Compare the predicted concentration c(t) and the uncertainty u(t) with T and G element by element respectively to construct an alarm decision matrix M alarm (t), which is defined as: Among them, is the step function, which outputs 1 when x > 0 and 0 otherwise. represents the operation process of cascading in sequence to form a block diagonal matrix; If matrix M alarm has a 1 in (t), it indicates that the pollutant concentration or uncertainty exceeds the corresponding threshold, and subsequent hierarchical alarms need to be triggered; S63, Pollutant classification alarm and emergency decision-making Analysis matrix M alarm For the output values of all block diagonal entries in (t), if only a very small number of pollutants are 1 and other pollutants do not exceed the threshold, a first-level warning is triggered to prompt the production line personnel to perform enhanced processing in the current sterilization process; If multiple pollutants exceed the threshold or the uncertainty increases significantly, trigger a secondary alarm and suspend production, quickly check the sterilization system and raw materials to prevent the spread of pollution; After completing the secondary alarm, on-site personnel perform disposal procedures such as stopping production, replacing raw materials, and increasing the sterilization intensity, and count the suspicious sample numbers or batch information according to the system prompt, and enter the next sub-step of the laboratory detection process; In addition, the alarm information is transmitted back to the superior supervision to ensure that subsequent batches can obtain risk warnings when they are initially put into production; S64, Manual verification and model feedback update Send the suspicious batch or single-point sample to the laboratory for high-precision analysis, and record the final test value as c lab (s) and its standard deviation δ(s), where s represents the sample number; Compare the detection results with the predicted values of the multi-kernel Gaussian process regression model for the same batch previously; If c lab (s) is significantly different from the online model prediction, then execute the "detection, optimization, deployment" loop described in step S50, add this difference data to the training sample pool, and fine-tune the band and kernel weights according to the changed safety threshold to make the model have higher adaptability to new pollution features or more stringent thresholds.

9. An artificial intelligence-based dairy product quality and safety detection system for the method according to any one of claims 1 to 8, characterized in that, Include the following modules: Sensor Deployment and Multi-source Data Acquisition Module: This module divides the production line into several continuous time periods, and deploys near-infrared spectroscopy sensors, temperature monitoring modules, and humidity monitoring modules; through indexing and alignment methods, the sensor output values, sterilization time, sterilization temperature, and storage period of each time period are synchronously summarized to achieve the unified collection and recording of process parameters and environmental variables, and construct a multi-source element data matrix; Data Preprocessing and Wavelet Denoising Module: Based on the multi-source element data matrix, this module performs improved wavelet decomposition on the multi-dimensional observation values of each time period; identifies high-frequency noise caused by high-temperature and high-humidity environments through an adaptive threshold strategy and performs denoising processing; on this basis, uses a time-window smoothing method to reduce the remaining noise interference in key bands or extreme temperature and humidity segments; finally, normalizes all dimensions to obtain consistent and stable input data; Regression Scenario Requirement Configuration and Multi-type Kernel Function Construction Module: This module combines the key attention of dairy product production to high-temperature and high-humidity links, clarifies the regression target and defines a small-batch scenario to measure the model robustness in different time periods; for sudden risks and slow risks, high-frequency kernel functions and low-frequency kernel functions are established respectively, and a process kernel function is constructed in combination with information such as sterilization time, sterilization temperature, and storage period to form a multi-type kernel function library; at the same time, by identifying high-sensitivity intervals, the weight attention of the model in high-temperature or high-humidity stages is improved, so that the kernel function can more accurately express environmental or process changes. Multi-core Gaussian Process Regression and Dynamic Optimization Module: On the basis of integrating multi-type kernel functions, this module generates a Gaussian process prior for each small-batch data and corrects it in time when there are observed values to obtain a posterior distribution; by monitoring indicators such as regression accuracy and convergence speed in high-risk sections, adaptively updates the hyperparameters of each kernel function and the prior dependence of the process to ensure high prediction accuracy and stability under sudden environmental changes and slow process impacts; Band-kernel Cooperative Optimization Module Driven by the Bitter Fish Algorithm: This module constructs the bitter fish algorithm to perform cooperative search and iteration on the optimal band and kernel parameter combination; after the band and kernel parameters are compiled into individuals, a refined search for key bands is realized through swarm behavior, and global jumps are combined to avoid local optima; at the same time, according to the noise distribution and temporal compliance, the scale and smoothness of the kernel function are dynamically adjusted to ensure that high-risk or high-uncertainty time periods can be identified and monitored in a timely manner, and finally the optimal band and kernel parameters are output. Online Monitoring and Distribution Drift Detection Module: This module uses the trained multi-core Gaussian process regression model to perform real-time pollution risk prediction and uncertainty output on a new batch of production data; at the same time, monitors the consistency between the current environmental data and the original training distribution, and if obvious drift or insufficient confidence is found, triggers a differential correction of the band and kernel parameters; this process is completed in the shortest time to provide timely prediction calibration for continuously changing temperature and humidity conditions and maintain the effectiveness and accuracy of online monitoring; Pollutant Alarm and Emergency Decision-making Module: This module determines the model prediction values based on the safety thresholds and upper limits of uncertainty of each pollutant; when any index or uncertainty exceeds the threshold, an alarm is triggered in a timely manner; For early warning classification decisions of different severities, including measures such as tightening treatment, suspending production and inspecting raw materials or sterilization systems, etc.; in addition, key batches or single-point samples are sent to the laboratory for high-precision detection. If there is a large deviation from the model prediction values, the difference data is fed back into the model training set, and re-optimization of the wavelength band and kernel parameters is triggered to continuously improve the adaptability of the model to new pollution characteristics or more stringent thresholds.

Citation Information

Cited By

  • Quality control system and method for Piteguo sparkling water production line

    CN120831941A

  • A quality control system and method for a birch water production line

    CN120831941B

  • Can production line network intelligent measurement and control system based on cloud platform

    CN121386555A

  • Intelligent factory data monitoring method and system based on distributed collaborative sampling

    CN121477803A

  • Material forming and pressing control system based on multi-parameter feedback

    CN121657627A