Disclosure of Invention
The invention provides a food safety detection system, which effectively solves the problem that the food quality is greatly influenced because the food freshness is not influenced by nonlinearity and large delay of the change of temperature parameters of food processing and transportation environments at different circulation stages of the existing food.
The invention is realized by the following technical scheme:
the invention relates to a food safety detection system, which consists of a food environment parameter acquisition platform and a food freshness big data processing subsystem. The test result shows that the food safety detection system has high prediction accuracy on food freshness and provides a beneficial reference for adjusting and determining the corresponding time of the environmental factors of food storage, transportation and preservation.
The invention further adopts the technical improvement scheme that:
the food environment parameter acquisition platform comprises a management center computer, 3 groups of multiple detection nodes, 3 aggregation nodes and a GPRS network, wherein the 3 groups of multiple detection nodes respectively form 3 environment parameter acquisition subnets to realize detection of storage environment, transportation environment and preservation environment parameters of food, and the 3 corresponding aggregation nodes transmit the information of the storage environment, the transportation environment and the preservation environment of the 3 food environment parameter acquisition subnets to the management center computer through the GPRS network to realize detection of the freshness of the food. The 3 groups of the detection nodes and the aggregation nodes are distributed in the storage environment, the transportation environment and the preservation environment of food in a wireless one-to-many communication mode of LoRa, the storage environment, the transportation environment and the preservation environment information of the food are collected respectively, the aggregation nodes are responsible for receiving and transmitting the data of the detection nodes and uploading the data to the management center computer through a GPRS network, the management center computer analyzes the information of the storage environment, the transportation environment and the preservation environment of the food and the storage time, the transportation time and the preservation time of the food, and the freshness of the food is predicted to be classified. The structure of the food environment parameter acquisition platform is shown in figure 1.
The invention further adopts the technical improvement scheme that:
the food freshness big data processing subsystem comprises 3 temperature detection modules and a freshness grade classifier, wherein the 3 temperature detection modules output the freshness temperature trapezoidal fuzzy number, the transportation temperature trapezoidal fuzzy number and the storage temperature trapezoidal fuzzy number of the food respectively as the input of 3 beat delay lines TDL of the corresponding freshness grade classifier, and the trapezoidal fuzzy number output by the freshness grade classifier represents the food freshness grade value; the 3 temperature detection modules are respectively a temperature detection module 1, a temperature detection module 2 and a temperature detection module 3, the temperature detection modules detect the fresh-keeping temperature, the transportation temperature and the storage temperature of food, each temperature detection module comprises a plurality of temperature detection models and a detection temperature fusion model, the trapezoidal fuzzy number of the temperature output by the plurality of temperature detection models serves as the input of the detection temperature fusion model, and the fusion value of the trapezoidal fuzzy number of the temperature output by the detection temperature fusion model serves as the output value of the temperature detection module.
The invention further adopts the technical improvement scheme that:
the temperature detection model consists of a temperature sensor, 1 beat Delay line TDL (tapped Delay line), a plurality of Adaline neural network models, a plurality of differential loops and 1 dynamic recursive wavelet neural network, wherein 2 differential operators S are connected in series to respectively form 1 differential loop, and 2 differential operator connecting ends of each differential loop and the output of each differential loop are respectively used as 2 corresponding inputs of the dynamic recursive wavelet neural network model; the output of the temperature sensor is used as the input of a beat delay line TDL, the temperature sensor value output by the beat delay line TDL for a period of time is respectively used as the input of a plurality of Adaline neural network models, each Adaline neural network model output is used as the input of a corresponding 1 differential loop and the input of a corresponding 1 dynamic recursive wavelet neural network, the trapezoidal fuzzy number output by the dynamic recursive wavelet neural network model respectively represents the dynamic trapezoidal fuzzy number of the temperature sensor value in a period of time and is [ a, b, c, d ], a, b, c and d respectively represent the minimum value output by the temperature sensor, the minimum value, the maximum value and the maximum value are composed of [ a, b, c and d ] to form a dynamic trapezoidal fuzzy value of the temperature sensor value output by the temperature detection model in a period of time, and the temperature detection model outputs a dynamic trapezoidal fuzzy value predicted value of the measured temperature in a period of time.
The invention further adopts the technical improvement scheme that:
fusion model design for detecting temperature
1. The temperature trapezoidal fuzzy values output by a plurality of temperature detection models in a period of time form a time series temperature trapezoidal fuzzy value array of the temperature sensors, the average value of all the temperature trapezoidal fuzzy values at the same moment forms a positive ideal value of the time series temperature trapezoidal fuzzy value array, the trapezoidal fuzzy value with the largest distance between all the temperature trapezoidal fuzzy values and the positive ideal value at the same moment forms a negative ideal value of the time series temperature trapezoidal fuzzy value array of the temperature sensors, the quotient obtained by dividing the distance of the negative ideal value of the time series temperature trapezoidal fuzzy value of each temperature sensor by the sum of the distance of the negative ideal value of the time series temperature trapezoidal fuzzy value of the temperature sensor and the distance of the positive ideal value of the time series temperature trapezoidal fuzzy value of the temperature sensor is the relative closeness of the distance of the time series temperature trapezoidal fuzzy value of the temperature sensor, dividing the distance relative closeness of the time series temperature trapezoidal fuzzy value of each temperature sensor by the sum of the distance relative closeness of the time series temperature trapezoidal fuzzy values of all the temperature sensors to obtain a quotient which is the distance fusion weight of the time series temperature trapezoidal fuzzy values of the temperature sensors;
2. dividing the positive gray correlation degree of the time-series temperature trapezoidal fuzzy value of each temperature sensor by the sum of the positive gray correlation degree of the time-series temperature trapezoidal fuzzy value of the temperature sensor and the negative gray correlation degree of the time-series temperature trapezoidal fuzzy value of the temperature sensor to obtain a quotient, namely the gray correlation degree of the time-series temperature trapezoidal fuzzy value of the temperature sensor is relatively close to the gray correlation degree; dividing the gray correlation degree relative closeness of the time series temperature trapezoidal fuzzy values of each temperature sensor by the sum of the gray correlation degrees relative closeness of the time series temperature trapezoidal fuzzy values of all the temperature sensors to obtain a quotient which is the gray correlation degree fusion weight of the time series temperature trapezoidal fuzzy values of the temperature sensors;
3. the distance fusion weight and the gray correlation fusion weight of the time sequence temperature trapezoidal fuzzy values of each temperature sensor respectively form a root mean square combination weight, a game theory combination weight, a linear combination weight and a product combination weight, the root mean square combination weight, the game theory combination weight, the linear combination weight and the product combination weight are arranged from small to large to form the trapezoidal fuzzy number fusion weight of the time sequence temperature trapezoidal fuzzy values of the temperature sensor, and the sum obtained by adding the products of the time sequence temperature trapezoidal fuzzy values of each temperature sensor and the trapezoidal fuzzy number fusion weight of the time sequence temperature trapezoidal fuzzy values of the temperature sensor is the time sequence trapezoidal fuzzy number fusion value of all the temperature sensors;
4. the negative ideal value of the time series temperature trapezoidal fuzzy value of each temperature sensor is characterized by the distance between the time series temperature trapezoidal fuzzy value of the temperature sensor and the negative ideal value of the time series temperature trapezoidal fuzzy value array of the time series temperature sensor, and the positive ideal value distance of the time series temperature trapezoidal fuzzy value of each temperature sensor is characterized by the distance between the time series temperature trapezoidal fuzzy value of the temperature sensor and the positive ideal value of the time series temperature trapezoidal fuzzy value array of the temperature sensor;
5. the positive grey correlation degree of the time series temperature trapezoidal fuzzy value of each temperature sensor is characterized by the grey correlation degree of the time series temperature trapezoidal fuzzy value of the temperature sensor and the positive ideal value of the time series temperature trapezoidal fuzzy value array, and the negative grey correlation degree of the time series temperature trapezoidal fuzzy value of the temperature sensor is characterized by the grey correlation degree of the time series temperature trapezoidal fuzzy value of the temperature sensor and the negative ideal value of the time series temperature trapezoidal fuzzy value array sensed by the time series temperature measurement;
6. the product combination weight is characterized in that the ratio of the distance fusion weight and gray relevance fusion weight product of the time-series temperature trapezoidal fuzzy values of each temperature sensor to the sum of the distance fusion weight and gray relevance fusion weight product of the time-series temperature trapezoidal fuzzy values of all the temperature sensors is the product combination weight of the time-series temperature trapezoidal fuzzy value fusion of the temperature sensor.
The invention further adopts the technical improvement scheme that:
the freshness grade classifier comprises 3 beat delay lines TDL, 3 self-association neural networks, 3 Elman neural networks and a least square support vector machine LS-SVM, wherein the 3 temperature detection modules output freshness temperature trapezoidal fuzzy numbers, transportation temperature trapezoidal fuzzy numbers and storage temperature trapezoidal fuzzy numbers of food respectively as the input of the 3 beat delay lines TDL3, TDL2 and TDL1 of the corresponding freshness grade classifier, the output temperature trapezoidal fuzzy numbers of the TDL3, TDL2 and TDL1 are respectively the input of the 3 self-association neural networks 3, 2 and 1, the trapezoidal fuzzy numbers output by the self-association neural networks 3 and the fresh-keeping time of the food, the trapezoidal fuzzy numbers output by the self-association neural networks 2 and the transportation time of the food, and the trapezoidal fuzzy numbers output by the self-association neural networks 1 and the output of the storage time of the food are respectively the Elman neural networks 3 corresponding to the freshness delay lines, The Elman neural network 2 and the Elman neural network 1 are correspondingly input, the Elman neural network 3 outputs a trapezoidal fuzzy number as a corresponding input of a least square support vector machine LS-SVM, the Elman neural network 2 outputs a trapezoidal fuzzy number as a corresponding input of the Elman neural network 3 and a corresponding input of a least square support vector machine LS-SVM, the Elman neural network 1 outputs a trapezoidal fuzzy number as a corresponding input of the Elman neural network 2 and a corresponding input of a least square support vector machine LS-SVM, the trapezoidal fuzzy number output by the least square support vector machine LS-SVM represents a food freshness grade value, and the least square support vector machine LS-SVM outputs a freshness grade classifier; according to engineering practice experience of food storage temperature, transportation temperature and preservation temperature control, food freshness is quantized into freshness grades through a freshness grade classifier, the food freshness is completely divided into five grades of general freshness, relatively freshness, very freshness, stale and very stale through trapezoidal fuzzy numbers, 5 freshness grades are respectively corresponding to 5 different trapezoidal fuzzy numbers, the similarity between the trapezoidal fuzzy number output by the freshness grade classifier and the 5 trapezoidal fuzzy numbers representing the 5 freshness grades is calculated, the freshness grade corresponding to the trapezoidal fuzzy number with the maximum similarity is determined as the foundation pit freshness grade, and dynamic performance and scientific classification of fresh foundation pit grade classification are achieved.
Compared with the prior art, the invention has the following obvious advantages:
the difference between the dynamic recursive wavelet neural network model and the common static wavelet neural network is that the dynamic recursive wavelet neural network model is provided with two associated layer nodes which play a role in storing the internal state of the network, and a self-feedback loop with fixed gain is added on the two associated layer nodes to enhance the memory performance of time sequence characteristic information, so that the tracking precision of the evolution tracks of the storage temperature, the transportation temperature and the preservation temperature of food is enhanced to ensure better prediction precision; a group of connection weights are added between the first association layer node and the output layer node of the dynamic recursive wavelet neural network model to enhance the dynamic approximation capability of the dynamic recursive wavelet neural network model and improve the prediction accuracy of the storage temperature, the transportation temperature and the fresh-keeping temperature of the food.
The Elman neural network adopted by the invention realizes the prediction of the temperature of the detected food within a period of time, and is generally divided into 4 layers, namely an input layer, an intermediate layer (hidden layer), a receiving layer and an output layer, wherein the input layer, the hidden layer and the output layer are connected similarly to a feedforward network, the unit of the input layer only plays a role in temperature signal transmission, and the unit of the output layer plays a role in linear weighting. The transfer function of the hidden layer unit can adopt a linear or non-linear function, and the accepting layer is also called a context layer or a state layer, and is used for memorizing the output value of the hidden layer unit at the previous moment, which can be regarded as a time delay operator. The Elman neural network is characterized in that the output of the hidden layer is self-connected to the input of the hidden layer through the delay and storage of the receiving layer, the self-connection mode enables the output to have sensitivity to the data of the temperature historical state of the food, and the addition of the internal feedback network increases the capability of the network for processing dynamic information, so that the purpose of dynamic modeling of the temperature of the food is achieved. The regression neuron network of the Elman neural network is characterized in that the output of the hidden layer is self-connected to the input of the hidden layer through the delay and storage of a structural unit, the self-connection mode enables the hidden layer to have sensitivity to the data of the temperature historical state of food, and the addition of the internal feedback network increases the capability of the network for processing the temperature dynamic information of the food, thereby being beneficial to the modeling of the temperature dynamic process of the food; the Elman neural network fuses the information of the temperature future prediction network of the food and the information of the temperature past prediction network of the food by utilizing the feedback connection of the dynamic neurons of the associated layers, so that the memory of the Elman neural network on the temperature time sequence characteristic information of the food is enhanced, and the temperature prediction accuracy of the food is improved.
Thirdly, the scientificity and the reliability of the freshness grade classifier of the invention, the food freshness grade classification of the freshness grade classifier, according to the engineering practice experience of controlling the storage temperature, the transportation temperature and the preservation temperature of the food and the control standard of the storage temperature, the transportation temperature and the preservation temperature of the food, the food freshness is quantized into fresh grades by a freshness grade classifier, the food freshness is totally divided into five grades of general freshness, comparative freshness, very freshness, stale and very stale by trapezoidal fuzzy numbers, 5 freshness grades respectively correspond to 5 different trapezoidal fuzzy numbers, the similarity between the trapezoidal fuzzy number output by the freshness grade classifier and the 5 trapezoidal fuzzy numbers representing the 5 freshness grades is calculated, and determining the freshness grade corresponding to the trapezoidal fuzzy number with the maximum similarity as the freshness grade of the foundation pit, thereby realizing the dynamic performance and scientific classification of the freshness grade of the foundation pit.
Because the first and second change rates of the predicted values of the food storage, transportation and preservation temperatures are introduced by the plurality of differential loops in a combined manner, the dynamic recursive wavelet neural network is applied to the time series prediction of the nonlinear parameters to convert the detected parameters into the trapezoidal fuzzy numbers according to the predicted values of the detected parameters and the influence of the change rates, so that the prediction precision and the self-adaptive capacity are better, and the generalization capacity of the dynamic recursive wavelet neural network is improved.
Detailed Description
The technical solution of the present invention is further described with reference to the accompanying drawings 1-7:
one, overall function design
The invention realizes the communication between the computer of the monitoring center and the detection nodes and the sink nodes of the storage environment, the transportation environment and the preservation environment of the food through the low-power consumption long-distance LoRa wireless network and the GPRS network, applies the LoRa communication technology to the long-distance wireless food safety monitoring to realize the detection of the food safety information, greatly reduces the relay use of the LoRa long-distance communication, saves the cost and realizes the detection and the centralized management of the food safety. The food environment parameter acquisition platform comprises a management center computer, 3 groups of multiple detection nodes, 3 aggregation nodes and a GPRS network, wherein the 3 groups of multiple detection nodes respectively form 3 environment parameter acquisition subnets to realize detection of storage environment, transportation environment and preservation environment parameters of food, and the 3 corresponding aggregation nodes transmit the information of the storage environment, the transportation environment and the preservation environment of the 3 food environment parameter acquisition subnets to the management center computer through the GPRS network to realize detection of the freshness of the food. And the management center computer analyzes the information of the storage environment, the transportation environment and the preservation environment of the food and the storage time, the transportation time and the preservation time of the food, and predicts and classifies the freshness of the food. Adopt the wireless one to many communication mode of loRa to distribute in the storage environment of food, transportation environment and fresh-keeping environment between 3 groups of a plurality of detection nodes and the aggregation node, gather the storage environment of food respectively, transportation environment and fresh-keeping environmental information, the aggregation node is responsible for receiving and dispatching the data of detection node, and upload the data to management center computer through the GPRS network, in the hardware design, SX1278 radio frequency module is a highly integrated low-power consumption half-duplex miniwatt wireless data transmission module, it is far away to have transmission distance, the penetrability of signal is strong, characteristics such as data reception and sending stability. The management center computer provides convenience for inquiring and managing food safety information, can also provide intelligent decision and forecast food freshness. The general structure of the food environment parameter acquisition platform is shown in figure 1.
Second, design of detection node
The detection nodes comprise a temperature sensor, a humidity sensor, an illuminance sensor and an SX1278 radio frequency module, 3 groups of multiple detection nodes are communicated with the sink node by means of the ultra-long distance wireless communication capacity of the LoRa network, and collected information of the food storage environment, the transportation environment and the preservation environment is transmitted to the management center computer through 3 corresponding sink nodes. The detection node structure is shown in fig. 5.
Third, sink node design
The sink node receives data information of the detection node through the SX1278 radio frequency module, uploads the information of the detection node to a management center computer through the GPRS module, and comprises a temperature sensor, a humidity sensor, a illuminance sensor, a GPRS module and the SX1278 radio frequency module. The sink node structure is shown in fig. 6.
Fourth, management center computer software design
The management center computer is an industrial control computer, the management center computer mainly collects food environment parameters and predicts the food quality and realizes information interaction with the detection nodes and the convergence nodes, the management center computer mainly has the functions of communication parameter setting, data analysis and data management and a food freshness big data processing subsystem for predicting the food freshness, the management software selects Microsoft Visual + +6.0 as a development tool and calls an Mscomm communication control of the system to design a communication program, and the management center computer software has the function shown in figure 7. The food freshness big data processing subsystem comprises 3 temperature detection modules and a freshness grade classifier, wherein the 3 temperature detection modules output the freshness temperature trapezoidal fuzzy number, the transportation temperature trapezoidal fuzzy number and the storage temperature trapezoidal fuzzy number of the food respectively as the input of 3 beat delay lines TDL of the corresponding freshness grade classifier, and the trapezoidal fuzzy number output by the freshness grade classifier represents the food freshness grade value; the temperature detection modules are respectively a temperature detection module 1, a temperature detection module 2 and a temperature detection module 3, the temperature detection modules are used for detecting the fresh-keeping temperature, the transportation temperature and the storage temperature of food, each temperature detection module comprises a plurality of temperature detection models and a detection temperature fusion model, the temperature trapezoidal fuzzy numbers output by the temperature detection models are used as the input of the detection temperature fusion model, and the fusion value of the temperature trapezoidal fuzzy numbers output by the detection temperature fusion model is used as the output value of the temperature detection module; the characteristics of the temperature detection model and the detection temperature fusion model are as follows:
1. temperature detection model design
The temperature detection model is shown in figure 3, and consists of a temperature sensor, 1 beat Delay line TDL (tapped Delay line), a plurality of Adaline neural network models, a plurality of differential loops and 1 dynamic recursive wavelet neural network, wherein 2 differential operators S are connected in series to respectively form 1 differential loop, and 2 differential operator connecting ends of each differential loop and the output of each differential loop are respectively used as 2 corresponding inputs of the dynamic recursive wavelet neural network model; the output of the temperature sensor is used as the input of a beat delay line TDL, the temperature sensor value output by the beat delay line TDL for a period of time is respectively used as the input of a plurality of Adaline neural network models, each Adaline neural network model output is used as the input of a corresponding 1 differential loop and the input of a corresponding 1 dynamic recursive wavelet neural network, the trapezoidal fuzzy number output by the dynamic recursive wavelet neural network model respectively represents the dynamic trapezoidal fuzzy number of the temperature sensor value in a period of time and is [ a, b, c, d ], a, b, c and d respectively represent the minimum value output by the temperature sensor, the minimum value, the maximum value and the maximum value are composed of [ a, b, c and d ] to form a dynamic trapezoidal fuzzy value of the temperature sensor value output by the temperature detection model in a period of time, and the temperature detection model outputs a dynamic trapezoidal fuzzy value predicted value of the measured temperature in a period of time. The dynamic trapezoidal fuzzy number output by the dynamic recursive wavelet neural network model is [ a, b, c, d ], the output value [ a, b, c, d ] of the dynamic recursive wavelet neural network model represents the dynamic trapezoidal fuzzy value of the temperature, and the dynamic trapezoidal fuzzy value of the temperature detection model at the temperature detection point can be described as follows:
U(t)=[a,b,c,d]=F[X(t),X(t-1)…,X(t-n)] (1)
the Adaptive Linear Element (Adaptive Linear Element) of the Adaline neural network model is one of the early neural network models, and the input signal of the model can be written in the form of vector, x (k) ═ x0(K),x1(K),…xn(K)]TEach set of input signals corresponds to a set of weight vectors expressed as W (K) ═ k0(K),k1(K),…k(K)],x0(K) When the bias value of the Adaline neural network model is equal to minus 1, the excitation or inhibition state of the neuron is determined, and the network output can be defined as follows according to the input vector and the weight vector of the Adaline neural network model:
in the Adaline neural network model, a special input, namely an ideal response output d (K), is sent into the Adaline neural network model, then the output y (K) of the network is compared, a difference value is sent into a learning algorithm mechanism to adjust a weight vector until an optimal weight vector is obtained, the y (K) and the d (K) tend to be consistent, the adjusting process of the weight vector is the learning process of the network, the learning algorithm is a core part of the learning process, and the weight optimization searching algorithm of the Adaline neural network model adopts a least square method of an LMS algorithm.
The temperature dynamic recursive wavelet neural network prediction model is different from a common static wavelet neural network in that the temperature dynamic recursive wavelet neural network prediction model is provided with two associated layer nodes which play a role in storing the internal state of a network, a self-feedback loop with fixed gain is added on the two associated layer nodes, and the memory performance of time sequence characteristic information is enhanced, so that the tracking precision of the temperature evolution track of food is enhanced to ensure better prediction precision; first of allThe associated layer node is used for storing the state of the phase point of the hidden layer node at the previous moment and transmitting the state to the hidden layer node at the next moment; the second correlation layer node is used for storing the state of the phase point of the output layer node at the previous moment and transmitting the state to the hidden layer node at the next moment; feedback information of neurons of the hidden layer and the output layer can affect the dynamic processing capacity of prediction of the temperature dynamic recursive wavelet neural network prediction model, and two related layers belong to state feedback inside the temperature dynamic recursive wavelet neural network prediction model to form the dynamic memory performance specific to the recursion of the temperature dynamic recursive wavelet neural network prediction model and improve the accuracy and the dynamic performance of the temperature dynamic recursive wavelet neural network prediction model; a group of connection weights are added between the first association layer node and the output layer node of the temperature dynamic recursive wavelet neural network prediction model to enhance the dynamic approximation capability of the temperature dynamic recursive wavelet neural network prediction model and improve the food temperature prediction precision. Wavelet Neural network WNN (wavelet Neural networks) theoretical basis is a feedforward network provided by taking a wavelet function as an excitation function of a neuron and combining an artificial Neural network, wherein the expansion and contraction, the translation factor and the connection weight of wavelets in the wavelet Neural network are adaptively adjusted in the optimization process of an error energy function. Let the input signal of the wavelet neural network be represented as an input one-dimensional vector xi(i ═ 1,2, …, n), the output signal is denoted yk(k is 1,2, …, m), and the calculation formula of the predicted value of the output layer of the wavelet neural network prediction model is as follows:
in the formula omega
ijInputting the connection weight between the i node of the layer and the j node of the hidden layer,
as wavelet basis functions, b
jIs a shift factor of the wavelet basis function, a
jScale factor, omega, of wavelet basis functions
jkThe connection weight between the node of the hidden layer j and the node of the output layer k. This patentThe correction algorithm of the weight and the threshold of the temperature dynamic recursive wavelet neural network prediction model adopts a gradient correction method to update the network weight and the wavelet basis function temperature, so that the output of the temperature dynamic recursive wavelet neural network prediction model is continuously close to the expected output.
2. Fusion model design for detecting temperature
The structure of the fusion model with the detected temperature is shown in FIG. 2.
Firstly, constructing a time-series temperature trapezoidal fuzzy numerical array of a temperature measurement sensor
Trapezoidal fuzzy values output by a temperature detection model of a plurality of temperature measurement sensors at a period of time form a time series temperature trapezoidal fuzzy value array of the temperature measurement sensors, trapezoidal fuzzy values of n temperature measurement sensors and m time nm temperature measurement sensors form a time series trapezoidal fuzzy value array of n rows and m columns of temperature measurement sensors, and trapezoidal fuzzy values of the same temperature measurement sensor at different times are set as Aij(t),Aij(t+1),…,Aij(m), the time series trapezoidal fuzzy number array of all temperature measurement sensors is:
secondly, calculating distance fusion weight of time sequence temperature trapezoidal fuzzy values of the temperature measurement sensor
The average value of the temperature trapezoidal fuzzy values of all the temperature measurement sensors at the same moment forms a positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensors, and the positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensors is as follows:
the temperature trapezoidal fuzzy values of all the temperature measuring sensors at the same moment and the trapezoidal fuzzy value with the largest distance between the positive ideal values of the trapezoidal fuzzy number arrays of the time series temperature measuring sensors form the negative ideal value of the trapezoidal fuzzy number array of the time series temperature measuring sensors, and the negative ideal value of the trapezoidal fuzzy number array of the time series temperature measuring sensors is as follows:
the positive ideal value distance of the time series temperature trapezoidal fuzzy value of the temperature measuring sensor is that the positive ideal value distance of the time series temperature trapezoidal fuzzy value of each temperature measuring sensor and the trapezoidal fuzzy value array of the time series temperature measuring sensor is as follows:
the distance between the negative ideal value of the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor is the distance between the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor and the negative ideal value of the trapezoidal fuzzy value array of the time-series temperature measurement sensors:
the quotient obtained by dividing the distance of the negative ideal value of the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor by the sum of the distance of the negative ideal value of the time-series temperature trapezoidal fuzzy value of the temperature measurement sensor and the distance of the positive ideal value of the time-series temperature trapezoidal fuzzy value of the temperature measurement sensor is the relative closeness of the distance of the time-series temperature trapezoidal fuzzy values of each temperature measurement sensor, and the formula is as follows:
as can be known from the formula (9), the greater the relative closeness of the time-series temperature trapezoidal fuzzy value distance of each temperature measurement sensor, the closer the time-series temperature trapezoidal fuzzy value of the temperature measurement sensor is to the positive ideal value, otherwise, the greater the relative distance of the time-series temperature trapezoidal fuzzy value of the temperature measurement sensor is to the positive ideal value, and according to this principle, the distance fusion weight of the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor, which is obtained by dividing the relative closeness of the time-series temperature trapezoidal fuzzy value distance of each temperature measurement sensor by the sum of the relative closeness of the time-series temperature trapezoidal fuzzy value distances of all temperature measurement sensors, as the quotient is determined as:
thirdly, calculating gray correlation degree fusion weight of time sequence temperature trapezoidal fuzzy values of the temperature measuring sensor
The grey correlation of the time series temperature trapezoidal fuzzy value of each temperature measurement sensor with the positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensors is:
by calculating the gray correlation of the time series temperature trapezoidal fuzzy value of each temperature measurement sensor with the positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensor, a gray correlation matrix of the time series temperature trapezoidal fuzzy value of each temperature measurement sensor can be constructed:
the gray correlation between the time-series temperature trapezoidal blur value of each temperature measurement sensor and the positive ideal value of the trapezoidal blur number array of the time-series temperature measurement sensors can be obtained according to the formula (12), which is shown as follows:
similarly, the gray correlation between the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor and the negative ideal value of the trapezoidal fuzzy value array of the time-series temperature measurement sensors is defined as follows:
similarly, a gray relevance matrix of the time series temperature trapezoidal fuzzy value of each temperature measurement sensor can be constructed by calculating the gray relevance of the time series temperature trapezoidal fuzzy value of each temperature measurement sensor and the negative ideal value of the trapezoidal fuzzy value array of the time series temperature measurement sensors:
the gray correlation between the time-series temperature trapezoidal blur value of each temperature measurement sensor and the negative ideal value of the trapezoidal blur number array of the time-series temperature measurement sensors can be obtained according to the formula (15), which is shown as follows:
the gray relevance degree of the time series temperature trapezoidal fuzzy value of each temperature measurement sensor and the positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensor is obtained by dividing the gray relevance degree of the time series temperature trapezoidal fuzzy value of the temperature measurement sensor and the positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensor and adding the gray relevance degree of the time series temperature trapezoidal fuzzy value of the temperature measurement sensor and the negative ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensor, and the quotient is the gray relevance degree of the time series temperature trapezoidal fuzzy value of the temperature measurement sensor, wherein the gray relevance degree is obtained by:
as can be known from the formula (17), the gray correlation degree of the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor is larger relatively to the closeness degree, the difference between the shape similarity of the time series temperature trapezoidal fuzzy value of the temperature measurement sensor and the positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensor is smaller, otherwise, the difference between the shape similarity of the time series temperature trapezoidal fuzzy value of the temperature measurement sensor and the positive ideal value of the trapezoidal fuzzy number array of the time series temperature measurement sensor is larger, according to the principle, the gray correlation degree fusion weight of the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor is obtained by dividing the gray correlation degree relative closeness of the time-series temperature trapezoidal fuzzy values of all the temperature measurement sensors by the sum of the gray correlation degrees relative closeness of the time-series temperature trapezoidal fuzzy values of all the temperature measurement sensors:
fourthly, calculating the fusion value of the time series temperature trapezoidal fuzzy values of the plurality of temperature measuring sensors
Distance fusion weight alpha according to time series temperature trapezoidal fuzzy value of each temperature measurement sensoriFusing weight beta with grey correlation degreeiCalculating the root mean square combination weight gammaiIs apparent gammaiAnd alphai、βiThe sum should be as close as possible, according to the principle of minimum relative entropy:
solving the optimization problem by a Lagrange multiplier method to obtain:
according to the formula (20), the ratio of the root mean square of the product of the distance fusion weight and the gray correlation fusion weight of the time-series temperature trapezoidal fuzzy value of each temperature measurement sensor to the root mean square of the product of the distance fusion weight and the gray correlation fusion weight of the time-series temperature trapezoidal fuzzy values of all temperature measurement sensors is the root mean square combination weight of the time-series temperature trapezoidal fuzzy value fusion of the temperature measurement sensor.
The method mainly aims to reduce the deviation between each basic weight obtained by different methods and the finally obtained combination weight, so that the weights determined by the methods are coordinated in a mutual competitive relationship, and further a more balanced result is sought, and the determined index combination weight is ensured to be more scientific and reasonable. In order to make the obtained combined weight more scientific and objective, L different methods can be used for weighting each index, so that a basic weight set can be constructed, and L methods are used for weighting the indexes, so that a basic weight set u is constructedi={ui1,ui2,…, u in1,2, …, L, which we remember that any linear combination of these L vectors is:
in order to find the most satisfactory among the possible weight vectors u
We combine L linear combination coefficients lambda
kOptimizing so that u is equal to each u
kThe dispersion of (a) is minimized. This leads to the following strategy model:
from the differential nature of the matrix, the optimal first derivative condition for equation (22) is
Can be converted into a linear equation set and calculated by using Mathmatica to obtain (lambda)
1,λ
2,…λ
L) And (3) carrying out post-normalization processing, and substituting the post-normalization processing into a formula (24) to obtain game theory combination weight:
distance fusion weight alpha according to time series temperature trapezoidal fuzzy value of temperature measurement sensoriFusing weight beta with grey correlation degreeiLinear combination is carried out to obtain linear combination weight theta of time sequence temperature trapezoidal fuzzy value fusion of the temperature measurement sensoriThe formula is as follows:
θi=ααi+ββi (24)
according to the ratio of the product of the distance fusion weight and the gray correlation degree fusion weight of the time series temperature trapezoidal fuzzy value of each temperature measurement sensor to the sum of the product of the distance fusion weight and the gray correlation degree fusion weight of the time series temperature trapezoidal fuzzy value of all the temperature measurement sensors, the product combination weight of the time series temperature trapezoidal fuzzy value fusion of the temperature measurement sensors is defined as the formula:
obtaining the trapezoidal fuzzy number fusion weight w of the time-series temperature trapezoidal fuzzy number fusion of the temperature measurement sensor according to the formulas (20), (23), (24) and (25)i:
wi=[min(θi,γi,νi,σi),κi,οi,max(θi,γi,νi,σi)] (26)
Wherein κi,οiRespectively 4 combining weights thetai,γi,νi,σiThe 3 rd number and the 2 nd number in the order from large to small.
From the formula (29), the root mean square combination weight, the game theory combination weight, the linear combination weight and the product combination weight of the time series temperature trapezoidal fuzzy values of each temperature measurement sensor are sequenced from small to large to form the trapezoidal fuzzy number fusion weight of the time series temperature trapezoidal fuzzy values of the temperature measurement sensor. The time series trapezoidal fuzzy number fusion value of all the temperature measurement sensors is obtained by adding the products of the time series temperature trapezoidal fuzzy number of each temperature measurement sensor and the trapezoidal fuzzy number fusion weight of the time series temperature trapezoidal fuzzy number of the temperature measurement sensor at the same moment:
3. freshness level classifier design
The freshness grade classifier is shown in figure 4 and comprises 3 beat delay lines TDL, 3 self-association neural networks, 3 Elman neural networks and a least square support vector machine LS-SVM, wherein the 3 temperature detection modules output the freshness temperature trapezoidal fuzzy number, the transportation temperature trapezoidal fuzzy number and the storage temperature trapezoidal fuzzy number of the food as the input of the 3 beat delay lines TDL3, TDL2 and TDL1 of the corresponding freshness grade classifier respectively, the output temperature trapezoidal fuzzy numbers of the TDL3, TDL2 and TDL1 are the input of the self-association neural network 3, the self-association neural network 2 and the self-association neural network 1 of the corresponding 3 self-association neural networks respectively, the trapezoidal fuzzy number output by the self-association neural network 3 and the freshness time of the food, the trapezoidal fuzzy number output by the self-association neural network 2 and the transportation time of the food, and the output of the trapezoidal fuzzy number output by the self-association neural network 1 and the output of the storage time of the food are the corresponding 3 Elman fuzzy numbers The Elman neural network 3, the Elman neural network 2 and the Elman neural network 1 of the neural network correspond to each other, the Elman neural network 3 outputs a trapezoidal fuzzy number as a corresponding input of a least square support vector machine LS-SVM, the Elman neural network 2 outputs a trapezoidal fuzzy number as a corresponding input of the Elman neural network 3 and a corresponding input of the least square support vector machine LS-SVM, the Elman neural network 1 outputs a trapezoidal fuzzy number as a corresponding input of the Elman neural network 2 and a corresponding input of the least square support vector machine LS-SVM, the trapezoidal fuzzy number output by the least square support vector machine LS-SVM represents the freshness of the food, and the LS-output of the least square support vector machine SVM serves as the freshness grade classifier; the design process of the self-associative neural network, the Elman neural network and the least square support vector machine LS-SVM is as follows: an Auto-associative neural network (AANN), a feedforward neural network of a special structure, includes an input layer, a number of hidden layers, and an output layer. The method comprises the steps of firstly compressing temperature input data information of food through an input layer, a mapping layer and a bottleneck layer, extracting a most representative low-dimensional subspace reflecting a system structure from a high-dimensional parameter space of the temperature of the food input from an associative neural network, effectively filtering noise and measurement errors in the temperature input data of the food, decompressing the temperature data of the food through the bottleneck layer, the demapping layer and the output layer, and restoring the previously compressed information to the temperature parameter value of each food, so that the reconstruction of the temperature input data of each food is realized. In order to achieve the purpose of compressing the temperature information of food, the number of nodes of a bottleneck layer of a self-associative neural network is obviously smaller than that of input layers, and in order to prevent the formation of simple single mapping between the input layers and the output layers, except that the excitation function of the output layers adopts a linear function, the excitation functions of other layers all adopt nonlinear excitation functions. In essence, the first layer of the hidden layer of the self-associative neural network is called as a mapping layer, and the node transfer function of the mapping layer can be an S-shaped function or other similar nonlinear functions; the second layer of the hidden layer is called a bottleneck layer, the dimension of the bottleneck layer is the minimum in the self-association neural network, the transfer function of the bottleneck layer can be linear or nonlinear, the bottleneck layer avoids the mapping relation that the one-to-one output and input are equal and easy to realize, the self-association neural network encodes and compresses the temperature signal of the food to obtain a correlation model of the predicted data of the input pressure sensor, and the correlation model is decoded and decompressed after the bottleneck layer to generate the estimated value of the input signal of the temperature predicted value of the food; the third layer or the last layer of the hidden layer is called a demapping layer, the node transfer function of the demapping layer is a generally nonlinear S-shaped function, and the self-associative neural network is trained by using a back-propagation (BP) algorithm.
The Elman neural network can be regarded as a forward neural network with local memory units and local feedback connections, and has a special association layer besides hidden layers; the correlation layer receives the feedback signal from the hidden layer, and each hidden layer node is connected with the corresponding correlation layer node. The association layer takes the hidden layer state at the previous moment and the network input at the current moment as the input of the hidden layer, which is equivalent to state feedback. The transfer function of the hidden layer is generally a Sigmoid function, the output layer is a linear function, and the associated layer is also a linear function. In order to effectively solve the problem of approximation accuracy in the temperature prediction of food, the function of the correlation layer is enhanced. Setting the number of an input layer, an output layer and a hidden layer of the Elman neural network as m, n and r respectively; w is a1,w2,w3And w4Respectively representing the connection weight matrixes from the structural layer unit to the hidden layer, from the input layer to the hidden layer, from the hidden layer to the output layer and from the structural layer to the output layer, and then the expressions of the hidden layer, the associated layer and the output layer of the Elman neural network are respectively as follows:
cp(k)=xp(k-1) (29)
the output of the Elman neural network in the technical scheme is a temperature trapezoidal fuzzy number.
The least square support vector machine LS-SVM has strong generalization capability and global capability, overcomes the defects of poor generalization capability, overfitting, easy falling into local optimum and the like of other machine learning methods, is an extension to a standard support vector machine, adopts a sum-of-squares error loss function to replace an insensitive loss function of the standard support vector machine, and simultaneously realizes the conversion of inequality constraints in a standard SVM algorithm into equal constraints. Therefore, the least square support vector machine (LS-SVM) simplifies the quadratic programming problem into solving a linear equation set, obviously reduces the complexity of solving and improves the calculation speed. The linear regression equation of the food freshness of the LS-SVM of the least squares support vector machine is as follows:
in the solving process, in order to avoid solving a complex nonlinear mapping function, a Radial Basis Function (RBF) is introduced to replace dot product operation in a high-dimensional space, so that the calculated amount can be greatly reduced, and the RBF is easy to realize the optimization process of the SVM because the center of each basis function of the RBF corresponds to the support vector one by one, and the support vector and the weight can be obtained through an algorithm. Therefore, the classifier of the least squares support vector machine LS-SVM food freshness is:
the output of the least squares support vector machine LS-SVM classifier represents the trapezoidal fuzzy number of the size of the freshness grade of the food. According to engineering practice experience of food storage temperature, transportation temperature and preservation temperature control, food freshness is quantized into freshness grades through a freshness grade classifier, the food freshness is completely divided into five grades of general freshness, relatively freshness, very freshness, stale and very stale through trapezoidal fuzzy numbers, 5 freshness grades are respectively corresponding to 5 different trapezoidal fuzzy numbers, the similarity between the trapezoidal fuzzy number output by the freshness grade classifier and the 5 trapezoidal fuzzy numbers representing the 5 freshness grades is calculated, the freshness grade corresponding to the trapezoidal fuzzy number with the maximum similarity is determined as the foundation pit freshness grade, and dynamic performance and scientific classification of fresh foundation pit grade classification are achieved. A corresponding relation table of 5 trapezoidal fuzzy numbers output by a least square support vector machine LS-SVM and 5 freshness degrees of food is constructed, and the corresponding relation of the freshness degree of the food and the trapezoidal fuzzy numbers is shown in table 1.
TABLE 1 food freshness grade and trapezoidal fuzzy number corresponding relation table
Serial number
|
Level of security
|
Fuzzy number of trapezoid
|
1
|
General freshness
|
(0.0,0.05,0.15,0.3)
|
2
|
Compare freshness
|
(0.1,0.15,0.3,0.4)
|
3
|
Is very fresh
|
(0.3,0.35,0.45,0.7)
|
4
|
Is not fresh
|
(0.6,0.75,0.8,0.9)
|
5
|
Is not fresh
|
(0.8,0.85,0.9,1.0) |
Design example of food safety detection system
According to the actual condition of a food safety detection system, 3 groups of multiple detection nodes, 3 aggregation nodes and an installation diagram of a monitoring center computer of a food environment parameter acquisition platform are arranged in the system, wherein the detection nodes and the aggregation nodes are evenly arranged in all directions in a storage, transportation and fresh-keeping environment according to the detection requirement, and the classification of food freshness grades is realized through the system.
The technical means disclosed in the invention scheme are not limited to the technical means disclosed in the above embodiments, but also include the technical scheme formed by any combination of the above technical features. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and such improvements and modifications are also considered to be within the scope of the present invention.