A Lévy Flight Based BAT Optimization Algorithm for Block-based Image Compression

: Many metaheuristics have been adopted to solve the codebook generation problem in image processing. In this paper, the Bat algorithm is combined by the Lévy flight distribution to find out the global optimum codebook. The Lévy flight distribution is combined by the local search procedure. Therefore most of the time the bat concentrate on the local area for specific food while it rarely flies to the different parts of the field for better food opportunities. This process strongly guides the bat on the global minimum way and offers better food, then the bat flies to that direction. Consequently, if a bat is captured by a local minimum point accidentally, the Lévy flight step provides a chance to escape from it easily. Numerical results suggest that the proposed Lévy flight based Bat algorithm is better than the classical ones and provides the global optimum codebook for image compression.


INTRODUCTION
Vector quantization (VQ) is a block-based lossy image compression technique combined with a codebook generation algorithm [1][2][3][4].A codebook contains vector blocks that represent the image best.The LBG [5] technique is a well-known codebook generation algorithm that satisfies local minimum solutions.
On the other hand, different metaheuristic algorithms have been developed and combined by VQ to overcome the optimum codebook generation problem.The optimum codebook is produced by the Genetic algorithm (GA) based on Principle Component Analysis (PCA) conversion [6].The Particle Swarm Optimization (PSO) technique is improved by the advantages of the adaptive fuzzy inference method for codebook generation [7].Honey Bee Mating Optimization (HBO) [8] algorithm is adapted to obtain the near-global optimal codebook.Improved Differential Evolution (IDE) [9] technique, which is an improved version of the traditional DE with modifications in the scaling factor and the boundary control mechanism, is used for codebook design.Ant Colony Optimization is redesigned for VQ by decreasing both computation number and the time required [10].Firefly algorithm (FRA) is adapted to LBG and achieved faster and higher quality reconstructed images than PSO, HBO and LBG [11].Recently Cuckoo search algorithm (CSA) is generated for optimizing the LBG codebook [12].The Cuckoo search algorithm spends 25% of convergence time for local search while it spends 75% of convergence time for the global optimum solution.The Bat algorithm (BAT) is a quite new optimization technique that is used for optimum solutions [13][14][15][16][17][18].Lévy flight distribution is combined with many optimization algorithms for global optimization [19][20][21][22][23][24][25][26][27][28][29][30][31][32][33][34][35].
In this paper, the classical BAT metaheuristic technique is improved by Lévy flight distribution to solve the codebook generation problem.When the bats are searching for food by locally near to the global solution, the Lévy flight mechanism helps the bat both focus on the local and random search at the same time.Lévy flight food search deals with the local search mostly and random search rarely.

RELATED ALGORITHMS
In this section, LBG algorithm of VQ and the Lévy algorithm is presented briefly.
The codeword which has the minimum error is assigned to each original image block.So, the block number from the codebook list is used instead of the real image block to obtain a lossy image compression.
Composing the vectors of C is achieved by minimizing the mean square error (MSE) formulation Eq. (1) to Eq. (3).

( )
The Euclidean distance between the x i image block and codeword c j is defined by The LBG algorithm executes the two rules given by Eq. ( 4) and Eq. ( 5).The group of image vectors ( , 1, 2,..., ) The center of the named as c j is calculated as Here, N j is the total number of elements that belong to R j .Assume that the image vectors are , 1, 2,..., ( ) ( ) Determine the new cluster centers by Eq. ( 7).
Until there is no change of centroid c j value execute the Eq. ( 6) and Eq. ( 7) sequentially.

BAT Algorithm
The bat-inspired metaheuristic algorithm is produced by Xin-She Yang [13] based on imitation of the echolocation feature of microbats.The microbats use echolocation between 25 kHz to 125 kHz, which means 2 mm to 14 mm wavelengths in the air.Microbats searches prey using this echolocation feature.In the search phase microbats emit short pulses, but when they approach a potential prey their pulse emitting frequencies increase, wavelengths of echolocation become shorter.Therefore, the microbats increase the accuracy of the prey location.The standard bat algorithm uses three rules; i.All microbats use echolocation and detect the distance to the potential food.ii.Microbats fly randomly with the parameters of Vi velocity, X i position, F i frequency, λ i wavelength and A i loudness.They can adjust the rate of pulse emission r∈[0, 1] according to the distance to the food.iii.The loudness varies from A min to A 0 a microbat has two flying types which are local search or generation of or random search.
Generation of new solutions; When a bat begins to search for prey it flies randomly following the three steps defined by Eq. ( 8) to Eq. (10).Here the frequency, velocity and position of the bats are updated.min max min ( ) ( ) In the equations above, the frequency boundaries are defined as (F min , F max ) = (0 Hz, 1 Hz), the uniform random variable u i∈ [0, 1].F min and F max are the user-defined parameters and can be changed according to optimization problem type.X i and V i are the positions and the velocities of a bat, where the X g denotes the global best position.The frequencies of the microbats are determined randomly at the beginning of the algorithm.

Local flying;
When a bat detects a prey specifically then the local flying strategy is used.This procedure is determined by Eq. ( 11) and Eq. ( 12).

if (
), Here U k∈ [0, 1] and ε k∈ [-1, 1] are uniform random variables, A ort is the average loudness of all the bats and R k is the pulse rate of the k th bat.Once a bat found its prey, the loudness usually decreases and the rate of pulse emission increases in order to determine true location of the prey.Therefore Eq. ( 12) is used more frequently than Eq. ( 11) when the bat is close to its prey.
Parameter updating; After a local or random search flying is completed the pulse rate Rk and the loudness A i parameters of the bats are updated using Eq. ( 13) and Eq. ( 14).
1 max (1 0.5 ) Here α is similar to the cooling factor of the cooling schedule in the simulated annealing [16].Therefore both alpha and gamma parameters are changed slowly depending on the iteration numbering which is shown in Fig. 1.Therefore both of them are determined as 0.997 for all iterations of the codebook generation method.The loudness reaches zero and the pulse rate variable reaches the final value of one by the end of the iteration number as shown in Fig. 1.The procedure of updating velocities and positions of the BAT algorithm is similar to the PSO algorithm.The frequency fi controls the step and range of the bat movement.The local search is controlled by the loudness and the pulse rate variables.

LEVY FLIGHT BASED BAT ALGORITHM
The BAT optimization contains two search mechanisms.The first one is the generation of the solution step.The other one is the local search focusing on the pray.If the bat is not near to the global optimum solution when it is on the random search, the equations of Eq. ( 9) and Eq. ( 10) may cause the bat captured by a local minimum.The local search performed by Eq. ( 11) may not provide an approximation step in the correct scale [17].Therefore the standard BAT formulations are reorganized and simplified [18].The first modification is a simplification of the bat location.The Eq. ( 15) is generated instead of Eq. ( 9) and Eq. ( 10).In Eq. ( 10) the velocity of the bat is disregarded.
Adoption of Eq. ( 15) for updating the bat location instead of Eq. ( 9) and Eq. ( 10) allows the bats to fly closer to the prey.On the other hand Eq. ( 15) decreases the ability of the bat population to visit the around effectively.Therefore a Lévy flight distribution is added to the local search procedure which is given by Eq. ( 16).  ) ( ) Here F L (X) represents the Levy function, whose values are small at big X values.On the contrary the magnitude of F L (X) is relatively big at small X values.Therefore the bats search is close to global solution in most of the local search iterations.On the other hand the bats rarely fly to far away with the help of Levy flight in order to escape from possible local minimum location.Let F(X) be a normal distribution.Let μ = 0 and standard deviation σ be a function of x.
Exponential term decreases to one by increasing x, and the Lévy distribution becomes like a power law function with long tail, which has an infinite variance with an infinite mean.
The approximated Lévy function which is expressed by Eq. ( 20) is plotted in Fig. 2 21).Therefore, if Eq. ( 20) is embedded into Eq.( 16) the bat movement is determined as where the random x is uniformly distributed in [0, 1], k and λ are the user defined coefficients.Since the term ( ) k random x λ − is power law function, in most of the iterations its value is small whereas the value is rarely relatively big.Consequently, the second term of Eq. ( 21) is called Lévy Flight step guides to the bat escape from local minimum points.The variable lambda is quite sensitive in Eq. ( 21) and must be properly tuned.The lambda is selected as λ = 2.0 for searching the best codebook.The pseudo code of the proposed LBAT is given below.
Other modifications of LBAT are about the pulse rate R i and loudness A i .The original pulse rate equation of Eq. ( 14) and loudness equation of Eq. ( 13) are redesigned as in Eq. ( 22) and Eq. ( 23) respectively [18].Instead of exponential function the t i R and t i A variables are changed into linear ones depending on the iteration number.max 0 max ( ) 1 ( ) Here, t max is the maximum iteration number while the notations 0 and ∞ corresponds the initial and the last values respectively.As previously mentioned, the resulting algorithm is named as LBAT after all these modifications.The pseudo code of the proposed LBAT is given below.Update the parameter of loudness t i A by Eq. ( 23) end

Parameters
In this paper, the LBG algorithm is adapted to the LBAT then each bat is represented by a codebook defined as . The number of codewords are selected as 8, 16, 32, 64 and 128 for the 256 gray level and 256×256 pixel sized standard images.C-Means variable of ε is defined as 0.001 for VQ.The user defined parameters k w , k p , and k g of PSO are defined as 0.9, 0.9 and 0.9 respectively when the random 1 and random 2 are the uniform randoms change in [0, 1].The α and γ parameters of BAT technique defined as 0.997 and 0.996 for image codebook generation.Objective functions of BAT and LBAT are directly proportional to inverse codebook error, which is determined as MSE -1 (C).The varibles α, γ and β 0 of FRA are determined as 0.5, 0.01 and 1.0 respectively.The coefficients of LBAT are selected as λ = 1.5 when γ = 0.01 and k = 2.0 for optimization.The iteration number of LBAT is determined as 1500 which is sufficient for LBAT algorithm to reach the global minimum point.

SIMULATIONS AND RESULTS
The codebook producing is achieved by using 256×256 pixel size of standard images, which have 256 gray levels.The standard images are divided into 4×4 pixel sized of 4096 subvectors.The standard FRA, BAT, PSO, VQ and LBAT algorithms are used for codebook generation.The variables of k and λ are important parameters of approximated Lévy Flight function FL(X).They are responsible for the convergence speed.Therefore they are fine-tuned as k = 2.0, λ = 2.0.The k determines the maximum Lévy Flight step value whereas the λ defines the percentile of the long Lévy Flight step rate as seen in Fig. 2. Small values of k and λ cause to be caught by a local minimum whereas the high values cause delay in the convergence time duration.When the bat is focusing on the local search the Lévy flight random step provides an opportunity of food search at the different fields of the search area.Therefore most of the time the bat consantrate on the local area for specific food while it rarely flies to the different part of the field for better food opportunity.The x variable interval is determined as x∈ [1,7].Consequently, Lévy Flight steps change from FL(1) = 2.0 to F L (7) = 0.04.The bat steps of LBAT algorithm change generally smaller than 0.5 but rarely bigger than 0.5.The long steps provide the bat easily escaping from possible local minimum whereas small steps help bat focusing to the food.The mean square error MSE(C) performance values for the codebooks of different and proposed techniques are given in Tabs.1-3.The number of 8, 16, 32, 64 and 128 codewords are used in the simulation.In addition to these results the error convergence graphics of the algorithms according to MSE versus iteration number are shown in Fig. 3 and Fig. 5 for the high contrast 256×256 pixels size Barbara and low contrast 256×256 pixel size Clock standard images.
Quantization Vector quantization (VQ) is a block-based lossy image compression technique.The codebook production is the fundamental process of VQ.Let input image { } ij Y x = be N×N pixels size.The original image is formed by sub-blocks with the size of m×m pixels.The dimension of the subvariable L be assumed as m×m pixel size.Then the original sub-blocks x i are determined as L dimensional Euclidean space i L x ∈ℜ .The number of N c codewords belong to codebook named the LBG technique achieves the following three steps to obtain the local optimal codebook; Divide the original image blocks into several clusters using Euclidean distance equation.The center of clusters is saved in an indicator matrix named U size of b c N N × pixels.

Figure 1
Figure 1 Loudness and pulse rate distribution according to the iteration number t

Figure 2
Figure 2 Approximated Lévy functions for different λ values Lévy Flight based Bat algorithm (LBAT) can be obtained by using Lévy distribution function F L (X) in the bat random search procedure which is defined by Eq. (21).Therefore, if Eq. (20) is embedded into Eq.(16) the bat movement is determined as

begin
Objective function MSE(C) by Eq.Define the Lévy Flight variables λ, k Define the initial and the end values of pulse rate R i and loudness A i Define iteration number n while (n < Max Iteration Number) Define uniform random numbers U i∈ [0, 1] If (U i < R i ) Local search by Levy Flight distribution as in Eq. (21) else Randomly search around by Eq. (11) Update the parameter of pulse rate t i R by Eq. (22)

Figure 3 Figure 4
Figure 3 Convergence results of PSO, FRA, BAT and LBAT algorithms for BARBARA image and 8 codewords of codebook

Figure 5 Figure 6
Figure 5 Convergence results of PSO, FRA, BAT and LBAT algorithms for CLOCK image and 8 codewords of codebook

Table 1
MSE performances of codebooks of different techniques for Barbara image

Table 2
MSE performances of different techniques for Clock image