# A Total Crop-Diagnosis Platform Based on Deep Learning Models in a Natural Nutrient Environment
## 2 Related Works
### A Design of a Crop Self-Diagnosis Module (CSM) Based on Deep Learning
#### 3.4.1 A Design of the APDS  
The APDS has the multi-layered neural network models which use back-propagation learning. In Figure 8, the APDS consists of the six neural network models which diagnose the parts affecting farming. For example, each part means the primary and secondary nutrient of soil, micro nutrient,  
Figure 8: The structure of the agricultural partial diagnosis sub-module (APDS). weather and soil condition separately. Sensor data is used as an input of a neural network model suitable for each diagnosis. The APDS uses the sensor data (see Figure 6c) transferred from the DSM as an input. In order for the APDS to be able to use the sensor data normally, the cloud server extracts payloads by removing the header and trailer from the sensor data (see step 1 of Figure 8). Then, the cloud server transfers the extracted payloads to the APDS (see step 2 of Figure 8). Because the OFSG transforms different formats into one format, the APDS processes only the payloads with one format. Also, because the payloads have the same size, the APDS has no problem in processing them. If the number of sensors is \(n\), the input of the APDS is represented as the following Formula (1). \[\mathrm{X}=\{x_{1},x_{2},x_{3},\ldots,x_{n}\} \tag{1}\]  
Because the output results of the six parts are not classified linearly, each neural network model has only one hidden layer. The number of hidden layer nodes is the same as that of input layer nodes. The hidden layer is represented as the following Formula (2). \[\mathrm{H}=\{h_{1},h_{2},h_{3},\ldots,x_{n}\} \tag{2}\]  
The output of the APDS is represented as one node, y which means the status of each part. The weight W between an input layer and a hidden layer is represented as the following Formula (3). \[\mathrm{W}=\{w_{1},w_{2},w_{3},\ldots,w_{n}\} \tag{3}\]  
The weight V between a hidden layer and an output layer is represented as the following Formula (4). \[\mathrm{V}=\{v_{1},v_{2},v_{3},\ldots,v_{n}\} \tag{4}\]  
Because the number of hidden layers is the same as that of input layers, the number of weights W is \(n\times n\). Figure 9 shows one example of the six neural network models in the APDS. The output \(y\) of each neural network models is between 0 and 1, and the items entered in the current neural network models are used as the value to judge whether farming is in a good condition. For example, in Figure 8, the first case shows that the analysis result of the primary nutrient is 0.948 and it is normal numeric is as much as 94.8%. The results of the six neural network models in the APDS are entered in the TEDS. Figure 9: The one example of the six neural network models in the APDS. The APDS is learned by using the back-propagation. Algorithm 1 shows the learning method of a neural network models in the APDS. Algorithm 1 works as follows. * First, the set of sensor data \(X_{i}\) and the result of \(X_{i}\), \(\mathrm{d_{i}}\) are entered into a neural network model;
* Second, the APDS initializes input layer size \(\mathrm{n}\), weight \(\mathrm{w}\), learning rate \(\alpha\) and limitation value of error \(\mathrm{E_{max}}\);
* Third, the APDS computes the value of the hidden layer nodes by using Formulas (5) and (6); \[NET_{H}=X_{i}W^{T}\] (5) \[\mathrm{H}=\frac{1}{1+e^{-NET_{H}}}\] (6)
* Fourth, the APDS computes the values of the output layer node by using Formulas (7) and (8): \[NET_{Y}=HV^{T}\] (7) \[\mathrm{Y}=\frac{1}{1+e^{-NET_{Y}}};\] (8)
* Fifth, the APDS computes the error \(\mathrm{E}\) and the error signal \(\delta_{y}\) by using the value of the output layer node and current trained result value, \(\mathrm{d_{i}}\). Formulas (9)-(11) are used to compute \(\mathrm{E}\) and \(\delta_{y}\), \(\delta_{h}\) separately: \[\mathrm{X}=\{x_{1},x_{2},x_{3},\ldots,x_{n}\} \tag{1}\]0 (9) \[\mathrm{X}=\{x_{1},x_{2},x_{3},\ldots,x_{n}\} \tag{1}\]1 (10) \[\mathrm{X}=\{x_{1},x_{2},x_{3},\ldots,x_{n}\} \tag{1}\]2 (11)
* Sixth, the APDS modifies the weight \(\mathrm{V}\) and \(\mathrm{W}\) of a neural network model by using Formulas (12) and (13).