Edge Node-Based Agricultural Product Processing Quality Traceability Monitoring Method and System
By building a unified data model and space-time alignment at edge nodes, combining hierarchical analysis method and machine learning algorithms, the fusion and decision-making problems of multi-source heterogeneous data in the agricultural product processing quality traceability monitoring system are solved, efficient quality evaluation and traceability, and the traceability and safety of agricultural product quality are achieved.
Patent Information
- Application Number
- CN202411658600.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-11-20
AI Technical Summary
In the agricultural product processing quality traceability monitoring system based on edge nodes, how to achieve efficient, real-time fusion and decision-making of multi-source heterogeneous data under limited computing resources, especially how to process and analyze heterogeneous data such as images, temperature, humidity, etc. to fully reflect the quality status of agricultural products, and perform data mining and pattern recognition in resource-constrained environments.
By building a unified data model for time synchronization and space-time alignment, quality evaluation is performed using hierarchical analysis method and fuzzy comprehensive evaluation method, data mining and pattern recognition is performed in combination with machine learning algorithms, quality defects are automatically judged using the rule engine, and the model is optimized through incremental learning and recorded on the blockchain for traceability.
It realizes intelligent quality monitoring and evaluation of the agricultural product processing process, improves the accuracy and traceability of the evaluation, ensures the quality and safety of agricultural products, and ensures the security and privacy of data through blockchain.
Smart Images

Figure CN119476730B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a method and system for tracing and monitoring the processing quality of agricultural products based on edge nodes. Background Art
[0002] In the traceability and monitoring system for the processing quality of agricultural products based on edge nodes, there are technical difficulties in multi-source heterogeneous data fusion and decision-making. The system needs to process and analyze data from various sensors, such as images, temperature, humidity, gas concentration, etc. These data differ in format, sampling frequency, data volume, etc. How to achieve efficient and real-time data fusion and decision-making under the limited computing resources and storage capacity of edge nodes is a key technical issue. Specifically, the monitoring of key quality indicators in the agricultural product processing process needs to consider multiple factors, and single-type data may not comprehensively reflect the quality status. For example, in the processing of fruits and vegetables, it is not enough to judge the appearance quality of agricultural products only through image recognition. It is also necessary to combine temperature and humidity data analysis to understand the impact of the storage environment on the quality. However, different types of data may not be completely synchronized in time and space. How to perform data alignment and correlation analysis requires the design of appropriate data fusion algorithms. At the same time, the quality assessment of agricultural product processing involves multiple indicators. How to weigh the importance of each indicator and construct a comprehensive quality assessment model is also a complex decision-making problem. In addition, when performing data mining and pattern recognition at edge nodes, how to select appropriate machine learning algorithms under limited computing resources and balance computing efficiency and analysis accuracy is also a technical difficulty that needs to be considered. Summary of the Invention
[0003] The present invention provides a method for tracing and monitoring the processing quality of agricultural products based on edge nodes, which mainly includes:
[0004] Obtain multi-source heterogeneous sensor data. In view of the differences in format, sampling frequency, and quantity of the multi-source heterogeneous sensor data, a unified data model is established in advance, and the multi-source heterogeneous sensor data is mapped into the unified data model. Data interpolation and downsampling methods are used to align the multi-source heterogeneous sensor data on the time axis, eliminate the sampling frequency differences, and obtain a time-synchronized multi-source data set; Based on the time-synchronized multi-source data set, a spatio-temporal data cube model is constructed, and multi-dimensional data including images, temperature, and humidity are mapped into a unified spatio-temporal coordinate system. On the basis of the spatio-temporal data cube model, data interpolation and aggregation methods are used to refine the coarse-grained data and generalize the fine-grained data, so that the spatio-temporal granularities of different source data tend to be consistent; Use the spatio-temporally aligned multi-source data to construct an analytic hierarchy process model, decompose the agricultural product processing quality evaluation indicators into several sub-indicators to form an indicator hierarchy structure, and use the fuzzy comprehensive evaluation method to comprehensively consider the importance weights and satisfaction degrees of each sub-indicator, calculate the comprehensive scores of each scheme, and judge the agricultural product processing quality; According to the agricultural product processing quality judgment results, conduct feature analysis on the agricultural product processing quality evaluation data, screen out the key features with greater influence, reduce the data dimension, and use decision tree and support vector machine machine learning algorithms to reduce the consumption of computing resources while ensuring the analysis accuracy, and realize data mining and pattern recognition in resource-constrained environments; Based on the analysis results of the machine learning algorithm, use a rule engine to compare the quality evaluation indicators with preset thresholds, automatically judge whether there are quality defects in the agricultural product processing process. If there are quality defects in the agricultural product processing process, trigger an early warning mechanism, display the problem links and reasons through data visualization, and assist in the rapid positioning and handling of quality problems; After the quality problem is handled, through data mining, analyze the key control points and influencing factors in the agricultural product processing process, use the incremental learning algorithm to dynamically update the quality evaluation model and rule base, and continuously update the model parameters by receiving new data samples to realize the continuous optimization of the model and continuously improve the accuracy of agricultural product processing quality evaluation; Record the quality evaluation results, optimization plans, and processing processes in the blockchain to form an immutable quality traceability chain, use cryptographic methods to encrypt and protect sensitive data to ensure data security and privacy, and use the smart contract mechanism to automatically determine and trace the quality responsibility of agricultural products, realizing the whole-process traceability, verifiability, and accountability of agricultural product quality, and enhancing consumer trust.
[0005] The present invention provides an agricultural product processing quality traceability and monitoring system based on edge nodes, mainly including: a data preprocessing module for unifying the formats and synchronizing the time of multi-source heterogeneous sensor data; a spatio-temporal data modeling module for constructing a spatio-temporal data cube model and aligning data granularities; a quality evaluation module for constructing an analytic hierarchy process model and conducting fuzzy comprehensive evaluation; a data mining module for feature analysis, dimensionality reduction, and application of machine learning algorithms; a quality monitoring module for automatically judging quality defects, giving early warnings, and visualizing problems; and a continuous optimization module for model updating, quality traceability, and responsibility determination. The technical solution provided by the embodiments of the present invention may include the following beneficial effects:
[0006] The present invention discloses an agricultural product processing quality traceability and monitoring method based on edge nodes. In view of the differences in multi-source heterogeneous sensor data, a unified data model is constructed and spatio-temporal alignment is performed to form a spatio-temporal data cube. On this basis, the analytic hierarchy process and fuzzy comprehensive evaluation methods are used to evaluate the quality of agricultural product processing. Through feature analysis and machine learning algorithms, data mining and pattern recognition are realized in a resource-constrained environment. Combining with a rule engine, quality defects are automatically judged and early warnings are triggered. Incremental learning is used to continuously optimize the evaluation model, and the results are recorded on the blockchain to form a traceable quality chain. The present invention realizes intelligent quality monitoring and evaluation of the whole process of agricultural product processing, improves the accuracy and traceability of evaluation, and effectively guarantees the quality and safety of agricultural products. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 It is a flowchart of the agricultural product processing quality traceability and monitoring method based on edge nodes of the present invention.
[0008] Figure 2 It is a schematic diagram of the agricultural product processing quality traceability and monitoring method and system based on edge nodes of the present invention.
[0009] Figure 3 It is another schematic diagram of the agricultural product processing quality traceability and monitoring method and system based on edge nodes of the present invention.
[0010] Figure 4 It is a schematic diagram of the structure of an agricultural product processing quality traceability and monitoring system based on edge nodes of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0011] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0012] As Figures 1-4 , a kind of agricultural product processing quality traceability and monitoring system based on edge nodes in this embodiment may specifically include:
[0013] Step S101: Obtain multi-source heterogeneous sensor data. For the differences in format, sampling frequency, and quantity of the multi-source heterogeneous sensor data, a unified data model is established in advance; map the multi-source heterogeneous sensor data into the unified data model, and use data interpolation and downsampling methods to align the multi-source heterogeneous sensor data on the time axis, eliminate the sampling frequency differences, and obtain a time-synchronized multi-source data set.
[0014] Obtain the original data of multi-source heterogeneous sensors. According to the pre-established unified data model, map the original data into this model to obtain standardized multi-source heterogeneous sensor data; for the standardized multi-source heterogeneous sensor data, extract the timestamp information of each data source, and determine the data segments that need to be time-axis aligned by comparing the timestamps of different data sources; for the data segments that need to be aligned, use the linear interpolation method to interpolate the data source with fewer timestamps on the time axis to align it with the data source with more timestamps; after interpolation, judge whether downsampling is required according to the preset sampling frequency threshold; if so, use the average value downsampling method to downsample the interpolated data to make its sampling frequency consistent with the threshold; sort the multi-source heterogeneous sensor data after interpolation and downsampling processing according to the unified time axis to obtain a time-synchronized multi-source data set; according to the time-synchronized multi-source data set, use the wavelet transform method to extract the time-frequency domain features of each data source and construct the feature vector of the multi-source heterogeneous sensor data; perform feature selection on the extracted feature vector to remove redundant and irrelevant features and reduce the feature dimension; then use the K-fold cross-validation method to divide the data set into a training set and a test set; input the processed feature vector into the pre-trained support vector machine model, optimize the model hyperparameters through grid search, and realize the classification and prediction of the multi-source heterogeneous sensor data; use the test set to evaluate the performance of the model, and calculate the evaluation indicators such as accuracy, precision, recall rate, and F1 value; if the model performance meets the requirements, apply it to the actual multi-source heterogeneous sensor data analysis and prediction tasks.
[0015] Exemplarily, first, obtain the raw data of multi-source heterogeneous sensors. For example, the temperature sensor collects data once per second, the humidity sensor collects data once every 10 seconds, and the light sensor collects data once per minute. According to the pre-established unified data model, map the raw data into this model. The temperature data is mapped to floating-point numbers within the range of (-50, 100), the humidity data is mapped to integers within the range of (0, 100), and the light data is mapped to integers within the range of (0, 10000), obtaining the standardized multi-source heterogeneous sensor data. For the standardized multi-source heterogeneous sensor data, extract the timestamp information of each data source. By comparing the timestamps of different data sources, determine the data segments that need to be aligned on the time axis. For example, the data segments of temperature data and humidity data between 09:00:00 and 09:10:00 need to be aligned. For the data segments that need to be aligned, use the linear interpolation method. Based on the timestamp of the humidity data, interpolate the temperature data to align it with the humidity data on the time axis. After interpolation, the sampling frequency of the temperature data is once every 10 seconds. According to the preset sampling frequency threshold of once per minute, determine that the interpolated temperature data and humidity data need to be downsampled. Use the average value downsampling method to reduce the sampling frequency of the temperature data and humidity data to once per minute, making it consistent with the sampling frequency of the light data. Sort the temperature data, humidity data, and light data after interpolation and downsampling according to the unified time axis to obtain a time-synchronized multi-source dataset. According to the time-synchronized multi-source dataset, use wavelet transform to extract the time-frequency domain features of each data source. For example, the mean of the wavelet coefficients of the temperature data is 35, the variance is 0.8, the mean of the wavelet coefficients of the humidity data is 42, the variance is 12, and the mean of the wavelet coefficients of the light data is 56, the variance is 21, constructing the feature vector of the multi-source heterogeneous sensor data. Use the maximum information coefficient method to perform feature selection on the extracted feature vector, remove redundant and irrelevant features, and select 5 most representative features to reduce the feature dimension. Then, divide the dataset into a training set and a test set in the way of 5-fold cross-validation. The training set accounts for 80%, and the test set accounts for 20%. Input the processed feature vector into the pre-trained support vector machine (SVM) model, optimize the model hyperparameters through grid search. The value range of the penalty coefficient C is [1, 1, 10], and the kernel function selects the radial basis function (RBF). The value range of the gamma parameter of the RBF kernel function is [0.1, 1, 1], realizing the classification and prediction of multi-source heterogeneous sensor data. Use the test set to evaluate the performance of the model. Calculate the accuracy rate as 92%, the precision rate as 97%, the recall rate as 94%, and the F1 value as 91%. The model performance meets the requirements, and apply it to the actual multi-source heterogeneous sensor data analysis and prediction tasks, such as predicting the environmental comfort level within the next hour based on temperature, humidity, and light data.
[0016] Step S102: Based on the multi-source data set with time synchronization, construct a spatio-temporal data cube model, and map multi-dimensional data including images, temperature, and humidity into a unified spatio-temporal coordinate system; on the basis of the spatio-temporal data cube model, refine the coarse-grained data and generalize the fine-grained data through data interpolation and aggregation methods to make the spatio-temporal granularities of data from different sources tend to be consistent.
[0017] Obtain multi-dimensional data of images and temperature / humidity according to the time-synchronized multi-source heterogeneous data, and construct a spatio-temporal data cube model; for the spatio-temporal data cube model, map the multi-dimensional data including image data and temperature / humidity data into a unified spatio-temporal coordinate system; obtain the mapped multi-dimensional spatio-temporal data, and judge whether the data granularity meets the requirements according to a preset data granularity threshold.
[0018] Among them, the preset data granularity threshold is set according to specific application scenarios and requirements. For example, in weather forecasting, the granularity threshold of temperature / humidity data can be set to once per hour. The method for judging whether the data granularity meets the requirements is to compare the time interval of the data with the preset granularity threshold. If the time interval is greater than the threshold, it is considered coarse-grained data; otherwise, it is considered fine-grained data. If the data granularity is coarse-grained data, use the linear interpolation method to refine the coarse-grained data to obtain fine-grained data. For example, the interp function of the NumPy library can be used for linear interpolation. If the data granularity is fine-grained data, use the data aggregation method to generalize the fine-grained data to obtain coarse-grained data. For example, the resample function of the Pandas library can be used for data aggregation to perform downsampling on the fine-grained data. According to the processed spatio-temporal data, update the data granularity in the spatio-temporal data cube model to make the spatio-temporal granularities of data from different sources tend to be consistent. The method for updating the data granularity is to remap the processed data into the spatio-temporal data cube model and replace the original data. According to the data with consistent spatio-temporal granularities, perform subsequent data analysis and applications. For example, the Matplotlib library can be used for spatio-temporal data visualization to generate charts such as line charts and scatter plots; the Scikit-learn library can be used for spatio-temporal data mining, such as clustering analysis and anomaly detection.
[0019] Exemplarily, first, multi-dimensional heterogeneous data such as images, temperature, and humidity are obtained. For example, image data is collected once per minute, temperature data is collected once every 10 minutes, and humidity data is collected once every 30 minutes. According to the pre-constructed spatio-temporal data cube model, the image data is mapped into a three-dimensional space coordinate system, and the temperature and humidity data are mapped onto the time axis to form a unified spatio-temporal coordinate system. For the mapped multi-dimensional spatio-temporal data, a preset data granularity threshold of once every 5 minutes is set. By comparing the time interval of the data with the threshold, it is determined that the image data is fine-grained data, and the temperature data and humidity data are coarse-grained data. For the temperature data and humidity data, a linear interpolation method is used to interpolate the data at 5-minute intervals to make its granularity consistent with that of the image data. For example, for the temperature data, 2 data points are inserted between the 10th minute and the 20th minute, and the temperature values are respectively taken as the average of the temperature values at the 10th minute and the 20th minute. For the image data, a data aggregation method is used to downsample the data at 30-minute intervals to make its granularity consistent with that of the humidity data. For example, the image data from the 0th minute to the 29th minute is aggregated into one data point, and the image features are taken as the average of 30 images. The processed image data, temperature data, and humidity data are remapped into the spatio-temporal data cube model to update the data granularity of the model to achieve a spatio-temporal granularity of once every 5 minutes. Based on the unified spatio-temporal granularity data, the K-means clustering algorithm is used to perform clustering analysis on the data. The number of clusters is set to 3, and the number of iterations is set to 10 times to obtain 3 cluster centers, which respectively represent different environmental states. The clustering results are visualized to generate a scatter plot, and points of different colors represent different clusters, intuitively showing the spatio-temporal distribution and aggregation characteristics of multi-source heterogeneous data, providing data support for subsequent environmental monitoring and early warning.
[0020] Step S103: Using the multi-source data aligned in space and time, construct an analytic hierarchy process model, decompose the agricultural product processing quality evaluation index into several sub-indices to form an index hierarchy structure; adopt a fuzzy comprehensive evaluation method, comprehensively consider the importance weights and satisfaction degrees of each sub-index, calculate the comprehensive scores of each scheme, and judge the agricultural product processing quality.
[0021] Obtain various parameter data during the agricultural product processing, including raw material quality, processing temperature, processing time, and equipment parameters, and establish an agricultural product processing database; for the agricultural product processing quality evaluation index, use the analytic hierarchy process to decompose the quality evaluation index into multiple sub-indices including sensory index, physical and chemical index, and safety index, and construct an agricultural product processing quality evaluation index hierarchical structure model; select experts in the industry and use the Delphi method to score the importance of each sub-index in two rounds. Adopt the 1-9 scale method and take the average value of the scores of each expert to determine the weight vector of each sub-index. The value range of the weight coefficient is from 0 to 1, and the sum of the weight coefficients is 1; for each sub-index, combine national and industry standards to construct a membership function, map the measured value of each sub-index to the interval [0, 1], and obtain the membership value of each sub-index; according to the weight vector and membership value of each sub-index, use the weighted average method to calculate the comprehensive evaluation score of the agricultural product processing quality; the formula is: comprehensive evaluation score = ∑(sub-index weight × sub-index membership value); compare the comprehensive evaluation score of the agricultural product processing quality with the preset qualified threshold. If the comprehensive evaluation score is greater than or equal to the qualified threshold, it is determined that the processing quality of this batch of agricultural products is qualified; otherwise, it is determined as unqualified, and this batch is marked as a quality defect batch; for the quality defect batch, extract the subset of the corresponding processing parameter data of this batch, use the Apriori association rule algorithm to mine the association rules between quality defects and processing parameters, and identify the key processing parameters that cause quality defects; according to the analysis results of the quality defect reasons, use the orthogonal experimental design method, take the key processing parameters as experimental factors, optimize the agricultural product processing process parameters, and formulate a quality improvement plan; in the processing production of the next batch of agricultural products, set the optimized agricultural product processing process parameters into the control program of the processing equipment to guide the actual production, and at the same time continuously collect and update the agricultural product processing database; by real-time monitoring the agricultural product processing process parameters, input the real-time data into the established quality evaluation model to predict the processing quality online. When the predicted quality is lower than the preset threshold, give an early warning in time and adjust the processing parameters to achieve the online control and continuous improvement of the agricultural product processing quality.
[0022] Exemplarily, during the agricultural product processing, raw material quality parameters (such as raw material moisture content, pH value, etc.), processing temperature, processing time, and equipment parameters (such as equipment rotation speed, power, etc.) are collected in real time through on-line sensors. Data is collected every 5 minutes and stored in a MySQL database. For the quality assessment of agricultural product processing, through the analytic hierarchy process, a three-level index system including sensory indicators (color, smell, etc.), physical and chemical indicators (moisture content, protein content, etc.), and safety indicators (heavy metal content, pesticide residue content, etc.) is constructed. Five industry experts are invited to score each index twice using the 1-9 scale method. After taking the average value, the AHP hierarchy analysis software is used to calculate the weight of each index. The weight of the sensory index is 2, the weight of the physical and chemical index is 5, and the weight of the safety index is 3. For each sub-index, referring to the national standard GB / T 1234-2022, a membership function is constructed. For example, the membership function of the moisture content is: when the moisture content ≤ 10%, the membership degree is 1; when the moisture content ≥ 20%, the membership degree is 0; when the moisture content is between 10% and 20%, the membership degree decreases linearly. According to the weighted average formula, the comprehensive score of the agricultural product processing quality is calculated. If the comprehensive score ≥ 85, it is determined that the quality of this batch of products is qualified; otherwise, it is determined as unqualified. The Apriori algorithm is used for association analysis of the unqualified batch data. The support threshold is set to 0.5 and the confidence threshold is set to 8. It is found that too high processing temperature and too long processing time are the main reasons for quality defects. The orthogonal experimental design method is adopted, with the processing temperature and processing time as factors, and 3 levels are set for each factor. Through the L9(34) orthogonal table, 9 groups of experiments are designed to optimize the processing process parameters. The optimal processing temperature is determined to be 120°C and the processing time is 30 minutes. The optimized parameters are set into the PLC control program of the processing equipment, and the processing data is collected and analyzed in real time. When the comprehensive score is lower than 85, the system automatically alarms and adjusts the processing parameters to achieve on-line quality control.
[0023] Step S104, according to the agricultural product processing quality judgment result, conduct feature analysis on the agricultural product processing quality assessment data, screen out the key features with greater influence, and reduce the data dimension; use decision tree and support vector machine machine learning algorithms to reduce the consumption of computing resources while ensuring the analysis accuracy, and achieve data mining and pattern recognition in a resource-constrained environment.
[0024] Obtain evaluation data according to the evaluation results of agricultural product processing quality, and store the data in the relational database MySQL; preprocess the evaluation data in MySQL, read the data using the Pandas library in Python, and use the data cleaning function of Pandas to remove noise data and outliers to obtain the cleaned data; adopt the Relief feature selection algorithm to analyze the importance of features for the preprocessed data, calculate the importance weights of each feature using the Scikit-learn library in Python, and select the top 10 key features ranked by weight; according to the selected key features, use the data selection function of Pandas to select the corresponding feature columns from the original dataset to construct a new low-dimensional dataset; if the number of samples in the dataset is greater than 1000, use the decision tree algorithm to establish a quality evaluation model; if the number of samples in the dataset is less than or equal to 1000, use the support vector machine algorithm to establish a quality evaluation model; use the Scikit-learn library to complete model training and testing; encapsulate the established quality evaluation model into a REST API, receive the production parameters collected by the sensors of agricultural product processing equipment in real time, conduct real-time evaluation of the processing quality, and return the evaluation results to the production control system; according to the quality evaluation results, the production control system dynamically adjusts the key process parameters affecting the processing quality, and realizes the automatic adjustment of parameters through the PID control algorithm to ensure that the agricultural product processing quality is stable within the target range.
[0025] Exemplarily, during the agricultural product processing quality assessment process, first, the assessment data is stored in a MySQL database. Then, the data in MySQL is read using the Pandas library in Python, and the dropna() function of Pandas is used to remove missing values. The quantile() function is used to calculate the upper and lower quartiles, and data exceeding 5 times the upper and lower quartiles is regarded as outliers and removed, obtaining a cleaned dataset. Next, the Relief feature selection algorithm is adopted, and the ReliefF class in the Scikit-learn library is used to calculate the importance weights of each feature, such as 30 features including color, smell, moisture content, etc. The top 10 key features with the highest weights are selected, such as color 85, smell 76, moisture content 69, etc. Then, the loc[] function of Pandas is used to select these 10 feature columns from the original dataset to construct a new low-dimensional dataset. Since the number of samples in the dataset is 2000, which is greater than 1000, the CART decision tree algorithm is used to establish a quality assessment model. The DecisionTreeClassifier class in the Scikit-learn library is used, setting the maximum depth of the decision tree to 5 and the minimum number of samples in the leaf nodes to 10. The dataset is subjected to 10-fold cross-validation, and the model accuracy is obtained as 92%. Finally, the decision tree model is encapsulated into a REST API, and the interface code is written using the Flask framework and deployed to a cloud server. The agricultural product processing equipment collects production parameters every 5 minutes and transmits the parameters to the REST API through an HTTP POST request. The API calls the decision tree model to perform real-time quality assessment on the parameters and returns the assessment results Good or Bad to the production control system. The control system dynamically adjusts key process parameters such as processing temperature and pressure according to the assessment results. Using the PID control algorithm, the temperature target value is set to 120 °C, the pressure target value is set to 5 MPa, and the PID parameters are Kp = 5, Ki = 8, Kd = 2 to achieve automatic adjustment of the parameters, ensuring that the agricultural product processing quality is stable within the target range and improving the product qualification rate.
[0026] Step S105, based on the analysis results of the machine learning algorithm, a rule engine is adopted to compare the quality assessment indicators with the preset thresholds to automatically determine whether there are quality defects in the agricultural product processing process; if there are quality defects in the agricultural product processing process, the warning mechanism is triggered, and through data visualization, the problem links and reasons are displayed to assist in the rapid location and handling of quality problems.
[0027] A1. Obtain the quality assessment index data during the agricultural product processing process, and analyze each index using the support vector machine or random forest algorithm to obtain the quality assessment result; A2. According to the pre-established quality assessment rules, compare the quality assessment result with the preset threshold to determine whether there are quality defects in the agricultural product processing process; A3. If the judgment result indicates the existence of quality defects, trigger the early warning mechanism, and display the processing links with quality problems and the reasons for quality defects in the form of charts and reports through data visualization technology; A4. For the displayed quality problem links and reasons, use the Apriori algorithm to analyze the historical quality problem data and dig out the key factors leading to the quality defects; A5. According to the dug out key factors, match and obtain the corresponding disposal measures from the pre-constructed quality problem disposal knowledge base based on case-based reasoning, and present the disposal measures through the data visualization interface; A6. After implementing the quality problem disposal measures, continuously obtain the quality assessment index data during the agricultural product processing process. If the quality improvement effect fails to meet the expectation, trigger the early warning mechanism again according to the latest quality data, and repeat steps A3 - A5 until the agricultural product processing quality fully meets the preset standards.
[0028] Exemplarily, during the agricultural product processing, data of 10 quality assessment indicators such as temperature, humidity, pH value, etc. are collected in real time by an on-line sensor, and the collection is carried out once every 5 minutes. For each indicator, the support vector machine algorithm is used for analysis with the Scikit-learn library of Python. The RBF kernel function is set, the penalty coefficient C = 10, gamma = 1, and 10-fold cross-validation is performed on 2000 sample data to obtain a quality assessment model with an average accuracy of 95%. The collected indicator data is input into the assessment model to obtain the quality assessment result, and it is compared with a preset threshold. For example, the temperature threshold is 20°C to 30°C, the humidity threshold is 60% to 80%, and the pH value threshold is 5 to 5. If it exceeds the threshold range, it is determined as a quality defect. When a quality defect occurs, an early warning mechanism is triggered. The Matplotlib library is used to draw a line chart to show the change trend of key indicators such as temperature and humidity, and the Seaborn library is used to draw a heat map to analyze the correlation between indicators and locate the key factors causing the quality defect, such as excessive temperature leading to water loss in agricultural products, etc. Then, the Apriori association rule mining algorithm is used to analyze 5000 pieces of historical quality problem data, the minimum support is set to 0.5, and the minimum confidence is 8 to obtain association rules, such as "excessive temperature and low humidity → shriveling of agricultural products", etc., and the key quality problem factors are extracted. According to the key factors, corresponding disposal measures are matched from the quality problem disposal knowledge base based on case-based reasoning, such as "excessive temperature → lower the equipment power and increase ventilation for cooling", etc. The PyQt library is used to develop a graphical interface to present the disposal measures in the form of a list. After the disposal measures are executed, the quality data is collected once every 5 minutes, and the same support vector machine algorithm as before is used for evaluation, and the Plotly library is used to draw a dynamic line chart of the quality score changing with time to show the quality improvement progress. If the quality score continues to be lower than 90 points, the early warning mechanism is triggered again, and the above quality problem analysis, location and disposal process are repeated. Through closed-loop feedback control, the quality of agricultural product processing is continuously optimized until the quality is stably up to standard.
[0029] Step S106, after the quality problem is disposed of, through data mining, analyze the key control points and influencing factors in the agricultural product processing process; adopt an incremental learning algorithm to dynamically update the quality assessment model and the rule base, and by continuously receiving new data samples, update the model parameters to achieve continuous optimization of the model and continuously improve the accuracy of the agricultural product processing quality assessment.
[0030] According to the data collected during the agricultural product processing, perform preprocessing operations such as data cleaning, denoising, and standardization on the data, and adopt the principal component analysis feature extraction method to extract key feature parameters; use the decision tree algorithm to construct an agricultural product processing quality assessment model, and establish a quality assessment rule base through the training of historical data; continuously collect new data samples during the agricultural product processing, perform preprocessing and feature extraction on the new data, and input the extracted feature parameters into the quality assessment model for quality prediction; compare the model prediction results with the actual quality measurement values, and calculate the model prediction error; according to the calculated model prediction error, use the random forest algorithm to optimize the quality assessment model, and improve the prediction accuracy of the model by dynamically updating the node thresholds and branch structures of the decision tree; during the model optimization process, if the prediction error is greater than the preset threshold, trigger the rule base update mechanism, and revise and supplement the quality assessment rules in the rule base according to the newly collected data samples; continuously iterate the update and optimization process of the quality assessment model and the rule base to make it adapt to the dynamic changes of raw materials and process factors during the agricultural product processing, and improve the accuracy and real-time performance of quality assessment; integrate the optimized quality assessment model and rule base into the agricultural product processing process control system to collect and monitor the processing parameters of key control points in real time; when the monitored parameters deviate from the optimal parameter range given by the quality assessment model, the system automatically generates a warning message, and according to the preset control strategy, sends a parameter adjustment instruction to the actuator to automatically adjust the process parameters of the processing equipment to ensure the stable and controllable quality of agricultural product processing.
[0031] Exemplarily, in the process of agricultural product processing, the collected data is first cleaned to remove noise data such as missing values and outliers, and the data is normalized using the min-max normalization method. Then, principal component analysis is used to extract the key features of the data. The cumulative variance contribution rate threshold is set to 90%, and the first 5 principal components are selected as input features. The C5 decision tree algorithm is used to construct a quality evaluation model, which is trained with 3000 historical data. The optimal splitting attribute is selected through the information gain ratio, and a pruning strategy is adopted to avoid overfitting, obtaining a quality evaluation rule base with an average accuracy of 93%. During the agricultural product processing process, data is collected every 10 minutes. After preprocessing and feature extraction of the new data, it is input into the quality evaluation model for prediction. The prediction results are compared with the actual quality measurement values, and the mean squared error (MSE) is used to evaluate the prediction performance of the model. When the MSE is greater than 0.5, the model optimization mechanism is triggered. The random forest algorithm is used to integrate and optimize the decision tree model. The number of decision trees is set to 100. Through bootstrap sampling and random attribute selection, multiple decision tree sub-models are constructed, and the prediction results of each sub-model are integrated through a voting mechanism to improve the accuracy of quality evaluation. At the same time, when the prediction error is greater than 1 for 5 consecutive times, the rule base update mechanism is triggered. The latest 1000 data samples are used to retrain the decision tree model through the C5 algorithm to update the quality evaluation rules. The optimized quality evaluation model and rule base are integrated into the agricultural product processing control system to collect and monitor parameters such as temperature, humidity, and pressure at key control points in real time. When the monitored parameters deviate from the optimal range (such as the temperature range is 20°C to 30°C), the system automatically generates a warning message and sends a parameter adjustment instruction to the PLC controller according to the fuzzy control strategy. By adjusting operations such as valve opening and rotation speed, the processing parameters are maintained within the optimal range to ensure the stable and controllable quality of agricultural product processing.
[0032] Step S107, record the quality evaluation results, optimization solutions, and processing procedures into the blockchain to form an immutable quality traceability chain; use cryptographic methods to encrypt and protect sensitive data to ensure the security and privacy of the data; through the smart contract mechanism, automatically determine and trace the quality responsibility of agricultural products, realizing the whole-process traceability, verifiability, and accountability of agricultural product quality, and enhancing consumer trust.
[0033] Obtain the agricultural product quality evaluation result data, record it on the chain through blockchain technology, and utilize the immutable feature of the blockchain to construct an agricultural product quality traceability chain; for the sensitive information in the agricultural product quality data, use the RSA asymmetric encryption algorithm for encryption processing to ensure the security of data transmission and storage in the blockchain network and protect the data privacy from being leaked; based on the blockchain smart contract, write the agricultural product quality responsibility determination rules into the contract code.
[0034] For example, if the product quality indicators exceed the range specified by the national standards, it is determined as the responsibility of the producer; if the quality problems are caused by the temperature and humidity exceeding the specified range during transportation, it is determined as the responsibility of the logistics, etc. The traceability rules are written into the contract code, such as associating production link data with product batch numbers, associating logistics link data with waybill numbers, etc., to achieve automatic liability determination and traceability of agricultural product quality problems. When there is a quality dispute, the responsible party is automatically verified by calling the contract. The data of each link of agricultural products from planting, harvesting, processing, packaging, transportation to sales are collected through Internet of Things devices and recorded on the blockchain quality traceability chain, including origin information, processing information, logistics information, sales information, etc., to achieve full-process traceability, verification, and accountability of agricultural product quality. By scanning the QR code on the packaging of agricultural products, consumers can view the quality information of each link such as production, processing, and logistics of agricultural products. Through blockchain technology, an agricultural product quality trust mechanism is established, and information such as quality assessment results is made public and transparent, subject to the supervision of all sectors of society, to enhance consumers' trust in the quality of agricultural products and promote the improvement of the brand value of agricultural products. An agricultural product quality blockchain network is built using the consortium blockchain model, with the agricultural administrative department as the regulatory party, agricultural product production enterprises, distributors, logistics companies, etc. as data providers, and third-party quality inspection institutions as data auditors participating together. The regulatory party is responsible for formulating agricultural product quality standards and management systems, the data providers are responsible for uploading quality data of each link, and the data auditors are responsible for verifying the authenticity of the data. All parties access quality data according to their permissions, ensuring both information sharing and protecting the privacy and security of sensitive data. By deploying random forest and support vector machine algorithms at the blockchain network nodes, the quality data of agricultural products are intelligently analyzed, early warnings of quality problems are given, decision-making support is provided for the optimization of agricultural product production and quality improvement, and the intelligent level of agricultural product quality management is improved. According to historical quality data, a random forest model is trained to predict the quality trend of agricultural products; through the support vector machine algorithm, the key factors affecting the quality of agricultural products are analyzed to find out the weak links in quality control and provide optimization suggestions for agricultural product production.
[0035] Exemplarily, in the construction of the agricultural product quality traceability chain, the RSA asymmetric encryption algorithm is first used to encrypt the agricultural product quality data. A 2048-bit key pair is used, where the public key is used for data encryption and the private key is held by the data owner for data decryption. The encrypted data generates a digital digest through the SHA-256 algorithm and is packaged and uploaded to the blockchain network together with the original data. The blockchain nodes ensure that the data has not been tampered with during transmission and storage by verifying the digital digest. In the smart contract, rules for determining agricultural product quality liability are set. For example, if the temperature exceeds 0-10°C, it is determined as the logistics liability, and if the pesticide residue exceeds the standard by 0.1 mg / kg, it is determined as the producer's liability, etc. In terms of traceability rules, the production link data is associated with a unique product batch number such as "P20220101001", and the logistics link data is associated with a waybill number such as "T20220101001". The data of each link of agricultural products is collected and uploaded to the blockchain through Internet of Things devices. For example, the temperature and humidity sensor collects data every 10 minutes and uploads it to the blockchain. Consumers can scan the product QR code such as "Q20220101001" to view information such as the production date, origin, and logistics temperature and humidity change curve of the product. The blockchain network adopts the PBFT consensus algorithm and consists of 5 nodes. The agricultural department, agricultural enterprises, logistics, distributors, and third-party quality inspection institutions each control one node to ensure the credibility of data uploading. Random forest and SVM algorithm models are deployed in the nodes and trained based on historical quality data. When the random forest model predicts that the probability of pesticide residue exceeding the standard is greater than 5%, a warning prompt is triggered; the key factors affecting pesticide residues are analyzed through the SVM model, and it is found that the amount of pesticide used is the primary factor, providing scientific pesticide application suggestions for farmers. Through the application of blockchain technology, a credible and traceable agricultural product quality and safety system is constructed, providing a strong guarantee for the improvement of agricultural product quality and brand value.
[0036] In addition, it should be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without conflict. To avoid unnecessary repetition, the present invention will not separately describe various possible combination methods. In addition, any combination can be made between various different embodiments of the present invention, as long as it does not violate the idea of the present invention, it should also be regarded as the content disclosed by the present invention.
Claims
1. An agricultural product processing quality traceability monitoring method based on edge nodes, characterized in that, The method includes: Obtain multi-source heterogeneous sensor data. In view of the differences in format, sampling frequency, and quantity of the multi-source heterogeneous sensor data, a unified data model is established in advance, and the multi-source heterogeneous sensor data is mapped into the unified data model. Data interpolation and downsampling methods are used to align the multi-source heterogeneous sensor data on the time axis, eliminate the sampling frequency difference, and obtain a multi-source data set with time synchronization; Based on the multi-source data set with time synchronization, construct a spatio-temporal data cube model, map multi-dimensional data including images, temperature, and humidity into a unified spatio-temporal coordinate system. On the basis of the spatio-temporal data cube model, data interpolation and aggregation methods are used to refine coarse-grained data and generalize fine-grained data, so that the spatio-temporal granularity of data from different sources tends to be consistent; Utilize the multi-source data with spatio-temporal alignment to construct an analytic hierarchy process model, decompose the agricultural product processing quality evaluation index into several sub-indices to form an index hierarchy structure, and adopt a fuzzy comprehensive evaluation method to comprehensively consider the importance weights and satisfaction degrees of each sub-index, calculate the comprehensive scores of each scheme, and evaluate the agricultural product processing quality; According to the agricultural product processing quality evaluation results, conduct feature analysis on the agricultural product processing quality evaluation data, screen out key features, reduce the data dimension, and adopt machine learning algorithms such as decision trees and support vector machines to reduce the consumption of computing resources while ensuring the analysis accuracy, and realize data mining and pattern recognition in a resource-constrained environment; Based on the analysis results of the machine learning algorithm, use a rule engine to compare the quality evaluation index with a preset threshold, automatically judge whether there are quality defects in the agricultural product processing process. If there are quality defects in the agricultural product processing process, trigger an early warning mechanism, and through data visualization, display the problem links and reasons to assist in the rapid positioning and handling of quality problems; After the quality problem is handled, through data mining, analyze the key control points and influencing factors in the agricultural product processing process, adopt an incremental learning algorithm to dynamically update the quality evaluation model and rule base, and continuously update the model parameters by continuously receiving new data samples to achieve the continuous optimization of the model and continuously improve the accuracy of the agricultural product processing quality evaluation; Record the quality evaluation results, optimization solutions, and processing processes in the blockchain to form an immutable quality traceability chain, use cryptographic methods to encrypt and protect sensitive data to ensure the security and privacy of the data, and automatically determine and trace the agricultural product quality responsibility through the smart contract mechanism.
2. The method according to claim 1, characterized in that, Obtain multi-source heterogeneous sensor data. In view of the differences in format, sampling frequency, and quantity of the multi-source heterogeneous sensor data, a unified data model is established in advance; map the multi-source heterogeneous sensor data into the unified data model, and use data interpolation and downsampling methods to align the multi-source heterogeneous sensor data on the time axis, eliminate the sampling frequency difference, and obtain a multi-source data set with time synchronization, including: Obtain the original data of the multi-source heterogeneous sensor, and map the original data into the model according to the pre-established unified data model to obtain standardized multi-source heterogeneous sensor data; For the standardized multi-source heterogeneous sensor data, extract the timestamp information of each data source. By comparing the timestamps of different data sources, determine the data segments that need to be aligned on the time axis; For the data segments that need to be aligned, use the linear interpolation method to interpolate the data source with fewer timestamps on the time axis to align it with the data source with more timestamps; After interpolation, determine whether downsampling is required according to the preset sampling frequency threshold; If required, use the average value downsampling method to downsample the interpolated data so that its sampling frequency is consistent with the sampling frequency threshold; Sort the multi-source heterogeneous sensor data after interpolation and downsampling according to a unified time axis to obtain a time-synchronized multi-source data set; Based on the time-synchronized multi-source data set, use the wavelet transform method to extract the time-frequency domain features of each data source and construct the feature vector of the multi-source heterogeneous sensor data; Perform feature selection on the extracted feature vector to remove redundant and irrelevant features and reduce the feature dimension; Then use K-fold cross-validation to divide the data set into a training set and a test set; Input the processed feature vector into a pre-trained support vector machine model, and optimize the model hyperparameters through grid search to achieve the classification and prediction of multi-source heterogeneous sensor data; Use the test set to evaluate the performance of the support vector machine model and calculate evaluation metrics such as accuracy, precision, recall, and F1 value; If the performance of the support vector machine model meets the requirements, apply it to the actual multi-source heterogeneous sensor data analysis and prediction tasks.
3. The method according to claim 1, wherein Based on the time-synchronized multi-source data set, construct a spatio-temporal data cube model, and map multi-dimensional data including images, temperature, and humidity to a unified spatio-temporal coordinate system; On the basis of the spatio-temporal data cube model, through data interpolation and aggregation methods, refine the coarse-grained data and generalize the fine-grained data to make the spatio-temporal granularity of different source data tend to be consistent, including: According to the time-synchronized multi-source heterogeneous data, obtain multi-dimensional data of images and temperature and humidity, and construct a spatio-temporal data cube model; For the spatio-temporal data cube model, map multi-dimensional data including image data and temperature and humidity data to a unified spatio-temporal coordinate system; Obtain the mapped multi-dimensional spatio-temporal data, and determine whether the data granularity meets the requirements according to the preset data granularity threshold.
4. The method according to claim 1, characterized in that, Using the spatio-temporally aligned multi-source data, construct an analytic hierarchy process model, decompose the agricultural product processing quality evaluation index into several sub-indices to form an index hierarchy structure; Adopt the fuzzy comprehensive evaluation method, comprehensively consider the importance weights and satisfaction degrees of each sub-index, calculate the comprehensive scores of each scheme, and evaluate the agricultural product processing quality, including: Obtain various parameter data in the agricultural product processing process, including raw material quality, processing temperature, processing time, and equipment parameters, and establish an agricultural product processing database; For the agricultural product processing quality evaluation index, use the analytic hierarchy process to decompose the quality evaluation index into multiple sub-indices including sensory index, physical and chemical index, and safety index, and construct an agricultural product processing quality evaluation index hierarchy model; Select experts in the industry and use the Delphi method to score the importance of each sub - indicator in two rounds. Adopt the 1 - 9 scale method, take the mean value of each expert's score, and determine the weight vector of each sub - indicator. The value range of the weight coefficient is from 0 to 1, and the sum of the weight coefficients is 1; For each sub - indicator, combine national and industry standards to construct a membership function, map the measured value of each sub - indicator into the interval [0, 1], and obtain the membership value of each sub - indicator; According to the weight vector and membership value of each sub - indicator, use the weighted average method to calculate the comprehensive evaluation score of the agricultural product processing quality; The formula is: Comprehensive evaluation score = ∑(sub - indicator weight × sub - indicator membership value); Compare the comprehensive evaluation score of the agricultural product processing quality with the preset qualified threshold. If the comprehensive evaluation score is greater than or equal to the preset qualified threshold, it is determined that the processing quality of this batch of agricultural products is qualified; Otherwise, it is determined as unqualified, and this batch is marked as a quality defect batch.
5. The method according to claim 1, wherein According to the agricultural product processing quality evaluation results, conduct feature analysis on the agricultural product processing quality evaluation data, screen out key features, and reduce the data dimension; adopt decision tree and support vector machine machine learning algorithms to reduce the consumption of computing resources while ensuring the analysis accuracy, and realize data mining and pattern recognition in resource - constrained environments, including: Obtain evaluation data according to the agricultural product processing quality evaluation results and store the data in the relational database MySQL; Pre - process the evaluation data in MySQL, use the Pandas library in Python to read the data, and use the data cleaning function of Pandas to remove noise data and outliers to obtain the cleaned data; Adopt the Relief feature selection algorithm to analyze the importance of features for the pre - processed data, use the Scikit - learn library in Python to calculate the importance weights of each feature, and screen out the top 10 key features in terms of weight ranking; According to the selected key features, use the data selection function of Pandas to select the corresponding feature columns from the original dataset to construct a new low - dimensional dataset; If the number of samples in the dataset is greater than 1000, adopt the decision tree algorithm to establish a quality evaluation model; If the number of samples in the dataset is less than or equal to 1000, adopt the support vector machine algorithm to establish a quality evaluation model; Use the Scikit - learn library to complete model training and testing.
6. The method according to claim 1, wherein Based on the analysis results of machine learning algorithms, adopt a rule engine to compare the quality evaluation indicators with the preset thresholds to automatically judge whether there are quality defects in the agricultural product processing process; if there are quality defects in the agricultural product processing process, trigger an early warning mechanism, and through data visualization, display the problem links and reasons to assist in the rapid positioning and handling of quality problems, including: A1. Obtain the quality evaluation index data in the agricultural product processing process, and use the support vector machine or random forest algorithm to analyze each index to obtain the quality evaluation results; A2. According to the pre - established quality evaluation rules, compare the quality evaluation results with the preset thresholds to judge whether there are quality defects in the agricultural product processing process; A3. If the judgment result indicates the existence of quality defects, trigger the early warning mechanism, and through data visualization technology, display the processing links with quality problems and the reasons for quality defects in the form of charts and reports; A4. For the displayed quality problem links and reasons, use the Apriori algorithm to analyze the historical quality problem data and mine the key factors leading to the quality defects; A5. According to the mined key factors, match and obtain corresponding disposal measures from the pre-constructed quality problem disposal knowledge base based on case-based reasoning, and present the disposal measures through the data visualization interface; A6. After implementing the quality problem disposal measures, continuously obtain the quality assessment index data during the agricultural product processing. If the quality improvement effect does not meet the expectation, trigger the early warning mechanism again according to the latest quality data, and repeat steps A3 - A5 until the agricultural product processing quality fully meets the preset standards.
7. The method according to claim 1, wherein Record the quality assessment results, optimization plans, and processing processes into the blockchain to form an immutable quality traceability chain; use cryptographic methods to encrypt and protect sensitive data to ensure the security and privacy of the data; through the smart contract mechanism, automatically determine and trace the quality responsibility of agricultural products, realizing the whole-process traceability, verifiability, and accountability of agricultural product quality, and enhancing consumer trust, including: Obtain the agricultural product quality assessment result data, record it on the chain through blockchain technology, and utilize the immutable feature of the blockchain to construct an agricultural product quality traceability chain; For the sensitive information in the agricultural product quality data, use the RSA asymmetric encryption algorithm for encryption processing to ensure the security of data transmission and storage in the blockchain network and protect the data privacy from being leaked; Based on the blockchain smart contract, write the agricultural product quality responsibility determination rules into the contract code.
8. An agricultural product processing quality traceability monitoring system based on the agricultural product processing quality traceability monitoring method based on edge nodes described in claim 1, characterized in that, The system includes: A data preprocessing module for unifying the formats and synchronizing the time of multi-source heterogeneous sensor data; A spatio-temporal data modeling module for constructing a spatio-temporal data cube model and aligning data granularities; A quality assessment module for constructing an analytic hierarchy process model and conducting fuzzy comprehensive evaluation; A data mining module for feature analysis, dimensionality reduction, and application of machine learning algorithms; A quality monitoring module for automatic judgment of quality defects, early warning, and problem visualization; A continuous optimization module for model update, quality traceability, and responsibility determination.
Citation Information
Patent Citations
Food safety risk early warning model based on AHP-EW and AE-RNN fusion and establishment method thereof
CN115392618A
Flood toughness efficient evaluation method and system based on natural language processing and data-driven model
CN118643997A