# Deep Learning Entrusted to Fog Nodes (DLEFN) Based Smart Agriculture
## 4 Proposed Solution  
### Deep Learning Services on Fog Nodes  
The purpose of this work was to minimize response delay and process more DL tasks for smart agriculture applications. The proposed DL model is composed of multiple layers, and each layer deals with incoming data from the previous layer to extract features and generate an intermediate result to be delivered to the next layer. The lowest layer handles pure data and the highest layer outputs valuable information. Each DL layer reduces the data volume to be delivered to the next layer; the  
Figure 3: Example of deep learning (DL) service grafted onto cloud computing. output data volume of each layer is smaller than the input data volume of that layer. Thus, a greater number of DL layers can output more valuable information with smaller size. Figure 4 depicts the DL model's implementation in an FC environment. A cloud server entrusts some layers of the DL model to fog nodes and take care of the residual layers. Each device is aware of information of a nearby fog node and transfers captured data to the respective fog node at the request of applications. Receiving pure data from devices, a fog node executes defined layers of the DL model corresponding to a DL task application and outputs intermediate results. Upon finishing the process of DL layers at the fog node, the intermediate results are delivered to the central cloud server, which executes residual DL layers to return final information. Since the cloud takes data already processed at fog nodes, the data volumes handled by the cloud are smaller than the unprocessed original data. Such reduction of data volumes leads to smaller loads for transmission throughout the entire network, thus preventing congestion on the network and lowering the computational burden on the cloud server. Consequently, the FC system can accommodate more DL tasks at the same time. Additionally, DL layers divided into fog nodes and a cloud server have a security advantage, since inferring original data from a partially processed intermediate result is difficult in the event of a malicious threat that steals data. Figure 4: Example of a DL service grafted onto fog computing. In this paper, the word application signifies a piece of software consisting of DL tasks that utilize data from several devices to provide convenience. Authorized users are permitted to access and use functions of this application. The cloud manages the DL operational algorithm for each DL task. In a cloud environment, the central cloud deals with all executions of DL. In an FC environment, by contrast, fog nodes execute fragmentary layers and then the cloud handles the residual layers. Figure 5 depicts an overview of a DL service for an application in FC environment. The cloud has pretrained, full DL models for tasks of the application and entrusts some appropriate layers of each model to fog nodes according to their available resources. We assume that the cloud periodically collects learning information from all fog nodes and disseminates the improved feature map based on the aggregated information. When either a human or an auto-program as a user requires the use of a DL task to analyze multimedia data generated from devices and obtain meaningful information, the data are transferred to a nearby fog node. Upon arrival of the data, the fog node executes the defined DL layer and delivers intermediate results with reference information about node ID, task, and layer to the cloud. The cloud checks the reference information received from fog node and handles intermediate results via execution of residual layers, and finally returns the results to the requested user. In order to achieve maximum efficiency of the DL model grafted onto an FC-based smart agriculture environment, it is necessary to assign the optimal layers of the DL model for each task to each fog node, in order that DL service may be supported for maximum applications within a given resource.