Keywords

1 Introduction

Image segmentation is a critical task in computer vision. It partitions an image in terms of pixel-based features into several homogeneous and disjoint regions so that the members within the same region share the same characteristics. Image segmentation is employed as a pre-processing step in many applications such as medical image processing  [4, 15] or modelling of microstructures  [16].

Clustering is one of the most commonly employed approaches for image segmentation. It divides an image into clusters (groups) so that the members located in the same cluster have more resemblance to each other than to those in others clusters. The k-means algorithm is the most popular clustering algorithm. It initialises k cluster centres randomly and each pattern is then assigned to the closest cluster centre. In the next step, the location of each cluster centre is recomputed and the process continues until a stopping criterion is met. However, k-means suffers from some drawbacks such as dependence on initialisation and getting stuck in local optima.

Population-based metaheuristics are problem-independent optimisation algorithms with stochastic characteristics and can be used to overcome these drawbacks. They typically create a random population of candidate solutions which are then iteratively updated based on operations that are stochastic and share information within the population.

Popular population-based metaheuristics that have been used for clustering-based image segmentation include particle swarm optimisation (PSO)  [12, 17], differential evolution (DE)  [2, 7], artificial bee colony (ABC)  [13] and harmony search (HS)  [20] among others.

Human mental search (HMS)  [11] is a relatively new population-based metaheuristic that has shown competitive performance in solving optimisation problems  [11]. HMS has three main operators: mental search, grouping, and movement. Mental search seeks around a candidate solution based on Levy flight, grouping clusters the population to find a promising region, and movement steers candidate solutions towards the promising area.

In this paper, we propose a novel image segmentation based on clustering and HMS. To this end, our encoding strategy is an array to define the cluster centres and we employ an objective function based on the mean squared error. An extensive set of experiments demonstrates very good segmentation performance and superiority over other methods.

The remainder of the paper is organised as follows. Section 2 summarises the human mental search algorithm, while Sect. 3 details our proposed image segmentation algorithm. Section 4 presents experimental results, and Sect. 5 concludes the paper.

2 Human Mental Search

Human mental search (HMS)  [11] is a recent population-based metaheuristic algorithm where candidate solutions are bids in the space of online auctions.

The workings of HMS are detailed in Algorithm 1 in terms of pseudo-code. Like other population-based algorithms, HMS starts with a set of random candidate solutions. Candidate solutions try to move towards the optimum using mental search (to explore the vicinity of bids), grouping (to find the promising area), and movement (to steer bids toward the promising area) operators. In the following, we briefly explain these three operators.

figure a

2.1 Mental Search

Here, each bid explores its vicinity based on a Levy flight distribution, resulting in both small and long jumps to enhance both exploration and exploitation ability of the algorithm simultaneously.

A bid \(x^i\) is updated as

$$\begin{aligned} x^i = x^i + S , \end{aligned}$$
(1)

with S calculated as

$$\begin{aligned} S=(2-NFE(2/NFE_{\max }))0.01\frac{u}{v^{1/\beta } } (x^{i} -x^*) , \end{aligned}$$
(2)

where NFE is the number of objective function evaluations so far, \(NFE_{\max }\) is the maximum number of function evaluations, \(x^{*}\) is the best bid found so far, and u and v are two random numbers calculated as

$$\begin{aligned} u\sim N(0,\sigma _{u}^{2} ) , \; v\sim N(0,\sigma _{v}^{2} ) , \end{aligned}$$
(3)

with

$$\begin{aligned} \sigma _{u} =\left\{ \frac{\varGamma (1+\beta )\sin (\frac{\pi \beta }{2} )}{\varGamma [(\frac{1+\beta }{2} )]\beta 2^{(\beta -1)/2} } \right\} ^{1/\beta },\; \sigma _{v} =1 , \end{aligned}$$
(4)

where \(\varGamma \) is a standard gamma function.

2.2 Grouping

A clustering approach is used to group the current population of bids. After clustering, which is performed using the k-means algorithm, similar bids are located in the same group. Then, the mean objective function value is calculated for each group, and the group with the lowest value selected as the winner group.

2.3 Movement

Here, bids move towards the best bid in the winner cluster as

$$\begin{aligned} x_{n}^{t+1} = x_{n}^{t} +C(r \times winner_{n}^{t} - x_{n}^{t} ) , \end{aligned}$$
(5)

where \(x_{n}^{t+1}\) is the n-th bid element at iteration \(t+1\), \(winner_{n}^{t}\) is the n-th element of the best bid in the winner group, t is the current iteration, C is a constant, and r is a number in [0; 1] taken from a normal distribution.

3 Proposed Segmentation Algorithm

This paper introduces a novel clustering-based image segmentation algorithm based on clustering and HMS.

Assume that a dataset has N objects, \(O_{1}, O_{2},..., O_{N}\). A clustering algorithm tries to find K cluster centres, \(C_{1},C_{2},...,C_{K}\) with the following conditions:

  1. 1.

    Each cluster contains at least one object.

  2. 2.

    Distinct clusters have no objects in common.

  3. 3.

    The total number of cluster members is equal to the total number of objects in the dataset.

For our application of HMS, two issues need to be taken into account: encoding strategy and objective function. The encoding strategy determines the structure of each bid in HMS. We use an array to encode the cluster centres, and the length of the array is thus the number of cluster centres. Also, the upper and lower bound of the array is set to the maximum and minimum of pixel values in the image. As objective function, we use the mean squared error (MSE) defined as

$$\begin{aligned} MSE=\frac{\sum _{j=1}^{K}\sum _{P_{i} \in C_{j} }d(P_{i} ,C_{j} )}{n} , \end{aligned}$$
(6)

where \(d(P_{i} ,c_{j} )\) is the Euclidean distance between pixel \(P_{i}\) and its cluster centre \(C_{j}\), and n is the total number of pixels in the image.

Fig. 1.
figure 1

Test image dataset.

Our image segmentation algorithm proceeds in the following steps:

  • Step 1: Parameter initialisation: population size \(N_{pop}\), minimum \(M_{l}\) and maximum \(M_{h}\) number of mental searches, number of clusters for bid grouping N, number of objective function evaluations NFE, and number of clusters for image segmentation K.

  • Step 2: Generate an initial random set of bids.

  • Step 3: Calculate the objective function value for each bid using Eq. (6).

  • Step 4: Create a random integer number for each bid in \([M_{l};M_{h}]\) indicating the number of mental searches for the bid.

  • Step 5: Mental search: generate new bids based on Levy flight distribution in the vicinity of each bid.

  • Step 6: Replacement: in case a newly produced bid is better than the old one, it will replace the latter.

  • Step 7: Bid grouping: all bids in the search space are clustered using the k-means algorithm.

  • Step 8: Calculate the mean objective function value for each cluster.

  • Step 9: The cluster with the minimum mean objective function value is selected as the winner cluster.

  • Step 10: Other bids move towards the best bid in the winner cluster based on Eq. (5).

  • Step 11: Find the best bid in the current population and if it is better than the previous best bid, substitute the latter with it.

  • Step 12: If the stopping condition is not met, go back to Step 3.

4 Experimental Results

In our experiments, we select 10 images, shown in Fig. 1, which are commonly used in the literature: Lenna, House, Airplane, Peppers, and MRI, and five images from Berkeley image segmentation dataset  [9], namely 12003, 42049, 181079, 198054, and 385028. We compare our algorithm with other population-based algorithms that have been previously used for image segmentation.

The population size and the number of objective function evaluations for all algorithms are set to 50 and 6000, respectively, and all results are run for \(K=5\). For HMS, we set the number of clusters used during grouping to 5 and C to 2, while \(M_l=2\), \(M_h=10\), \(L=0.3\), and \(U=1.99\). For the other algorithms, we adapt default values previously employed in this context, listed in Table 1. Since the algorithms are stochastic, we run each algorithm 25 times on each image, and report the average over these runs. We also rank the algorithms for each image and calculate Friedmann ranks which are obtained by averaging the ranks over the image set.

Table 1. Parameter settings for all algorithms.

Table 2 compares the results in terms of objective function values. As we can see, HMS is ranked first for 5 of the 10 images, and second for the other ones, leading to a clear best overall rank, followed by DE and PSO.

Table 2. Objective function value results.

We also perform a statistical analysis, using the Wilcoxon signed rank test to compare our HMS-based algorithm with the other techniques. The null hypothesis \(H_{0}\) here indicates no statistical difference between two algorithms, while the alternative hypothesis \(H_{1}\) points to a statistically significant difference. The obtained p-values are 0.0020 for ABC, 0.0039 for HS, 0.0273 for PSO, 0.0488 for DE, and 0.0020 for GA and are thus all below 0.05 demonstrating statistical superiority of HMS.

Table 3. BOR results.

We further assess our proposed algorithm using several image segmentation criteria, in particular:

  • Borsotti criterion (BOR)  [1]: an unsupervised criterion based on the number, the variance, and the area of segmented image regions. A lower BOR indicates a better segmentation performance.

  • Levine and Nazif interclass contrast (LNIC)  [8]: an unsupervised criterion based on the sum of region contrasts weighted by their areas. A higher LNIC indicates a better segmentation performance.

  • Levine and Nazif intra-class uniformity (LNIU)  [8]: an unsupervised criterion based on the sum of normalised standard deviations of image areas. A higher LNIU indicates a better segmentation performance.

  • Variation of information (VoI)  [10]: a supervised criterion that calculates the information shared between a ground truth and a segmented image. A lower VoI indicates better segmentation performance.

  • Probabilistic Rand index (PRI)  [14]: a supervised criterion that computes the fraction of pairs of pixels whose labels are consistent between computed and ground truth segmentations. A higher PRI indicates better segmentation performance.

Since the latter two require a ground truth, we can only evaluate these measures on the images of the Berkeley dataset.

Table 4. LNIC results.
Fig. 2.
figure 2

Segmented images for image 385028.

The BOR results in Table 3 show that HMS performs best for all but one image and is thus clearly ranked first overall with PSO coming second.

For LNIC, reported in Table 4, HMS yields the first rank for 5 images and second for a further 4, while similar results can be seen for LNIU in Table 5. For both criteria, our approach is the overall top-ranked algorithm.

Table 5. LNIU results.

Table 6 indicates the VoI results. Here, HMS obtained the first rank for 2 and second rank for the remaining 3 images, while GA, HS, and PSO rank first each for one image. Overall, HMS ranks first, followed by PSO and DE.

Table 6. VoI results.

Table 7 lists the PRI results. For all images, HMS ranks first or second, resulting in an overall first rank.

Table 7. PRI results.

Last not least, we show an example of the obtained results in Fig. 2 which also demonstrates the superiority of HMS.

Overall, it is clear that our proposed HMS approach outperforms all other algorithms based on all employed measures.

5 Conclusions

This paper proposes a novel clustering-based image segmentation based on human mental search (HMS). Our proposed algorithm encodes cluster centres as the candidate solutions, uses the mean squared error as objective function and employs HMS for optimisation of the latter. The proposed algorithm is compared with five other metaheuristic algorithms and the obtained experimental results verify the efficacy of the proposed algorithm for image segmentation and show it to outperform the other approaches. In future, we plan to extend our approach to find the number of optimal clusters automatically, while integrating a local search mechanism is also being investigated. We also currently explore our algorithm in the context of video analysis  [6].