To solve the problem of unreliability of traceability information in the traceability system, we developed an intelligent monitoring system to realize the real-time online acquisition of physicochemical parameters of the agricultural inputs and to predict the varieties of input products accurately. Firstly, self-developed monitoring equipment was used to realize real-time acquisition, format conversion and pretreatment of the physicochemical parameters of inputs, and real-time communication with the cloud platform server. In this process, LoRa technology was adopted to solve the wireless communication problems between long-distance, low-power, and multinode environments. Secondly, a deep belief network (DBN) model was used to learn unsupervised physicochemical parameters of input products and extract the input features. Finally, these input features were utilized on the softmax classifier to establish the classification model, which could accurately predict the varieties of agricultural inputs. The results showed that when six kinds of pesticides, chemical fertilizers, and other agricultural inputs were predicted through the system, the prediction accuracy could reach 98.5%. Therefore, the system can be used to monitor the varieties of agrarian inputs effectively and use in real-time to ensure the authenticity and accuracy of the traceability information.
The traceability system of agricultural products is a powerful tool for solving the food safety issues [
There have been many reports about the rapid techniques for detection of agricultural inputs. To name a few, Deng et al. established a liquid chromatography-tandem mass spectrometry (LC-MS) method for the simultaneous determination of benzoylurea pesticide residues in vegetables [
It is desirable to seek an alternative method to overcome these drawbacks. In this report, based on sensors and DBN-SOFTMAX algorithm, we developed an intelligent monitoring system for the agricultural inputs. Different from chemical-based agrarian inputs detection methods described above. This paper proposed using the sensors arranged in the soil to realize the monitoring and prediction of farming inputs. In general, sensors were employed in agriculture to achieve environmental monitoring such as moisture and temperature [
The overall structure of the intelligence-monitoring platform for agricultural inputs is shown in Figure
The overall system architecture.
The monitoring equipment collects data every 15 seconds to obtain the physicochemical parameters of agricultural inputs, such as pH value, electronic conductivity (EC), and temperature, in real time. After data preprocessing, analog-to-digital conversion, and RS485 [
The monitoring system mainly consists of sensor module, low-power digital processor, multichannel AD/DA conversion module, RS485 serial communication module, LoRa wireless communication module, and solar power module. The sensor module includes a pH sensor, an EC sensor, and a temperature sensor. The RS485 serial port communication module provides multisensor data fusion service. It uses polling mode to collect different sensor data of the same monitoring point through the RS485 interface to complete multisensor data fusion. LoRa wireless communication module developed by LoRa spread spectrum chip SX1278; its transmission distance and penetration ability are more than one time higher than those of traditional FSK [
The hardware structure of monitor terminal.
There are three kinds of nodes in LoRA, namely, sensor, routing, and aggregation nodes. The routing node is responsible for forwarding data. The aggregation node does not collect data, but as a control center, it sends synchronization information to the monitoring network and the received data to the local monitoring and remote monitoring centers. The corresponding node software is designed to perform the functions of each node. In this paper, the sensor node was used as an example to introduce the software design method. The C language was used to develop software, and the flow chart of the program is shown in Figure
The node program flow.
The entire programming process uses the modular design, mainly including equipment initialization, data acquisition and processing, serial communication, and wireless communication. PC monitoring controls acquisition cycle and acquisition command and controlling center software. If the node software receives the acquisition command sent by the PC monitoring center program, it immediately responds and transmits the collected data to the corresponding sensor according to different Modbus protocol commands.
The software workflow diagram is shown in Figure
The software workflow.
Restricted Boltzmann Machine (RBM) [
If
RBM was an undirected graph model [
The RBM model.
RBM task was used to fit the input training data, figured out the optimal parameter
The key to solving the optimal parameter
Since the number of samples
It has been shown that the normalization factor The RBM network structure was connected between layers, no connection within the layer and the structure of symmetry, i.e., when the state of the visible cell was fixed, an activating probability of the
When the state of the hidden cell was fixed, activating probability of the
The binary state of all hidden layer units was calculated from equation ( The parameter updated formula in the data training process was as follows:
In the above process, what is finally obtained was the feature values of
The softmax classifier.
Thus, to a sample set with
Among
In equation (
The likelihood function corresponding to training samples is
The cost function is minimized by the gradient descent method; the gradient function is as follows:
The softmax classifier has an unusual feature: it has a “redundant” set of parameters [
In equation (
In establishing the model, the collected data were first normalized, and then DBN was used for unsupervised training to extract features. However, these features were not directly applicable to classification [
The flow diagram of modeling.
In this experiment, we used six agricultural inputs, including phosphate (P2O5, SinoChem, China), potassium (K2O, SinoChem, China), compound fertilizer (carbamide, nitrogen phosphorus potassium, SouthRanch, China), Podol pesticide (TaoChun, China), imidacloprid (Bayer, Germany), and oxamoxime (HeYi, China), purchased from local stores in Guangzhou, China. The first three of these inputs were chemical fertilizers, the latter three were pesticides, and their aqueous solutions were placed in dilution ratios (500 : 1) for use. Eighteen pots of soil-filled bottom drainable basins were prepared and set in an open-air environment. The EC sensors, pH sensors, and moisture sensors were inserted into the soil, and the power was turned on to enable to collect the sensor data in real time. During the period from October 2016 to March 2017, 200 ml of each inputs aqueous solution was sprayed into three pots of soil. Over 50 experiments, the soil parameter data before and after the input, including moisture proportion (before input), conductivity (before input), the pH value (before input), moisture ratio (after input), conductivity (after input), and the pH value (after input) were recorded. 150 data were collected for each type of input product, and the total number of data was 900.
The sensor data before input were not the same in each experiment; the collected sensor data after input minus before input could better explain the characteristics of the input. Six agricultural inputs were sprayed into the soil, respectively, and pH, conductivity, and moisture data were collected before and after the input. In this paper, 20 times of experimental data were randomly selected for observation.
Observing the collected pH values, before input they were close to 7, which was neutral. After applying six agricultural inputs, the pH value decreased. As shown in Figure
Changes in pH before and after input.
Further observation of changes in electrical conductivity (EC), since the EC value was very sensitive to moisture content, there was a significant error in the shift in the EC value observed separately. The EC value divided the moisture content, and the obtained ratio was counted as shown in Figure
Changes in EC/moisture before and after input.
Sensors collected the trained and relevant experimental data of the agricultural inputs prediction models. The main content of each data sample is input product category, the moisture proportion (before input), conductivity (before input), the pH value (before input), moisture ratio (after input), conductivity (after input), and pH value (after input). In establishing the model, the leave-one-out method [
When using DBN for feature extraction, a four-layer neural network was established, the number of neurons in each layer was 300, 100, 20, and 6, respectively. The activation function of the hidden layer was “logsig”, the training method was the L-BFGS algorithm [
During the training, the number of iterations was 400, the learning rate was 0.1, and the training error target was set to 0.001. After the training, the extracted feature data were shown in Table
The characteristic data table.
Feature data | ||||||
---|---|---|---|---|---|---|
1 | 0.261774 | 0.51821 | 0.363377 | 0.333239 | 0.40386 | 0.748109 |
1 | 0.249594 | 0.569245 | 0.360975 | 0.317917 | 0.442481 | 0.728785 |
1 | 0.25111 | 0.560419 | 0.361024 | 0.32006 | 0.437188 | 0.730672 |
2 | 0.811001 | 0.796877 | 0.348194 | 0.270687 | 0.189169 | 0.231068 |
2 | 0.839929 | 0.777112 | 0.698331 | 0.380023 | 0.302937 | 0.187739 |
2 | 0.822922 | 0.811853 | 0.321081 | 0.268463 | 0.183998 | 0.220862 |
3 | 0.397166 | 0.347973 | 0.591175 | 0.642555 | 0.696136 | 0.526804 |
3 | 0.441901 | 0.3287 | 0.630434 | 0.696979 | 0.742546 | 0.464949 |
3 | 0.417766 | 0.325697 | 0.646081 | 0.692987 | 0.75344 | 0.477638 |
4 | 0.716266 | 0.526859 | 0.587048 | 0.715965 | 0.590975 | 0.389491 |
4 | 0.764408 | 0.593614 | 0.599644 | 0.594801 | 0.447832 | 0.317517 |
4 | 0.735743 | 0.50656 | 0.56267 | 0.718762 | 0.570059 | 0.368529 |
5 | 0.221322 | 0.570325 | 0.261664 | 0.264869 | 0.386502 | 0.750886 |
5 | 0.226302 | 0.555085 | 0.258739 | 0.26812 | 0.375292 | 0.751574 |
5 | 0.23323 | 0.578087 | 0.251799 | 0.265587 | 0.376804 | 0.743913 |
6 | 0.760376 | 0.252841 | 0.753006 | 0.841325 | 0.298932 | 0.814017 |
6 | 0.752798 | 0.194803 | 0.781346 | 0.848471 | 0.26095 | 0.846151 |
6 | 0.760472 | 0.275192 | 0.74997 | 0.839426 | 0.310604 | 0.809583 |
a
Through unsupervised training of DBN and nonlinear mappings, the features were obtained from the input data, such as pH, moisture, and conductivity. After extracting features, the cohesion of the same types of agricultural inputs and the variances of different farm inputs could be better demonstrated. After dimensional reduction by the principal component analysis (PCA) method [
Three-dimensional distribution of feature values.
Three-dimensional distribution of original values.
We used this model for predicting the agricultural inputs. First, by applying the RBM-based DBN model, unsupervised training on raw data was carried out to improve the robustness of the network. Second, the feature data were obtained, and the softmax classifier was added to the back of DBN, the feature data were taken as the input, and the categories of inputs were taken as the output. Thirdly, the feature data and the tagged samples were combined to fine-tune the softmax classifier, and finally, the model was established to predict the accuracy. The result was shown in Figure
The predicted results of DBN-SOFTMAX for test sets. In the ordinate, 1: potassium fertilizer; 2: compound fertilizer; 3: imidacloprid; 4: Podol liquid; 5: oxamoxime; and 6: phosphate fertilizer.
To evaluate the performance of the DBN-softmax model, BP-neural network and DBN-BP model were also established and the prediction accuracy of the input products was compared.
As shown in Table
The forecast accuracy comparison table.
Training data | Model | Input layer (neuron) | Hidden layer (neuron) | Output layer (neurons) | Accuracy |
---|---|---|---|---|---|
Raw data | BP | 6 | 10 | 6 | 84.7% |
Raw data | DBN-BP | 6 | 300-100-20-6 | 6 | 97.8% |
Raw data | DBN-SOFTMAX | 6 | 300-100-20-6 | 6 | 98.5% |
Further research on the determination coefficient (R-Square) and root mean square error (RMSE) when testing model performance. This paper compared conventional modeling methods such as BP-NN and support vector machine (SVM) [
As shown in Table
DBN model performance comparison with BP-NN and SVM.
Models | R2cal | RMSEC | R2CV | RMSECV |
---|---|---|---|---|
DBN | 0.99 | 0.03 | 0.99 | 0.15 |
BP-NN | 0.99 | 0.09 | 0.94 | 0.40 |
SVM | 0.99 | 0.09 | 0.98 | 0.21 |
Based on the self-developed monitoring equipment and DBN-SOFTMAX model, we have developed a platform for intelligent monitoring of agricultural inputs; perform online and real-time monitoring on farms. When the agricultural inputs were applied in farms, we could compare the types of inputs and application time with the data entered by the administrators in the traceability system. Once the producers do not record the traceability information or input the wrong information, our system can capture related data timely and accurately, then automatically provides safety warning to the producers, to ensure that the traceability information is true and accurate. The intelligent monitoring platform will pave a new way for the development of traceability systems.
The data used to support the findings of this study are available from the corresponding author upon request.
The authors declare no conflict of interest.
Ling Yang, Ting Wu, and Li Lin conceived and designed the experiments; Ling Yang performed the experiments; Ting Wu, Juan Zhou, Xu Can Cai, and V Sarath Babu analyzed the data; Ling Yang, Ting Wu, and Li Lin wrote and finalized the manuscript.
This study was jointly supported by the National Natural Science Fund (61501531); fund for Science and Technology from Guangdong Province (2015A020209173, 2017A020225007); fund from Guangzhou Science and Technology Bureau (201704020030, 201803020033); and “Innovation and Strong Universities” special funds (KA170500G) from the Department of Education of Guangdong Province. V. Sarath Babu was supported by Chinese Postdoctoral Science Foundation.