IOT-Based Cotton Whitefly Prediction Using Deep Learning

Agriculture is suffering from the problem of low fertility and climate hazards such as increased pest attacks and diseases. Early prediction of pest attacks can be very helpful in improving productivity in agriculture. Insect pest (whitefly) attack has a high influence on cotton crop yield. Internet of *ings solution is proposed to predict the whitefly attack to take prevention measures. An insect pest prediction system (IPPS) was developed with the help of the Internet of *ings and a RBFN algorithm based on environmental parameters such as temperature, humidity, rainfall, and wind speed. Pest Warning and Quality Control of Pesticides proposed an economic threshold level for prediction of whitefly attack. *e economic threshold level and RBFN algorithm are used to predict the whitefly attack using temperature, humidity, rainfall, and wind speed. *e seven evaluation metrics accuracy, f-measures, precision, recall, Cohen’s kappa, ROC AUC, and confusion matrix are used to determine the performance of the RBFN algorithm.*e proposed insect pest prediction system is deployed in the high influenced region of pest that provides pest prediction information to the farmer to take control measures.


Introduction
e Food and Agricultural Organization (FAO) predicts that the world population will reach 8 billion people by 2025 and 9.6 billion people by 2050 [1]. Due to an increase in population, the need of foods is increasing day by day. e basic needs (foods etc.) of humans cannot be met by using old traditional farming methods. e old farming methods consume more manpower and are less efficient. e risk of less productivity is still there by using old traditional farming methods. e crop yield can be increased by using new farming methods with the usage of IoT technology. e "Internet of ings" (IoT) is a creative idea integration through which any object can transfer data through the network [2,3]. e "Internet of ings" (IoT) is an exceptionally encouraging group of innovations that are capable of offering numerous solutions towards the modernization of agriculture [4]. Agriculture is one of the sectors that is expected to be highly influenced by the advances in the domain of IoT.
Cotton is one of the most well-known fiber crops. Cotton is a significant business crop around the world. It is known as the lord of fiber and is designated "as white gold" assuming a key job in numerous socio-economic parts of the world. Cotton is cultivated in 77 countries of the world including Pakistan [5]. Cotton crop employs millions of farmers and workers. It supports the cotton textile industry of Pakistan. It provides not only fiber for the textile industry but also cotton seed which is a major source of edible oil for human consumption. Its proteinaceous oil cake is used as a food supplement for dairy animals.
e cotton crop yield is influenced by many kinds of insect pests. Whitefly (Bemisia tabaci) is one of them, having a severe effect on cotton crop yield [6]. e attack of whitefly is a global problem for cotton crop with extreme danger to worldwide sustainable agricultural development [7].
Sustainable agriculture is a new farming concept which is based on scientific innovations to fulfill the need of food and textile needs of society. Climatic conditions have a potential impact on whitefly [8]. IoT application is suitable to increase the cotton crop yield with the monitoring of environmental conditions [3,9]. IoT can perform a significant role in the prediction of whitefly based on environmental factors.
As the agricultural sector is facing many challenges regarding climate change, the current challenges of the less favorable climatic conditions flourish the more serious hazards for cotton crops. e climatic conditions influence crop production which results in the economic loss to the farmers [10]. erefore, continuous monitoring of the climatic conditions is suggested to reduce the attack of whitefly on cotton crop. Different environmental parameters such as temperature, humidity, rainfall, and wind speed could be monitored through IoT technology. As a result, whitefly prediction would be held through the data of environmental parameters and deep learning algorithms. Figure 1 shows the flow of the pest attack prediction process at any crop. In the first step, it shows the types of crops such as cotton, wheat, rice, and sugarcane, which are the main crops of Pakistan. In Figure 1, step 2 represents the stages of crop growth such as seed planting, germination, sprout, plant, flowers, and fruit. In Figure 1, 3rd step illustrates the environmental parameters such as temperature, humidity, rainfall, and wind speed which have effects on different stages of crop growth. e 4 th step shows the growth of pests after the climatic effect on different stages of crop growth.
(i) Whitefly's attack time/month is an important factor because in a specific time/month, the growth of whitefly is probably more (ii) Environmental factors such as (temperature, humidity, rainfall, and wind speed) are major factors for the growth of whitefly insect pests [11] (iii) Whitefly insect pest growth is more in a dry environment (iv) High wind speed can transfer the larva and eggs from one place/area to another e study aims is to seek protection from insect pest attacks with the early prediction using environmental factors to produce high crop yield and to alert the farmer of taking prevention measures. e remaining paper is structured into "related work," "methodology," "implementation," and "results and discussion."

Related Work
During the literature, we will discuss the smart agriculture system especially focusing on different insect pest predictions and their solutions.
Raghavendra et al. [12] focused on weather-based prediction of pest in cotton by using different prediction model machine learning algorithms such as multiple linear regression (REG) and generalized linear model (GLM). e authors also applied statistical correlation on weather parameters. e weather parameters were consisting of maximum temperature, minimum temperature, morning humidity, evening humidity, and rainfall. e experiments were conducted on both training and test datasets. e weather parameters' data used were from 2006 to 2010.
Shang et al. [13] proposed a prediction model to predict the occurrence of insect pests by combining the two machine learning algorithms: artificial neural network and genetic algorithm. e prediction model included three parts i.e., input layer, hidden layer, and output layer. e author used metrological data (precipitation, sunshine hours, mean temperature, relative humidity, and so on) as an input to predict the occurrence of insect pests. e author claimed 91.67% accuracy of prediction of insect pests due to an intelligent model and by applying a hybrid algorithm.
Kim et al. [14] presented is model had been used to predict pest and disease in the strawberry crop, in which image capture devices and sensors were used for the prediction of pests and disease in crops. e authors analyzed the environmental factors, pathogens, and host plants and simulated the captured data. e captured data was processed and analyzed through the FaaS Model. is model predicted the pest and disease occurrence and sent the alarm to the farmer through the mobile-based service.
Sajjad et al. [15] focused on the effect of climate change (temperature, humidity, rainfall, and sunshine) on major crops (e.g., sugarcane, maize, rice, and wheat) in Pakistan. e authors stated that the high temperature has a severe negative impact and low temperature has a positive impact on major crop production. e standard error techniques HAC (heteroskedasticity and autocorrelation) and FGLS (feasible generalized least square) were used to find the regression result.
Tripathy et al. [16] predicted the pest/disease, collected the sensory data which consists of temperature, humidity, leaf wetness, and soil moisture, and continuously monitored these parameters. e authors have developed a decision support system by using DM (data mining technique) and multivariant regression mining algorithm for groundnut crop. e authors developed a prediction model and these above techniques were used in this model. e authors claimed to achieve high accuracy in the prediction of pest attack.
Rubanga et al. [17] focused on small-scale greenhouse farming. Due to the shortage of labor in Japan, there is a dire need to develop a smart agricultural system. e smart system gathered real-time climate data through a wireless sensor network (WSN) and stored it in a web-based database.
e stored data is used to calculate, analyze, and formulate the whole data which displayed the result on screen. e result is displayed in the form of a graph for the ease of understanding to help the farmer in decision-making to increase the production of tomatoes. e growing degree day (GDD) algorithm was used to calculate and analyze the microclimate environment in the greenhouse.
Wang et al. [18] developed a dynamic simulation model for the prediction of rice brown plant hoppers by using historical metrological data. e model consisted of complex features that were dynamic, persistent, nonlinear, and multivariable.
ere were five inputs (temperature, humidity, rainfall, intensity of light, and sunshine hours) to the simulation model, and one output result was the growth rate of brown plant hoppers. e authors claimed to achieve the high accuracy for the prediction of rice brown plant hoppers.
Mekala et al. [19] presented different techniques to boost up the agriculture market by using CLAY-MIST measurement techniques which were based on the sensed temperature and humidity to assess the comfort level of the crop. It presents the IoT cloud model which shows 5-layer architecture. e results are gathered by using different hardware such as microcontroller, sensor, communication protocols, and IoT cloud servers, and the authors developed a CMM algorithm for measurement of the CLAY-MIST index. is algorithm found the issues, calculated accurate decisions about issues, and sent a report to the farmers. e outcomes were 94% exact with less execution time when compared with the current warm comfort strategies.
Trogo et al. [20] presented agriculture as a major industry in every country. e use of technology had great influence to increase the yield. ey used a smart agricultural solution, called DSSAT. DSSAT used Automated Weather Station (AWS) sensors and SMS technology, as well as expert knowledge of the farmers. e use of technologies such as SMS played a vital role to alert to the farmers. With the usage of technology, climate alerts, dry soil, and fertilizer alerts could be made accessible to the farmers.
Mathurkar et al. [21] presented that the agricultural sector performs a crucial role in the economics of every country. ese days everything operates automatically. ere are sensors to operate farms automatically. e enhancement in the crop yield could be done with the usage of FPGA. By using sensor devices, sense the data such as moisture level, temperature, and humidity and apply FPGA to monitor the environmental and soil condition required to know the timings of water supply to the fields for better growth of plants. Table 1 presents the detail of previous studies which display the techniques/sensors and purpose of the study about the pest monitoring and prediction system. Scientific Programming (i) Previous studies focused more on insect pest detection not prediction (ii) Previous studies focused more on image processingbased pest prediction (iii) Previous studies more focused on insect pest disease identification or detection (iv) Previous studies had not focused on the accuracy of prediction (v) Previous studies had not used sensors for insect pest prediction (vi) Intelligent decision-making was not used for prediction

Methodology
is portion explained about the model and design of the suggested solution about whitefly insect pest prediction, methods, and algorithm.

Architecture of Suggested Prediction Method.
e suggested insect pest prediction method is designed with the capability of intelligent categorization of environmental factors such as temperature, humidity, rainfall, and wind speed. Our approach focuses on efficient energy consumption as it does not turn on all the sensors all the time. e proposed approach precisely monitors the whitefly insect pest growth environment by classifying the environmental factors by continuing with a RBFN. e proposed architecture consists of several layers, as shown in Figure 2. It describes that the five layers of the prediction system are input layer, gateway layer, storage layer, prediction layer, and application layer. e implementation of each layer is given below. Figure 2 hierarchical structure, the first layer consists of sensors of different environmental parameters such as temperature, humidity, rain, and wind speed. e data is collected by using sensors of these abovementioned parameters. ese sensors are deployed at an experimental plot. Figure 2 hierarchical structure, the second gateway layer consists of a different hardware device such as a microcontroller (Arduino). e microcontroller is responsible for collecting data measured by sensors. e Wi-Fi module is responsible for the transfer of the data to the IoT server. Figure 2 hierarchical structure, the third storage layer consists of an IoT server. e previous gateway layer transfers the data to the IoT server and stores the data in MySQL. e MySQL data can be exported in the CSV form. Figure 2 hierarchical structure, the fourth prediction layer consists of a machine learning algorithm on the IoT server for the prediction of whitefly insect pest by using exported data from MySQL in the CSV form. At this layer, RBFN, a deep learning algorithm is deployed for prediction. Figure 2 hierarchical structure, the fifth application layer consists of predicted output which is displayed or transferred to the Android application for farmers to take necessary action.

Application Layer. In
In Figure 2, all layers have a strong relationship. e first input layer is basically related to the perception layer in IOT architecture in which it consists of sensors. is input layer can send data through the gateway layer using Wi-Fi modules to the server and store data at the storage layer. e next prediction layer is basically a processing layer in which the RBFN algorithm develops and makes  [29] 2019 No sensor/image processing Plant disease and pest detection using deep neural network He et al. [30] 2019 Camera and light source/imaging system Detect oilseed rape pests based on deep learning 4 Scientific Programming prediction using test and train data which are obtained from the storage layer, and the last layer is the application layer in which prediction about pest can be sent to the farmers. e strength point of the problem is that the sensors sensed real-time data from the field and addressed the unique idea to predict the pest attack in the field. Farmers can take prevention measures according to the environment.
ere are many key technologies of IoT but the main key technologies used in architecture are RFID at the gateway layer, sensor technology at the input layer, communication technology Wi-Fi modules at the gateway layer, and cloud computing at the storage layer.

Radial Basis Function Network for Prediction of Whitefly
Insect Pest. RBFN is used as a deep learning algorithm for getting the proposed prediction. RBFN is selected due to its performance in binary class prediction with the independence condition of datasets. Deep learning is too beyond the machine learning. e machine learning algorithm already has the solution of binary classification but the suggested model uses RBFN due to five reasons.
(i) RBFN has supremacy in terms of accuracy when trained with a huge amount of data. Keeping in view with the passage of time, the data of environmental parameters such as temperature, humidity, rainfall, and wind speed have been increased. (ii) More reliable when a huge amount of data are processed through RBFN.
(iii) Accuracy will be increased when the amount of data size has been increased. (iv) RBFN techniques have an efficient decision support system for prediction. (v) RBFN has high accuracy with a complex problem.
RBFN consists of many layers. Details are given below: (i) e first layer is the input layer where environmental parameters are given (ii) e second layer is a hidden layer that consists of one layer where processing or learning has been performed (iii) e last layer is the output layer where output/ prediction is displayed e regression or classification problem could be resolved with the use of the RBFN Algorithm. e most significant benefit of deep learning is that feature extraction has been performed automatically. Deep learning has a great influence on the industry and agricultural sectors.
Any neuron in the neural network has two parts, as shown in Figure 3. One is the calculated linear function, and the other is to calculate the activation function. e linear function in weights' nonlinear function is known as activation function. Figure 4 describes the structure of RBFN which has one input layer, one hidden layer, and one output layer.
Compute linear and nonlinear/activation function of the hidden layer: In pu t la ye r G at ew ay la ye r St o ra ge la ye r Ap pl ic at io n lay er Pr ed ic ti on la ye r In (1) and (2), f (x) is the output which consists of x as inputs and w i as the weight of the hidden layer multiplied by Gaussian activation function h (x), h (x) is a Gaussian activation function with the parameter r radius of the neuron, and c is the center defined separately at each RBF unit.
RBFN consists of three layers i.e., one input layer, one hidden layer, and one output layer.
(i) Input layer is called X, which consists of input data from sensors taken by Pest Environment Monitoring System (PEMS). e input data consists of temperature, humidity, rainfall, and wind speed. (ii) Output layer is displays the output in the form of Yes or No.

Implementation
is section shows experimental settings, layout of experimental area, prototype model deployment in an experimental area, and RBFN implementation.

Experimental Area.
e hardware is deployed in the city of Faisalabad of Pakistan. e location of Pakistan in the world is presented in Figure 5.

Crop, Season, and Insect Pest.
e scientific name of cotton is Gossypium hirsutum. Pakistan is a cotton-growing land. Due to the attack of whitefly pest, the cotton growth is decreasing with the passage of time. e suggested solution is deployed for the prediction of the whitefly pest [31]. e suggested solution is extendable to any other insect pest. e selected area has two cropping seasons. To conduct the experiment, 2nd season is selected which prevails from May to November.

Experimental Plot Layout.
e selected area for the experiment is one acre (43,560 ft 2 ) having length and width of 208 × 208 feet. To observe the whitefly attacks, a dataset having 416 rows and 62 coloumns was used. Each column has 416 plants. One foot space has 2 cotton plants. Total cotton plants are 12,896 for the prediction of the whitefly population. e layout detail of the experimental area is shown in Figure 6.

Equipments Used.
Temperature, humidity, rainfall, and wind speed sensors are used for the model to execute the suggested solution.
e attributes of the sensor devices describe the predictive features. Figure 7 presents a temperature sensor device known as DHT-22 to produce highly accurate data (sense the temperature and humidity) from the atmosphere. DHT-22 device is low cost and low powered. DHT-22 provides numeral results. e technical details of DHT-22 with characteristics are mentioned in Table 2.

Rain Detection Sensor
Device. In our suggested model, the usage of the rainwater detection sensor device is displayed in Figure 8 which is a low cost, low powered, and lightweight device for measuring the intensity of rainwater in the open air. e rainwater detector sensor provides both digital and analog output. e rain sensor module is an easy tool for rain detection. e technical details of the rainwater detector with characteristics are mentioned in Table 3.

Anemometer/Wind Speed Sensor Device.
In our suggested model, the usage of the wind speed sensor device is displayed in Figure 9, which is a reliable and stable sensor for measuring the intensity of wind speed in the open air. e anemometer/wind speed sensor provides an analog output. e wind speed sensor is an easy tool for wind speed measurement. e technical details of the wind speed sensor with characteristics are mentioned in Table 4.

4.4.4.
Microcontroller. In our suggested model, a microcontroller having name WeMos D1 Wi-Fi UNO-based ESP8266 shield for Arduino, as shown in Figure 10, with characteristics in Table 5 is used.

Prototype Model and Deployment.
e prediction model is shown in Figure 11, with Wi-Fi Arduino and sensors. e developed model is used to observe the whitefly attack with the effect of environmental factors such as temperature, humidity, rainfall, and wind speed values. e hardware model is developed and deployed in the crop field, as shown in Figure 11. e web application is developed using the PHP Language; MySQL is implemented at the IoT webserver. e web application captures the environmental data, processes it, and stores it. Four times in a day, data of sensors are captured through sensors. e libraries "ESP8266WiFi.h" and "DHT.h" are used in a web application to send data from the sensors to the server (May to November) and store data in the database, as shown in Figure 12.

RBFN Implementation.
Optimum values for cotton crop of environmental factors such as temperature, humidity, rainfall, and wind speed with respect to insect pest whitefly are given in Table 6.
Whitefly has positive relation with temperature and wind speed, while negative relation with humidity and rainfall. e whitefly population increases with the increase of temperature and wind speed, while the whitefly population decreases with the increase of relative humidity and rainfall [11].

Display Result.
e predicted output has been displayed at the Android app for farmers to take further necessary action to control the whitefly pest at the initial level. e sample output message is shown in Figure 13.

Results and Discussion
Our suggested model (RBFN) has the capability of decisionmaking to predict the attacks of the whitefly. e deployment of layered design and prototype is depicted in the earlier sections. e four sensors (temperature, humidity, rainfall, and wind speed) and a microcontroller have been deployed on the selected zone to assess the result. Cotton is developed in May and finishes in November in the selected zone.
e deployment time of hardware is from May to November of 2018 and from May to November of 2019. e proposed model captured the temperature data as displayed in Figures 14 and 15 for the year 2018 and 2019 with daily maximum temperature, every day minimum temperature, and daily average temperature. Figures 14 and 15 plot the maximum, minimum, and average temperatures from 1 st May to 1 st December for the year of 2018 and 2019. Maximum temperature was 47°C and 48°C in June month and minimum temperature was 5°C and 4°C in November for the year of 2018 and 2019, respectively. e plotted graph represents the maximum temperature in the blue line, the minimum temperature in the red line, and the average temperature in the green line. e X-axis represents the time interval and Y-axis represents temperature in Celsius. Figure 16 shows daily data about average temperature, humidity, rainfall, and wind speed from May to Nov of 2018 captured from sensors, stored in the database, and then downloaded in the CSV form. Figure 17 shows daily data about average temperature, humidity, rainfall, and wind speed from May to Nov of 2019 captured from sensors, stored in the database, and then downloaded in the CSV form.

Performance of RBFN Model.
Performance of the RBFN is detected in terms of accuracy, precision, recall, and fmeasure. Precision is the fraction of the correct prediction out of the total prediction made, and recall is the ratio of the accurate prediction to all the prediction in the binary class. e execution of RBFN is performed in Python language by using the "Keras" library. e achievement of the RBFN algorithm is measured by using the "sklearn.metrics" library

Input layer
Hidden layer Output layer  Scientific Programming in Python with the accuracy of RBFN 82.88%, high F 1 , precision, recall, support, Cohen's kappa, ROC AUC, log loss, and confusion matrix of different predictive features, as shown in Table 7 and 8, respectively. e actual and predicted values of 2018 and 2019 plotted, as shown in Figure 18. Figure 18 plots the output as expected and predicted results. e plotted graph represents the expected (actual) results in the blue line and the predicted results in the orange line. It is observed that there is a fluctuation in the results which is why we have not got 100% accuracy in the result. e X-axis represents the record of test data, and the Y-axis represents the prediction output from 0 to 1.

Field Evaluation of Proposed Model.
Field evaluation is performed by observing the economic threshold level (ETL) of whitefly of 5 adult or nymph or both per leaf [32] in the fields at different times. One-acre sampling points of the cropping area plotted from May to November of 2018 and 2019 in the experiment plot and observation were started at the start of May. Infield evaluation below the ETL mean does not exist and above the ETL mean exists. e maximum whitefly has been observed in July 15, 2018 to August 15, 2018 and May 15, 2019 to August 30, 2019. In the selected experimental area, a maximum of 24 whiteflies per leaf has been observed. ese 24 whiteflies consist of different forms of whitefly such as egg, pupal, and adults. e observed whitefly intensity is presented in Table 9.
e intensity of whitefly in May to Nov. 2018 has been observed during field evaluation, as shown in Figure 19.
During the field evaluation, the population of whitefly has been observed, and the observed data are plotted in Figure 19. In Figure 19, the maximum intensity of whitefly has been observed during July and August in the year of 2018. e plotted graph represents the X-axis as a time interval and the Y-axis as the intensity of the whitefly population.     Scientific Programming e intensity of whitefly in May to Nov. 2019 has been observed during field evaluation, as shown in Figure 20.
Again in 2019, population of whitefly has been observed during field evaluation, and the observed data are plotted in Figure 20. In Figure 20, the maximum intensity of whitefly has been observed during the end of July and start of the August in the year of 2019. e plotted graph represents the X-axis as a time interval and the Y-axis as the intensity of the whitefly population.
Hot spots of whitefly above ETL have been observed during a field evaluation of May to Nov. 2018 in the experimental area, as shown in Figure 21. Figure 21 displays different whitefly hotspot points in the experimental area. It shows different whitefly intensity levels for different experimental points. e graph plots in threedimension represent the length, width of the plot, and intensity of the whitefly population. e 72.5% hotspots of whitefly above ETL have been observed during field evaluation in the experimental area in 2018.
Hot spots of whitefly above ETL have been observed during a field evaluation of May to Nov. 2019 in the experimental area, as shown in Figure 22. Figure 22 also displays different whitefly hotspot points in the experimental area for the year of 2019. It shows different whitefly intensity levels for different experimental points. e above graph plots in three-dimension represent the length, width of the plot, and intensity of the whitefly population. e 74.5% hotspots of whitefly above ETL have been observed during field evaluation in the experimental area in 2019.          [11,32] 35-51°C Humidity [11,32] Below 65% Rainfall [11] 1-2 mm Wind speed [11] 5.50-5.75 km/h 10 Scientific Programming        14 Scientific Programming

Limitation of the Study.
e prediction is based on the abiotic factor only. Many other factors such as the number of host plants, area of host plant cultivation, presence of predators, and pesticide usage affect the pest population. e factors are important but out of the scope of the study.

Conclusion and Future Work
e IoT-assisted crop field context in terms of temperature, humidity, rainfall, and wind speed is used to monitor the environment daily to predict the whitefly attack to take necessary action for the adoption of control measures. e necessities are upgraded by the predominant conditions in the field to effectively serve the target of prediction. ese predictions are used to train and test the RBFN algorithm for the deep learning model to optimize these predictions to prevent the attack of whitefly in the cotton crop field. e prediction proved to be very effective regarding the recommendation of pesticides. e prediction of real-time sensor-based environmental data i.e., temperature, humidity, rainfall, and wind speed helps to increase the yield of the crop with high accuracy. e implementation of the suggested model shows major developments in controlling the whitefly attack on the cotton crop area. e pest prediction needs to be evaluated for other types of pests on different other crops. e inclusion of other factors of pest predictions such as the area of host crops available for the pest can significantly improve the accuracy of the pest prediction mode. Different other biotic and abiotic factors can improve the accuracy of the pest prediction model.

Data Availability
e data used to support the findings of the study are available from the corresponding author upon request.