Sunteți pe pagina 1din 8

A Vision-Based Hybrid Classifier for Weeds Detection

in Precision Agriculture Through the Bayesian and Fuzzy


k-Means Paradigms
Alberto Tellaeche1, Xavier-P. BurgosArtizzu2, Gonzalo Pajares3, and Angela Ribeiro2
1

Dept. Informtica y Automtica, E.T.S. Informtica- UNED, 28040 Madrid, Spain


tellaeche@euskalnet.net
2
Instituto de Automtica Industrial. CSIC. Arganda del Rey. Madrid. Spain
{xpburgos,angela}@iai.csic.es
3
Dept. Ingeniera del Software e Inteligencia Artificial, Facultad Informtica, Universidad
Complutense, 28040 Madrid, Spain
pajares@dacya.ucm.es

Abstract. One objective in Precision Agriculture is to minimize the volume of herbicides that
are applied to the fields through the use of site-specific weed management systems. This paper
outlines an automatic computer vision system for the detection and differential spraying of
Avena sterilis, a noxious weed growing in cereal crops. With such purpose we have designed a
hybrid decision making system based on the Bayesian and Fuzzy k-Means (FkM) classifiers,
where the a priori probability required by the Bayes framework is supplied by the FkM. This
makes the main finding of this paper. The method performance is compared against other
available strategies.
Keywords: Bayesian classifier, Fuzzy k-Means, precision agriculture, weeds detection.

1 Introduction
Nowadays, there is a clear tendency of reducing the use of chemicals in agriculture.
Numerous technologies have been developed trying to obtain safer agricultural
products and lower environmental impacts. The concept of Precision Agriculture
provides a valuable framework to achieve this goal [1],[2].
Within this general framework, weeds can be managed site-specifically using
available geospatial and information technologies [3]. Initial efforts to detect weed
seedlings by machine vision were focused on geometrical measurements such as
shape factor, aspect ratio, length / area, etc. [4]. Later, color images were successfully
used to detect weeds and other types of pests [5]. Weed coverage and weed
patchiness, based on digital images, using a fuzzy algorithm for planning site-specific
herbicide applications have been also estimated in [6]. Different approaches have
used spectral colour indices to distinguish plant material from the background [3], [7],
[8]. Avena sterilis L., (winter wild oat) is one of the most widely distributed and
abundant weeds of cereals in Spain and other regions with Mediterranean climate,
causing substantial losses in these crops [9], [10]. The main problem concerning its
E. Corchado et al. (Eds.): Innovations in Hybrid Intelligent Systems, ASC 44, pp. 7279, 2007.
springerlink.com
Springer-Verlag Berlin Heidelberg 2007

A Vision-Based Hybrid Classifier for Weeds Detection

73

detection is that, at the time of herbicide treatment, A. sterilis shape, color and texture
are undistinguishable from those of the crop (barley or wheat). Due to this similarity,
none of the detection methods mentioned previously are applicable to this case.
Our work was based on the hypothesis that a high density of green color in the
inter row areas (where the crop is not present) after postemergence herbicides have
been applied for broadleaf weed control, indicates that these zones are infested by
high densities of A. sterilis, which can be differentially sprayed.
Although there are several approaches to compute shapes or areas as attributes
[11], [12], [13], the computation of unary attributes describing each isolated patch
form is not appropriated in this particular case due to the irregular distribution and
shapes of weed patches. Because of this, we decided to define binary relations among
the weed patches and the crop rows. In order to decide whether the selected area was
to be sprayed or not, the Bayesian and Fuzzy k-Means (FkM) frameworks are
combined for making the decision. This makes the main finding of this work.
This paper is organized as follows. In section 2 the image segmentation process is
described. In section 3 the combined decision making strategy is proposed. The
performance of this approach is described in section 4. Finally in section 5 the
conclusions are presented.

2 Image Segmentation Process


Adquisition. The images used for this study were captured in an experimental field of
barley on La Poveda Research Station, Arganda del Rey, Madrid. The area of the field
was 1.7 ha. Images were taken on two different dates on April 2003. Row spacing
was 0.36 m. Digital images were captured with a Sony DCR PC110E camera. The
area covered by the piece of each image which is to be processed was approximately
1.9x15 m2 and the resolution of an image was 1152x864 pixels.
Binarization. In precision agriculture several techniques have been proposed in
order to isolate weeds and crops [8,12,13,14]. A thresholding approach applied to the
gray level image coming from the RGB original one is applied in [8],

T (i, j ) = rR (i, j ) + gG (i, j ) + bB(i, j ) .

(1)

where r, g and b are set to: r = 1, g = 2 and b = 1; if T (i, j ) 0 then T (i, j ) = 0 ;


if T (i, j ) 255 then T (i, j ) = 255 , i.e. the grey level output values range in [0,255].
The resulting binarized image is morphologically opened as in [13] in order to
remove spurious white pixels and to smooth white contours.
Crop lines detection and grid cell partition. In the opened binary image, plant
material from both weeds and crops is white and the rest, coming from soil, stones
and residual is black. The furrows are wide lines with weeds patches. We apply the
Hough transform as a robust technique in the normal parameter space (polar
coordinates) for describing the furrows [15],[16]. This gives straight-line equations
for accumulations greater than 100 pixels. Two lines are fused in a unique line, if the
differences between the polar angles and distances are less than the two respective
thresholds 1 and 2 , set to 5 and 10 respectively in this paper.

74

A. Tellaeche et al.

By drawing horizontal lines vertically spaced in steps of 50 pixels and taking the
computed crop lines, the image is split in cells. The basic unit to be analyzed is the
cell. Due to the perspective transformation the shape and size of the cells differ
among them along the image, Fig. 1(a).
Attribute extraction. In [4], [12] are used topological properties (area, invariant
moments, etc.); colour (variance, skewness of the intensity histogram, etc.) for weeds
identification. In our experiments they are not applicable because the weeds have
irregular forms and similar spectral signature than the crop cereal. Moreover the
cereal grows uncontrolled in the field. This means that white patches in soil areas
between crops should be weeds and the surrounding crop areas are probably affected
by weed seeds. To solve these problems, we use attributes that are independent of the
weeds distribution and from the size and shape of the cells. Two area-based attributes
are computed and embedded as the components of an area-vector xi, for the cell i, this
vector is: xi = {xi1 , xi 2 } . Let m the total number of connected regions in the cell i (i.e.
the number of white pixels in the cell) and Aij the area of the j-th region. Aic is the total
area of the cell. AiL and AiR the areas for the left and right regions respectively. These
regions correspond to crop areas and after experimentation we assume that they cover
1 6 each one of the total area of the cell. Based on the area measurements the
following coverage values are computed: crop (Cic), weed (Ciw) and soil (Cis),
Cic = AiL + AiR ; Ciw =

A
j =1 ij

Cic and Cis = Aic (Cic + Ciw )

(2)

From equation (2) we compute the components for the area-vector x i as follows,
xi1 =

Ciw
Aic

and

xi 2 =

Ciw
Cic

Cis
1
Aic

(3)

The component xi1 is defined as the weed coverage rate in [14] and xi2 can is the
weed pressure defined in [8]; xi1 and xi2 range in 0, 45 and [0, 5.13] respectively,

[ ]

obtained by giving limit values in (3). They are linearly mapped to range in [0, 1] so
that its contribution is similar.

3 Hybrid Classifier: Bayesian and Fuzzy k-Means


Given xi, representing the attributes of the cell i, the problem is to make a decision
about if the cell must be or not sprayed. This is carried out through the Bayesian
framework. Indeed, the Bayes rule computes the posterior probability,
P(wc | xi ) =

p( xi | wc )P(wc )
, c = y, n
p ( xi )

(4)

where wy, wn represent classes of cells to be and not to be sprayed respectively. P(wc)
is the a prior probability that the cell belongs to the class wc; p(xi) is the twofold
mixture density distribution. So, the decision is made through the equation (5),

)( )

i w y if p xi | w y P w y > p( xi | wn )P(wn ) ; otherwise i wn

(5)

A Vision-Based Hybrid Classifier for Weeds Detection

75

The main problems to be solved are the estimations of both the class-conditional
probability density functions p( x i | w y ) , p( x i | wn ) and the a priori probabilities

P( w y ) , P( wn ) . The first ones are obtained via the well-known parametric Bayesian
estimator assuming a Gaussian distribution [17]. The second ones are derived from a
decision function provided by the FkM approach [17], [18], [19], [20]. This
combination makes the main finding of this paper.
and X n = x1n , x 2n ,..., x nnn two subsets of attribute
Let X y = x1y , x 2y ,..., x ny

vectors representing the cells to be and not to be sprayed respectively,


with X = X y X n ; the number of cells belonging to each subset is ny and nn
respectively, i.e. N = ny + nn. Initially both sets are selected under the supervision of
the technical consultants and farmers.
Prior probability by FkM: given the number of clusters c and following [17],
[18], [19], [20] the FkM algorithm is based on the minimization of the objective
function J,
N c

J (U ; v ) = ijm d ij2 .

(6)

i =1 j =1

subject to

j =1

i =1

ij [0,1] ; ij = 1 ; ij < N ; 1 j c , 1 i N .

(7)

In our approach the clusters are wy wn, i.e. c = 2 and v = {v1 , v 2 } . These cluster
centers are to be updated. The Nxc matrix U = [ ij ] contains the membership grade of
2

pattern i with cluster j; d ij

(xi , v j ) is also the squared Euclidean distance. The

number m is called the exponent weight [19]. In order to minimize the objective
function in (6), the cluster centers and membership grades are chosen so that high
memberships occur for samples close to the corresponding cluster center. The higher
the value of m, the less those samples whose memberships are low contribute to the
objective function. Consequently, such samples tend to be ignored in determining the
cluster centers and membership degrees [19], [20].
The original FkM computes for each xi at the iteration k its membership grade and
updates the cluster centers according to equation (8),

( (d

ij (k ) =

c
r =1

The

stopping

ij ( k )

criterion

d ir (k )

of

2 ( m 1) 1

the

in=1 ijm (k ) xi
; v j (k + 1) =
n
i =1 ijm (k )

iteration

process

is

achieved

(8)
when

ij (k + 1) ij (k ) < ij or a maximum number of iterations is reached.


Once the cluster centers vj are estimated, we can compute the membership degrees
for xi through (8) obtaining iy (in = 1 iy).
We identify the a priori probabilities as P( w y ) = iy and P( wn ) = in . Now, the
decision through the equation (5) can be made.

76

A. Tellaeche et al.

4 Comparative Analysis and Performance Evaluation


4.1 Design of a Test Strategy

In order to assess the validity of the proposed hybrid approach, we have designed a
test strategy with the following three goals:
1) to compare the performance of the attributes used
2) to verify the performance of the proposed combined approach against single
strategies
3) to compare the performance with respect the number of images processed.
In our approach we use two attributes, xi1 and xi2. As described in the section 2, xi1
and xi2 are used individually in [8] and [14] respectively.
Performance of the attributes. In order to compare this performance we identify three
tests: Test 1, which uses both attributes xi1 and xi2; Test 2, which uses only the
attribute xi1 and Test 3, using only xi2. Hence, this allows the testing of our approach
against the two methods given in [8] and [14].
Performance of the combination. Our proposed strategy (Bayes and FkM) is
compared against the single FkM and Bayesian methods. When Bayes is applyoed
individually, we ignore prior knowledge. Hence, the prior probability in the equation
(5) is fixed to 0.5, which is the intermediate probability value in the range [0,1]. As
we will see later, the combined strategy for Test 1 performs better than the single
ones, as expected. Hence, we use only the combined methods for Tests 2 and 3.
Performance for the number of images. The probability density function and the
membership degrees for the Bayesian and Fuzzy approaches are obtained taking into
account the number of cells (patterns), i.e. the number of images processed. In order
to compare the performance against the number of patterns, the Tests are applyid in
four STEPs (0 to 3). At each STEP, a new set of 30 images with 10 cells per image
are (300 patterns) are added to the previous ones. So, we estimate the probability
density function and compute the membership degrees with the number of cells
available at each STEP, i.e. with 300, 600, 900 and 1200 for STEPs 1, 2 3 and 4
respectively.
Initially, the set of 30 images processed in STEP 0 is selected randomly, where the
number of cells classified as candidate to be sprayed is 48 (16% of 300). With this set
we obtain the initial supervised estimation. Then, for STEPs 1 to 3 the cells classified
as belonging to the class wy /wn are added to the corresponding subsets
X y / X n respectively, from which we estimate the new probability density function
and membership degrees for Bayes and FkM respectively.
4.2 Measurements for Validation

The results obtained for each strategy are checked by technical consultants and
farmers, i.e. under an expert human criterion. The different Tests analysed are based
on the following values:

A Vision-Based Hybrid Classifier for Weeds Detection

77

True Spraying (TS): i.e. number of cells correctly identified to be sprayed.


True No Spraying (TN): i.e. number of cells that do not require spraying correctly
detected.
False Spraying (FS): i.e. number of cells that do not require spraying but identified
as cells to be sprayed.
False No Spraying (FN): i.e. number of cells requiring spraying that they are
identified by the method as cells that do not require spraying.
Traditionally, from these four quantities several measures have been used for
classification. In [21] some of them are analysed. The best ones are those combining
the above four values. We have chosen the correct classification percentage (CCP)
based on the analysis reported in [21], which is defined as follows,

CCP =

TS + TN
TS + FS + TN + FN

(9)

Figure 1(a) displays a representative original image of a cereal crop field to be


sprayed. In (b) the segmented image with the set of cells labeled as F identified as
cells to be sprayed.

(a)

(b)

Fig. 1. (a) original image; (b) segmented image

4.3 Analysis of Results

Table 1 displays the results in terms of the correct classification for the three STEPs.
Our proposed strategy (Bayes and FkM) is verified for Tests 1, 2 and 3. The Bayes
and FkM are individually verified for Test 1. For each STEP the CCP values are
displayed under the CCP columns. Larger score values indicate better performance.
The percentages of cells classified as cells to be sprayed is also displayed (%).
From results in table 1, one can infer that the best performance is achieved by our
proposed approach at each STEP, i.e. through the combined strategy as expected
according to the reports found in the literature [19].
Hence, the fusion of classifiers becomes a suitable approach, which achieves better
results than the single methods. During the Test 1 we obtain better results than those
obtained in Test 2 and Test 3, i.e. the two attributes used in Test 1 perform better than
the single attribute used in Test 2 and 3.

78

A. Tellaeche et al.

Also, the performance improves as the number of pattern samples increases. This
is applicable for all strategies. This means that the number of samples is important.
Additionally, we can see that less percentage of cells classified as units to be
sprayed is achieved by our approach.
This best percentage and its best performance imply that the amount of herbicide
to be applied is reduced by using the proposed hybrid method achieving an important
saving in cost and ground pollution.
Table 1. CCP score values for the different strategies in the three Tests and STEPs
STEP 1

STEP 2

STEP 3

CCP

CCP

CCP

Test 1 (Bayes + FkM)

80

23

86

21

91

18

Test 1 (Bayes)

75

25

81

24

87

22

Test 1 (FkM)

72

28

79

26

85

23

Test 2 (Bayes + FkM)

66

32

70

32

70

32

Test 3 (Bayes + FkM)

70

30

70

31

71

31

5 Conclusions
We propose a new automatic process for detecting weeds in cereal crops. The weeds
and the crops have similar spectral signatures and textures. This represents an
important problem which is addressed under two strategies: segmentation and
decision making.
We apply a segmentation process which combines different techniques. This
implies that the image is ready for making the decision about its spraying.
The decision is based on the fusion of two well-tested classifiers (Bayes and FkM)
under the Bayesian framework making the most important contribution of this paper.
Additionally, the strength of the probability allows us to determine the amount of
herbicide to be applied, making another important finding against methods where the
decision is discrete (yes or not).
The combination of the weed coverage and weed pressure attributes improves the
performance of the approach as compared with the use of these attributes separately.
An important issue that is to be analysed in future works is the robustness of the
proposed approach against illumination variability. This is because the robot-tractor
where the system is installed goes in a direction and its opposite, i.e. the illumination
coming from the natural environment varies. This could be carried by applying
homomorphic filtering, so that the reflectance component is separated from the
illumination [15].
Acknowledgments. Part of the work has been performed under project AGL-200506180-C03-03. Alberto Tellaeche is with Tekniker foundation in Eibar, Gipuzkoa,
Spain, working in Computer Vision tasks and intelligent systems.

A Vision-Based Hybrid Classifier for Weeds Detection

79

References
1. Stafford, J.V.: The role of Technology in the Emergence and Current Status of Precision
Agriculture. In Handbook of precision agriculture (Srinivasan, A. ed.). Food Products
Press. New York. (2006) 19-56
2. Zhang, A., Wang, M. and Wang, N.: Precision Agricuture-a Worldwide Overview.
Computers and Electronics in Agriculture, 36 (2002) 113-132
3. Gerhards, R. and Oebel, H.: Practical Experiences with a System for Site-specific Weed
Control in Arable Crops Using Real-time Image Analysis and GPS-controlled Patch
Spraying. Weed Research, 46 (2006) 185-193
4. Prez, A.J., Lpez, F., Benlloch, J.V. and Christensen, S.: Colour and Shape Analysis
Techniques for Weed Detection in Cereal Fields. Computers and Electroncis in
Agriculture, 25 (2000) 197-212
5. Sgaard, H.T. and Olsen, H.J.: Determination of Crop Rows by Image Analysis without
Segmentation. Computers and Electronics in Agriculture, 38 (2003) 141-158
6. Yang, C.C., Prasher, S.O. Landry, J.A. and Ramaswamy, H.S.: Development of an Image
Processing System and a Fuzzy Algorithm for Site-specific Herbicide Applications.
Precision Agriculture, 4 (2003) 5-18
7. Thorp, K.R. and Tian, L.F.: A Review on Remote Sensing of Weeds in Agriculture.
Precision Agriculture, 5, (2004) 477-508
8. Ribeiro A.., Fernndez-Quintanilla, C., Barroso, J., Garca-Alegre.M.C.: Development of
an Image Analysis System for Estimation of Weed. In Proc. 5th European Conf. On
Precision Agriculture (5ECPA), 2005 pp. 169174
9. Barroso, J., Fernndez-Quintanilla, C., Ruiz, C., Hernaiz, P. and Rew, L.J.: Spatial
Stability of Avena Sterilis ssp. Ludoviciana Populations under Annual Applications of
Low Rates of Imazamethbenz. Weed Research, 44 (2004) 178-186
10. Radics, L., Glemnitz, M., Hoffmann, J. and Czimber, G.: Composition of Weed Floras in
Different Agricultural Management Systems within the European Climatic Gradient. In
Proc. 6th European Weed Research Society (EWRS). Workshop on Physical and Cultural
Weed Control, Lillehammer, Norway, (2004) 58-64
11. Aitkenhead, M.J., Dalgetty, I.A., Mullins, C.E., McDonald, A.J.S. and Strachan, N.J.C.:
Weed and Crop Discrimination Using Image Analysis and Artificial Intelligence Methods.
Computers and Electronics in Agriculture, 39 (2003) 157-171
12. Granitto, P.M., Verdes, P.F. and Ceccatto, H.A.: Large-scale Investigation of Weed Seed
Identification by Machine Vision. Computers and Electronics in Agriculture, 47 (2005) 15-24
13. Onyango, C.M. and Marchant, J.A.: Segmentation of Row Crop Plants from Weeds Using
Colour and Morphology. Computers and Electronics in Agriculture, 39, (2003) 141-155
14. Tian, L.F. and Slaughter, D.C.: Environmentally Adaptive Segmentation Algorithm for
Outdoor Image Segmentation. Computers and Electronics in Agriculture, 21 (1998) 153-168
15. Gonzalez, R.C., Woods, R.E. and Eddins, S.L.: Digital Image Processing using Matlab.
Prentice Hall, New York (2004)
16. Astrand, B. and Baerveldt, A.J.: An Agricultural Mobile Robot with Vision-Based
Perception for Mechanical Weed Control. Autonomous Robots, 13, (2002) 2135
17. Duda, R.O., Hart, P.E. and Stork, D.G.: Pattern Classification, Jhon Willey and Sons, New
York (2001)
18. Zimmermann, H.J.: Fuzzy Set Theory and its Applications, Kluwer Academic Publishers,
Norwell (1991)
19. Sneath, P., Sokal, R.: Numerical Taxonomy: the principle and practice of numerical
classification, W.H. Freeman, San Francisco (1973).

S-ar putea să vă placă și