A Novel Artificial Bee Colony Algorithm Based on Internal-Feedback Strategy for Image Template Matching

Image template matching refers to the technique of locating a given reference image over a source image such that they are the most similar. It is a fundamental mission in the field of visual target recognition. In general, there are two critical aspects of a template matching scheme. One is similarity measurement and the other is best-match location search. In this work, we choose the well-known normalized cross correlation model as a similarity criterion. The searching procedure for the best-match location is carried out through an internal-feedback artificial bee colony (IF-ABC) algorithm. IF-ABC algorithm is highlighted by its effort to fight against premature convergence. This purpose is achieved through discarding the conventional roulette selection procedure in the ABC algorithm so as to provide each employed bee an equal chance to be followed by the onlooker bees in the local search phase. Besides that, we also suggest efficiently utilizing the internal convergence states as feedback guidance for searching intensity in the subsequent cycles of iteration. We have investigated four ideal template matching cases as well as four actual cases using different searching algorithms. Our simulation results show that the IF-ABC algorithm is more effective and robust for this template matching mission than the conventional ABC and two state-of-the-art modified ABC algorithms do.


Introduction
Template matching is defined as the action of recognizing predefined template patterns in a source image. It is a fundamental issue in pattern recognition and has been widely applied to the fields such as face recognition [1], pulmonary nodules detection [2], handwriting identification [3], and road detection [4] over the past few decades.
In general, template matching involves two critical aspects: similarity measurement and best-match search [5,6]. When measuring the similarity, a source image and a predefined template image are superimposed in a certain location and then the similarity evaluation is made on the basis of a selected model or criterion. The sum of absolute differences (SAD), the sum of squared differences (SSD), and the normalized cross correlation (NCC) are all popular similarity measurement models. SAD is sensitive to the illumination disturbances and may lead to large variations in the intensity values [7]. SSD has a similar drawback. The NCC model utilizes rotation and scale invariant evaluations for the degree of similarity [8] and is confirmed to be more robust than SAD and SSD, especially in terms of uniform illumination changes in the source image [6,9]. Therefore, the NCC model is more widely used than the other two models. With regard to the search strategy for a best-match position, a thorough search algorithm is proposed as a pioneering work [10], in which all the pixel-candidate positions are checked until the one with the maximum similarity is located. However, such exhaustive search is computationally expensive, which restricts its applications, especially in terms of some real-time recognition issues.
In order to reduce the computation complexity in the template matching schemes, search strategies based on evolutionary algorithms have been developed and investigated.  Species-based genetic algorithm (Sb-GA) [11], bat algorithm (BA) [12], chaotic quantum-behaved particle swarm optimization (CQ-PSO) [13], chaotic imperialist competitive algorithm (C-ICA) [14], and a states-of-matter search (SMS) algorithm [5] have been proposed for this template matching problem. Although these algorithms aim to reduce the computation load of the global optimums searching, they cannot avoid the derivation of suboptimal matching results.
It is worth pointing out that most evolutionary algorithms are generally suitable for the optimization of convex or nearly convex functions [15]. But the template matching field contains a finite number of candidate matching locations. Such a discrete function is usually anything but smooth.
In other words, the objective function concerning template matching may drastically oscillate along the domain, which critically restricts the advantages of such evolutionary algorithms. Therefore, it calls for a new way to modify these existing evolutionary algorithms so as to accommodate the discreteness and oscillation in an objective function. Artificial bee colony (ABC) is a relatively new swarm intelligence algorithm. It is motivated by the foraging behavior of bee swarms, in which both local exploitation and global exploration are implemented [16]. Applications and developments of this algorithm have been proposed in a variety of ways . In this paper, our previously proposed internal-feedback artificial bee colony (IF-ABC) algorithm is adopted as a search approach to find the best-match location for the template matching scheme. IF-ABC features by its effort to fight against premature convergence. In a sense, IF-ABC sacrifices part of its convergence speed for the ability to avoid premature convergence [22,39,40]. Our work intends to have an intensive evaluation about the true performance of IF-ABC regarding image template matching, in comparison with some other state-of-the-art ABCs.
The remainder of this paper is organized as follows. In Sections 2 and 3, basic principles of NCC model and the conventional ABC algorithm are introduced. Section 4 holds a description of IF-ABC algorithm in detail. Then, several cases of comparative experiments have been conducted in Section 5. Further discussions concerning the comparable convergence performances are included in Section 6. The final section includes the conclusions, the limitations of this study, and our future work.

Model of Image Template Matching
Image template matching aims to locate a given reference image (which is also called template image) over a source image such that they best match each other. Typically it is assumed that the predefined template image and the source image are given in RGB format. Before the matching process starts, the corresponding grayscale images are derived in the preprocessing procedure. The grayscale template image is described by a matrix temp × , in which temp( , ) refers to the gray level of the pixel located at ( , ) in the grayscale template image. It is obvious that temp( , ) ∈ [0, 255] ∩ Z. Similarly, the grayscale source image is described by a matrix test × . The template matching scheme can be expressed as finding an optimal location ( , ) for the grayscale template image temp × so that the similarity between temp(1 : , 1 : ) and test( : ( + − 1), : ( + − 1)) is maximized within the feasible searching region (see Figure 1).
There are a number of ways to measure such similarity. Considering the robustness in terms of disturbing illuminations, we choose the following NCC model (see (1)) in this work. Consider where ( , ) represents the target location of top-left-corner pixel in the grayscale template. In other words, the grayscale template image shifts according to a vector of = ( , ) over the grayscale source image. In this particular case, it is required that ∈ [1, − + 1] ∩ Z, ∈ [1, − + 1] ∩ Z, which are regarded as the feasible searching conditions as demonstrated in Figure 1. It is easy to see that NCC(⋅) ∈ [0, 1] and the optimal ( * , * ) satisfies NCC( * , * ) = 1.  The Scientific World Journal Those bold values denote the best value (mean or C.R.) in every single line. Implementation procedures of template matching are given as follows.
Step 1. Import original source image and predefined template image (both in RGB form).
Step 2. Convert template and source image to grayscale.
Step 3. Choose NCC model as similarity criteria.
Step 4. Search among all feasible locations aiming to find the best-match location using IF-ABC algorithm.
Step 5. Terminate searching procedure when terminal condition is reached; then output best-match result.

Brief Review of Conventional ABC Algorithm
The preceding section introduces the NCC model, which is taken as a similarity criterion in this work. But how can one find the very ( * , * ) that maximizes NCC? In this section and the next, two intelligent algorithms named ABC and IF-ABC will be introduced, respectively, either of which can The Scientific World Journal  be taken as a searching approach for the optimal matching location. ABC is a swarm intelligence-based optimization algorithm. It is inspired by the forging behavior of bees. In this algorithm, there are three kinds of bees, namely, the employed bees, the onlooker bees, and the scout bees. They cooperate to search for the optimal nectar source in the space [16,23].
At the beginning, an initial population is randomly generated, which contains as many as food sources (i.e., SN feasible solutions), using (2). Consider In the above equation, each solution X = ( 1 , 2 , . . . , ) is a -dimensional vector, X max and X min are the predefined constraints set for the optimization problem, and rand(0, 1) denotes a random number in the range (0, 1) obeying the uniform distribution.
Then, the iteration process starts. Generally, as many as SN employed bees search globally in each cycle of iteration, and then SN onlooker bees search locally around the "qualified" employed bees. Those employed bees who cannot make any progress within some certain cycles will be replaced by the scout bees. The qualification standard concerns the roulette selection strategy and will be introduced later.
In detail, each employed bee utilizes the position of its randomly chosen companion to generate a new searching direction, as shown in (3). Consider Here, X = ( 1 , 2 , . . . , ) denotes the position of the th employed bee, X = ( 1 , 2 , . . . , ) stands for the position of a randomly chosen companion, and the searching location changes in the th element of X .
Thereafter, the greedy selection procedure is implemented. If the new position updated by (3) is better (i.e., the corresponding objective function value is higher), the previous position is discarded; otherwise, the employed bee remains at the previous position. When all the SN employed bees complete the searching procedure mentioned above, an index is calculated as the qualification measurement for the employed bees using (4). Consider where obj(⋅) denotes the objective function, and fitness(⋅) is conventionally defined. Each onlooker bee needs to search around an employed bee using (3). In this case, stands for the corresponding element of the selected employed bee, and denotes that of the th onlooker bee. Again, the greedy selection procedure is implemented here. The selection principle for the qualified employed bees concerns the roulette selection strategy. If 1 ≥ rand(0, 1), the first employed bee is chosen for the specific onlooker bee; otherwise, comparison between 2 and rand(0, 1) is carried on. If all the are smaller than rand(0, 1), such process goes over again until one employed bee satisfies the condition. In this way, each of the SN onlooker bees determines which employed bee to follow, respectively.
During each cycle of the iteration, once the th employed bee or an onlooker bee (which searches around the th employed bee) finds a better position in the crossover procedure, the parameter trial( ) is directly reset to zero; otherwise, it is added by one. In this sense, trial is regarded as a counter recording the invalid searching times around the th employed bee. Before a new cycle of iteration starts, it is necessary to check whether any trial( ) exceeds a certain threshold Limit. If trail( ) > Limit, the th employed bee will be directly replaced by a scout bee. A scout bee simply stands for a randomly initialized position utilizing (2).

Principle of IF-ABC Algorithm
IF-ABC algorithm was originally proposed to optimize protein secondary structures in our previous works [22,40]. In this paper, it is slightly modified to accommodate well to the template matching problem.
At first, as many as SN employed bees are randomly sent out to explore in the feasible solution space using (2). Then, the iteration process gets started. In each cycle of iteration, an employed bee utilizes the location of one randomly selected companion to generate a new searching location using (3). Afterwards, the onlooker bees carry on the searching process.
In the IF-ABC algorithm, each of the employed bees is given a chance to be followed by an onlooker no matter whether they are "qualified" or not. In other words, we discard the conventional roulette selection procedure mentioned in ABC here, pursuing to bring more chances (i.e., more dynamics and indeterminacy) to the evolution process. Therefore, the th onlooker bee in IF-ABC directly chooses the th employed bees to follow. At this point, a new idea is proposed (see (5) to follow the employed bees. It is notable that we introduce a multiplier ( ) in this equation, which is defined in (6). Consider Similar to ABC, the parameter trial in (6) records the number of inefficient searching times. In IF-ABC, if the th employed/onlooker bee finds a position that is better than the previous one it stays at, trial( ) is reset to 1 (but not zero); otherwise, we add 1 to it. If trial( ) exceeds Limit, the th employed bee will be reinitialized using (2).
( ) manipulates the exploitation accuracy, which decreases exponentially to as trial( ) gradually approaches Limit. Here, is a user-specified lower boundary of convergent scale. In this sense, the search process is intensified gradually with an increasing trial( ). That is, the search accuracy will be gradually enhanced before the position of the th employed bee is eventually discarded by the whole bee swarm. Figure 2 illustrates the flow chart of our IF-ABC algorithm. The pseudocode of IF-ABC for numerical optimization is given in Algorithm 1.

Experimental Results
In this section, besides the conventional ABC and IF-ABC, two state-of-the-art versions of ABC, named Gbest-ABC [41] and I-ABC [42], were tested on four ideal template matching cases as well as four practical cases. All the simulations were implemented in MATLAB R2010a and executed on an Intel Core 2 Duo CPU with 2 GB RAM running at 2.53 GHz under Windows XP. Every single type of experiment was repeated 500 times with different random seeds. Userspecified parametric settings for these ABCs are listed in Table 1, where Limit denotes invalid trial time and SN stands for half of the swarm population. Satellite images involved in this paper originate from the Google Earth (visit http://www.google.com/earth/). Figures 3, 4, 5, and 6 illustrate the comparative simulation results concerning the four ideal cases; in each case the template is exactly part of the source image. Some typical local optimal matching locations are plotted (see the red  Figures 3(c), 4(c), 5(c), and 6(c)), together with the global optimal matching locations (see the blue boxes). For the convenience of evaluation, two indexes that reflect the convergence performances (i.e., the mean and convergence rate C.R.) are listed in Table 2, where MCN stands for the predefined maximum cycle number. In order to show the necessity of applying evolutionary algorithms, we also made comparisons regarding the average time consumptions between IF-ABC algorithm and the classical full search algorithm in the four template matching cases. Figure 11 demonstrates the comparative results, where each pair of comparison was repeated 50 times.
Similarly, another four cases of experiments with illumination disturbances considered were conducted. The results are shown in Figures 7, 8, 9, and 10, and the detailed comparisons are listed in Table 3.
Since template matching process does not take rotation or rescaling into consideration in our study, the twodimensional domain is discrete (i.e., there exist a finite number of feasible solutions in total). Therefore, feasible solutions on a continuous domain need to be discretized so as to fit the objective function as in (1). As the objective function under consideration is a real-valued function of two variables, it is possible to plot the function surface using 3D graphics (as illustrated in Figures 3(e), 4(e), 5(e), and 6(e)).

Discussions
As shown in Table 2, the search process on the basis of IF-ABC is more efficient and robust than the other three algorithms. In detail, the convergence curves in Figures 3-6 suggest that the advantage of IF-ABC in case 1 is not as significant as it is in the rest of the three cases. It is also notable that the feasible solution surface in case 1 (see Figure 3(c)) is relatively smoother than the surfaces in the other three ideal cases (see Figures 4(c), 5(c), and 6(c)). In this particular case, classical methods are not inefficient. However, if the feasible solution surface is oscillatory or rugged, internalfeedback strategy will take effect. Take case 2 as an example, the overall surface is like a peak function (see Figure 4(c)), so it is more difficult to search for the global optimal location than case 1. The situations are quite similar in cases 3 and 4. In addition, although we observe from Table 2 that IF-ABC always possesses convergence rates far higher than those of the other three algorithms, the derivation of global optimum is not always guaranteed within the predefined iterations.
Here comes the question: what is the advantage of IF-ABC in the case that a classical full search algorithm has been proposed nearly 40 years ago and always guarantees the derivation of a perfect matching result? Figure 7 gives a direct answer: the time consumption. For example, it takes IF-ABC an average of 3.6412 seconds to help find the optimal location ( * , * ) with NCC( * , * ) = 1 in case 1, but it takes The Scientific World Journal 378.9624 seconds for the full search algorithm. We conclude that it may be an epitome that accounts for the prosperity of developments in intelligent algorithms.
Experiments mentioned above are based on a default assumption that a source image does perfectly contain the predefined template image. However, such assumption is never satisfied in practical terms. Therefore, to testify the practical value of template matching (concerning the utilization of NCC model), four practical cases were added in our work. The original source images are blurred, overexposed, or underexposed in those practical cases, and the advantages of IF-ABC are still remarkable, expect for practical case 3 (see Figure 10). We still are not aware of what makes the situation different. But we did not intend to conceal this truth. It should be recognized that there is still room for improvement in IF-ABC.
IF-ABC is mainly highlighted by its ability to fight against premature convergence. On one hand, IF-ABC discards the well-known roulette selection procedure. On the other hand, it advocates to fully utilize the variables or indexes hiding in the convergence system, rather than to seek for some hybridization from the "outside world. " The authors believe that the roulette selection procedure does contribute a lot when optimizing some continuous unimodal objective functions. Nevertheless, when the objective function is discontinuous or multimodal, the roulette selection procedure will cause premature convergence because swarm diversity will be significantly reduced. In our point of view, convergence efficiency of the bees should be measured not by the corresponding objective function values, but by the fact whether they are better than the previous one. In this sense, it provides more possibilities for the so-called unqualified employed bees to be exploited locally by onlooker bees in the IF-ABC algorithm.

Conclusions and Future Work
The innovation of this work lies in the application of our previously proposed IF-ABC algorithm to solve the template matching problem. Experimental results clearly demonstrated the efficiency of IF-ABC in comparison with some state-of-the-art ABCs. Besides, it is also preliminarily confirmed that the NCC model works robustly when the source image can not 100% match the template image.