MSWOA: A Mixed-Strategy-Based Improved Whale Optimization Algorithm for Multilevel Thresholding Image Segmentation

: Multilevel thresholding image segmentation is one of the most widely used segmentation methods in the ﬁeld of image segmentation. This paper proposes a multilevel thresholding image segmentation technique based on an improved whale optimization algorithm. The WOA has been applied to many complex optimization problems because of its excellent performance; however, it easily falls into local optimization. Therefore, ﬁrstly, a mixed-strategy-based improved whale optimization algorithm (MSWOA) is proposed using the k-point initialization algorithm, the nonlinear convergence factor, and the adaptive weight coefﬁcient to improve the optimization ability of the algorithm. Then, the MSWOA is combined with the Otsu method and Kapur entropy to search for the optimal thresholds for multilevel thresholding gray image segmentation, respectively. The results of algorithm performance evaluation experiments on benchmark functions demonstrate that the MSWOA has higher search accuracy and faster convergence speed than other comparative algorithms and that it can effectively jump out of the local optimum. In addition, the image segmentation experimental results on benchmark images show that the MSWOA–Kapur image segmentation technique can effectively and accurately search multilevel thresholds.


Introduction
With the rapid development of computer technology, computer vision has gradually formed its own scientific system.Computer vision usually involves the evaluation of images or videos, including image classification, object detection [1], image segmentation, image enhancement [2], and other subtasks.In recent years, deep learning technology has been applied to almost every field of computer vision.Researchers have proposed various network optimization models for different tasks and achieved a series of remarkable research results [3].
Image segmentation, one of the computer vision research hotspots, is a fundamental stage in image processing, visual analysis, and pattern recognition.At present, image segmentation has been applied in a variety of fields, including medical image processing and analysis [4], traffic images [5], remote sensing images [6], and satellite images [7].Image segmentation makes an image easier to analyze by simplifying or changing the representation of it.The most classical method for image segmentation is binarization.Shaikh et al. [8] discussed the method of image segmentation using binarization.The numerous image segmentation methods [9] can be broadly categorized into thresholding segmentation, image edge detection, region growth-based segmentation, feature space-based clustering segmentation, and morphology-based image segmentation.Among these methods, thresholding segmentation has become the most widely used segmentation method in image segmentation due to its stable performance, simple algorithm, easy implementation, and high efficiency.It has been a hot research point in the field of image segmentation.
Histogram-based thresholding segmentation is one of the most studied image segmentation techniques.The most famous threshold selection criteria include the Otsu method [10] and Kapur entropy [11].These segmentation methods usually use a specific objective function to find the optimal threshold using an analytic formula under certain conditions.Due to the discrete characteristics of image pixels, these multilevel thresholding segmentation methods based on objective functions are essentially solved using exhaustive search.However, as there are more thresholds, using an analytical formula to solve the threshold has the drawbacks of large search space, high computational complexity, large amount of calculation, and high time consumption.Therefore, it is challenging to employ the conventional exhaustive method for multilevel thresholding segmentation when the number of thresholds to be selected is huge.How to increase real-time performance without lowering search accuracy is a hot issue in research on this kind of algorithm.
Swarm intelligence (SI)-based optimization algorithms have gained popularity in recent years as some of the standard methods for multilevel thresholding image segmentation due to their ability to significantly increase the speed and stability of the optimization process.Segmentation methods based on swarm intelligence optimization algorithms often use some unique computing techniques to improve algorithm performance, and the objective function often uses the Otsu method or some entropy functions such as Kapur, Tsallis, or Minimum Cross Entropy (MCE).Swarm intelligence optimization algorithms have become a popular topic in research in the optimization sector, mainly because they can find a more workable solution with a very low calculation cost, which can reduce operation time and improve solution accuracy.They have the advantages of simple and effective computing, fast operation speed, high precision, and being suitable for large-scale parallel solutions.Common swarm intelligence optimization algorithms include particle swarm optimization (PSO) [12], the artificial bee colony algorithm (ABC) [13], the firefly algorithm (FA), the bat algorithm (BA) [14], moth-flame optimization (MFO) [15], cuckoo search (CS) [16], the bacterial foraging optimization algorithm (BFO) [17], gray wolf optimizer (GWO) [18], etc.Until now, these new optimization algorithms have been applied to the field of image segmentation.Wu Peng applied the firefly algorithm (FA) combined with maximum entropy for image segmentation.The experimental results demonstrate that the method can quickly and accurately find the optimal thresholds and improve accuracy and anti-noise performance.Chao Yuan et al. [19] proposed a multilevel thresholding image segmentation method based on the generalized inverse particle swarm optimization and gravity search hybrid algorithm (GOPSOGSA) by combining PSO and the gravitational search algorithm (GSA).The experimental results indicate that the proposed method is better than the GSA in segmentation accuracy but needs more computing time.Pare et al. [16] proposed ELR-CS (Egg Laying Radius) on the basis of CS (cuckoo search) and extended the energy curve of gray-scale images into color images.The experimental results prove that the color image segmentation method using the CS-Kapur energy curve can obtain higher segmentation accuracy.Prateek Agarwal [20] applied histograms based on bimodal and multimodal thresholds, and the social spider algorithm (SSA) to the multilevel thresholding segmentation of gray-scale images, effectively improving computing time and realizing the optimization of the optimal threshold.Hao Gao et al. [13] applied a modified artificial bee colony algorithm to multilevel thresholding image segmentation to solve the problems of large amount of computation and long computing time.A gray image segmentation method [21] using Kapur entropy based on the month swarm algorithm (MSA) was proposed; it effectively solves the issue of large amount of computation in multilevel thresholding segmentation.Ashish Kumar Bhandari [22] proposed a multilevel thresholding segmentation method named Energy-Masi-MSA based on Masi entropy.Compared with other meta heuristic algorithms, the MSA has better performance in threshold evaluation index and reducing computational complexity.Abdul Kayom et al. [12] used GWO to identify the best threshold of gray images under the conditions of Kapur entropy and Otsu.According to the experimental results, the suggested method has higher convergence precision and is more stable than PSO and BFO.In the same year, Shubham Kapoor [23] applied the GWO algorithm to satellite image segmentation and achieved advantages in computational efficiency and accuracy.K.P. Baby Resma et al. [24] applied the krill herd optimization algorithm (KHO) to gray-scale image segmentation; Lifang He [25] proposed an efficient krill herd algorithm (EKH) for color image segmentation.Comparative experiments on Otsu, Kapur entropy and Tsallis entropy showed that EKH-Kapur entropy is more effective in color image segmentation and is more accurate and robust.GuoShen Ding et al. [26] improved the fruit fly optimization algorithm (FOA).The experimental results demonstrate that the suggested method outperforms other algorithms in terms of segmentation efficiency and global convergence.Pankaj Upadhyay et al. [27] proposed a multilevel thresholding segmentation method for gray images based on the crow search algorithm (CSA) and Kapur entropy.The experimental findings prove that the suggested approach has superior accuracy in solution and segmentation effect when comparing PSNR, SSIM, FSIM, and computation time.Zhikai Xing [28] improved emperor penguin optimization (EPO) by introducing strategies such as Levy flight, Gaussian mutation, and opposition-based learning into the algorithm to improve the search ability of it.Moreover, improved EPO is applied to the segmentation of various types of color images.Erick Rodríguez-Esparza [29], Aneesh Wunnava [30], and Mohamed Abd Elaziz [31] applied Harris Hawks Optimization (HHO) and improved HHO to multilevel thresholding image segmentation and achieved good results.A modified remora optimization algorithm (MROA) [32] was proposed for global optimization and image segmentation tasks.The experimental results prove that it is a promising method for global optimization problems and image segmentation.As intelligent optimization algorithms quickly advance, more and more academics are starting to apply them to multilevel thresholding image segmentation, which can partially address the issue of operating efficiency.These research results also demonstrate the viability and efficiency of intelligent optimization methods for multilevel thresholding image segmentation.
The whale optimization algorithm (WOA) [33] is a brand-new swarm intelligence optimization algorithm that simulates the behavior of whale predation.Compared with other classical intelligent optimization algorithms, such as PSO and the GSA, it has the advantages of straightforward structure, fewer parameters, and strong optimization capacity.The WOA has attracted the attention of numerous academics and has been used to address a variety of real-world issues, such as constrained engineering design problems [34], forecasting water resource demand [35], multiobjective optimization problems [36], large-scale global optimization problems and high-dimensional global optimization problems [37,38], optimal single mobile robot scheduling [39], real-time task scheduling in multiprocessor systems [40], talent stability prediction [41], and multilevel thresholding image segmentation [42].Similar to other swarm intelligence optimization algorithms, the WOA also has some problems, such as being premature and easily falling into local optimization.Numerous scholars have attempted to modify it to overcome these shortcomings and boost performance by mostly concentrating on three aspects, where the first is to improve population initialization.For example, Zhang Yong et al. [43] used piecewise logistic chaotic maps to generate a chaotic sequence to initialize the population position, so as to maintain the diversity of the initial population in the global search.Secondly, the search strategy and search process are improved to balance the local search and global search.Third, other optimization algorithms or strategies are used to improve the original algorithm.For example, Seyed et al. [44] introduced differential evolution (DE) into the search process of the whale optimization algorithm to obtain better solutions; this obtains better experimental results, but it also makes the algorithm more complex.
The main work and contribution of this paper are as follows:

•
The definitions of k-point and k-point-based initialization algorithm are proposed.

•
The mixed-strategy whale optimization algorithm (MSWOA) is proposed using the k-point-based initialization strategy, the nonlinear convergence factor, and the adaptive weight coefficient to improve the optimization ability.

•
The proposed algorithm was applied to the multilevel thresholding segmentation of gray images using the Otsu method and Kapur entropy, respectively.PSNR, SSIM, FISM, and CPU time were chosen to measure it.
The rest of the paper is arranged as follows: In Section 2, the mathematical description of the multilevel thresholding segmentation of gray images and the mathematical formulas of the Otsu method and Kapur entropy are described.In Section 3, a mixed-strategy whale optimization algorithm is proposed and applied to gray image multilevel thresholding segmentation.In Section 4, the performance of the MSWOA is discussed using experiments based on benchmark functions.Section 5 presents the comparative experiment and analysis of image segmentation.Finally, Section 6 presents the conclusion and future research directions.

System Model and Definitions
In this work, the type of image we discuss is gray images.Assuming that there are L gray levels in the given gray image, I, and the gray range is {0,1,2,. . .,(L−1)}, then m thresholds divide the image into m + 1 classes, which can be described as follows: where t i (i = 1, 2, . . ., m) is the ith threshold, C i is the ith pixel set of image I, and g(i, j) is the gray level of image I at pixel (i, j).When m = 1, there is only one threshold, also known as single-level thresholding, while if m ≥ 2, it is called multilevel thresholding.In this study, we mainly discuss multilevel thresholding image segmentation.
Assuming that f (t In this paper, among the common multilevel thresholding image segmentation methods, the Otsu method and Kapur entropy are selected and combined with the MSWOA to achieve image segmentation.The Otsu method and Kapur entropy are detailed below.

Otsu Method
The Otsu method [10] was proposed by Japanese scholar Nobuyuki Otsu in 1979.Its basic idea is to use the one-dimensional probability histogram of the image gray level to select the segmentation threshold when the between-class variance of the image reaches the maximum.The best threshold divides the image into sections with the largest betweenclass variance.The Otsu method considers that the image segmentation effect is the best under this condition.
Assuming that image I has N pixels, probability p i of the ith gray level can be expressed as shown in Equation (3): where h i represents the sum of the number of the ith gray levels and where In Equation ( 4), µ T = L−1 ∑ i=0 ip i represents the average gray level of the whole image, and

Kapur Entropy
Kapur entropy [11], also known as the maximum entropy method, was proposed by Kapur in 1985.Its basic idea is to divide the gray histogram of an image into independent classes with several thresholds, so as to maximize the sum of the entropy values.The function of Kapur entropy of image I can be expressed as shown in Equation (5): where

Our Proposed MSWOA Scheme
This section first introduces the basic whale optimization algorithm.Then, a mixedstrategy-based improved whale optimization algorithm (MSWOA) is proposed.Finally, the proposed algorithm is applied to the multilevel thresholding segmentation of gray images.As mentioned above, the Otsu method and Kapur entropy are combined with the MSWOA to achieve image segmentation.When the function of between-class variance or the Kapur entropy function obtains the maximum value, image segmentation works best.In this work, a gray image segmentation task is proposed as shown in Equation ( 6): where the mathematical expressions of the objective functions are shown in Equations ( 4) and (5).

Whale Optimization Algorithm
The whale optimization algorithm is a meta heuristic optimization algorithm simulating the behavior of whales in the ocean.It includes three main stages: prey encircling, bubble hunting, and prey searching.In the whale optimization algorithm, assuming that the size of the whale population is N and the dimension of the solution space is D, the corresponding position of the ith whale in the D-dimensional space is X i = (x 1 i , x 2 i , . . ., x D i ), i = 1, 2, 3, . . ., N, and the position of the optimal whale (prey) corresponds to the global optimal solution.
Prey encircling: The whale locates prey and surrounds it throughout the predation phase.Other members of the group move to the best position, which is assumed to be where the prey is currently, and the position is updated using the formula below: where t indicates the current iteration; X * (t) represent the optimal whale position in the tth iteration; X(t) is the position of the individual whale in the tth iteration; and A and C are coefficients calculated with the following equations: where r is a random number in [0, 1] and a decreases linearly from 2 to 0 during iteration.Bubble hunting: In the WOA, whale predation behavior is classified as shrinking encircling and spiral updating.Of these, shrinking encircling is realized according to Equation (9), where convergence factor a decreases linearly with iterations and A is a random value in [−a, a].If | A |≤ 1, the individual whale updates its position as it approaches prey and completes the contraction of prey in accordance with Equation (8).Individual whales in spiral updating must first calculate how far apart they are from prey and then prey on the prey in a spiral form.The following is the mathematical expression of this behavior: where Equation (11) indicates the distance between the ith whale and its prey, l is a random number in [−1, 1], and b is a constant that defines the shape of the spiral.
In the whale predation process, spiral updating is carried out at the same time as shrinking encircling.To simulate this synchronization process, the WOA assumes that probability p of performing these two predation behaviors is 50%.The mathematical model is as follows: Prey searching: When | A |≥ 1, a member of the population is randomly chosen as prey for the global search to avoid falling into the local optimum.The mathematical model is shown as follows: where X rand indicates the position of a random whale (or prey) in the current population.

Mixed-Strategy-Based Improved Whale Optimization Algorithm
A mixed-strategy-based improved whale optimization algorithm (MSWOA) is presented using the k-point initialization algorithm, the nonlinear convergence factor, and the adaptive weight coefficient to enhance the search ability of the WOA.In addition, the MSWOA is applied to multilevel thresholding gray image segmentation combined with the Otsu method and Kapur entropy, respectively.

Population Initialization Based on k-Point Search Strategy
Haupt et al. [45] and Gondro et al. [46] pointed out that the accuracy and convergence speed of swarm intelligent optimization algorithms depend on the quality of the initial population.A better initial solution can accelerate the convergence speed of the algorithm and help to find the global optimal solution.However, the global optimal solution of the problem to be optimized is usually unknown.Without any prior knowledge, swarm intelligence optimization algorithms, including the WOA, usually use random methods to generate initial population individuals.The search accuracy and efficiency of an algorithm is somewhat impacted by the variety of the initial population, which cannot be guaranteed using the random initialization method.
In this work, inspired by the idea of the opposition-based learning strategy [47] and the binary search strategy, we propose a new search strategy called k-point and apply it to the algorithm for population initialization.
Definition of k-point: If there is a real number x in interval [lb, ub], the left binary point of x is defined as x l = (lb + x)/k, and the right binary point is defined as , where x l i = (lb i + x i )/k, and the right binary point of p is defined as p r = (x r 1 , x r 2 , . . ., x r d ), where x r i = (x i + ub i )/k.k is an integer larger than 1.According to the above definition, the specific steps for generating the initial population using the k-point search strategy are shown in Algorithm 1.

Algorithm 1: Population initialization based on k-point search strategy.
Set population size N for i = 1 to N do for j = 1 to d do with the best fitness as the initial population.

Nonlinear Convergence Factor and Adaptive Weight Coefficient
Similar to other swarm intelligence optimization algorithms, the basic WOA suffers from imbalance between global and local search capabilities when trying to identify the optimal solution.How to coordinate its exploration and development abilities is very important.Exploration ability means that the group needs to explore a wider search area to prevent the algorithm from falling into the local optimum; exploitation ability primarily uses the existing information of the group to search for some neighborhood of the solution space, which has a significant impact on the convergence speed of the algorithm.In the basic WOA, Equation ( 9) is used to control the global search or local search.When A ≥ 1, the algorithm conducts a random global search with a probability of 0.5.When A < 1, the algorithm performs a local search, and the value of A is mostly determined by convergence factor a. Therefore, in order to discover the best solution, the change in convergence factor a is crucial.Convergence factor a in the basic WOA decreases linearly with the increase in the number of iterations, which makes the algorithm's convergence speed excessively slow.
In the initial stage of iteration, the algorithm is better able to escape the local extremum if a is larger; in the middle stage of iteration, in order to ensure faster convergence speed, a should be rapidly reduced to a smaller value with the increase in the number of iterations; while the search range of the optimal solution is basically determined in the later stage, a smaller a should be selected to improve the convergence accuracy of the algorithm.In order to accelerate the convergence speed while maintaining the algorithm's potential for both global exploration and local exploitation, we introduce a nonlinear adjustment strategy without altering the changing trend of the original convergence factor.The specific formula is as follows: where u is a constant coefficient, which is used to adjust the attenuation degree of convergence factor a; and the value range of u is greater than 0; t is the number of iterations; and T max is the maximum number of iterations.When T max = 500, the curve of a changing with u is shown in Figure 1.As shown in Figure 1, when the attenuation degree of convergence factor a changes from slow to rapid, compared with the basic WOA, A ≥ 1 accounts for a larger proportion of iterations, and the random global exploration ability of the algorithm is enhanced, while the local development ability is weakened; on the contrary, when the attenuation degree of convergence factor a changes from fast to slow, A ≥ 1 takes up a smaller proportion of iterations, and the local development ability of the algorithm is enhanced, while the random global exploration ability is weakened.In this paper, u = 0.4 was selected to enhance the local development ability of the algorithm and improve the convergence speed and accuracy of the algorithm.
In the basic WOA, the position of prey is the location of the optimal solution.However, in the process of algorithm execution, the location of prey X * (t) in Equations ( 8), ( 13) and ( 15) is not fully utilized.In this paper, the adaptive weight coefficient is presented to make use of the optimal solution to increase the accuracy of the algorithm.The adaptive weight coefficient, ω, is defined as follows: where t is the number of iterations and T max is the maximum number of iterations.It is obvious that the value of ω is increased from 0 to 1.In Equations ( 18)-( 20), adaptive weight coefficient ω increases with the number of iterations, which means that after each iteration, the position of prey is closer to the theoretical optimal solution, so as to improve the optimization accuracy of the algorithm; in the spiral update, the whale continues to approach its prey as the number of iterations rises.To enhance the local search capability of the algorithm, a smaller weight is introduced, which can make it possible to discover whether there is a better solution near the prey while updating the location.

Multilevel Thresholding Using MSWOA
In this work, the proposed MSWOA was applied to the threshold segmentation of gray images to obtain the optimal threshold and realize the segmentation of images.The task of image segmentation is described in Equation ( 6).The basic idea of using the MSWOA to search for the optimal threshold is to transform the threshold search into the minimum or maximum search of the objective function using the Otsu or Kapur method.In this process, a group of thresholds can be regarded as the position values of individual whales in the search space.Therefore, the continuous adjustment of the whale position means that the threshold is searched for continuously until convergence accuracy is reached or the stop condition of the optimization algorithm is satisfied.The flow chart is shown in Figure 2.

Performance Evaluation
In order to test the performance of the proposed algorithm, especially in terms of solution accuracy and convergence speed, 13 benchmark functions [33] (as shown inTable 1) were selected for experiments.The benchmark functions in Table 1 included seven unimodal functions and six multimodal functions.We compared the proposed algorithm with the WOA, PSO, the SSA [48], the GOA [49], MFO [15], MVO [50], and the DA [51] to prove its effectiveness.The simulation experiments in this paper were conducted using Intel(R) Core (TM) i7-8700 CPU, 3.20 GHz, 16 GB RAM, and Windows 10 (64-bit) operating system, and the programming software was MATLAB R2016b.

Parameter Settings
The population size (PopSize) of all algorithms in this section was set to 30.Each algorithm was run independently for each function 30 times to obtain the average value and standard deviation.Due to the slow convergence speed of some algorithms (e.g., MFO and DA), more iterations were needed to achieve a certain convergence accuracy, so 500 and 800 were set as the maximum iteration (Max_Iter) numbers for independent experiments and compared.The core parameter settings and their values involved in all algorithms are shown in Table 2. Other parameters and their values not listed in the table were set according to the original paper.

Experimental Results and Analysis
Tables 3 and 4 show the running results of eight optimization algorithms on 13 benchmark functions in Table 1.Among them, Table 3 shows the results of 500 iterations after running the algorithms independently 30 times; Table 4 shows the results of 800 iterations after running the algorithms independently 30 times.It can be seen from Table 3 that compared with the WOA, except for F12, the MSWOA had better solution accuracy; especially, it could converge to the theoretical minimum value of 0 of F1, F3, F9, and F11.Compared with other six algorithms, PSO had more advantages in solving F6, F12, and F13; the SSA had more advantages in solving F6; and the MSWOA performed better in other benchmark functions.Similarly, it can be seen from Table 4 that compared with the WOA, the MSWOA only performed slightly worse in the results of F6 and F12, but the order of magnitude was the same, and there was no significant difference in numerical value.Similar to the results in Table 3, in Table 4, compared with other six algorithms, the solution accuracy of the MSWOA for F6, F12, and F13 was not as good as that of PSO and the SSA, and there were many differences in the order of magnitude, but it was the best in solving other functions.In general, the accuracy of the MSWOA was obviously better than that of the other seven optimization algorithms.The bolded part is the algorithm that performs best on the benchmark functions (Avg or Std metrics).The bolded part is the algorithm that performs best on the benchmark functions (Avg or Std metrics).
In order to reflect the speed of convergence and the capability to jump out of the local optimum of the MSWOA intuitively, we selected six typical function convergence curves when the maximum iteration number was 800, as shown in Figure 3.The solution accuracy of the ordinate in the figure was logarithmized based on 10.It can be seen from Figure 2 that the curves of the MSWOA have the fastest descent and convergence speed.Among them, the convergence curves of F1 and F9 are interrupted when the number of iterations is less than 500, which indicates that the algorithm jumped and converged to 0 (logarithm cannot be taken as 0), which is consistent with the values shown in Table 4.The convergence curves of F5 and F10 show that the convergence accuracy of the MSWOA and that of the WOA in these two functions are similar, but the convergence speed of the MSWOA is obviously faster than that of the WOA.Combined with the data in Tables 3 and 4, it can be concluded that the MSWOA and the WOA generally converge within 500 iterations.When the number of iterations increases from 500 to 800, there is little room for further improvement in solution accuracy, while for other algorithms, especially the GOA and the DA, more iterations (more than 500) are needed to achieve similar convergence accuracy.The convergence curves of F6 and F12 show that the MSWOA and the WOA have faster convergence speed (less than 100 iterations) than other algorithms, but they are not as accurate as PSO and the SSA.Generally speaking, the MSWOA has faster convergence speed than other algorithms in Tables 3 and 4, and the decline range has mutation, which can effectively jump out of the local optimum.

Benchmark Images
In this work, we selected eight common images for a multilevel thresholding segmentation experiment based on histograms.These images were from Berkeley Segmentation Dataset and the Benchmarks 500 (BSDS500) dataset.The color images were grayed.Figure 4 shows the original images of the benchmark images: (a) Lena, (b) Baboon, (c) Starfish, (d) Couple, (e) Cameraman, (f) Pepper, (g) Tree, and (h) Building, where the size of Lena and Baboon was 512 × 512, the size of Cameraman and Pepper was 256 × 256, and the size of other images was 481 × 321. Figure 5 shows the histogram curve corresponding to each image in Figure 4.

Experimental Settings
In this experiment, we used m to represent the multiple threshold levels of images.We mainly considered four different threshold levels: 2-threshold level, 3-threshold level, 5-threshold level, and 8-threshold level (Tables 5-8).In particular, the 10-threshold level, 15-threshold level, 20-threshold level, 25-threshold level, and 30-threshold level were also considered for the proposed algorithm (Table 9).Since this work focused on gray images, gray level L was 255, that is, the value range of each pixel was [0, 255].Therefore, for the m-level optimization problem, the search space was [0, 255] m .The bolded part is the algorithm that performs best in quality metrics (PSNR, SSIM, FSIM, CPU time) at the threshold level (m = 10, 15,20,25,30).
In order to compare the image segmentation effect, we compared the MSWOA, and the WOA, PSO, the SSA, the GOA, MFO, MVO, and the DA to prove the effectiveness of the proposed algorithm in image segmentation.The parameter settings of each algorithm are shown in Table 2.The population size of all algorithms was 30, and the maximum iteration number was 800.The experimental environment was the same as that in Section 4.

Segmented Image Quality Metrics
In order to evaluate the segmentation effect of the eight algorithms, the commonly used peak signal-to-noise ratio (PSNR ), structural similarity (SSIM), feature similarity (FSIM), and CPU time were selected as the evaluation criteria of the quality of image segmentation [16].As a common image evaluation standard in image segmentation, PSNR is used to compare the signal-to-noise ratio between the original image and the segmented image and is calculated using the following equation: where MSE is the mean square error, which is defined as follows: where M and N are the sizes of image I, I is the original image, and I is the segmented image.
SSIM is a metric used to measure the similarity between two images [52].Assuming that there are image x and image y, the structural similarity of the two images can be calculated using the following equation: where µ x is the average value of image x, µ y is the average value of image y, σ 2 x is the variance of image x, σ 2 y is the variance of image y, σ xy is the covariance of image x and image y, and c 1 and c 2 are used to maintain a stable constant in order to avoid the case where the denominator is 0. The value range of SSIM is [0, 1], and the larger the value is, the more similar the structures of the two images are.When two images are the same, the value of SSIM is equal to 1.
FSIM is a variant of SSIM whose principle is that all pixels in an image are not of the same importance.Some special pixels, such as those on the edge of objects, are more important in defining the structure of objects than those of other background areas.Therefore, more weight should be given to these pixels in calculation to highlight the important features of an image.The definition of FSIM is shown as follows [53]: where ω represents the entire image and S L (x) indicates the similarity between the segmented image and the original image.

Analysis of Otsu and Kapur Methods
According to the PSNR, SSIM, and FSIM results with m = 2, 3, 5, and 8 (as shown in Tables 5-7), the method based on Kapur entropy could obtain better data values under the same number of thresholds, and image segmentation quality and accuracy increased, showing a better segmentation effect.Figure 6 shows bar charts for Baboon with MSWOA-Otsu and MSWOA-Kapur with m = 2, 3, 5, and 8.It is obvious that the values of the Otsu-based method were smaller than those of the Kapur entropy-based method.Figures 7 and 8 show the segmentation effects of MSWOA-Otsu and MSWOA-Kapur with m = 2, 3, 5 and 8, respectively.And the segmentation effect in Figure 7 is clearer than that in Figure 8.In terms of CPU time, as shown in Table 8, Kapur took a little longer than Otsu, that is to say, the Otsu-based method took less time, but the difference between them was not significant, and the value was in the same order of magnitude.The segmentation results of MSWOA-Otsu and MSWOA-Kapur with m = 10, 15, 20, 25, and 30 are given in Table 9, which further shows that the segmentation effect of Kapur was still better in high dimensions (with more thresholds), and the numerical difference was significant.Figure 9 shows line charts of PSNR, SSIM, FSIM, and CPU time for Lena with MSWOA-Otsu and MSWOA-Kapur with m = 10, 15, 20, 25, and 30.Generally speaking, for the same optimization algorithm, the method based on Kapur entropy was significantly better than the Otsu-based method in the given segmentation image and the same number of thresholds, m.

Analysis of MSWOA and Other Seven Optimization Algorithms
With the Kapur entropy-based method, when the number of thresholds was small (e.g., m = 2 and 3), the segmentation results of each algorithm were almost the same.When the number of thresholds was large (e.g., m = 5 and 8), the numerical difference in the segmentation results was obvious.By comparing the results of eight optimization algorithms based on the Kapur entropy-based method in Tables 5-8, it is not difficult to find that the segmentation results of the MSWOA were the best among all algorithms except for individual singular values.Figures 10-13 show images segmented with different segmentation methods.In terms of program time consumption (CPU time), except for the GOA and the DA, the time consumption of the other six optimization algorithms was not significantly different, all of which were on the same data level.The reason is that although the solution time of intelligent optimization algorithms increases with the increase in solution space, it is not a positive-proportion (or exponential) growth.Therefore, compared with the traditional exhaustive method, the multilevel thresholding segmentation method based on an intelligent optimization algorithm is much faster, especially in the case of high dimensions (many thresholds).In terms of PSNR, SSIM, and FSIM, their overall numerical trend is also consistent, and the value based on the MSWOA shows the majority of advantages.For the Otsu-based method, the conclusion is similar to that of the Kapur entropy-based method.Generally speaking, the segmentation effect of the MSWOA was the best among the eight algorithms, whether using the Otsu or Kapur method.

Statistical Analysis with Wilcoxon Rank Sum Test
Wilcoxon rank sum test [18] is a kind of nonparametric test.In this paper, it was used to test whether there was a significant difference in the overall distribution of sequence data obtained with two groups of different algorithms at the 5% significance level.The null hypothesis indicated that there was no significant difference among the algorithms, while the alternative hypothesis indicated significant difference among the algorithms.In this work, the MSWOA proposed in this paper was compared with other seven algorithms in terms of the PSNR value of segmented images.The objective functions were Otsu and Kapur.Each algorithm ran 100 times for each of the cases, with m = 5 and 8, and the experimental results are shown in Tables 10 and 11.Among them, a p-value less than 0.05 (or h = 1) means that the null hypothesis could be rejected at the 5% significance level, indicating that there were obvious differences between algorithms; on the contrary, a p-value greater than 0.05 (or h = 0) indicates that the null hypothesis was accepted, that is to say, there was no obvious difference among the algorithms.Superscript '+' indicates a significant difference at the level of p-value < 0.05, which means that the MSWOA performed better than the other algorithms, while '#' indicates that MSWOA performance was similar to or worse than that of the other algorithms.As can be seen from Table 10 (Otsu-based), the numbers of instances of p-value<0.05(or h = 1) were 12 (MSWOA vs. WOA), 13 (MSWOA vs. PSO), 14 (MSWOA vs. SSA), 13 (MSWOA vs. GOA), 13 (MSWOA vs. MFO), 14 (MSWOA vs. MVO), and 14 (MSWOA vs. DA), respectively.Similarly, in Table 11 (Kapur-based), the numbers of instances of p-value < 0.05 (or h = 1) were 13 (MSWOA vs. WOA), 16 (MSWOA vs. PSO), 15 (MSWOA vs. SSA), 14 (MSWOA vs. GOA), 14 (MSWOA vs. MFO), 14 (MSWOA vs. MVO), and 14 (MSWOA vs. DA).The results show that there were significant differences between the MSWOA and the other seven algorithms.Therefore, in most cases, the multilevel thresholding segmentation effect of the MSWOA was better than that of the other seven algorithms.
Based on all the above analysis, we can consider that the MSWOA-Kapur multilevel thresholding image segmentation method proposed in this paper can quickly and accurately find the best thresholds of the image and is better than other algorithms compared in the paper in terms of segmentation effect and statistical analysis.'+' indicates that the MSWOA performed better than the other algorithms.'#' indicates that MSWOA performance was similar to or worse than that of the other algorithms.

Conclusions and Future Work
To address the issues of extensive calculation and time consumption in multilevel thresholding image segmentation, a new intelligent optimization algorithm called WOA is introduced, which has the advantages of simple structure, few parameters, and fast solving speed.It can effectively handle the high-dimensional space optimization problem, yet it also has some drawbacks, such as easily falling into the local optimum.Firstly, the MSWOA was designed by improving the basic WOA in terms of initialization, nonlinear convergence factor, and adaptive weight, especially proposing a new initialization strategy named kpoint.Using 13 benchmark functions, the effectiveness of the MSWOA was proved.Then, the MSWOA was applied to the multilevel thresholding segmentation of gray images.We chose the Otsu method and Kapur entropy as the objective functions and selected PSO, the SSA, the GOA, MFO, MVO, and the DA as the comparative algorithms to perform a series of experiments.According to PSNR, SSIM, FSIM, CPU time, and other evaluation criteria, and statistical analysis (Wilcoxon rank sum test), we believe that the MSWOA-Kapur multilevel thresholding image segmentation proposed in this paper is a better method that can effectively reduce the amount of calculation, improve the operation efficiency, and obtain relatively good thresholds.In general, the main work of this paper is to propose the MSWOA and prove its effectiveness and advantages from the two aspects of algorithm performance and multilevel thresholding image segmentation.
This paper is based on histogram gray image segmentation; as a further study, we will try to improve the histogram, take some spatial properties (e.g., energy curve) [53,54] into consideration to improve the quality of image segmentation, and apply it to color image segmentation.Meanwhile, we are going to apply more intelligent optimization algorithms (e.g., Seagull Optimization Algorithm (SOA)) [55] and segmentation methods (e.g., Tsalli entropy and Reny entropy) to multilevel thresholding image segmentation.

Figure 1 .
Figure 1.The curve of a changing with u.

Figure 2 .
Figure 2. The flow chart of the proposed algorithm.

Figure 3 .
Figure 3. Convergence curve of typical benchmark functions.
(t 1 < t 2 < • • • < t m ) of image I, the goal of multilevel thresholding segmentation is to find a set of optimal thresholds {t * 1 , t * 2 , . . ., t * m } to maximize objective function f (t 1 , t 2 , . . ., t m ) under the condition of a given threshold number, m, which can be described as follows: 1 , t 2 , . . ., t m ) is an objective function of a set of thresholds {t 1 , t 2 , . . ., t m } Thresholdset {t 1 , t 2 , ..., t m } divides the image into m + 1 parts.If the probability of the ith part is ω i and the average gray level of the ith part is µ i , then the function of the between-class variance of image I can be expressed as shown in Equation (4):

Table 5 .
Comparison of PSNR computed with eight algorithms using the Otsu and Kapur methods with m of 2, 3, 5, and 8.

Table 6 .
Comparison of SSIM computed with eight algorithms using the Otsu and Kapur methods with m of 2, 3, 5, and 8.
The bolded part is the algorithm that performs best in SSIM metrics at the threshold level (m = 2, 3, 5, 8).

Table 7 .
Comparison of FSIM computed with eight algorithms using the Otsu and Kapur methods with m of 2, 3, 5, and 8.
The bolded part is the algorithm that performs best in FSIM metrics at the threshold level (m = 2, 3, 5, 8).

Table 8 .
Comparison of CPU time computed with eight algorithms using the Otsu and Kapur methods with m of 2, 3, 5, and 8.The bolded part is the algorithm that performs best in CPU time metrics at the threshold level (m = 2, 3, 5, 8).

Table 10 .
Wilcoxon rank sum test results based on multilevel thresholding methods using the Otsu method.+' indicates that the MSWOA performed better than the other algorithms.'#' indicates that MSWOA performance was similar to or worse than that of the other algorithms. '

Table 11 .
Wilcoxon rank sum test results based on multilevel thresholding methods using Kapur entropy.