Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 18

A

Seminar Report
On

Ant Colony Optimization


For Image Edge Detection

Submitted by

M.Manohar Reddy
Roll No: 07AT1A0441
B-Tech (ECE)

Under the esteemed Guidance Of

Mr. S.Nagaraja Rao M.TECH(P.hd)


Head of the Department, Dept. of E.C.E.

G. Pullaiah College of Engineering & Technology


Approved by A.I.C.T.E, Affiliated to J.N.T.U
Kurnool
ABSTRACT

Ant colony optimization (ACO) is an optimization algorithm inspired by the natural behavior
of ant species that ants deposit pheromone on the ground for foraging. Ant colony
optimization (ACO) is a population-based met-heuristic that mimics the foraging behavior of
ants to find approximate solutions to difficult optimization problems. It can be used to find
good solutions to combinatorial optimization problems that can be transformed into the
problem of finding good paths through a weighted construction graph

In this paper, ACO is introduced to tackle the image edge detection problem. The proposed
ACO-based edge detection approach is able to establish a pheromone matrix that represents
the edge information presented at each pixel position of the image, according to the
movements of a number of ants which are dispatched to move on the image. Furthermore, the
movements of these ants are driven by the local variation of the image’s intensity values.
Experimental results are provided to demonstrate the superior performance of the proposed
approach.
I. Introduction

In a colony of social insects, such as ants, bees, wasps and termites, each insect usually
performs its own tasks independently from other members of the colony. However, the tasks
performed by different insects are related to each other in such a way that the colony, as a
whole, is capable of solving complex problems through cooperation. Important, survival-
related problems such as selecting and picking up materials, finding and storing food, which
require sophisticated planning, are solved by insect colonies without any kind of supervisor
or centralized controller. This collective behavior which emerges from a group of social
insects has been called “swarm intelligence”. In this paper we are interested in a particular
behavior of real ants, namely the fact that they are capable of finding the shortest path
between a food source and the nest (adapting to changes in the environment) without the use
of visual information. This intriguing ability of almost-blind ants has been extensively
studied by ethnologists. They discovered that, in order to exchange information about which
path should be followed, ants communicate with one another by means of pheromone (a
chemical substance) trails. As ants move, a certain amount of pheromone is dropped on the
ground, marking the path with a trail of this substance. The more ants follow a given trail, the
more attractive this trail becomes to be followed by other ants. This process can be described
as a loop of positive feedback, in which the probability that an ant chooses a path is
proportional to the number of ants that have already passed by that path.

When an established path between a food source and the ants’ nest is disturbed by the
presence of an object, ants soon will try to go around the obstacle. Firstly, each ant can
choose to go around to the left or to the right of the object with a 50%-50% probability
distribution. All ants move roughly at the same speed and deposit pheromone in the trail at
roughly the same rate. Therefore, the ants that (by chance) go around the obstacle by the
shortest path will reach the original track faster than the others that have followed longer
paths to circumvent the obstacle. As a result, pheromone accumulates faster in the shorter
path around the obstacle. Since ants prefer to follow trails with larger amounts of pheromone,
eventually all the ants converge to the shorter path.

The paper is organized as follows. In Section II, a brief introduction is provided to present
the fundamental concepts of ACO. Then, an ACO-based image edge detection approach is
proposed in Section III. Experimental results are presented in Section IV. Finally, Section V
concludes this paper.
II. Ant Colony Optimization

An Ant Colony Optimization algorithm (ACO) is essentially a system based on agents


which simulate the natural behavior of ants, including mechanisms of cooperation and
adaptation. In the use of this kind of system as a new meta-heuristic was proposed in order to
solve combinatorial optimization problems. This new meta-heuristic has been shown to be
both robust and versatile – in the sense that it has been successfully applied to a range of
different combinatorial optimization problems .

ACO algorithms are based on the following ideas:


 Each path followed by an ant is associated with a candidate solution for a given
problem.
 When an ant follows a path, the amount of pheromone deposited on that path is
proportional to the quality of the corresponding candidate solution for the target
problem.
 When an ant has to choose between two or more paths, the path(s) with a larger
amount of pheromone have a greater probability of being chosen by the ant.

As a result, the ants eventually converge to a short path, hopefully the optimum or a near-
optimum solution for the target problem, as explained before for the case of natural ants. In
essence, the design of an ACO algorithm involves the specification of an appropriate
representation of the problem, which allows the ants to incrementally construct/modify
solutions through the use of a probabilistic transition rule, based on the amount of pheromone
in the trail and on a local, problem-dependent heuristic.

 A method to enforce the construction of valid solutions, that is, solutions that are
legal in the real-world situation corresponding to the problem definition.
 A problem-dependent heuristic function (η) that measures the quality of items that can
be added to the current partial solution.
 A rule for pheromone updating, which specifies how to modify the pheromone trail (τ
).
 A probabilistic transition rule based on the value of the heuristic function (η) and on
the contents of the
 Pheromone trail (τ ) that is used to iteratively construct a solution.
 Artificial ants have several characteristics similar to real ants, namely:
 Artificial ants have a probabilistic preference for paths with a larger amount of
pheromone5
 Shorter paths tend to have larger rates of growth in their amount of pheromone.
 The ants use an indirect communication system based on the amount of pheromone
deposited on each path.

In the real world, ants (initially) wander randomly, and upon finding food return to their
colony while laying down pheromone trails. If other ants find such a path, they are likely not
to keep travelling at random, but to instead follow the trail; returning and reinforcing it if they
eventually find food (see Ant communication).

Over time, however, the pheromone trail starts to evaporate, thus reducing its attractive
strength. The more time it takes for an ant to travel down the path and back again, the more
time the pheromones have to evaporate. A short path, by comparison, gets marched over
faster, and thus the pheromone density remains high as it is laid on the path as fast as it can
evaporate. Pheromone evaporation has also the advantage of avoiding the convergence to a
locally optimal solution. If there were no evaporation at all, the paths chosen by the first ants
would tend to be excessively attractive to the following ones. In that case, the exploration of
the solution space would be constrained.

Thus, when one ant finds a good (i.e., short) path from the colony to a food source, other
ants are more likely to follow that path, and positive feedback eventually leads all the ants
following a single path. The idea of the ant colony algorithm is to mimic this behavior with
"simulated ants" walking around the graph representing the problem to solve.

Detailed Work:
The original idea comes from observing the exploitation of food resources among ants, in
which ants’ individually limited cognitive abilities have collectively been able to find the
shortest path between a food source and the nest.

 The first ant finds the food source (F), via any way (a), then returns to the nest (N),
leaving behind a trail pheromone (b)
 Ants indiscriminately follow four possible ways, but the strengthening of the runway
makes it more attractive as the shortest route.
 Ants take the shortest route; long portions of other ways lose their trail pheromones.
In a series of experiments on a colony of ants with a choice between two unequal length
paths leading to a source of food, biologists have observed that ants tended to use the shortest
route. A model explaining this behavior is as follows:

 An ant (called "blitz") runs more or less at random around the colony;
 If it discovers a food source, it returns more or less directly to the nest, leaving in its
path a trail of pheromone;
 These pheromones are attractive, nearby ants will be inclined to follow, more or less
directly, the track;
 Returning to the colony, these ants will strengthen the route;
 If there are two routes to reach the same food source then, in a given amount of time,
the shorter one will be traveled by more ants than the long route;
 The short route will be increasingly enhanced, and therefore become more attractive;
The long route will eventually disappear because pheromones are volatile;
 Eventually, all the ants have determined and therefore "chosen" the shortest route.

Ants use the environment as a medium of communication. They exchange information


indirectly by depositing pheromones, all detailing the status of their "work". The information
exchanged has a local scope, only an ant located where the pheromones were left has a notion
of them. This system is called "Stigmergy" and occurs in many social animal societies (it has
been studied in the case of the construction of pillars in the nests of termites). The mechanism
to solve a problem too complex to be addressed by single ants is a good example of a self-
organized system. This system is based on positive feedback (the deposit of pheromone
attracts other ants that will strengthen it themselves) and negative (dissipation of the route by
evaporation prevents the system from thrashing). Theoretically, if the quantity of pheromone
remained the same over time on all edges, no route would be chosen. However, because of
feedback, a slight variation on an edge will be amplified and thus allow the choice of an edge.
The algorithm will move from an unstable state in which no edge is stronger than another, to
a stable state where the route is composed of the strongest edges.

Proposed method:

ACO aims to iteratively find the optimal solution of the target problem through a guided
search (i.e., the movements of a number of ants) over the solution space, by constructing the
pheromone information. To be more specific, suppose totally K ants are applied to find the
optimal solution in a space χ that consists of M1 × M2 nodes, the procedure of ACO can be
summarized as follows.

 Initialize the positions of totally K ants, as well as the pheromone matrix τ (0).
 For the construction-step index n = 1 : N,
- For r the ant index k = 1 : K,

∗ consecutively move the k-th ant for L steps, according to a probabilistic transition
matrix

P(ni , )j (With a size of M1M2 ×M1M2).

– Update the pheromone matrix τ(n).

• Make the solution decision according to the final pheromone matrix τ(N).

There are two fundamental issues in the above ACO process; that is, the establishment of
the probabilistic transition matrix p (n) and the update of the pheromone matrix τ (n), each of
which is presented in detail as follow, respectively. First, at the n-th construction-step of
ACO, the k-th ant moves from the node i to the node j according to a probabilistic action rule,
which is determined by [4].

∝ β
(τ (n−1)
i , j ) (ηi , j )
, if jε Ω j----------- (1)
(n )
P =
i, j ∝ β
Σjε Ω j (τ (n−1)
i , j ) (ηi , j )

where τ (n−1) i,j is the pheromone information value of the arc linking the node i to the node
j; Ω j is the neighborhood nodes for the ant ak given that it is on the node i; the constants α
and β represent the influence of pheromone information and heuristic information,
respectively; ηi,j represents the heuristic information for going from node i to node j, which is
fixed to be same for each construction-step. Second, the pheromone matrix needs to be
updated twice during the ACO procedure. The first update is performed after the movement
of each ant within each construction step. To be more specific, after the move of the k-th ant
within the n-th construction-step, the pheromone matrix is updated as

( 1− p ) . τ i , j(n−1) + ρ . Δ(k)
τi, j (n−1 )
= { τi, j (n −1 )
i, j
------- (2)
where ρ is the evaporation rate. Furthermore, the determination of best tour is subject to the
user-defined criterion, it could be either the best tour found in the current construction-step,
or the best solution found since the start of the algorithm, or a combination of both of the
above two [4]. The second update is performed after the move of all K ants within each
construction-step; and the pheromone matrix is updated as [4].

where ψ is the pheromone decay coefficient. Note that the ant colony system [6] performs
two update operations (i.e, (2) and (3)) for updating the pheromone matrix, while the ant
system [3] only performs one operation (i.e., (3)).

τ (n)= (1−ψ ) . τ (n−1) +ψ . τ(0)-------------- (3)


III. Proposed ACO-Based Image Edge Detection Approach

The proposed ACO-based image edge detection approach aims to utilize a number of ants
to move on a 2-D image for constructing a pheromone matrix, each entry of which represents
the edge information at each pixel location of the image. Furthermore, the movements of the
ants are steered by the local variation of the image’s intensity values. The proposed approach
starts from the initialization process, and then runs for N iterations to construct the
pheromone matrix by iteratively performing both the construction process and the update
process. Finally, the decision process is performed to determine the edge. Each of this
process is presented in detail as follows, respectively

A. Initialization Process
Totally K ants are randomly assigned on an image I with a size of M1 ×M2, each pixel of
which can be viewed as a node. The initial value of each component of the pheromone matrix
τ (0) is set to be a constant τinit.

B. Construction Process
At the n-th construction-step, one ant is randomly selected from the above-mentioned total K
ants, and this ant will consecutively move on the image for L movement-steps. This ant
moves from the node (l,m) to its neighboring node (i, j) according to a transition probability
that is defined as

α β
(n ) (τ(n−1)
i , j ) (ηi , j )
p =
( l , m) ,(i , j) ∝ β ---------- (4)
Σ (i, j)ε Ω (l , m) (τ(n−1)
i , j ) (ηi , j )

i , j is the pheromone value of the node (i, j), Ω l , m ¿ ¿is the neighborhood nodes of the
where τ (n−1)

node (l,m), (ηi , j )β represents the heuristic information at the node (i, j). The constants α and β
represent the influence of the pheromone matrix and the heuristic matrix, respectively.

There are two crucial issues in the construction process.The first issue is the determination of
the heuristic information ηi,j in (4). In this paper, it is proposed to be determined by the local
statistics at the pixel position (i, j) as

η 1 ------------ (5)
i , j=¿ V (I )¿
Z c ( i, j )
Fig 4.1 A local configuration at the pixel position I (i , j) for computing the variation V c ( I (i , j) ) )
defined in (6). The pixel I (i , j)is marked as gray square.

where Z = Σ i=1 : M Σ j=1 : M V c ( I ( i, j )) which is a normalization factor, I (i , j) is the intensity value


1 2

of the pixel at the position (i, j) of the image I, the function V c ( I (i , j) ) is a function of a local
group of pixels c (called the clique), and its value depends on the variation of image’s
intensity values on the clique c (as shown in Figure 1). More specifically, for the pixel ( I (i , j) )

under consideration, the function V c ( I (i , j) ) is

V c ( I (i , j) ) = f¿ +

(|I i−2 , j+1−I i+2 , j−1|) + (|I i−1, j−2−I i+1 , j+2|) + (|I i−1 , j−1−I i +1 , j +1|) + (|I i−1 , j−I i+1 , j|) + (|I i−1 , j+ 1−Ii−1 , j−1|)
----------- (6)

To determine the function f(·) in (5), the following four functions are considered in this
paper; they are mathematically expressed as follows and illustrated in Figure 2, respectively.

f ( x )= λx , for x ≥ o ,-------------------------- (7)

f ( x )= λ x 2 , for x ≥ o ,------------------------- (8)

πx
f ( x )=f ( x )=
{
sin(

) ,0 ≤ x ≤ λ
0 , else
------------ (9)
πx

{
f ( x )=f ( x )= (
πxSin (
λ
λ
),

0 , else
), 0 ≤ x ≤ λ ---------- (10)

The parameter λ in each of above functions (7)-(10) adjusts the functions’ respective shapes.
The second issue is to determine the permissible range of the ant’s movement (i.e., Ω l , m in
(4)) at the position (l,m). In this paper, it is proposed to be either the 4-connectivity
neighborhood or the 8-connectivity neighborhood, both of which are demonstrated in Figure
3.

Fig 4.2 .Various neighborhoods (marked as gray regions) of the pixel I (i , j):

(a) 4-connectivity neighborhood; and


(b) 8-connectivity neighborhood.

C. Update Process
(a) The proposed approach performs two updates operations for updating the
pheromone matrix. • The first update is performed after the movement of each
ant within each construction-step. Each component of the pheromone matrix is
updated according to
( 1− p ) . τ i , j(n−1) + ρ . Δ(k)
τi, j (n−1 )
= { τi, j (n −1 )
i, j
------- (11)

if (i, j) is visited by the current k-th ant; i, j otherwise.

(b) The second update is carried out after the movement of all ants within each
construction-step according to where ψ is defined in
τ (n)= (1−ψ ) . τ (n−1) +ψ . τ(0),……. (12) Where ψ is defined in (3).

D. Decision Process
In this step, a binary decision is made at each pixel location to determine whether it is
edge or not, by applying a threshold T on the final pheromone matrix τ (n). In this paper, the
above-mentioned T is proposed to be adaptively computed based on the method developed in
[20]. The initial threshold T (0)is selected as the mean value of the pheromone matrix. Next,
the entries of the pheromone matrix is classified into two categories according to the criterion
that its value is lower than T (0) or larger than T(0). Then the new threshold is computed as the
average of two mean values of each of above two categories. The above process is repeated
until the threshold value does not change any more (in terms of a user-defined tolerance). The
above iterative procedure can be summarized as follows.

Step 1:

Initialize T 0 as

Σ i =1 : M Σ j=1 : M τ(N )
0 i,j
T = 1 1
……….. (13) And set the iteration index as l = 0.
M1M2

Step 2:

Separate the pheromone matrixT (N )) into two class usingT (l), where the fist class consists
entries of τ that have smaller values than T (l), while the second class consists the rest entries
of τ . Next, calculate the mean of each of the above two categories via

(l) gTL (l) (τ ¿ ¿i , j (N) )


m =Σ i=1: M Σ j=1 : M
L ¿…….. (14)
Σ i=1 : M Σ j =1 : M hTL (l) (τ ¿ ¿ i , j (N) ) ¿
1 1

1 1

gUT (l) (τ ¿ ¿i , j (N) )


m(l)
U =Σ i=1: M Σ j=1 : M ¿…….. (15)
Σ i=1 : M Σ j =1 : M hUT (l) (τ ¿ ¿ i , j (N) ) ¿
1 1

1 1

Where

(l)
gTL (l)= x if x ≥ T ……… (16)
{
0 Otherwies

(l)
hTL (l)= 1 if x ≥ T ……………. (17)
{0 otherwise

(l)
gUT (l)= x if x ≥T ……………. (18)
{0 otherwise

(l)
hUT (l)= 1 if x ≥ T ……………. (19)
{0 otherwise
Step3

Set the iteration index l = l + 1, and update the threshold as

m (lL )+ m(l)
U
T (l)= …………………….. (20)
2

Step4

If |T(l)−T(n−1)| > , then go to Step 2; otherwise, the iteration process is terminated and a
binary decision is made on each pixel position (i, j) to determine whether it is edge (i.e., Ei , j
= 1), or not (i.e., Ei , j = 0), based on the criterion

1if
Ei , j = {0 otherwise T ( N)
i, j ≥T (l )…….. (21)

E. The Summary of The Proposed Approach


Fig 3. A summary of the implementation of the proposed ACO-based image edge detection
approach.

IV. Experimental Results


Experiments are conducted to evaluate the performance of the proposed approach using test
image, Camera, Furthermore, various parameters of the proposed approach are set as follows.

 K = _√M1 ×M2: the total number of ants, where the function _x represents the highest
integer value that is smaller than or equals to x.
 τinit = 0.0001: the initial value of each component of the pheromone matrix.
 α = 1: the weighting factor of the pheromone information in (4).
 β = 0.1: the weighting factor of the heuristic information in (4).
 Ω = 8-connectivity neighborhood: the permissable ant’s movement range in (4), as
shown in
 λ = 1: the adjusting factor of the functions in (7)-(10).
 ρ = 0.1: the evaporation rate in (11).
 L = 40: total number of ant’s movement-steps within each construction-step.
 ψ = 0.05: the pheromone decay coefficient in (12).
 e = 0.1: the user-defined tolerance value used in the decision process of the proposed
method.
 N = 4: total number of construction-steps.
The determination of above parameters is critical to the performance of the proposed
approach; this issue will be reported elsewhere. Experimental results are provided to compare
the proposed approach with Nezamabadi-Pour et al.’s edge detection method. To provide a
fair comparison, the morphological thinning operation of [18] is neglected, since it is
performed as a post-processing to further refine the edge information that is extracted by
ACO. Furthermore, to present how the determination of the heuristic matrix (i.e., (5)) is
crucial to the proposed method, various functions defined in (7)-(10) are individually
incorporated into (6) of the proposed approach, and their resulted performances are presented.
Figures 6, 7, 8 and 9 present the results of test images Camera, House, Lena and Pepper,
respectively. As seen from above Figures, the proposed approach always outperforms
Nezamabadi-Pour et al.’s method, in terms of visual quality of the extracted edge
information. The proposed ACO-based edge detection approach is implemented using the
Mat lab programming language and run on a PC with a Intel CoreTM DUO 2.13 GHz CPU
and a 1 GB RAM. The computational times of the proposed approach are 64.90 seconds,
64.15 seconds, 64.46 seconds and 64.57 seconds, for the test image Camera, with the
incorporation of the functions in (7)-(10), respectively.

(a) (b)
(C) (d)

(e) (f)

(g) (h)
(i) (j)

Fig. 4 Various extracted edge information of the test image Lena: (a) the original image
Edges for Lena at different values of:
(b) 0.0 (c) 0.1 (d) 0.2 (e) 0.3 (f) 0.4
(g) 0.6 (h) 0.7 (i) 0.8 (j) 0.9

V. Conclusion

An ACO-based image edge detection algorithm that takes advantage of the improvements
introduced in ACS has been successfully developed and tested. Experimental results show the
feasibility of the approach in identifying edges in an image. With suitable parameter values,
the algorithm was able to successfully identify edges in the canonical test images. It must be
noted that the appropriate parameter values depend on the nature of the image, and thus, may
vary per application.

As a continuation of this research, it is recommended to further examine how the quality of


the extracted edges is affected by the parameter values and the functions for obtaining the
heuristic information, for quantifying the quality of a solution, and for computing how much
pheromone to deposit. In a study on a simplified ACO algorithm, it was shown that the basic
properties of ACO are critical to the success of the algorithm, especially when solving more
complex problems.
In recent studies, techniques that could enhance the performance of ACS have been explored.
In ants are assigned different pheromone sensitivity levels, which make some ants more
sensitive to pheromone than the others. In multiple ant colonies with new communication
strategies were employed. The proposed ACS method for edge detection could be extended
and possibly be improved by making use of such techniques.

You might also like