An Entropy-KL Strategy for Estimating Number of Classes in Image Segmentation Issues

In this paper a general entropy-KL strategy is proposed based on the disorderliness and the distances between the distributions of different classes, to estimate the number of classes in image segmentation issues. In this strategy, the information of a homogeneous region is measured by entropy. Then a region is considered to be disordered and should be split if its entropy is more than a given threshold. On the contrary, when the KL information of two homogeneous regions is less than a threshold, it is believed that they are similar and should be merged. The entropy-KL strategy can be combined with any kind of segmentation algorithm since it uses the information and distance as a general way to decide the number of classes. In this paper, the HMRF-FCM algorithm is employed as the segmentation process and combined with the entropy-KL strategy to induce a segmentation algorithm which can fix the number of classes automatically. The proposed algorithm is performed on synthetic image, real panchromatic images and SAR images to demonstrate the effectiveness.


INTRODUCTION
Estimating the number of classes in the process of image segmentation is a difficult task.The most popular methods of image segmentation with unknown number of classes are region growing algorithm (Jose and Jose, 2014;Zhao and Xu, 2015) and Iterative Self-Organizing Data Analysis Technology Algorithm (ISODATA) (Yang et al., 2014;Ramya and Praveen, 2015).The former needs a primary result in which each homogeneous region contains only one kind of object.Besides, the stopping criteria and the corresponding thresholds, which can determine whether the algorithm has reached its optimum, are another aspects influencing the accuracy of the final result.As to the selection of original regions, Sainju et al. (2014) selected them manually and change them by applying a segmentation method on them in the following iteration.In order to improve the accuracy of the stopping criteria, Rough et al. (2015) obtained the thresholds by a trained artificial neural network (ANN).Then comes the ISODATA, it uses splitting and merging processes to estimate the number of classes.However, it is a cluster-based algorithm and the splitting/ merging conditions are designed in the feature space of the detected image.So it can only be used on cluster-based algorithms.Besides, there are a lot of thresholds which have a great effect on the segmentation result and the thresholds are given by users in advance.Thresholds for different images are dissimilar and it is very difficult to find the most appropriate ones.
Information is the content of message contained in an image.Entropy (Bhandari et al., 2014;Yin et al., 2014) which is defined as the expectation of information is a common method to measure the quantity of information of an image.In general, the quantity of information in a homogeneous region is less than that in an inhomogeneous region.So a homogeneous region can be split if its entropy is more than a threshold.In contrast, Kullback-Leibler (KL) information (Krishnamurthy and Moore, 1993;Park, 2005), can measure the differences between information.When the KL information is less than a threshold it means the information of the two homogeneous regions are too similar and they should be merged.Then a generalized method which can fix the number of classes automatically is proposed based on the entropy and the KL information.
The remainder of this paper is organized as follows.Section 2 gives an outline of the Hidden Markov Random Field (HMRF) model-based Fuzzy C-Means (FCM) algorithm which is used as the segmentation process to obtain information of homogeneous regions.Then the difinations of entropy and KL information are introduced to define the splitting and merging processes of homogeneous regions.And as the entropy decreases as the increasing of number of classes, the definition of threshold is a difficult part in the splitting process.Section 3 shows the performance of the proposed algorithm on synthetic and real remote sensing images.A conclusion is presented in Section 4.

THE PROPOSED ALGORITHM
The proposed algorithm with unknown number of classes can determine whether the homogeneous regions should be split or merged through calculating the entropy in a homogeneous region and the KL information between different homogeneous regions.The homogeneous regions are obtained by traditional image segmentation algorithms.In this paper, the HMRF-FCM algorithm proposed by Chatzis and Varvaigou (2008) is employed as a segmentation process to provide a segmentation result which is expressed by homogeneous regions to the splitting and merging processes as described in 2. 1.

HMRF-FCM Algorithm
Let X = {x1, x2, …, xi, …, xN} expresses the detected image, where xi is the intensity of the ith pixel, N is the number of total pixels in the image.Then the objective function of the HMRF-FCM algorithm can be expressed as where i is the index of the pixels, j is the index of the classes, c is the number of classes under current, U = {uij} is the membership function which can express the degree of the ith pixel belongs to the jth class, D = {dij} is the dissimilarity measure between the ith pixel and the jth class,  is a fuzzy factor which can express the fuzziness of the algorithm,  = {ij} is the prior distribution describing the prior probability of the ith pixel belongs to the jth class.
As the HMRF model is used in the segmentation process to depict the neighborhood system of the label field, the prior distribution can be calculated as where, li is the label of the ith pixel, Ni is the set of neighbor pixels of xi, and i is the index of neighbor pixels,  is the coefficient describing the influence of the neighborhood, Vc is the energy between the ith pixel and its i and can be defined as To describe the characteristic in a homogeneous region, assume it subjects to a normal distribution.Then the dissimilarity measure between the ith pixel and the jth class can be defined as where  = {j} is the set of means of the homogeneous regions,  = {j} is the set of variance of the homogeneous regions.
The expressions of the above parameters can be obtained by taking partial derivatives with respect to the objective function (see details in Chatzis and Varvarigou 2008): Then the steps of the segmentation process are Step 1: Calculate the prior distribution  (t) according to equation ( 2), where t is the loop of iteration.
Step 2: Calculate the mean  (t) and variance  (t) of the distribution of the jth class according to equations ( 6) and ( 7).
Step 4: If max{|U (t) -U (t-1) |} <  (given by users as a stopping criterion) which is used as a stopping condition, stop; otherwise, go to Step 1 and continue.

2 Splitting Process
Entropy (Shannon, 1949;Shannon, 1950) can be used to measure the disorder of a homogeneous region in image segmentation algorithm to determine whether the homogeneous region is too disorder to be split into two.Since uij is used to describe the partition of the image in the above image segmentation algorithm and on the other hand to express the degree to which the ith pixel belongs to the jth class, it can be used as the probability as the ith pixel belongs to the jth class.So the entropy of the jth homogeneous region can be defined as where Rj expresses the set of pixels belonging to the jth homogeneous region.Then a region should be split if its entropy is more than a threshold.Considering the limiting case: the initial segmentation contains only one kind of object.
It should be split if its entropy is more than the threshold and in contrary it means only one kind of object is contained in it, if the entropy is less than the threshold.So the calculation of the threshold has a great influence on the segmentation result.
As the entropy will increase with the increasing of the number of classes, the threshold should be related with it.
Taking the case of equal probabilities into consideration, the entropy of a class can be 1/clog(1/c), then the total entropy of the image is c1/clog(1/c).Considering the influence of the number of classes, the threshold can be defined as At last we can get a threshold by giving a coefficient to the function f (c), i.e., the threshold is e f (c).e can control the influence of defined function on the threshold.When e is small the number of homogeneous regions will be more than that when e is large.In other words, the chosen of e should ensure inhomogeneous regions are all split and homogeneous regions are not split as much as possible.Then the homogeneous region which has larger entropy than the threshold (suppose the homogeneous region is indexed by j) should be split according to the following equations (assume the split homogeneous regions are indexed by j + and j -):   where uj is a vector of the fuzzy membership function expressing the degree of all the pixels belonging to the jth class,  is a random vector taking values between 0 and 1.

3 Merging Process
KL information, also known as the relative entropy (Chang et al. 1994), can be used to measure the differences of information between different homogeneous regions.In this paper, the KL information of the j -th and the j + th homogeneous regions is calculated as where the probabilities are defined by the Gaussian distribution as shown in equation ( 5).Then it is possible to evaluate whether the two homogeneous regions should be merged by giving a threshold d for the KL information.If the KL information between the j + th and j -th homogeneous regions is less than the threshold d, it means they are similar and should be merged.The two homogeneous regions can be merged by simply adding the two vectors of membership function like the following equation Since the calculations of entropy and KL information are all based on the probability, the proposed entropy-KL strategy can be used as a class number estimation method in any statistical based segmentation algorithm.Besides, there are a lot of other variables sharing the same meaning with probability which can express the degree of the pixel belonging to a class.Thus, the proposed strategy can play a role among a large range of segmentation algorithms.The splitting process can obtain a segmentation result with an upper bound of entropy for each homogeneous region and provide a segmentation result, in which each homogeneous region contains only one kind of object, for the following merging process.That means the splitting process is independence on the segmentation algorithm it combined with.The procedure is totally free from the influence of initial segmentation result and it can be completed without any iteration.Therefore, the proposed algorithm acts much faster than other algorithms with unknown number of classes.
That makes the proposed entropy-KL strategy can be used for estimation of number of classes for most image segmentation issues.
The steps of implementing the proposed algorithm is Step 1 Set the thresholds including: the initial number of classes c, the influence of neighborhood in the HMRF-FCM algorithm when defining the prior distribution , the fuzzy factor which can express the fuzziness of the algorithm , the threshold controlling the splitting process e, the threshold controlling the merging process d, the stopping condition of the segmentation algorithm e and the upper bound of iteration times I.
Step 2 Initial the fuzzy membership function U (0) .
Step 3 Perform the segmentation process described in 2. 1.
Step 4 Split homogeneous regions if any of them satisfies the splitting criterion depicted in 2.2.
Step 5 Perform the segmentation process again.
Step 6 Merge two homogeneous regions between which the KL information is less than the threshold d.
Step 7 Output final result by performing the segmentation process.

EXPERIMENTS AND RESULTS
To evaluate the effectiveness of the proposed algorithm quantitatively and qualitatively, it is tested on synthetic remote sensing image and real remote sensing images.The synthetic remote sensing image shown in Fig. 1(a) is generated by jigsawing three homogeneous regions, which are cut out from WorldView-1 images covering sea water (I), grass land (II) and facet of a building (III), respectively.proposed entropy-KL strategy can be used as a general method to estimate the number of classes in image segmentation issues.And it also immune the influence of initial segmentation result.In addition, the proposed algorithm can execute the merging process right after the splitting process and the proposed algorithm do not need an iteration to obtain its optimum result.Although the segmentation process is carried out three times, the proposed algorithm still performs much faster than any other algorithms with unknown number of classes.
Fig. 1(b) is the initial segmentation result in 2 classes.Fig. 1(c) is the segmentation result after the splitting process.Technically, it contains 9 classes but it only shows 6 of them (green, ellow, cyan, magenta, blue and black).And the reason is that there are two classes sharing the same mean and variance and another three classes having equal means and variances.In other words, the two and the three homogeneous regions stand for the same class.So they are represented by the same color.Then the final segmentation result is acquired by merging process and it is displayed by color and average mean value, respectively as shown in Fig. 1(d) and Fig. 1(e).Fig. 1(f) is the outline of the segmentation result superimposed on the original image.The confusion matrix, product accuracies, user accuracies and total accuracy are listed in Table 1.The splitting process gives an upper bound of information in each homogeneous region to ensure that it contains one kind of object only.One can find the changes from initial segmentation to the splitting result through the comparison of Fig. 1(b) and Fig. 1(c).In Fig. 1(c) some homogeneous regions represent the same kind of object.So they are merged based on the criterion proposed in the merging process and then the segmentation result is obtained (Fig. 1(d) in color; Fig. 1(e) in average gray).
Fig. 1 Synthetic image and segmentation result.

Fig. 3 Fig. 2
Fig. 3 are SAR images and their segmentation results, where (a1-b1) are Radarsat2 images and (c1-d1) are from Radarsat1.Fig. 3 (a1) contains three kinds of farmlands and its edge is well extracted.Artificial buildings in Fig. 3(b1) do not have distinct edges so its area in the Fig. 3(b2) is not regular.Both Fig. 3(a1) and (b1) are segmented to three classes which is coincidence with visual perspective.Although segmentation results of Fig. 3(c1-d1) are not satisfactory enough, the proposed algorithm can still find the exact number of classes automatically.

Table 1
Confusion matrix of the segmentation result.