Weed Detection Using SVMs

The major concern in Pakistani agriculture is the reduction of growing weed. This research aims to provide a weed detection tool for future agri-robots. The weed detection tool incorporates the use of machine-learning procedure explicitly implementing Support Vector Machines (SVMs) and blob analysis for the effective classification of crop and weed. Weed revealing is based on characteristic features i.e. red green blue (RGB) components which differentiate soil and plant. Morphological features—centroidand length aid to distinguish shape of crop and weed leaves. Following feature extraction, the positive and negative margins are separated by a hyper-plane. The separating hyper-plane acts as the decision surface. Sample input consists of multiple digital field images of carrot crops. Training samples of seventy two images are taken. Accuracy of the outcomes discloses that SVM and blob analysis attain above 50-95% accuracy. Keywords—image segmentation; colour segmentation; binarization; morphological features; support vector machines


INTRODUCTION
One of the major concerns of an economy is accelerating agricultural development.Weeds are unwanted plants that can survive and reproduce in agricultural fields.They hinder agricultural development by disturbing production and quality through competing with crops for water, light, soil nutrients, and space.As a result, weed control strategies are critical to sustain crop productivity.Agriculture is a vital sector of the economy of Pakistan and recently accounted for a 5.28% growth according to government estimates [1].The sector directly supports three-quarters of the country's population, employs half the labor force, and contributes a large share of foreign exchange earnings.Up to 60% of yield is dependent on soil fertility, and weeds that rob nutrients from crops limit yield potential [2].Therefore, removal of weed from cultivated fields during early stages of crop growth is essential for a healthy and good harvest.For weed detection we need field photographs with good precision.Taking photographs can be done by attaching a camera in the front of the tractor/machine or manually.Then, by applying image processing techniques to that image by using MATLAB we can detect the weed in the field.In this algorithm, our main aim is detection and removal of the weed using image processing.
Hand weeding is the technique of detecting weeds by naked eye and plucking it by hand or some tool one by one.Hand hoeing is the technique carried out with specific measured mechanical machines that are moved over the fields within plant rows because weeds mostly emerge in between the crop plants [3].Two other means include using chemical sprays applied consistently across the entire field area before planting seeds and after the rise of plants and biological methods that employ natural pests which attack only weeds.There are many parts of the field that have insignificant volume of weeds, but herbicides are also applied in those parts.Applying herbicides by human laborers using back-pack sprayer is very time consuming and costly, but still remains a common practice in many developing countries.By applying same types of herbicides in a field repeatedly, for the removal of the weeds population, there is a probability of appearance of weeds that are tolerant to those types of herbicides.According to the International Survey of Herbicide Resistant Weeds [4], 346 herbicide resistant biotypes that belonged to 194 species (114 dicots and 80 monocots) are spread over 340,000 fields worldwide [5].
The objective of our paper is to present a new model for classifying crops and weeds in digital images by using Support Vector Machines (SVMs) with blob analysis to evaluate its performance in an automated weed control system.Blob analysis is a fundamental technique of machine vision based on the analysis of consistent image regions [6].The most promising techniques to identify weed species in arable crops are based on image processing [7].The aim of this algorithm is to detect crops and weeds based on their features: RGB, centroid, and length.After leaf image acquisition (stored image), image processing techniques are employed for weed detection.Processed image will be handed over to robots.In order to separate soil from plants, image segmentation is used.Binarization method is based on thresholding and is implemented to differentiate soil and plant.The idea that weed and crop seems greener than loam is used to apply the segmentation.Let 'G' represent the green pigment of an RGB image.A grey-scale image is obtained by seeing the 'G' value only.A threshold 'T' value for 'G' is calculated.

G > T
(1) Equation (1) shows the pixels that are plant pixels and vice versa.The binary version is found, where the pixels with a value '0' represent soil and pixels with a value '1' represent plant [5].SVMs has been chosen as the classifier because of their impressive generalization performance, the absence of local minima, and the sparse representation of its solution [8].Our simulation works in two stages: (1) performing a training process and (2) performing a decision making process, where a decision is made between crop and weed.

II. METHODOLOGY
This research work describes the methodology for weed detection process in carrot crops.It follows ten steps.The task flow is shown in Figure 1.The tasks and process represents the steps of the algorithm.Our algorithm includes the following steps.The RGB image will be converted to black and white image.Threshold used here is ten percent.
 Step 8: Blob analysis procedure is used after binarization.Blob analysis is a major technique of machine vision.This is a mean for applications that discriminate the object from background.


Step 9: In last step decision is made.If the weed is present in the image it will be pointed out, if no weed is present then the algorithm will point out nothing and will take another image using try catch loop.


Step 10: It is the termination step that ends the loop and algorithm.After that all the output samples are displayed.

III. RESULTS AND DISCUSION
For better analysis and understanding, the subsequent samples are divided in to three different scenarios: maximum crop sample, maximum weed sample and marginal weed and crop sample

A. Scenario 1: Maximum Crop Sample
This is a situation in which crop is in abundance with respect to the weed or weed is absent in the sample.Due to the presence of crop only, the specified algorithm will detect weed intelligently and after comparison of crop and weed it will not show any pointer as weed is absent.

B. Scenario 2: Maximum Weed sample
Any sample that will have more/maximum weed and minimum/no weed will be categorized in this scenario.Usually the resultant image of scenario two is more clear and easy to analyze because it shows clear pointed weed.An example of scenario 2 can be shown in Figure 4.

C. Scenario 3: Marginal Weed and Crop Sample
Practically, when we observe any field area we find overlapped weed and crop leaves.This intermingling makes the scenario more complex for weed detection.As leaf to leaf comparison is attained for sorting out weed and crop, so that is the most complicated scenario and the accuracy may fluctuate here.Due to the problem's complexity, we have divided scenario 3 into three distinct cases that will help the analysis: a) Case 1: Overlapping Overlapping includes the situation when the leaves of carrot crop are too close to the weed, hence the shape of each leaf will not be prominent.As for leaf to leaf comparison that creates further difficulties to compare the leaf shapes and features, overlapping changes the actual shapes of leaves and that results in less accuracy and complex detection.These cases usually show the minimum accuracy.Such a case is shown in Figure 5.The position in which the leaves of weed and crop are close but their leaves are apart and their shapes are not distorted, we can say that only a minor/no overlapping is there that is fitted in case 2. Due to non-overlapping maximum output is achieved.SVM can clearly differentiate both species.Accuracy in this case is 100%.Such a case is shown in Figure 6.

c) Case 3: Poised Overlapping
If crop and weed are neither separated gently nor as much close to overlap they will be categorized in the moderate overlapping.The output of that image will be more precise.In this case, besides slight overlapping, maximum output is gained.Accuracy rate is 90%.Almost the entire weed is detected.Such a case is shown in Figure 7. Weed is detected using SVMs and a feature extraction technique.The concept of SVMs is concentrated on decision planes that describe decision boundaries.The data is divided into two sets including seventy-two samples for training and eight samples for testing.Algorithm's accuracy varies according to image types and cases.Accuracy varies from 50% to 95%.Images that have distant weed and crop are observed with maximum accuracy while the images that include overlapping leaves have minimum accuracy.The basic three techniques including binary image conversion, SVM, and blob analysis evidenced as a paramount combination of techniques that holds the comparison between weed and crop more wisely.The three techniques seem adaptive and can be applied to diverse images, as two entirely different images are used for testing with varying size, weeds, lighting conditions and backgrounds.

Fig. 1 .
Fig. 1.Task flow  Step 1: Load input sample images.Some input images are shown in Figure 2.

Fig. 5 .
Fig. 5. Image showing maximum overlapping b) Case 2: Non-overlappingThe position in which the leaves of weed and crop are close but their leaves are apart and their shapes are not distorted, we can say that only a minor/no overlapping is there that is fitted in case 2. Due to non-overlapping maximum output is achieved.SVM can clearly differentiate both species.Accuracy in this case is 100%.Such a case is shown in Figure6.