World Academy of Science, Engineering and Technology 14 2008
An Improved Fuzzy Algorithm for Image Segmentation Majid Gholamiparvar Masooleh, and Seyyed Ali Seyyed Moosavi
more computational resources. According to [5], fuzzy approaches for image segmentation can be categorized into four classes: segmentation via threshholding, segmentation via clustering, supervised segmentation, and rule based segmentation. Among these categories, rule based approaches are able to take advantage of application dependent heuristic knowledge, and model them in the form of fuzzy rules. In [6], a set of fuzzy rules are established based on fuzzy variables, which are associated with the membership values of pixels obtained by the fuzzy c-mean clustering approach (FCM) [7] and the possibilistic c-mean clustering approach (PCM) [8], to construct a correction matrix for modifying the fuzzy partition matrix. In [9], a fuzzy reasoning method in conjunction with a PSO is employed for color image classification through region merging. In this paper we present a novel approach for color classification which is used in RoboCup soccer in the Middle size League and it can be applicable for other machine vision applications as well. The aim of this work is to retrieve images according to their dominant(s) color(s) expressed through linguistic expressions, and implementation through a vision system. The main problem occurs by the huge number of fuzzy rules. These rules decrease the pace of classifying data. So what we need is an efficient method to classify data while decreasing the number of the concerning rules. In this paper a Particle Swarm Optimization (PSO) method has been used for an automatic production of fuzzy rules and generation of an optimized membership function. The so called PSO method emerges and allies itself to Evolutionary Algorithms based on simulation of the behavior of a flock of birds or school of fish, and it’s proven to have great potential for multi-objective optimization applications [10]. Swarm Algorithms differ from Evolutionary Algorithms most importantly in both metaphorical explanation and how they work. What is new with the Swarm Algorithm is that the individuals (particles) persist over time, influencing one another’s search of the problem space. This paper organized as follows: The second section contains the fundamental of fuzzy color classification, in the third section optimization using PSO is presented and in the fourth section PSO-based Fuzzy Classification System is defined. Our experimental setup and results are shown in section five. Finally, conclusions and discussions come in section six.
Abstract—In this paper we propose a color classification algorithm in which Particle Swarm Optimization method optimizes a fuzzy system for Color Classification and Image Segmentation with least number of rules and minimum error rate. In this approach each particle of the swarm codes a set of fuzzy rules. During evolution, each member of population tries to maximize a fitness norm which has designed due to high classification rate and small number of rules. Finally, the particle with the highest fitness value is selected as the best set of fuzzy rules for image segmentation. Fuzzy sets are defined on the H, S and L components of the HSL Color Space to provide a fuzzy-based model which aims to follow the human intuition of Color Classification. Color-based vision applications face the challenge of color variations by illumination. The Final system designed by this method is adaptive to continuous variable lighting according to its evolvingfuzzy nature. In this method parameters setting's done only once .The experimental results in RoboCup leagues demonstrate that the presented approach can be very robust to noise and light variations.
Keywords—Image Segmentation, Fuzzy reasoning, Particle Swarm Optimization, Fuzzy Color Classification. I. INTRODUCTION
M
ANY color vision systems require a first step of classifying pixels of a given image into a discrete set of color classes. This early vision step plays an important role in machine vision application. RoboCup soccer is a color-coded environment, where colors are used to define principal objects needed by the robots to perform their tasks. Color variation by illumination is one of the most concerning matters in colorbased vision applications. To address this concern, adaptive color modeling has attracted intense research interests, and its use in color tracking applications shows promising results like [1], [2] and [3].Good color segmentation allows for easy implementation of object recognition and localization. Most of the robot vision systems are based on fast and accurate implementation of such processes. Most of the teams in RoboCup soccer, recognize and locate objects from a rough segmentation (e.g. [4]), applying more sophisticated recognition techniques (e.g., region growing) at a later stage. However, this second approach may be less reliable or require
M. Gholamiparvar. M. was with the Islamic Azad University of Qazvin, Qazvin, Iran. He is now a faculty member of the Computer Engineering Department of Islamic Azad University of Abhar, Abhar, Iran (e-mail: gholami.parvar
[email protected]). S. Ali S. Moosavi, is with Islamic Azad University of Qazvin, Qazvin, Iran (e-mail:
[email protected]).
400
World Academy of Science, Engineering and Technology 14 2008
II. FUZZY COLOR CLASSIFICATION
To complete the Modelization, it is necessary to take into account the two other dimensions (L and S). Each colorimetric qualifier is associated to one or both dimension(s). To facilitate the process, each dimension interval is divided into three sub-intervals: low value, average value and strong value. Thus, we obtain six "one dimension-dependent" qualifiers and nine "two dimension-dependent" qualifiers. Fig. 3 shows the nine "two dimension-dependent" qualifiers denoted by Q [12]. Each qualifier of Q is associated to a Membership Function varying between 0 and 1.
Fuzzy color segmentation is a supervised learning method for segmentation of color images. This method assigns a color class to each pixel of an input image by applying a set of fuzzy rules on it. A set of training image pixels, for which the colors are known are used to train the fuzzy system at first step. The trained fuzzy system will be later evaluated on test images. Our vision system uses HSL color space for color classification. HSL space (Hue, Saturation and Lightness) is a space that characterizes the color directly, thanks to its hue! Indeed hue is enough to recognize the color, except when the color is very pale or very somber. In this space saturation corresponds to the quantity of "white" in the color and lightness corresponds to the light intensity of the color. Thus, the identification of color is made in two steps: first H, then L & S, as it can be seen in Fig. 3. As an example, H dimension in Fig. 2 is partitioned into nine trapezoidal membership functions each one coding a different color. Another important problem about color spaces is uniformity of scale. HLS space is quite convenient of this problem, but it is a non-UCS (Uniform Color Scale) Space [11]. Indeed our eyes don't perceive small variations of hue when color is green (h = ±85) or blue (h = ±170) while they perceive it very well with orange (h = ±21) for example.
Fig. 3 Fundamental Color Qualifiers
III. PARTICLE SWARM OPTIMIZATION Particle Swarm Optimization (PSO) is an evolutionary computation technique (a search method based on a natural system) developed by Kennedy and Eberhart [14] [15]. Like a Generic Algorithm (GA), PSO is a population based optimization tool. However, unlike GA, PSO has no evolution operators such as Crossover and Mutation, and moreover, PSO has less parameters. PSO is an evolutionary algorithm that does not implement survival of the fittest, and unlike other evolutionary algorithms where an evolutionary operator is manipulated, the velocity is dynamically adjusted. The system initially has a population of random solutions. Each potential solution, called a particle, is given a random velocity and is flown through the problem space. The
Fig. 1 The HSL Space
Thus, to model the fact that the distribution of colors is not uniform on the circle of hues, Truck in [12], propose to represent them with trapezoidal or triangular Fuzzy Subsets. Several other works have been done in the field of none uniformly distributed scales: for example, Herrera and Martinez use Fuzzy Linguistic Hierarchies with more or less labels, depending on the desired granularity [13]. Similarly, [12] associated colors with fuzzy sets. Indeed, for each color of Г they built a Membership Function varying from 0 to 1. If this function is equal to 1, the corresponding color is a "true color" (Fig. 2). Fig. 4 Dimensions L and S
particles have memory and each particle keeps track of its ) and its corresponding previous best position (called the for the respective fitness. There exist a number of particles in the swarm and the particle with greatest fitness is
Fig. 2 The Dimension H
401
World Academy of Science, Engineering and Technology 14 2008
fuzzy sets of the generated Fuzzy Classification System. A set of L individuals called population (P), is expressed as following:
) of the swarm. The basic concept called the global best ( of the PSO technique lies in accelerating each particle towards its and locations, with a random weighted acceleration at each time step. The main steps in the particle swarm optimization process can be described as follows: (I). Initialize a population of particles with random positions and velocities in d dimensions of the problem space and fly them. (II). Evaluate the fitness of each particle in the swarm. (III). for every iteration compare each particle’s fitness with its previous best fitness ( ) obtained. If the current value is better than , then set equal to the current value and the location equal to the current location in the d-dimensional space. of particles with each other and (IV). Compare update the swarm global best location with the greatest fitness ( ). (V). Change the velocity and position of the particle.
(2) In order to evolutionarily determine the parameters of the Fuzzy Classification System, the individual
contains two
. The parameter vector
parameter vectors:
consists of the premise parameters of the candidate fuzzy rules, where B is a user-defined positive integer to decide the maximum number of Fuzzy Rules in the rule base generated by the individual
. Here,
is the parameter vector to determine the membership functions of the j-th fuzzy rule,
and represent the velocity and position of the i-th particle with d dimensions, respectively, and are two uniform random functions, and W is the inertia weight, which is chosen beforehand.
where is the parameter vector to determine the membership function for i-th input variable. The parameter vector is used to select the Fuzzy Rules from the candidate rules. , then the j-th candidate rule
If
)
is added to the
whose value rule base. Consequently, the total number of is greater than or equal to 0.5, is the number of Fuzzy Rules in the generated rule base. In order to generate the rule base, the
(1) (VI). Repeat steps (II) to (V) until convergence is reached based on some desired single or multiple criteria. PSO has many parameters and these are described as follows: W, called the inertia weight controls the exploration of the search space because it dynamically adjusts velocity. Local minima are avoided by small local neighborhoods, but faster convergence is obtained by a larger global neighborhood, and in general a global neighborhood is preferred. Synchronous updates are more costly than the asynchronous updates. is the maximum allowable velocity for the particles (i.e. in the case where the velocity of the particle exceeds , then it is ). Thus, resolution and fitness of search limited to depends on . The constants and in, termed as cognition and social components, respectively, are the acceleration constants which changes the velocity of a particle towards and (generally, somewhere between and ). The velocities of the particles determine the tension in the swarm.
index j of
whose value is greater than or equal to 0.5 is
where represents defined as the number of the fuzzy rules in the generated rule base. generates the premise part of the . fuzzy rule base generated by the individual Consequently, the rule base of the generated Fuzzy Classification System is described as follows: r-th rule: if is
, then with
is
and
is
and … and belongs to class where
are the fuzzy sets of the generated r-th fuzzy rule. In order to determine the consequent parameters and of the r-th fuzzy rule, a procedure is described as follows [16]:
IV. PSO-BASED FUZZY CLASSIFICATION SYSTEM In the PSO-based method, each individual is represented to determine a Fuzzy Classification System. The individual is used to partition the input space so that the rule number and the premise part of the generated Fuzzy Classification System are determined. Subsequently, the consequent parameters of the corresponding fuzzy system are obtained by the premise
Step 1. Step2. Step3. Determine the grade of certainty, r-th fuzzy rule by:
402
, of the
World Academy of Science, Engineering and Technology 14 2008
where
(3)
Thus, the consequent parameters of the generated Fuzzy Classification System are determined by the above procedure. According to the above description, each individual corresponds to a Fuzzy Classification System. In order to construct a Fuzzy Classification System which has an appropriate number of fuzzy rules and minimize incorrectly classified patterns simultaneously, the fitness function has defined as follows:
and
and
Step2. Select particle’s neighbors. For each particle generate as follows: Select two particles randomly, if Fitness[ then , else .
are defined as follows:
Step3. Update the vector follows:
and Here patterns,
and () and
(4) Where
randomly. Each
(c) Generate initial velocity vectors velocity is expressed as follows:
Symbol
Population size Max number of rules Max number of iterations Constants of fitness Constants of PSO
L B
Initialization Value Variable 90
K
400
and
510 (1,1,1,0.6)
, () + 0.5
Step4. Calculate the best position met by each individual and best position met by its neighbors, by using equations number (4) and (5).
TABLE I PSO PARAMETERS Parameter Name
then
If
is the number of incorrectly classified is the number of fuzzy rules in the rule-base of the
as
Step5. Update the velocity vectors and positions by using equations number (6) and (7). Step6. Decrease the equations:
and
velocities using following
generated Fuzzy Classification System, and and are user-defined constants for the fitness function. Subsequently, a PSO-based method is generated to find an appropriate individual so that the corresponding Fuzzy Classification System has the desired performance. Consequently, the overall procedure can be stated as:
Step7. Check stopping criteria: If K then go to Step8; otherwise go to Step3.
Step1. Initialize the PSO-based method. (a) Set the number of individuals (L), the maximum number of rules (B), the number of generations (K), the constants for the fitness function ( and ) and the constants for the PSO algorithm ( ), according to Table I. (b) Generate initial population P, randomly. Each individual of the population would be expressed as follows:
A. Practical Data Practical Data has been obtained from colored images of Middle Sized RoboCup soccer field. Robustness of the classification in the variable light was aimed. Practical data is classified into 10 different colors (red, orange, yellow, green, cyan, blue, purple, magenta and pink). 1200 samples were selected from each color class while 200 samples were randomly selected as test samples and 1000 samples as practical data. Totally, 10000 practical data samples and 2000 test samples have been used for all of the colors.
Step8. Stop: Report particle with the best fitness value as best rule bas. V. SIMULATION RESULTS
where,
and
Membership function Trapezoidal
and ()
and
No. of rules 90
() Note that fuzzy set.
has been set with regard to
403
TABLE II ANFIS PERFORMANCE Membership function Gaussian
Membership function Triangular
efficiency No. of rules efficiency No. of rules efficiency 60 %
90
81.49 %
90
77.63 %
World Academy of Science, Engineering and Technology 14 2008
First generation
Random Based on ANFIS
TABLE III PSO PERFORMANCE Membership Membership function function Trapezoidal Gaussian No. of efficiency No. of efficiency rules rules 40 60.32 % 42 51.84 % 47
60.82 %
39
73.34 %
recognition has also improved, due to not only image segmentation performance, but because object recognition routines can reason about the different levels of color uncertainty indicated by core colors, maybe colors, and unknown colors. As the results show, this method uses a fewer number of rules compared to ANFIS method and therefore responds in a shorter time, while its efficiency is almost the same as ANFIS. The first generation calculated with ANFIS has a better efficiency compared to a randomly initialized generation.
Membership function Triangular No. of rules 38
efficiency
36
89 %
53.63 %
B. Fuzzy System The fuzzy system has three inputs for each of HSL dimensions. The number of membership functions for H, S&L inputs and one output are 11, 3, 3 and 10, respectively. A Sugeno Fuzzy System has been used.
REFERENCES [1]
[2]
C. Initialization One of the most effective factors on the system’s efficiency is swarm initialization. This initialization could be random or based on a specific algorithm like neuro-fuzzy. Therefore, first we generate the rules with the use of ANFIS software and then optimized them. As it can be seen from the results in Table II & III, the efficiency of the algorithm when we use ANFIS algorithm for initialization, is much better than a random initialization. If we use a random initialization, the chance of reaching the optimum answer is low because the algorithm might stop at a local maximum, but with a proper initialization it's possible to reach the Overall Maximum. According to results, a Trapezoidal membership function has lower efficiency compared to Trapezoidal and Gaussian functions. In using ANFIS Gaussian membership functions has a better efficiency. The number of fuzzy rules derived by ANFIS is constant, but with using the presented method we could reduce the number of the rules to one third which makes a big difference.
[3]
[4] [5]
[6]
[7] [8] [9]
[10]
[11]
VI. CONCLUSION [12]
In this paper, we presented a new method based on Particle Swarm Optimization and Fuzzy Logic as an evolutionary approach in robot vision for color image classification. Fuzzy Classification is a Learning Method with observation which we used to classify the different colors. And this Knowledge Based Supervised Fuzzy-Classification uses Particle Swarm Optimization method as an evolutionary algorithm to generate the appropriate number of optimized fuzzy rules. We also presented the effectiveness of this method in comparison with the conventional method using permissible ranges. Our result show certainly that using this method helps so much in variegated lighting environment and also make robots robust to changing the color of their environment in an optimized way. Moreover, color calibration can be undertaken more quickly, as the calibration method encourages the human trainer to identify all possible pixel values for each color of interest, rather than avoiding those that may cause misclassification (e.g. those that occur in shadow or on the borders of different objects within the image). Lastly, object
[13]
[14]
[15] [16]
404
Y. Wu and T. S. Huang. “Color tracking by transductive learning” In Proc. IEEE Int’l Conf. on Compute. Vis. and Patt. Recog., pages 133– 138, 2000. I. Truck, H. Akdag and A. Borgi, "Using Fuzzy modifiers in Colorimetery", Proceedings of the 5th World Multi conference on Systemic, Cybernetics and Informatics, SCI 2001, pp. 472-477, Orlando, Florida, USA, 2001. K. Nummiaro, E. B. Koller-Meier, and L. Van Gool. “Object tracking with an adaptive color-based particle filter”. Symposium for Pattern Recognition of the DAGM, pages 355–360, 2002. N. Lovell. “Illumination independent object recognition” In RoboCup 2005: Robot Soccer World Cup IX, 2005. J.-C. Bezdek, J.Keller, K. Raghu, N. H. Pal, “Fuzzy models and algorithms for pattern recognition and image processing”, Kluwer Academic Publishers, Boston 1999. Y. A. Tolias, S. M. Panas, “On applying spatial constraints in fuzzy image clustering using a fuzzy rule-based system,” IEEE signal Processing Letters, vol. 5,pp. 245-247, 1998. J. C. Bezdek, “Pattern recognition with fuzzy objective function algorutgns”, Plenum Press New York and London ,pp. 98-110, 1993 R. Krishnapuram, J. M. Keller, “A possibilistic approach to clustering, “IEEE pans, fuzzy System,vol,1, pp,98-110,1993 S. Makrogiannis, G. Eeanomou, S. Fatopoulos, "A fuzzy dissimilarity function for region based segmentation of color images," int. j. pattern recognition, Artificial Intelligent., vol. 15. pp. 255-267,2001 A Coello Coello Carlos and M. S Lechuga, ”MOPSO : A proposal for multiple objective particle swarm optimisation” Proceeding of internationl. Conference on Artificial Neural Nets and Genetic Algorithmes, ICANNGA’97.Springer Verlag, pp. 335-338. 1997. K. Nummiaro, E. B. Koller-Meier, and L. Van Gool. Object tracking with an adaptive color-based particle filter. Symposium for Pattern Recognition of the DAGM, pages 355–360, 2002. I. Truck, H. Akdag and A. Borgi, "A Symbolic Approach for Colorimetric Alterations", proceedings of EUSFLAT 2001, 105-108, Leicester, England, September 2001. F. Herrera and L. Martinez, "A model based on linguistic two-tuples for dealing with multigranularity hierarchical linguistic contexts in multiexpert decision-making", IEEE transactions on Systems, Man and Cybernetics, Part B, 31(2), pp. 227-234, 2001. J. Kennedy and R. Eberhart, "Particle swarm optimization," Proceedings, IEEE International Conf. on Neural Networks, Vol. 4, pp.1942–1948. J. Kennedy, R Eberhart and Y. Shi, Swarm intelligence, Morgan Kaufmann Publishers, 2001. Ishibuch, H., Nozaki, K., Yamamoto, N.and Tanaka, H., “Selecting Fuzzy If-Then Rules for Classification Problems Using Genetic Algortithms,” IEEE Trans. Fuzzy Systems, Vol. 3,pp.260-270(1995).