This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
Reducing the abundance of agricultural weeds involves heavy reliance on herbicide applications. Although these approaches have been successful in increasing farm labour efficiency and crop productivity, concerns regarding the economic and environmental impacts of these weed control practices and the development of herbicide resistance have generated interest in identifying alternative weed control strategies. An automated machine vision system which can distinguish between crops and weeds can be an economically feasible alternative to reduce the excessive use of herbicides. In machine vision technology, the main component of the system is image processing and a classification model to recognize crops and weeds. This paper deals with the use of support vector machines (SVM) for classification in a real time system. The developed system has been tested to determine the robustness and accuracy using least possible features. The analysis of the classification results shows over 97% accuracy over 224 sample images.
Increasing productivity and upgrading plantation systems are the major concerns for accelerating agricultural development. Weeds, perceived as unwanted plants having adaptive characteristics which allow them to survive and reproduce in cropping system, hamper agricultural development by competing with crops for water, light, soil nutrients and space. So, weed control strategies are required to sustain crop productivity. There are several strategies for weed control such as removing weeds manually by human labourers, mechanical cultivation and using agricultural chemicals known as herbicides. Using herbicides is the most common method which has adverse impacts on environment and human health. It also raises some economic concerns. In United States, total cost of herbicides was about $16 billion in 2005 . Major cost ineffective and strategic problem in using herbicides system is that in most of the cases, herbicides are applied uniformly within crop field. There can be many portions of field having no or few weeds but herbicides are also applied there. On the other hand, human involvement in applying herbicides is time consuming and costly. Repeated use of the same herbicide in a field tends to promote the emergence of herbicide tolerant weeds. Over 290 biotypes of herbicide tolerant weeds have been reported in agricultural fields and gardens worldwide .
The economy of Bangladesh is primarily supported by agriculture. The performance of this sector has an overwhelming impact on poverty alleviation, economic development and food security. The total cultivable land of Bangladesh is 8.44 million hectare , which is relatively lower than the total population. Population pressure continues to place a severe burden on productive capacity. For cost-effective land use, crop production and quality must be maximized and the cost of weed control must be minimized. The most commonly used technique for applying herbicides in Bangladesh is to spray the herbicide solution with a knapsack sprayer. This technique is considered to be inefficient and time consuming and recommended safety measures are rarely obtained. So, a machine vision system, having the ability to distinguish between crops and weeds and put herbicides where there are weeds, can be a novel approach which will enhance the profitability and lessen environmental degradation. In this approach, images will be taken from crop field and weeds will be identified by an automated system. The main objective of this work is to use support vector machines as a classification model to classify crops and weeds from digital images and to determine whether this model can be used in real-time.SVM was chosen because of significant advantages of SVM such as good generalization performance, the absence of local minima and the sparse representation of solution .
Much research has investigated various strategies to find out a robust weed control system. A few real-time field systems have been developed. The photo sensor based plant detection systems developed by Shearer and Jones (1991) and Hanks (1996) were able to detect all the green plants and spray only the plants. Islam et al. (2005) used PDA as processing device and measure Weed Coverage Rate (WCR) to discriminate between narrow and broad leaves. Ahmad I. et al.(2007) developed an algorithm to classify images into broad and narrow class based on Histogram Maxima with threshold for selective herbicide application with an accuracy of 95%. Ghazaliet al. (2008) developed an intelligent real-time system for automatic weeding strategy in oil palm plantation using statistical approach GLCM and structural approach FFT and SIFT with a success rate above 80%.
MATERIALS AND METHODS
The images to be used for this study were taken from a chilli field. Also five weed species were chosen which are common in chilli fields of Bangladesh. TABLE I lists the English and Scientific names of chilli and the selected weed species. Fig. 1 shows sample images of chilli and other five weed species.
Fig. 1 Sample images of different plants; (a) chilli (b) pigweed (c) marsh herb (d) lamb's quarter (e) cogongrass (f) burcucumber
The images were taken with an OLYMPUS FE4000 digital camera equipped with a 4.65 to 18.6 mm lens. The camera was pointed directly towards the ground while taking the images. The lens of the camera was 40 cm above the ground level. An image taken with these settings would cover a 30 cm by 30 cm ground area. No flash was used while taking the picture and the image scenes were protected against direct sunlight. The image resolution of the camera was set to 1200x768.The images taken were all RGB images.
Segmentation method was used to separate the plants from soil in images. Thresholding technique was used for this purpose. The fact that plants are greener than soil was used to do segmentation. Let 'G'denotes the green colour component of a RGB image. A gray-scale image was obtained from the original image by considering only the 'G'value. A threshold value of 'G' was then calculated. Let 'T' denotes this threshold value. The pixels with 'G'value greater than 'T' were treated as plant pixels and lower than were soil pixels. For each image, a binary image was obtained by segmentation, where pixels with value '0' represent soil and pixels with value '1' represent plant.
For removing noise from the images, an opening operation was first applied to the binary images. In opening, an erosion operation is followed by a dilation operation. It has the effect of removing small pixel regions . Then a closing operation was applied. In closing, a dilation operation is followed by an erosion operation. It will fill small holes in an object .
Fig. 2 Images of a pigweed; (a) RGB image (b) gray-scale image (c) segmented binary image (d) binary image after noise removal
A total number of fourteen features were extracted from each image. These features can be divided into three categories: colour features, size independent shape features and moment invariants.
Colour Features: Let 'R', 'G' and 'B' denote the red, green and blue colourcomponents respectively. Every component was divided by the sum of all three components to make the colour features independent of different light conditions .
r = (1)
g = (2)
b = (3)
Only plant pixels were used when calculating the colour features, so the features are only based on plant colour not soil colour. The colour features used were: mean value of 'r', mean value of 'g', mean value of 'b', standard deviation of 'r', standard deviation of 'g' and standard deviation of 'b'.
Size Independent Shape Features:The size independent features used for this study were:
Formfactor = (4)
Elongatedness = (5)
Convexity = (6)
Solidity = (7)
Here, area is the number of pixels with value '1' in a binary image.Perimeter is defined as the number of pixels with value '1' for which at least one of the eight neighbouring pixels is a soil pixel. Thickness is twice the number of shrinking steps (elimination of border pixels one layer per step) to make an object within an image disappear . Convex area is the area of the smallest convex hull that contains all objects in an image. Convex perimeter is the perimeter of the convex hull that contains all objects in an image.
Moment Invariant Features:The moments determine how spread an object's area is . The following moment invariants were used:
Î¦1 = Î·2,0 + Î·0,2 (8)
Î¦2 = (Î·2,0 + Î·0,2)2 + 4Î·1,12 (9)
Î¦3 = (Î·3,0 - 3Î·1,2)2 + (Î·0,3 - 3Î·2,1)2 (10)
Î¦4 = (Î·3,0 + Î·1,2)2 + (Î·0,3 + Î·2,1)2 (11)
f(x,y) is '1' for those pairs of (x,y) that correspond to plant pixels and '0' for soil pixels. The moment features are invariant to rotation and reflection. The moment invariants were calculated on object area. Natural logarithm was used to make the moment invariants more linear.
Classification Using Support Vector Machines
In SVM, a classiï¬cation task usually involves separating data into training and testing sets. Each instance in the training set contains one "target value" (i.e. the class labels) and several "attributes" (i.e. the features or observed variables). The goal of SVM is to produce a model (based on the training data) which predicts the target values of the test data given only the test data attributes . A training set of tuples and their associated class labels was used. Each tuple is represented by an n-dimensional feature vector,
Here, 'X' depicts n measurements made on the tuple from n features.There are six classes labelled 1 to 6 as listed in TABLE I.
SVM requires that each data instance is represented as a vector of real numbers. As the feature value for the dataset can have the value in dynamic range, dataset needs to be normalized to avoid attributes in greater numeric ranges dominating those in smaller numeric ranges. LIBSVM 2.91 was used for support vector classification . Each feature value of the dataset was scaled to the range of [0, 1]. RBF (Radial-Basis Function) kernel was used for SVM training and testing. As this kernel nonlinearly maps samples into a higher dimensional space so it can handle the case when the relation between class labels and features is nonlinear . RBF kernel requires two parameters: 'Î³' and a penalty parameter, 'C'. Appropriate values of 'C' and 'Î³' should be calculated to achieve high success rate in classification. For this study, the values of these two parameters were C = 1.00 and Î³= 1 / total number of features.
Result and Discussion
A common testing procedure is to separate the data set into two parts, of which one is considered unknown. The performance of classifying an independent testing data set is reflected by the prediction accuracy obtained from the "unknown" set. Cross validation is an improved version of this procedure which prevents the overï¬tting problem. Ten-fold cross validation was selected for the testing purpose. In ten-fold cross-validation, the training set is divided into ten subsets of equal size. Sequentially one subset is tested using the classiï¬er trained on the remaining nine subsets. Thus, each instance of the whole training set is predicted once so the cross-validation accuracy is the percentage of data which are correctly classiï¬ed. The cross validation result of the developed system using all features was 95.9% over 224 samples.
All crop images were identified correctly by SVM. But in case of weed images, there were some misclassifications. Five images of pigweed were misclassified as burcucumber. One image of burcucumber was misclassified as pigweed. Two images of marsh herb were misclassified aslamb'squarters. No weed image was misclassified as Chilli. The overall classification result is shown in TABLEII.
CLASSIFICATION RESULT USING ALL FEATURES
English Name of Samples
Number of Samples
Number of Misclassified Samples
Average Success Rate
To select the set of features which gives the best classification result, both forward-selection and backward- elimination methods were used. In forward-selection, selection process starts with one feature and other features are added one at a time. At each step, each feature that is not already in the set is tested for inclusion in the set. This process continues until no significant improvement in classification result is observed. In backward-elimination, the process starts with all features included. At each stage, the least significant feature is eliminated from the set. This process continues until a certain criterion is met. These two processes can be combined to find an optimal set of features. This process is called stepwise selection. In stepwise selection, features are added as in forward selection, but after a feature is added, all the features in the set are candidates for backward-elimination. Using this method, a set of nine features was selected which produce the best classification rate. Those nine features were:
Mean value of 'r'
Mean value of 'b'
Standard deviation of 'r'
Standard deviation of 'b'
log(Î¦1) of area
log(Î¦2) of area
log(Î¦4) of area
The result of ten-fold cross validation using these nine features was 97.3%. Four images of pigweed were misclassified as burcucumber and two images of burcucumber were misclassified as pigweed. All other images were classified accurately. The overall classification result using these nine features is given in TABLEIII.
CLASSIFICATION RESULT USING BEST FEATURES
English Name of Samples
Number of Samples
Number of Misclassified Samples
Average Success Rate
An automated weeding system must have the ability to identify crops and weeds automatically and treat them accordingly. Machine vision system based on digital image processing is found to be the most efficient sensor detection technique. For real time implementation of this machine vision system, an efficient classification model is required which can classify crops and weeds with a high accuracy ratio. The goal of this paper was to test the feasibility of support vector machines in crops and weeds classification. From the results, it is clear that SVM provides very high accuracy ratio and it is also quite robust. To classify mixed weeds, further research is required. One way is to divide the image into smaller regions and work with a single region at a time. Thus, there will be less possibility to find more than one weed classes in this small region.