An automatic pesticide sprayer to detect the crop disease using machine learning algorithms and spraying pesticide on affected crops

In the face of a focus on development, a farming residue a most powerful sector of an Indian financial management system both regarding the benefaction to gross domestic product (GDP) and also the source of utilization to the billions of people across the country. Agriculture is an agribusiness of the farmer that take part in the Indian financial management system. More than 75 percent of farm households depend on agriculture for their livelihood. But pest infestation in crops is a serious problem that slows down the growth of agricultural production. Crop disease identification in the agricultural sector is essential to deal with such problems. This present paper provides a technical solution to solve the type of issue in which the CNN algorithm is used to diagnose crop diseases and involves automatic pesticide spraying to spray pesticides on the affected crops locally. The system is based on pesticide sprays. The design deals with three modules image acquisition, image pre-processing, image segmentation, feature extraction, and classifications, and automatic spraying pesticide on the crop. The suggested system can work from a distance with a laptop with the help of a VNC viewer and Python IDLE.


Introduction
Agriculture in India is the main source of employment for Indian citizens, comprising about 60 percent of the population. Farming where farmers do fertile work for different types of crops in their fields depending on the weather and resources. To meet the food demand of such a large population, farmers have to use large quantities of pesticides to increase food production. Another organic parameter such as pesticides, diseases affects crop productivity and these parameters can be controlled by man to improve crop yields. Before the completion of agricultural mechanization, the farmers who had small farms had to do the changes manually. However, with the enlargement of fields and intensive mechanization, it has become very difficult to do all the changes manually without a revolutionary development in technologies. But when they spray the pest, it is a very harmful process for the farmers, they need to be very careful like wearing proper clothes, gloves, and masks, etc. Current methods for application of pesticides include selective spraying on targets using a human operator and backpack sprayer traveling in the crop queue and mechanized non-selective spraying in which a man attached to the trailer behind the tractor drives a tractor which continuously sprays the pesticide [1]. Pesticide protection devices such as individual head masks and central systems were used for manual and mechanized spraying, respectively. There is a risk of dangerous pesticides that can cause negative problems to human health. Moreover, manual spraying is cumbersome, slow and restricted due to absence of labour in the farm. The use of robots for the best solution in such situations is an extremely quick technical solution that improves productivity and efficiency. This makes it an effective-technical solution [1].
The field of robotics has grown exponentially in a variety of applications, from home automation to military applications. Continuous monitoring of the agricultural sector is possible as a result of the automated production of agricultural vehicles which has increased investment and research, which is one of the applications of machinery design and robotics in the agricultural sector [2]. Agricultural vehicle capabilities could be classified as direction, discovery, operation, and functioning. The route of navigational by the motor vehicle is called instruction, the exploration of environmental features is named and the action as the implementation of the task assigned is named and the area is called mapping with its characteristics. All four categorizations are independent [3]. An automatic motor vehicle used for primary or secondary farming work is said that a service department. The traditional approach for the identification of plant diseases by visible inspection. This is feasible after recent crop damage but treatment will not be limited or useful. To protect the bark from irreparable damage, the farmer must recognize the infection earlier it becomes infected. Advances in vision technologies, computer software technologies, and biotechnology have done it possible to develop such a disease [4].
Usually, with open eyes, we can easily recognize the infection. So we can say that the change in the color of the crop is an important part of the suggestion. When the health of the crop is in good condition, the color of the crop varies but the color changes automatically as soon as some harmful pathogens affect the crop. Generally, through the naked eyes, the monitoring was taken by the Experts in ancient times for the detection and identification and classification of crop diseases. But for this, the continuous observation is required by the Experts and it is too expensive in large fields. So in many underdeveloped countries in an agricultural area, the farmer needs to take lots of effort [5]. Plant diseases have transformed into a quandary it can cause a notable depletion in both the standard and amount of farming products. It is evaluated that the year of 2007 and plant disease losses in Georgia is accurate $540.69 million. Of this amount, around the 185 million USD was spent on controlling the diseases, and the rest is the value of the damage caused by the diseases [6]. Most agriculture manufacturer just pollinate and sparkler, spout pesticide blindly, which results in waste in human, financial resources and material resources, and also not good influences the product standard because of low identification and classification ratio, difficult detection, and no effective and accurately correct steps to control plant disease. With the development of new technology, image and video processing are used in plant disease detection and control systems [7]. Applying automation in this industrial sector is important from the viewpoint of the safety of human operators [8]. Using the navigation technology in aagriculture they remove there cost of plant production and improves there working accuracy of farmers. Agricultural or farming robots are used in many agricultural fields, like as crop harvesting, another as crop row weeding, and automatic fertilizing or pollinate. These robots have become a very important part of modern exactness Agriculture [9]. Science and Robotic technology can provide a process of decrease the number of pesticides put in, upgrade its tenable, and reduceit's environmental effect. A robotic sprayer can decrease the number of pesticides appeal in modern agriculture and potentially reduce or minimize the human presence during the pesticide spraying process and there methods. Studies show that up to 61% of pesticide are used can be reduced when the spraying material is targeted toward the designated object. Agricultural robots have been developed for many operations, such as field farming, planting, spraying, pruning, and selective Pesticide spraying methods and procedures. Backpack sprayer where the human carries the pesticide and sprays each target manually, and tractor sprayer where the human drives a tractor with spraying equipment garning. An exhaustive review of the state-of-the-art exhaustive robots for high-value crops recognize the resources of variation in a crop environment that must be considered in the development of a harvesting robot: objects, environment, and crops. Robotic systems for spraying in agriculture have been developed for plant protection applications and others.

Literature survey
This section presents a brief discussion about recent techniques and methods in the field of disease detection and pesticide spraying. Systems have been deployed for disease detection in the agriculture field. There are different Segmentation Algorithms given below.

A. Technique for Traditional Thresholding-based Segmentation
In the study, the Ostu method was added to calculate threshold value automatically, and thus enable researchers to reduce objects of interest from its background. This method is divided image into the two classes. The gray level is composed of the different shades of gray varying from black at the weakest intensity to white at the strongest intensity which ranges from 0 to 255.The two classes are area of interest to background. In this case, the area which having the different gray levels was observe as an area of interest whereas the areas which have the same gray-level were assigned to the background when the variance between the two classes was maximum then the exact threshold value on the image was maximum then the exact threshold value on the image was selected which gives the result as the best detachment of classes in the gray level of binary images which consist of black as well as white pixels where the pixels have the bigger gray level than the threshold values were set to white and all the remaining pixels were divided the images into the small segments like '1' Represents the white and '0' represents the black colour which represents an object of the interest to background, respectively. However, it was observed that some images do not have the exact shapes to represent the investigated region because of the unsuitability of the automated calculated threshold values. This showed that the existing Otsu method was failed to segment the images in the natural environment correctly. Therefore, the modification to the threshold values was required to extract the area of an interest-only.

B. Technique for Natural Images (TsTN) of Thresholding-based Sementation
To refine the standard of the split image, a robust splitting methods was progress. This new upgrade technique is used by the Otsu techniques generate threshold values automatically and quickly. However, the use of automatic threshold values when splitting a natural image was not sufficient to create standard segmented images. Therefore, it was necessary to change the threshold values to get the best image. In existing systems, the KNN algorithm is used for the training of datasets. K-Proximate Neighbor (KNN) is the simplest algorithm used for regression and classification problems in machine learning. KNN algorithms use data and categorize new data points based on their similar measures (e.g. distance functions). The classification is done by the suffrage of its neighbors. Data is assigned to the nearest adjacent class. As you increase the number of close neighbors, the value and accuracy of K can increase. When a new situation arises, it scans all previous experiences and finds nearby experiences.

Figure 1. Data Points
In the above Figure1 the image that most of the time, similar data points that are extracted from various images are close to each other. The KNN algorithm hook on this assumption are being true enough for all algorithm to be useful. The KNN can capture the idea of similarity or nearness with some mathematical models. There are many other ways are presented for calculating the distance, and the one way might be advantageous which is depending on the problem we are solving. However, the straight-line distance i.e. also called Euclidean distance is a popular and familiar choice for almost all data scientist. In the proposed system we have used the CNN algorithm rather than the KNN algorithm. Because the accuracy of the CNN is superior to KNN. CNN gives more accuracy than KNN because of the following reasons. CNN's build their own features from the raw signal or raw data. Opposed to other algorithms that use the vector representations where each and every component usually makes some sense on its own. Pixels don't have any meaning outside the context, but together they may contains the more information about the object on a picture than a bunch of its properties that you feed into SVM.CNN's rely on spatial features. It can be their strength if the context of the feature is local and it can we their weakness if the context is distributed (a sum of several one-hot encodings is the mode difficult to handle with CNNs, but it is very easy for a decision tree).CNNs store much more information parameters than another methods. Trees in RFs can tell you something about the feature importance if you have interpretable features, but that's it. Convnets are used to identify the images by transforming the original image through the layers to a class scores. Convents have the better way of utilizing huge amount of parameters.

Proposed system
The robotics model is providing the facility to control a movement or navigation of an agriculture vehicles or agricultural robots. The quantity and quality of agricultural products is dependent on the outcome of crops. If the diseases are not detected in early phase then produced the enormous effect scenario. Early pest detection is the serious issue which is dealt with a plantation of crops.

Figure 2. Proposed System
The Agbot is a robot or a vehicle which is made for cultivation purposes. It decreases the efforts of farmers additionally it is used to increasing the speed and accuracy of the work. We developed a robot system for identifications, monitoring, and detection of crop diseases & according to that spraying pesticides. In our system the uploaded images or captured images are processed by using CNN algorithm and CNN algorithm is a image processing algorithm, then the complete processed results are converted into the binary codes and it transfer to the microcontroller unit that is Raspberry pi. The microcontroller unit is programmed in such a way that it controls the Agri-Robo. The microcontroller unit controls the spraying mechanism. The spraying system contains a tank for storing the pesticides or fertilizers in that, a sprayer as well as a DC motor which is used to direct the robot for any direction for spraying the pesticides in the desired spray area. The microcontroller is used to control DC motors with the help of an L293D driver. The stepper motors are fixed on the wheels of the robot which have strong bounding to hold the wheels which are able to moving the vehicle in any direction. This is made to be an earthly vehicle or robot which have the facility to check the crops or farmland visually for spraying the pesticides or fertilizers uniformly at a particular location or spray area. In this proposed system we used inexpensive components or parts because of that the vehicle becomes a financially rewarding. The robot is steer between the crops or farmland, using the wireless camera the robot can view the crops and their diseases and robot's path as well as it used for obstacle detection. The signal is captured at the operating end and this signals are viewed and check using the laptop. The another method for disease detection is using drones but, the drones are not very efficient almost not possible because the drones cannot navigates into the crops might also lead to destroy the crops due to its propelling fans. Thus identification of affected crops by particular disease is more efficient and simple using the robot. The complete working model is shown in Figure 3. In addition, the proposed system includes a sprinkler which is connected to the motor and allow to spraying the fertilizers, pesticides, etc. on the affected crops concurrently. This study serves to reduce the heavy work of the farmers and also proves to be very economical and efficient.

Flow Chart Diagram
Our proposed work, as shown in above figure Figure.2, the camera is used to detect the obstacle and captured images provided to system to identify the disease of the plant. By using image processing we can predict the diseases. Sprinkle motor is used to sprinkle the pesticide on the affected crops.

Figure 4. Flow Diagram
The proposed techniques involves the following steps as shown in above flowchart in Figure 4.

A. Input Image
First, we give the captured image as a input to the system. This input image is the image of diseased leaf. This image can be of .jpeg format.

B. Data Pre-processing
Pre-processing of the image is done which reduces the noisy data from it. Data pre-processing are involve cleaning, selection, normalization, transformation and feature extraction. The product is a final training set.

C. Image Segmentation
Image segmentation is nothing but a process of partitioning the digital or analog image into the multiple segments or multiple parts i.e. pixels sets, also known as an image object. The main aim of segmentation is to simplify the image and make it something more meaningful and easier to analyze.

D. Feature Extraction
In this step, Feature extraction is done. It is the type of dimensionality reduction which is work efficiently and represents the interesting parts of an image and convert it into a feature vector. This approach is useful when an image or a picture size is large or not compatible and reduced feature representation is required to rapidly complete the tasks such as image retrieval and matching. This feature extraction can also extract the features from the segments of an image.

E. Feature selection by optimization
This Feature selection optimization selects the optimized features by optimization process using deep learning method. Feature selection techniques are often used in the domains where there are many features and comparatively few samples or data points

F. Analysis of precision recall and accuracy
After the step of feature selection, we have to interpret the performance measures analysis such as precision, recall and accuracy.
Precision: Precision is a ratio of correctly predicted positive observations to a total predicted positive observations or data points.
Recall: Recall is the fraction of the total amount of relevant instances that were actually retrieved. Accuracy: Accuracy is the metric for evaluating classification models. It is the fraction of predictions our model got right.

G. Detection of affected leaf
In this step we got the result and output as the name of disease.

Result and discussion
This section presents complete exploratory and comparative analysis of crops or farmland. The proposed system is implemented using VNC tool which is running on windows platform or on Linux and the computer is configured with Intel i3 processor with 4GB RAM. In order to perform this task, we have considered Fruit disease dataset. The results of our system are shown in below Figure 5 and Figure 6. As per our methodology, system working accurately.  System takes the captured leaf images and identify the disease using image processing. After detecting the disease, when pesticide given to robot it will automatically spray on affected crops. System has a wireless camera to avoid the obstacle. Robot works 98% accurately as per our proposed system.

Conclusion
The accurate and efficient classification and detection of a plant diseases is vital task for the successful farming of a crops and is the key to prevent the agriculture loss. The modern agricultural technology towards plant production, protection, health and sustainable agriculture. This can be done using image processing technique, which is used for the detection of plant leaf diseases. This paper discussed the various techniques to segment the disease part of a plant and spraying the pesticide on the diseased plant efficiently and effectively. We can say that proposed system is efficient enough for detection of the leaf diseases.