CPC G06N 3/0455 (2023.01) [G01D 18/008 (2013.01); G01N 33/02 (2013.01)] | 5 Claims |
1. A photoelectric detection model transfer and sharing method based on a cloud service, comprising:
acquiring in batches, by a detection terminal No. 0, spectrum information and temperature information of typical and representative agricultural product samples and building a temperature compensation model;
acquiring quality indicators of the typical and representative agricultural product samples, extracting characteristic wavelengths from a wavelength-calibrated spectrum, and building a detection model based on the characteristic wavelengths and the quality indicators;
acquiring in batches, by the detection terminal No. 0 and a detection terminal No. 1, the spectrum information of the typical and representative agricultural product samples and building a spectrum transfer model by using an autoencoder neural network, wherein the acquiring in batches, by the detection terminal No. 0 and the detection terminal No. 1, comprises measuring the spectrum information acquired by the detection terminal No. 0 and the detection terminal No. 1 with an optical source and a photoelectric sensor of the detection terminal No. 0 and with an optical source and a photoelectric sensor of the detection terminal No. 1, wherein the spectrum information measured by the detection terminal No. 0 is provided in a spectrum matrix S0, the spectrum information measured by the detection terminal No. 1 is provided in a spectrum matrix S1, wherein the building the spectrum transfer model comprises training the autoencoder neural network on difference features between the spectrum matrix S0 and the spectrum matrix S1 and calibrating the spectrum matrix S1 into the spectrum matrix S0; and
invoking the temperature compensation model and the spectrum transfer model to calibrate spectrum information of agricultural product samples to yield calibrated spectrum information, and invoking the detection model to compute the calibrated spectrum information to obtain quality detection results of the agricultural product samples,
wherein the building the spectrum transfer model comprises:
encoding, by an encoder, the spectrum matrix S1 of the detection terminal No. 1 into a low-dimensional hidden variable h, restoring, by a decoder, the low-dimensional hidden variable h in a hidden layer of the spectrum matrix S0 of the detection terminal No. 0, and the training the autoencoder neural network on the difference features between the spectrum matrix S0 and the spectrum matrix S1 and the calibrating the spectrum matrix S1 into the spectrum matrix S0;
an encoding process from an input layer to the hidden layer being:
![]() a decoding process from the hidden layer to an output layer being:
![]() wherein w1 is a weight matrix of the encoding process, w2 is a weight matrix of the decoding process, θ1 is a function of the encoding process, θ2 is a function of the decoding process, b1 is a deviation matrix of the encoding process, b1, is a deviation matrix of the decoding process, and X represents a spectrum matrix;
the spectrum transfer model comprises the encoder and the decoder, the encoder comprises the weight matrix w1 and the deviation matrix b1, and the decoder comprises the weight matrix w2 and the deviation matrix b2,
further comprising: when a new detection terminal is added, acquiring the spectrum information of the agricultural product samples by the new detection terminal, and updating the spectrum transfer model by using a transfer learning method, to enhance a robustness of the spectrum transfer model and realize the spectrum transfer model sharing in different detection terminals,
wherein the updating the spectrum transfer model by using the transfer learning method comprises: freezing parameter matrices of the autoencoder neural network updated by the detection terminal No. 0 and the detection terminal No. 1, adding a new decoder, and updating parameter matrices of the new decoder by the detection terminal No. 0 and the new detection terminal,
wherein serial numbers of the agricultural product samples are generated while the detection results are obtained, the agricultural product samples are drawn according to the serial numbers for actual measurement, an error between the detection results and actual measurement results is computed, and when the error exceeds a preset threshold, the detection model is updated,
wherein the detection model is updated by using an active feedback mechanism and a passive feedback mechanism, wherein the active feedback mechanism comprises: selecting representative agricultural product samples for active update of the detection model at key time points after harvesting, before storage, and before sale; and the passive feedback mechanism comprises: during a detection process, numbering the agricultural product samples required for detection, dynamically drawing a certain quantity of the agricultural product samples as an independent validation set to validate the detection model, and when the error between the detection results and the actual measurement results exceeds the preset threshold, updating the detection model by using the independent validation set,
wherein the updating the model comprises: selecting representative agricultural product samples from the independent validation set to obtain selected samples and adding the selected samples into a training set of the detection model, thereby improving an adaptability of the detection model and a prediction accuracy of the detection model for new product samples.
|