Image segmentation based on equivalent three-dimensional entropy method and artificial fish swarm optimization algorithm

Abstract. To improve the timeliness of the three-dimensional (3-D) maximum entropy method, an image segmentation method based on equivalent 3-D entropy and artificial fish swarm optimization algorithm is proposed. An equivalent 3-D entropy method without logarithmic operation is developed, and its equivalence is proved theoretically. The optimal threshold is determined based on the artificial fish swarm optimization algorithm so as to avoid exhaustive search and improve algorithm efficiency. The experimental results demonstrate that the proposed method is more time-efficient than the traditional 3-D entropy method and the equivalent 3-D entropy method without affecting segmentation. Compared with the one-dimensional entropy method and the two-dimensional entropy method, it is obviously superior in noise immunity and detail preservation.


Introduction
Image segmentation refers to the technique of dividing an image into nonoverlapping homogeneous regions and extracting the objects of interest.It is the basis of image analysis and computer vision. 1 Recently, considerable research on image segmentation has been conducted, and various segmentation algorithms have been proposed.In general, these algorithms can be divided into: edge detection segmentation algorithms, 2 region segmentation algorithms, 3 threshold segmentation algorithms, 4 and fuzzy segmentation algorithms. 5Among them, threshold segmentation algorithms have been widely studied and applied owing to their simplicity and effectiveness.
The purpose of threshold segmentation is to separate the object from the background as much as possible and retain maximum image information entropy.Therefore, the essence of an entropy-based threshold segmentation algorithm is to use different entropy functions to establish the objective function, with the segmentation threshold as the independent variable, and then to determine the threshold where the objective function takes the extreme value according to a certain criterion.The traditional one-dimensional (1-D) maximum entropy method only considers the gray-scale information of pixels and neglects their spatial correlation.Although the processing speed is high, the noise immunity is poor.In this regard, by using the information contained in the two-dimensional (2-D) histogram of the gray-scale distribution of image pixels and the average gray-scale distribution of their neighborhood, Abutaleb 6 proposed a 2-D maximum entropy method that takes into account the neighborhood mean value information.Although the 2-D maximum entropy method enhances the algorithm's ability to suppress noise and improves segmentation accuracy, the introduction of neighborhood gray scale mean value information increases running time and resource consumption. 7o improve efficiency, Zhang et al. proposed a 2-D maximum entropy threshold segmentation algorithm by combining the artificial fish swarm optimization algorithm with Abutaleb entropy, which has satisfactory noise immunity and convergence performance. 8To obtain a better threshold, a combination of optimization algorithms is usually employed, such as the particle swarm optimization algorithm, 9 the artificial swarm optimization algorithm, 10 and the artificial fish swarm optimization algorithm. 7To further improve the performance of the algorithm, Lei et al. introduced the neighborhood gray-scale median based on the 2-D histogram; moreover, they proposed a three-dimensional (3-D) cross-entropy method as well as a fast recursive method to improve efficiency.It achieved a better segmentation effect. 11ompared with the 2-D maximum entropy method, the 3-D maximum entropy method has better segmentation quality; however, algorithm complexity greatly increases.To some extent, the efficiency of the algorithm has been improved by the aforementioned recurrence method and an intelligent optimization algorithm, but the entropy calculation still involves a logarithmic operation.Thus, the algorithm efficiency should be improved.Accordingly, in this study, an equivalent 3-D entropy method is proposed by establishing an equivalent objective function.The method can effectively simplify the calculation and improve efficiency.In view of the searching performance of the artificial fish swarm optimization algorithm, a new threshold calculation method is developed based on the proposed objective function so as to further enhance the timeliness of the algorithm.The experimental result shows that this method not only yields segmentation results that are equivalent to those obtained by the logarithmic method but also improves the efficiency of the algorithm.

Three-Dimensional Maximum Entropy Method
Let I be an image of size M × N, and let fðx; yÞ, fðx; yÞ ∈ f0;1; • • • ; L − 1g, be the gray-scale value of the pixel ðx; yÞ.The neighborhood gray-scale mean value gðx; yÞ and gray-scale median hðx; yÞ of a K × K neighborhood of the pixel ðx; yÞ can be defined as follows: E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 1 ; 6 3 ; 6 5 2 gðx; yÞ E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 2 ; 6 3 ; 6 0 3 hðx; yÞ ¼ med fðx; yÞ, gðx; yÞ, and hðx; yÞ can define a triple ði; j; kÞ.For example, if n ijk represents the frequency at which the pixel with gray-scale value i, neighborhood gray-scale mean value j, and neighborhood gray value k appears in the image I, then its frequency p ijk is 12 ; t e m p : i n t r a l i n k -; e 0 0 3 ; 6 3 ; 4 9 5 p ijk ¼ Based on the definition of Shannon entropy, the 3-D discrete entropy can be defined as E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 4 ; 6 3 Based on the 3-D histogram shown in Fig. 1, the 3-D maximum entropy method divides the image into the objective area 0 and the background area 1 by using the threshold ðs; t; qÞ.Areas 2 to 7 are the edges and noise regions.Clearly, it can be seen that the 3-D maximum entropy method uses the maximum amount of object and background information in the image, thus preserving details as much as possible.
According to the definition of entropy, the total entropy of the image I is E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 5 ; 3 2 6 ; 7 5 2 Hðs; t; qÞ ¼ − where L is gray levels, s is gray value of image pixels, t is neighborhood mean, q is neighborhood median, p 0 ijk ¼ According to the principle of maximum entropy, the optimal threshold value is E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 6 ; 3 2 6 ; 6 1 2 3 Equivalent Three-Dimensional Entropy

Equivalent Three-dimensional Entropy Method and Equivalence Proof
According to Eq. ( 5), there are a large number of logarithmic operations in the process of calculating the 3-D entropy.However, the logarithmic operation efficiency is low, which seriously restricts the application of the algorithm.
Maximum entropy means the kind of situation in which the probability distribution is the most uniform.And in the ideal situation, p 0 ijk is infinitely close to 1 stq , and p 1 ijk close to In view of this, a new 3-D maximum entropy method is proposed in this study.Its efficiency is improved by replacing the logarithmic operations with more efficient subtraction operations.The equivalence between this algorithm and the traditional 3-D maximum entropy method is now proved theoretically.

Definition 1. The equivalent 3-D entropy is defined as follows:
E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 7 ; 3 2 6 ; 3 5 3 By Eq. ( 6), the optimal threshold value ðs Ã ; t Ã ; q Ã Þ is Lei, Ouyang, and Xu: Image segmentation based on equivalent three-dimensional entropy method and artificial fish swarm optimization algorithm E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 8 ; 6 3 ; 7 5 2 ðs Ã ; t Ã ; q Ã Þ ¼ Arg max 0≤ðs;t;qÞ≤L−1 ½H 1 ðs; t; qÞ : Theorem 1.The optimal threshold value calculated by Eq. ( 6) is equal to that calculated by Eq. (8).Namely, the proposed 3-D entropy method is equivalent to the traditional 3-D entropy method. Proof.
E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 0 9 ; 6 3 ; 6 4 3 ∵

▯
According to Lagrange Multiplier Method, 13 constants are introduced, then it can be obtained from Eq. ( 5): e m p : i n t r a l i n k -; e 0 1 0 ; 6 3 ; 5 5 3 Take the partial derivatives of p 0 ijk and p 0 ijk , respectively, and let the derivatives be 0, which can get E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 1 1 ; 6 3 ; 3 7 3

<
: Solve the equation set shown in the Eq. ( 11), which can get E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 1 2 ; 6 3 ; 2 8 0 It can be obtained from Eqs. ( 9) and ( 12) ; t e m p : i n t r a l i n k -; e 0 1 3 ; 6 3 ; 2 1 8 Therefore, E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 1 4 ; 6 3 ; 1 5 6 It is known from the above solving process, h 1 stq ; is the maximum value of Eq. ( 5).And it is also the maximum point of H 1 ðs; t; qÞ, is known from Eq. (7).
Therefore, the optimal threshold value calculated according to Eq. ( 6) is equal to that calculated according to Eq. ( 8).Namely, the equivalent 3-D entropy method is equivalent to the traditional 3-D entropy method.

Artificial Fish-Swarm Algorithm
According to Eq. ( 7), for any threshold vector ðs; t; qÞ, the entropy is calculated through stq þ ðL − s − 1ÞðL − t − 1ÞðL − q − 1Þ summations.The complexity of this calculation is oðL 3 Þ.In addition, 0 ≤ ðs; t; 1Þ ≤ L − 1.Hence, for any image, the complexity of the calculation is oðL 6 Þ. 14 It can be seen that if the optimal threshold of Eq. ( 7) is obtained by the exhaustive search method, the algorithm is relatively inefficient.Intelligent optimization algorithms can effectively avoid exhaustive calculation and improve efficiency.6][17] In view of this, Dai et al. 17 put forward an optimization strategy from bottom to top, which is called artificial fish swarm optimization algorithm (AFSA), by analyzing the behavioral characteristics of shoals and adopting the model of autonomous animation.AFSA exhibits high convergence rate, high robustness, and strong global searching ability. 17n view of the high convergence rate and strong global searching capability of AFSA, in this study, AFSA is used to determine the optimal threshold value in Eq. ( 7).In the 3-D gray-scale space Q ¼ fðs; t; qÞj0 ≤ s; t; q ≤ L − 1g, an artificial fish individual model for threshold value calculation is constructed.Each artificial fish represents a potential threshold solution ðs; t; qÞ.The behavior types of artificial fish are also defined, namely, foraging behavior, swarm behavior, following behavior, and random behavior. 17,18) Foraging behavior.Let the current state of the artificial fish be X i .A state X j is randomly selected within its range of perception.If in the problem of determining the maximum it holds that Y i < Y j , a step is taken in that direction; otherwise, a state X j is selected again, and it is determined whether the forward condition is met.If the number of repeated attempts has reached Try-max, the maximum number of predetermined attempts, then a step is taken randomly: E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 1 5 ; 3 2 6 ; 2 5 4 where randðÞ is a random number in [0,1].(2) Swarm behavior.It is assumed that the current state of the artificial fish is X i , and the concentration of food is Y i .Then, the number n f and the central position X c of the current neighborhood are considered (d i;j < visable).If Y c ∕n f > δY i , then there is sufficient food, and the shoal is not crowded.In this case, a step is taken toward the center; otherwise, foraging behavior is performed: E Q -T A R G E T ; t e m p : i n t r a l i n k -; e 0 1 6 ; 6 3 ; 7 5 2 (3) Following behavior.It is assumed that the current state of the artificial fish is X i , and the concentration of food is Y i .Then, the position of the artificial fish X j is considered when Y max is the maximum in the current neighborhood (d i;j < visable).If Y max ∕n f > δY i , then there is sufficient food, and it is not crowed at the position of the artificial fish X j .In that case, a step is taken toward the position of the artificial fish X j ; otherwise, foraging behavior is performed: ; t e m p : i n t r a l i n k -; e 0 1 7 ; 6 3 ; 5 8 8 (4) Random behavior.Within the range of perception of X i , any other state X j is selected, and a step of random length is taken in the direction of X j .(5) Bulletin board.It is used to record the optimal individual state of the artificial fish.If the current state is better, the bulletin board will be updated to the current state; otherwise, the state of the bulletin board remains the same.

Threshold Optimization Based on AFSA
To avoid exhaustive search and improve the efficiency of the equivalent 3-D entropy method, AFSA is used to determine the optimal threshold value shown in Eq. ( 8) and thus achieve image segmentation.If the food concentration in the current position of artificial fish is calculated by the entropy objective function, then the distance between two artificial fish X i and X j is defined as ; t e m p : i n t r a l i n k -; e 0 1 8 ; The specific steps to obtain the optimal threshold value by using AFSA are summarized as follows: Step 1: AFSA parameters are initialized, namely, the population size SN, the initial position X i ¼ ðs i ; t i ; q i Þ of artificial fish i, the maximum number of iterations T max , the step length η of artificial fish, the crowd factor δ, and the algorithm termination conditions.Here, i ¼ 1;2; • • • ; S N .Step 2: The bulletin board is initialized, the adaptive value of each artificial fish is calculated based on Eq. ( 7), and the artificial fish with the largest adaptive value is set as the current optimal X Ã .Step 3: Behaviors are selected.Swarm behavior and following behavior are performed by each artificial fish separately.The optimal values obtained by the two behaviors are selected.The default behavior is foraging behavior.The state of each artificial fish is updated according to Eqs. ( 15)-( 17).
Step 4: The bulletin board is updated.The adaptive value of each artificial fish is calculated by Eq. ( 7), and the artificial fish with the largest adaptive value is set as the current optimal X Ã .Step 5: If the algorithm termination conditions are met, then the optimal threshold value X Ã ¼ ðs Ã ; t Ã ; q Ã Þ is the output, and image segmentation is performed according to the threshold; otherwise, execution returns to step 3 and continues.
The more the population size SN is, the richer the information representing the original image will be, the more accurate the segmentation threshold will get, the higher the optimization accuracy of the algorithm will become.But the increase of population will increase the complexity of the algorithm if other conditions remain unchanged.Reference 19 shows that the efficiency and accuracy will reach the peak value at the same time and the image segmentation effect will be the best when the population size is between 15 and 35.The maximum number of iterations is one of the conditions for the end of the optimization algorithm.It is set so that the algorithm can find the optimal solution under the prescribed conditions.With a large number of experiments, it can be proved that the algorithm can find the optimal solution when the maximum number of iterations is 30.
In this study, the population size SN is 20, and the maximum number of iterations is 30, the step length η is 10, and the crowd factor δ is 0.8.Thus, the total number of summation operations is 20 , and the complexity of the algorithm is OðL 3 Þ, whereas the complexity of the exhaustion method is OðL 6 Þ.Thus, the computation time of this method is significantly reduced, which improves the efficiency of the algorithm.

Experimental Analysis
To test the segmentation performance of the proposed method, the following two sets of experiments were conducted using the four images shown in Fig. 2: (i) Quantitative analysis experiments regarding quantitative indicators of the segmentation effect.Two indicators, namely, threshold value and running time, were selected.A quantitative comparison was made among the traditional 3-D maximum entropy method, the equivalent 3-D maximum entropy method, and the AFSAbased equivalent 3-D maximum entropy method to analyze the effectiveness of the proposed method in improving efficiency.(ii) Qualitative analysis experiments regarding visual effects.The segmentation results of the traditional 1-D, 2-D, and 3-D maximum entropy methods were compared, and the effectiveness of the proposed method was qualitatively analyzed from a visual perspective.The experimental platform was a PC with 2-GB RAM and a Q8300 CPU, which was programmed using Matlab2010.

Effectiveness Validation of Improvement Measures
To verify the equivalence of the proposed 3-D maximum entropy and the rationality of using AFSA to determine the optimal threshold value, the equivalent 3-D maximum entropy method based on AFSA was compared with the traditional 3-D maximum entropy method and the equivalent 3-D maximum entropy method.As the purpose of the experiment is to verify the equivalence between the solution by the Optical Engineering 103106-4 October 2018 • Vol.57 (10)  improved method and the solution by the traditional 3-D maximum entropy method, it is necessary to compare the threshold values calculated by each method.To test the efficiency of the improved method, the running time of the algorithms should be compared.From the comparison results in Table 1, it can be seen that the threshold value obtained by the equivalent 3-D maximum entropy method is consistent with that obtained by the traditional 3-D maximum entropy method, which experimentally verifies Theorem 1.As the equivalent 3-D maximum entropy method can avoid the time-consuming logarithmic operation, the efficiency of the algorithm is greatly improved.As AFSA is used to determine the optimal threshold value in the AFSA-based equivalent 3-D maximum entropy method, which avoids exhaustive search, the efficiency of the algorithm is further improved.It can be seen that the equivalent 3-D maximum entropy method based on AFSA can give better consideration to the time factor and achieves the same segmentation effect.

Comparison of Segmentation Effect
To test the segmentation performance of the proposed method and verify its advantages, comparisons with the 1-D maximum entropy method, the 2-D maximum entropy method, and the 3-D maximum entropy were conducted.
As shown in Figs.3-6, the 1-D maximum entropy method only considers the pixel gray-scale information and fails to   consider the spatial correlation of pixels, which leads to poor noise immunity.By introducing the neighborhood mean value information, the 2-D maximum entropy method improves the noise immunity of the algorithm.However, as the probability of the main diagonal region is assumed to be ∼1 during the threshold calculation process, 18 the image information is lost, which leads to inaccurate image details.The traditional 3-D maximum entropy method considers median information and more neighborhood information on the basis of 2-D maximum entropy method, and the details of the image are relatively richer.In the proposed method, the optimal threshold is determined based on the 3-D histogram.The noise immunity of the algorithm is relatively strong.As there is no approximate calculation, the same segmentation effect as the maximum entropy method is achieved.The comparison results show that the proposed method exhibits strong antinoise performance and is able to better retain image details.Thereby, the advantages of the method are verified from the visual perspective.

Conclusions
In view of the low efficiency of the traditional 3-D maximum entropy method, an image segmentation method based on the equivalent 3-D entropy and AFSA was proposed.In this method, the optimal threshold is determined by the equivalent 3-D entropy equation shown in Eq. (8), which avoids the time-consuming logarithmic operation.The optimal threshold is calculated by AFSA, which avoids exhaustive search.
The results of the quantitative comparison with the traditional 3-D maximum entropy method showed that the segmentation effect of the proposed method is the same as that of the traditional 3-D maximum entropy method, but the efficiency of the algorithm is greatly improved.The qualitative analysis of the 1-D maximum entropy method and the 2-D maximum entropy method showed that the method has strong antinoise performance and better retains image details.The qualitative and quantitative comparison and analysis demonstrated that the proposed method has high accuracy, strong noise immunity, and high speed and may be successfully applied in the segmentation of SAR and noisy images.

Table 1
Comparison of the results of 3-D maximum entropy method.