1 Introduction

Reaching better accuracy when analyzing an image is considered an indispensable objective, but the image may be crowded with objects that are not beneficial for this analysis, and subsequently, the accuracy will reduce significantly due to paying attention to some unimportant regions within the analyzing process. As a result, separating the similar regions within the image is a common problem known as image segmentation problem (ISP) that the researchers’ pit for overcoming to extract the desired regions that improve the analysis accuracy of the image in several fields such as historical newspapers (Naoum et al. 2019; Barman et al. 2020), satellite image processing (Karydas 2020), object recognition (Wang et al. 2020), and medical diagnosis (Mittal et al. 2020; Zhang et al. 2020; Sultana et al. 2020; Hassanzadeh et al. 2020).

To overcome ISP, several segmentation techniques under region-based (Aksac et al. 2017), feature selection-based clustering (Narayanan et al. 2019), edge-based (Prathusha and Jyothi 2018), and threshold-based (Han et al. 2017) have been suggested. From among those techniques, threshold-based segmentation is the simplest, fastest, and accurate. As a result, threshold-based segmentation is significantly utilized to tackle ISP (Kuruvilla et al. 2016; Oliva et al. 2014; Arora et al. 2008). Threshold-based segmentation has two categories: bi-level threshold, and multi-level threshold. In the bi-level, the image is divided into two parts: background and foreground (object). When having more than two similar regions within the image, the bi-level is skipped, and comes the role of the multi-level threshold that appeared to separate the several similar regions within the image. But although the high benefits that multi-level threshold could come true to overcome ISP for an image with several regions, it needs time increased exponentially with the required threshold number.

Some of the threshold techniques are based on a parametric approach that needs to compute some parameters under the probability density function for each region to extract the optimal threshold values. While the other techniques use a non-parametric approach that seeks to maximize some functions such as Kapur’s entropy (Kapur et al. 1985), fuzzy entropy (Li et al. 2021) and Otsu function (Otsu 1979) without going to computing some parameters.

Since the multi-level threshold needs time increased exponentially with the threshold levels, the traditional techniques are inadequate for overcoming those levels especially for an image with an extremely significant level. Consequently, the researchers think in the meta-heuristic algorithms as another methodology to overcome the drawbacks of the traditional techniques due to the great success that could achieve in many fields (Abdel-Basset et al. 2018; Sayed et al. 2019; Abouhawwash and Alessio 2021; Ma et al. 2021, 2020) within less possible time. Several meta-heuristic algorithms for tackling ISP has recently been proposed, some of which will be reviewed within the next section.

Recently, a new metaheuristic algorithm known as the marine predators algorithm (MPA), which mimics the behaviors of the predators when attacking their prey, has been proposed for tackling the global optimization problem and could fulfill superior performance (Faramarzi et al. 2020). As a result, it has been applied for tackling several real optimization problems. In Soliman et al. (2020), MPA was adapted for finding the unknown parameters of triple-diode photovoltaic models and could fulfill superior outcomes compared to four other metaheuristics algorithms. It has been also applied for finding the optimal thresholds of an image by maximizing the fuzzy entropy type II as an objective function (Mahajan et al. 2021). Moreover, the MPA integrated with dominance strategy-based exploration and exploitation was applied for tackling the multiobjective optimization problems and could outperform several well-known multiobjective optimization algorithms (Abdel-Basset et al. 2021). Both MPA and political optimizers (PO) were applied for finding the unknown parameters of fuel cells and the experimental findings show that MPA is better than PO and some of the compared metaheuristic algorithms (Diab et al. 2020). Compared to some of the evolutionary algorithms like genetic algorithm and differential evolution, in addition to the particle swarm optimization algorithm as one of the well-known swarm-based optimization algorithms, MPA could fulfill terrible success for tackling several optimization problems due to having some strong characteristics which have aided avoiding stuck into local minima by exploring several regions within the search space in less number of function evaluations to increase the convergence speed (Faramarzi et al. 2020). Moreover, MPA has additional merit, increasing the exploration capability, known as fish aggregating devices (FADs) that have employed various updating manners to reposition each solution to other regions in the search space for preserving the solution diversity within various optimization phases.

Furthermore, MPA was integrated with Success History based Adaptive Differential Evolution (SHADE) algorithm to utilize the features of each one for producing a new strong variant called hybrid Marine Predators—Success History based Adaptive Differential Evolution (MP-SHADE) algorithm for estimating the unknown parameters of the single and double diode photovoltaic models. A combination of both MPA and teaching and learning-based optimization could produce a new strong one having higher exploration capability to avoid stuck into local minima as an attempt to find better outcomes. This variant was abbreviated as TLMPA and applied for tackling IEEE CEC-2017 benchmark functions and four engineering design problems. Many other variants of MPA have been recently published for tackling other real optimization problems: parameter identification of single and double diode models (Ridha 2020), a new configuration of an autonomous CHP system based on improved MPA (Wang et al. 2021), Multi-Regional Optimal Power Flow (Swief et al. 2021), and several else (Kapur et al. 1985; Yu et al. 2021; Panagant et al. 2021; Shaheen et al. 2021, 2020; Durmus 2021; Liu and Yang 2021; Elsayed et al. 2021; Ramezani et al. 2021; Riad et al. 2021; Ghoneimy et al. 2021).

Within our work, we try to support another technique that tries to exploit the individuals of the population significantly within the optimization process. This technique is based on selecting a number of the individuals with the worst fitness values, this number increases linearly with the iteration, then each individual within those individuals will be updated either with a small step size, which increases gradually with increasing the current iteration, toward the best-so-far one to explore a huge number of solutions between this worst and the best-so-far one, in addition to avoiding stuck into local minima at the start of the optimization process, or randomly within the search space to avoid stuck into local minima, the trade-off between those two different updates: toward the best-so-far and randomly within the search space is based on a certain probability illustrated within the experiments section in the parameter tuning. . After that, due to the significant success achieved by MPA in several fields as mentioned before, in addition to its need for more improvements to balance between the exploration and exploitation operators, it has been used to be integrated with this technique to propose a new variant, MPALS, having a strong exploitation operator for tackling ISP with threshold levels up to 40. However, this variant still suffers from falling into local minim because of the low exploration operator, therefore, another strategy known as ranking-based updating strategy (RUS) has been proposed with a novel updating scheme to replace the unbeneficial solutions which could not come true better solution within a consecutive number perIter of the iterations with those which improve both exploration and exploitation operators of the optimization algorithms. then, MPALS is combined with RUS to develop a new variant called HMPA. Both HMPA and MPALS were compared with a number of recently proposed well-established optimization algorithms. From involving those algorithms, the hybrid marine predators algorithm with ranking-based diversity strategy that is recently proposed for tackling ISP for covid19 images. After completing the comparison, it was notified that HMPA is superior on significant threshold levels and converged with the small threshold levels. The main contributions introduced within this paper are:

  1. 1.

    Proposing two strategies known as linearly increased the worst solutions improvement strategy and ranking-based updating strategy (RUS) to utilize each individual within the optimization process as possible for reaching better outcomes.

  2. 2.

    Integrating these strategies with MPA to propose two variants: the first is based on integrating MPA with LIS (MPALS), and the second improves MPALS by RUS (HMPA) for tackling ISP with threshold levels reaching 40.

  3. 3.

    Those two variants were extensively validated on 14 test images taken from Berkeley Segmentation Dataset, and compared with a number of recently proposed optimization algorithms to show the superiority of the proposed.

  4. 4.

    After validation and comparison, we see that HMPA could be converged with the small threshold levels and significantly outperform with the high threshold levels.

Within the following sections in this paper: some of the previous works done on ISP are reviewed in Sect. 2, the Kapur’s entropy is described in Sects. 34 overviews the marine predators algorithm. Section 5 designs the paces of developing MPA with a linear population improvement strategy for tackling ISP. Section 6 validates and compares the proposed algorithm on some test images, and Sect. 7 shows the conclusions about our proposition and future works.

2 Literature review

There are several meta-heuristic algorithms proposed for tackling ISP such as, ant colony optimization algorithm (Kaveh and Talatahari 2010), whale optimization algorithm (WOA) (Abd El Aziz et al. 2017), multi-verse optimizer (Kandhway and Bhandari 2019), particle swarm optimization (PSO) (Guo and Li 2007; Xiong et al. 2020; Di Martino and Sessa 2020), cuckoo search (CS) (Agrawal et al. 2013), locust search algorithm (LSA) (Cuevas et al. 2020), honey bee mating optimization (HBM) (Horng 2010), symbiotic organisms search (SOS) (Chakraborty et al. 2019), harris hawk optimization algorithm (HHA) (Bao et al. 2019), and moth-flame optimization (MFA) (Abd El Aziz et al. 2017), flower pollination algorithm (FPA) (Wang et al. 2015), crow search algorithm (Oliva et al. 2017), an improved grey wolf optimizer (IGWO) (Yao et al. 2019), genetic algorithm (GA) (Elsayed et al. 2014), bee colony algorithm (BCA) (Huo et al. 2020), marine predators algorithm (MPA) and improved MPA (IMPA) (Abdel-Basset et al. 2020a), equilibrium optimizer (EO) (Abdel-Basset et al. 2020c), bacterial Foraging Algorithm (BFA) (Sanyal et al. 2011), and firefly optimization algorithm (FFA) (Erdmann et al. 2015). Through this section, some of this algorithm will be surveyed briefly.

Abd El Aziz et al. (2017) developed both WOA and MFA for overcoming ISP by maximizing the Otsu’s method on small threshold levels reaching 6, but its performance on significant threshold levels is not known even now as its main limitations. In addition, Agrawal et al. (2013) proposed CS for overcoming ISP by using the tsallis entropy as a fitness function. The CS was verified a standard benchmark of test images, and compared with 4 optimization algorithms: artificial bee colony (ABC) algorithm, particle swarm optimization (PSO) , bacteria foraging optimization (BFO) and genetic algorithm (GA). According to the discussion of the authors, the CS was competitive with those algorithms in terms of only the CPU time and the objective function. This algorithm has been investigated for only 5-threshold levels, higher than that, its performance is not known as its main shortage. Chakraborty et al. (2019) proposed SOS enhanced by the opposition-based learning to increase the convergcne speed toward the optimal solution and avoid the local minima that may deteriorite the perforamcne of SOS for tackling ISP of color images. The performance of the improved SOS was validated using a set of the color images taken from Berkeley Segmentation Dataset (BSDS) and another set gathered for the COCO dataset. The experimental results of the improved SOS in comparison to a number of the existing algorithms: Bat algorithm (BA), CS, PSO, and ABC show the superiority of the improved SOS in terms of the objective values. Also, the performance of this algorithm is not known with increasing threshold levels and subsequently not preferred for tackling any image with a significant number of threshold levels.

Furthermore, Bhandari et al. (2015) proposed the modified ABC to find the optimal threshold values for the satellite image segmentation using different objective functions: Kapur’s, Otsu and Tsallis. In the modified ABC (MABC), the chaotic maps and opposition-based learning was employed during generating the initial population to improve the convergence speed. This modified version was compared with the standard ABC, PSO and GA under various objective functions, but this algorithm was limited in terms of CPU runtime and algorithm complexity compared to those compared algorithms. In Erdmann et al. (2015), FFA was proposed to tackle ISP, but its performance was weak, so the improved one (IFFA) (Chen et al. 2016), that was improved using the Cauchy mutation and neighborhood strategy to overcome the local minima and improve its exploration capability, has been developed.

Maitra and Chatterjee (2008) improved PSO with cooperative and comprehensive learning for overcoming the dimensionality curse and increasing the early convergence, respectively. Also, PSO (Liu et al. 2015) modified using adaptive inertia, and the population has been proposed for tackling ISP. BFA (Sanyal et al. 2011) has been proposed for tackling ISP of grey images by using fuzzy entropy to alter the bacterium between intensification and diversification operators. Furthermore, BFA (Tang et al. 2017) is integrated with PSO to support the global search capability in addition to the weak bacterium, which selects a random strong one to reach a location near it. In Yao et al. (2019), an improved grey wolf optimizer (IGWO) has been proposed for tackling ISP. IGWO was improved using a good point set method to initialize the population, this algorithm has a high ability to get rid of local optima and finding better solutions. This algorithm has not discussed the CPU runtime in addition to using a small number of threshold levels up to 5 and consequently, it is not a good alternative to the existing image segmentation techniques.

An improved Bat algorithm (IBA) (Mokhtari and Kimour 2019) was proposed for tackling ISP. IBA accelerated the convergence and increased the diversity between the members of the population until disposing of stuck into local minima using both the crossover operator and chaotic search, respectively. In Xu et al. (2019), A dragonfly algorithm (DA) and differential evolution (DE) have been proposed for tackling the color image segmentation problem. DA has a high ability on getting out of local minima so it can reach a better solution, in addition to integrating DE as a local search strategy to improve the precision of the solution. A modified spherical search optimizer (MSSO) (Naji Alwerfali et al. 2020) has been proposed and modified by the sine-cosine algorithm (SCA) to increase the exploitation capability of this algorithm.

In Abdel-Basset et al. (2020c), equilibrium optimizer (EO) was adapted for tackling the ISP by maximizing the Kapur’s entropy. EO was verified using a collection of the test images extracted from Berkeley Segmentation Dataset. In addition, EO was compared with a number of the popular optimization algorithms, such as WOA, BA, SCA, salp swarm algorithm, Harris hawks algorithm, crow search algorithm, and PSO to see its efficacy under a set of performance metrics. EO still suffers from falling into local minima and low convergence speed which stand as an immune obstacle front reaching the optimal threshold levels. Furthermore, in Abdel-Basset et al. (2020a) the standard MPA in addition to an improved one by ranking based diversity reduction strategy has been suggested for segmenting the x-ray images infected by covid19 under the Kapur’s entropy. The standard MPA was improved using this novel method to accelerate the convergence speed toward the best-so-far solution as an attempt to find better outcomes. This improved MPA was compared with a number of the recent algorithms to see its efficacy. The experimental results proved its efficacy over the standard one and the compared ones. Also, as discussed in the experiments later that this improved MPA had two shortcomings: local minima and low convergence speed.

Chouksey et al. (2020) has investigated the performance of the antlion optimization (ALO) and multiverse optimization (MVO) algorithms for tackling the multilevel image segmentation problem based on two objective functions: kapur’s entropy and Otsu method. Those two algorithms were compared with evolutionary algorithms under the objective value, the stability, feature similarity index (FSIM), peak signal to noise ratio(PSNR), and structural similarity index (SSIM), and CPU time. The experiments show that those algorithms could come true better outcomes over the compared algorithm, in general. Especially, the MVO could be more converged than ALO. However, those algorithms have not experimented with thresholds greater than 5 as their main limitation. Shahabi et al. (2019) proposed the crow search algorithm (CSA) for estimating the optimal threshold values using the Otsu function. This algorithm was compared the improved PSO, FFA, the fuzzy version of FFA to see its efficacy. The experimental outcomes proved the efficacy of the CSA over those algorithms for time and uniformity.

Further, the water wave optimization (WWO) algorithm modified by opposition based learning strategy and ranking-based mutation strategy to improve both the diversity of the individuals within the population and the selection probability, respectively, has been proposed by Yan et al. (2020) to select the optimal threshold values for the underwater ISP. The modified WWO (MWWO) was compared with the other algorithms based on the PSNR, the SSIM, the CPU time, the objective values, and the Wilcoxon rank sum test. The experimental outcomes show the superiority of the MWWO over the other algorithms. However, its performance for threshold levels higher than 6 has not been investigated, and hence when increasing the threshold levels, this algorithm is not preferred for tackling this problem.

3 Kapur’s entropy

Within this section, we will describe the Kapur’s entropy used to extract the optimal threshold values by maximizing the entropy of the segmented regions [14]. Let’s see the mathematical model of this method, supposing that the threshold values that segment an image with k similar regions are \(t_{0},t_{1},t_{2},\ldots\),and \(t_{k}\), then the Kapur’s entropy seek for maximizing the following formula until reaching the optimal threshold values:

$$\begin{aligned} T(t_{0},t_{1},t_{2},\ldots ,t_{n})=T_{0}+T_{1}+T_{2}+\cdots + T_{n} \end{aligned}$$
(1)
$$\begin{aligned} T_{0}= -\sum _{i=0}^{t_{0}-1}\frac{X_{i}}{W_{0}} *ln\frac{X_{i}}{W_{0}}, X_{i}=\frac{N_{i}}{W}, W_{0}= \sum _{i=0}^{t_{1}-1}X_{i} \end{aligned}$$
(2)
$$\begin{aligned} T_{1}= -\sum _{i=t_{0}}^{t_{1}-1}\frac{X_{i}}{W_{1}} *ln\frac{X_{i}}{W_{1}}, X_{i}=\frac{N_{i}}{W}, W_{1}= \sum _{i=t_{0}}^{t_{1}-1}X_{i} \end{aligned}$$
(3)
$$\begin{aligned} T_{2}= -\sum _{i=t_{1}}^{t_{2}-1}\frac{X_{i}}{W_{2}} *ln\frac{X_{i}}{W_{2}}, X_{i}=\frac{N_{i}}{W}, W_{2}= \sum _{i=t_{1}}^{t_{2}-1}X_{i} \end{aligned}$$
(4)
$$\begin{aligned} T_{k}= -\sum _{i=t_{k}}^{L-1}\frac{X_{i}}{W_{k}} *ln\frac{X_{i}}{W_{k}}, X_{i}=\frac{N_{i}}{W}, W_{k}= \sum _{i=t_{k}}^{L-1}X_{i} \end{aligned}$$
(5)

\(T_{0},T_{1},T_{2},\ldots ,\) and \(T_{k}\) expresses the entropies of similar regions, and \(N_{i}\) refers to the count of pixels with a value equal to i. \(W_{0},W_{1},W_{2},\ldots ,\) and \(W_{k}\) is a phrase about the probabilities of the different regions in proportion to the whole pixel W within an image. Finally, Eq. 1 is used in our proposition as a fitness function to find the optimal threshold values until overcoming ISP.

4 Marine predators algorithm (MPA)

Recently, Faramarzi et al. (2020) proposed a novel meta-heuristic algorithm, namely marine predators algorithm (MPA), that mimics the behavior of the predators when attacking their prey. Specifically, the predators tradeoff between the \(l\acute{e}vy's\) flight and Brownian strategy according to the velocity from the prey to predators when searching for their prey. Mathematically, MPA is formulated as follows:

Like most meta-heuristic algorithms, at the outset of the optimization process, the prey of size N will be distributed within the search space using the following equation:

$$\begin{aligned} \mathbf {prey}= \mathbf {X}_{min}+ \mathbf {r}*(\mathbf {X}_{max}- \mathbf {X}_{min}) \end{aligned}$$
(6)

Where \(\mathbf {r}\) is a vector to contain numerical values generated randomly at the interval of 0 and 1, and \(\mathbf {X}_{min}\), and \(\mathbf {X}_{max}\) are two vectors contain the maximum and minimum boundaries of the search space for the problem.

After that, the fitness function is calculated and the prey with the highest fitness is selected as the Top predator within the optimization process to construct the Elite (E) matrix. This matrix is constructed as follows: \(\begin{matrix} E= \begin{bmatrix} A_{1,1}^I &{} A_{1,2}^I &{} \ldots &{} A_{1,d}^I\\ A_{2,1}^I &{} A_{2,2}^I &{} \ldots &{} A_{2,d}^I\\ \ldots &{} \ldots &{} \ldots &{} \ldots \\ A_{N,1}^I &{} A_{N,2}^I &{} \ldots &{} A_{N,d}^I \end{bmatrix} \end{matrix}\)

\(\mathbf {A}^{I}\)is the top predator and repeated N times to build up the elite matrix. N indicates the individual numbers in the population, and d is dimension number in each individual. Then, within the optimization process, the predators are moved towards a prey matrix formulated as and initialized randomly within the search space:

$$\begin{matrix} prey= \begin{bmatrix} A_{1,1} &{} A_{1,2} &{} \ldots &{} A_{1,d}\\ A_{2,1} &{} A_{2,2} &{} \ldots &{} A_{2,d}\\ \ldots &{} \ldots &{} \ldots &{} \ldots \\ A_{N,1} &{} A_{N,2} &{} \ldots &{} A_{N,d} \end{bmatrix} \end{matrix}$$

Within the optimization process, the updating of each prey will be divided into three stages according to the velocity ratio from the prey to the predators.

  1. 1.

    High-velocity ratio The velocity ratio from the prey to predators is high in this phase, where the prey is moved quickly searching for their food and the predators monitor their movements. Therefore, the predators in this phase don’t need to move at all, because the prey will reach them itself. This phase occurs at the start of the optimization process, where the algorithm searches for better solution in all regions within the search space of the problem. This phase is mathematically formulated as follows:

    while \(t< \frac{1}{3}*t_{max}\)

    $$\begin{aligned} \mathbf {S}_{i}= \mathbf {R}_{B}\otimes (\mathbf {E}_{i}-\mathbf {R}_{B}\otimes \mathbf {Prey}_{i}) \end{aligned}$$
    (7)
    $$\begin{aligned} \mathbf {Prey}_{i}=\mathbf {Prey}_{i}+ P.\mathbf {R} \otimes \mathbf {S}_{i} \end{aligned}$$
    (8)

    where \(\mathbf {R}_{B}\) is a vector assigned randomly using the normal distribution to represent the Brownian strategy, \(\otimes\) is the entry-wise multiplication, P is a fixed value and assigned 0.5 as recommended in the original paper, \(\mathbf {R}\) is a vector generated randomly within 0 and 1, t indicates the current iteration, and \(t_{max}\) expresses the maximum iteration.

  2. 2.

    Unit velocity ratio.

    This stage occurs at the intermediate stage of the optimization process where the exploration is converted into the exploitation phase. So this stage is neither exploration nor exploration but it is a mix of them. Based on that, MPA within this phase divides the population into two halves: the first half will move using exploration steps while the other has exploitation steps. Finally, this stage will be mathematically formulated as follows:

    while \(\frac{1}{3}*t_{max}< t<\frac{2}{3}*t_{max}\)

    • For the first half of the population

      $$\begin{aligned} \mathbf {S}_{i}= \mathbf {R}_{L}\otimes (\mathbf {E}_{i}-\mathbf {R}_{L}\otimes \mathbf {Prey}_{i}) \end{aligned}$$
      (9)
      $$\begin{aligned} \mathbf {Prey}_{i}=\mathbf {Prey}_{i}+ P.\mathbf {R} \otimes \mathbf {S}_{i} \end{aligned}$$
      (10)
    • For the second half of the population

      $$\begin{aligned} \mathbf {S}_{i}= \mathbf {R}_{B}\otimes (\mathbf {R}_{B} \otimes \mathbf {E}_{i}- \mathbf {Prey}_{i}) \end{aligned}$$
      (11)
      $$\begin{aligned} \mathbf {Prey}_{i}=\mathbf {E}_{i}+ P* CF \otimes \mathbf {S}_{i} \end{aligned}$$
      (12)

    where \(\mathbf {R}_{L}\) is a vector generated randomly based on the \(l\acute{e}vy\) distribution, and CF is an adaptive parameter designed to manage the step size and created using the following equation:

    $$\begin{aligned} CF= (1-\frac{t}{t_{max}})^{2 \frac{t}{t_{max}}} \end{aligned}$$
    (13)
  3. 3.

    Low velocity-ratio:


    This stage occurs at the end of the optimization process where the exploration operator is completely converted into the exploitation operator and mathematically modeled as:

    while \(t > \frac{2}{3}*t_{max}\)

    $$\begin{aligned} \mathbf {S}_{i}= \mathbf {R}_{L}\otimes (\mathbf {R}_{L}\otimes \mathbf {E}_{i}-\mathbf {Prey}_{i}) \end{aligned}$$
    (14)
    $$\begin{aligned} \mathbf {Prey}_{i}=\mathbf {E}_{i}+ P* CF \otimes \mathbf {S}_{i} \end{aligned}$$
    (15)

    Some other factors such as eddy formulation and fish aggregating devices (FADs) affect significantly the behaviors of the predators. Based on some studies, as a result of FADs, the predators spend 20% of their search time exploring another environment around the search space with abundant prey, while the other time they search for better solution within the surrounding environment. FADs could be mathematically computed according to the following formula:

    $$\begin{aligned} \mathbf {prey}_{i}= \left\{ \begin{array}{cc} \mathbf {prey}_{i}+ CF[\mathbf {X}_{min}+\mathbf {r}_{2}(\mathbf {X}_{max}-\mathbf {X}_{min})]\otimes \mathbf {U}&{} if\; r<FADs\\ \mathbf {prey}_{i}+ [FADs(1-r)+r](\mathbf {prey}_{r1}-\mathbf {prey}_{r2}) &{} if\; r\geqslant FADs \end{array}\right. \end{aligned}$$
    (16)

    r is a number generated randomly within 0 and 1. Where, \(\mathbf {r}_{2}\) indicates the index of a prey selected randomly from the population. \(\mathbf {U}\) is a binary vector including 0 and 1. FADs=0.2 indicates the probability of impacting FADs on the optimization process. \(r_{1}\) indicates the index of a prey selected randomly from the population.

    After each updating process, MPA compares the fitness of the updated solutions with the fitness for the previous solution to see if this update improves in the positions or not. If the updated position of each solution is better than the old one, the updated will be stored to be compared with the next generation, and if the old is better than the updated one then the old solution will be used within the next generation instead of the updated one. This process is known as memory saving. The pseudo-code of MPA is exposed in Algorithm 1, and the same steps are also shown in Fig. 1. In this pseudo-code and figure, \(t++\) is the same as \(t=t+1\) and is responsible for moving the algorithm to the next generation for satisfying the termination condition related to a maximum generation.

figure a
Fig. 1
figure 1

Depiction of the MPA steps

5 Proposed work

In this section, the marine predators algorithm improved using an improvement strategy that selects a number, increasing gradually with the iteration, of the worst solutions and updates them toward the best-so-far solution and randomly within the search space is illustrated in this section. Our strategy is differentiated of the evolutionary population dynamics (EPD) (Saremi et al. 2015) by that, in EPD, the worst N/2 solutions are omitted from the population and repositioned randomly them again around the best solution. On the contrary, in our strategy, a number of the worst solutions, increasing linearly with the iteration, will be selected each iteration to trade-off between moving: most the dimensions within each one toward the best-so-far solutions, and the others are randomly reinitialized within the search space of the problem.

Our strategy works gradually on increasing the convergence of each worst one toward the best so-far solutions until accelerating the convergence speed and finding better solutions. Generally speaking, when moving each worst solution toward the best-so-far, the convergence toward the best solution increases significantly, but what if the best-so-far solution is local optima, if that, then the diversity of population are already reduced. Since the diversity of the population fade away and at the same time the best-so-far solution is local minima, no better solutions could be obtained after that. Therefore, our strategy manipulates in some of the dimensions of the worst repositioned solutions, to help in disposing of the local optima, and at the same time to keep the diversity of the population.

Our strategy methodology is contradicted with EPD because EPD repositions the worst half of solutions around the best-so-far solutions using a random number to specify the distance that will add to the best-so-far solution, thus the obtained distance is based on the random number generated and the probability of reaching better solutions is relied on this generated number. On the contrary, our proposed moves the worst solutions toward the best-so-far solutions, and the distance between the best and the worst reduces gradually each update until exploiting the best-so-far solutions deeply in addition to disposing of the local minima by reinitializing randomly within the search space some of the dimensions within the worst solutions to get rid of local minima. Within this section, Initialization, evaluation, and improvement will be illustrated in detail and mathematically.

5.1 Initialization

Before starting the optimization process, a group of N prey (population size) will be defined, where each one in the group will have a number of dimensions according to the threshold level acquired. Those dimensions will be distributed within the search space according to Eq. 17. In this phase, a number N of prey with a number of the threshold is predefined.

$$\begin{aligned} \mathbf {prey}_{i}= \mathbf {min}+ \mathbf {r} \cdot (\mathbf {max}-\mathbf {min}) \end{aligned}$$
(17)

where \(\mathbf {r}\) is a vector including values generated randomly between 0 and 1, \(\mathbf {min}\),and \(\mathbf {max}\) are the vectors including the upper and lower bound of the grey level for an image within its histogram, respectively? For example, assuming that the upper bound grey level is equal to 255, the lower bound is 0, and the threshold level of 8 is required, then each solution within the population will be represented as shown in Fig. 1 (truncated the digits after the decimal point to become integer numbers), in addition to adding the first and the last cell with the lower and the upper grey level for the image. Each cell within Fig. 2 indicates the threshold value used to find the optimal threshold values for threshold level 8.

Fig. 2
figure 2

Initial representation of the solution for tackling ISP

5.2 Evaluation

After each generation, the fitness value for each solution will be calculated using Eq. 1 and the solutions under the new positions with higher fitness value will stay inside the population for the next generation; otherwise, the old positions will be used again within the next generation. So, the evaluation steps significantly affect the performance of MPA, because the fittest solution (the best-so-far solution/predator) and the solutions used within the next generation are specified according to this step.

5.3 Linearly increased the worst solutions improvement strategy(LIS)

Recently, a new strategy (Abdel-Basset et al. 2020b) known as a linear reduction diversity technique has been proposed to update a number, increasing with each iteration, of the worst solution toward the best-so far solution to increase the convergence speed toward the best-f-so-far solution, in addition to improving the quality of the obtained solution. But, updating toward the best-so-far may accelerate the convergence toward the local minima, therefore in this paper, we tried to get rid of this problem based on another position update scheme. After calculating the fitness for each solution, a number of the worst solutions will be updated using two ways: the first one is based on updating those solutions toward the best solution with a controlling factor to determine the step size taken in the direction of this best solution to avoid stuck into local minima if the best is so. This factor, namely C, will take small steps increased gradually with increasing the current iteration even avoiding stuck into local minima at the start of the optimization process because the best-so-far might be local minima. Additionally, the second way is based on updating the current solution in the direction of the best-so-far solution using a random number generated within 0 and 1 based on the uniform distribution but will be added to this solution another step size generated based on the upper and lower bound of the problem. The number of the worst solutions is related to the iteration, where, at the start of the iteration, a small number of solutions will be selected, and with the iteration, this number will be gradually increased until maximizing at the end of the iteration. Generally, Eq. 18 represents the mathematical formula for calculating this number symbolized np:

$$\begin{aligned} np= N* \frac{t}{t_{max}} \end{aligned}$$
(18)

Where N is the population size, and np indicates the number of the worst solutions increased linearly with increasing the current iteration t. After calculating np, those worst solutions will be updated according to Eq. 19.

$$\begin{aligned} \mathbf {prey}_{w,j}= & {} \left\{ \begin{matrix} min+ r.(max-min) &{} if\; r_{3}<ER\\ E_{w,j}+ r*(E_{w,j}-prey_{w,j}) &{} otherwise \end{matrix}\right. \end{aligned}$$
(19)
$$\begin{aligned} C= & {} 1-e^{-t*r} \end{aligned}$$
(20)

\(prey_{w,j}\) indicates the \(j\hbox{th}\) dimension of the \(w\hbox{th}\) worst particle. \(r_{3}\) is a random number between 0 and 1. min refers to the lower bound of the \(j\hbox{th}\) dimension, while max is the upper bound of the same dimension. r is a number generated randomly between 0 and 1. \(E_{w,j}\) indicate the \(j\hbox{th}\) dimension of the row w in the elite matrix (E). ER expresses the exploration rate used to get the solution out of the local minima problem, its value will be discussed in the parameter settings. This strategy is known as the linearly increased the worst solutions improvement strategy (LIS). Finally, the pseudo-code of the hybrid MPA-LIS is shown in Algorithm 2.

figure b

5.4 Ranking-based updating strategy

Recently, in Abdel-Basset et al. (2020a), we proposed a method called ranking-based updating strategy which is based on replacing those solutions that could not fulfill better solutions in the last perIter iterations with other ones to improve the outcomes produced by the optimization algorithms; in our experiments, perIter is set to 3 as recommended in the original work. But, our previous proposition was based on updating those solutions which passed the unallowed rank by steering them to the right direction of the best-so-far solution in the hope of finding better solutions there. However, moving in the direction of the best-so-far solution might take the algorithm to local minima and hence no better solution will be achieved within the remaining iterations. Therefore, herein, a new updating scheme has been proposed for updating those solutions based twofold: the first one is based on searching for a better solution around one selected randomly from the population as an attempt to increase the exploration capability for reaching other regions might involve better solutions; the second one is based on turning around the best-so-far solution in a shrinking circle with the iteration to strengthen the exploitation capability. The exchange between those twofold is achieved based on a probability Pr ranging between 0 and 1 and picked by the researchers according to their experiments. the optimal value to this parameter within our experiments as discussed later. Generally, the mathematical model of this updating scheme is as follows:

$$\begin{aligned} prey_{w,j}= & {} \left\{ \begin{matrix} prey_{a,j}+D *(prey_{b,j}-prey_{c,j} )+r*(prey_{a,j}-prey_{d,j}) &{} if\; r_{3}<Pr\\ E_{i,j}+ r_{1}*A*(prey_{b,j}-prey_{c,j} ) &{} otherwise \end{matrix}\right. \end{aligned}$$
(21)
$$\begin{aligned} a=\, & {} 1- \frac{t}{t_{max}} \end{aligned}$$
(22)
$$\begin{aligned} A=\, & {} 2*a*r_{2}-a \end{aligned}$$
(23)
$$\begin{aligned} D=\, & {} e^{-A*t}* \cos {2\pi r} \end{aligned}$$
(24)

where a, b, c, and d are indices of four solutions selected randomly from the population. \(r,r_{1}\), and \(r_{3}\) are three random numbers ranging between 0 and 1. Algorithm 3 described the steps of the ranking-based updating strategy (RUS) for replacing the solutions which pass three consecutive iterations without any better solution than the best-local one with those created using Eq. 21. Finally, this strategy is integrated with the MPALS variant as listed in algorithm 4 to propose a new strong one, namely HMPA, having a high ability to balance between the exploration and exploitation capability for reaching better solutions in less number of function evaluations. The RUS give the choice to the algorithms for determining if the exploration operator will be applied more than the exploitation operator and this will make applicable for several metaheuristic algorithms because some algorithms might have low exploitation operator while the others might suffer from weakening the exploration capability, so this method could help the two sets based on the required need.

figure c
figure d

Some of the advantages of the proposed algorithms are that both the proposed strategy integrated work on increasing the convergence speed and at the same time avoiding falling into local optima and subsequently the probability of finding better solutions is significant. Although the significant success achieved by both HMPA and MPALS on the various threshold-levels, it consumes more a bit computational cost compared to some of the competing algorithms as their main limitation tackled in future work.

6 Results and discussion

6.1 Test images description and experimental settings

To validate our proposed algorithms, 14 test images taken from Berkeley Segmentation Dataset (BSDS500) [75] are used to observe their effectiveness. These images are named as “12003”, “61060”, “38092”, “232038”, “108082”, “148089”, “189003”,“108070”, “227092”, “277036”, “Barbara”, “Airplane”, “Mand”, “lena”. Besides, the original images and the histogram of each one is shown in Figs. 3 and  4.

Fig. 3
figure 3

Illustration the original image and its histogram used in our experiment

Fig. 4
figure 4

Illustration the original image and its histogram used in our experiment

A number of algorithms, such as HHA (Bao et al. 2019), WOA (Mirjalili and Lewis 2016), slime mould optimizer (SMA) (Li et al. 2020), improved tunicate swarm algorithm (ITSA) (Houssein et al. 2021), flower pollination algorithm (FPA) (Yang 2012), EO (Abdel-Basset et al. 2020c), and IMPA (Abdel-Basset et al. 2020a), are employed to check the effectiveness of our proposed algorithms, whose parameters are as recommended in the cited papers, except the population size N set to 30, and the maximum iterations \(t_{max}\) equal 300 for a fair comparison. Those algorithms were employed because they have been recently applied for tackling several optimization problems: image segmentation, parameter estimation of photovoltaic models, DNA fragment assembly problem, global optimization, and several else, and could come true superior outcomes. Table 1 lists the parameter settings of those compared algorithms.

Table 1 Parameter settings of competing algorithm

Regarding the parameters of the proposed algorithm, ER of the MPALS algorithm is tuned on 12003 under the threshold level 40 and displayed in Fig. 5, which shows the superiority of \(ER=0.9\) against the other values. For the parameter Pr of HMPA, it is checked on some values such as 0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.08, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, and 1.0 and the outcomes are illustrated on Fig. 6. This figure shows that \(Pr=0.05\) is the best. Some values for the parameter \(\beta\) are observed to see the best value for it, after observing and exposing the output on Fig. 7, \(\beta =0.01\) is the best.

Fig. 5
figure 5

Tuning the parameter ER of MPALS under 40 threshold level for 12003

Fig. 6
figure 6

Tuning the parameter Pr of HMPA under the threshold level 40 on 12003

Fig. 7
figure 7

Adjusting the parameter \(\beta\) of HMPA under the threshold level 40 on 12003

Finally, a device equipped with Windows 10 and having 32GB of RAM, AND Corei7 Intel CPU with 2.40GH as speed is used to conduct those experiments.

6.2 Performance metrics

In this section, the performance metrics used to observe the performance of the algorithm will be discussed in brief. Those metrics are standard deviation (SD), Peak Signal to noise ratio (PSNR), Structured similarity index metric (SSIM), universal quality index (UQI), fitness value under Kapur’s entropy, and CPU time.

  1. 1.

    Standard deviation (SD): SD is used to measure the stability of the outputs obtained by each algorithm within several runs and mathematically calculated using the following equation:

    $$\begin{aligned} SD=\sqrt{\frac{1}{n-1} \sum _{i=1}^{n} (f_{i}-{\bar{f}})^{2}} \end{aligned}$$
    (25)

    n indicates the number of independent runs, \(f_{i}\) is the fitness value under Kapur’s entropy of the \(i^{th}\) run, and \({\bar{f}}\) is the average of the fitness value within the independent runs. The algorithm with the smallest SD is considered the best.

  2. 2.

    Peak signal to noise ratio (PSNR): PSNR (Hore et al. 2010) is a quality indicator used to check the quality of the segmented image compared with the original image. This indicator calculates the mean square error (MSE) between the original and segmented images using Eq. 27, then take a log with base 10 for the square of 255 divided by MSE. The mathematical model of PSNR is as follows:

    $$\begin{aligned} PSNR=10 \log _{10}\left(\frac{255^{2}}{MSE}\right) \end{aligned}$$
    (26)
    $$\begin{aligned} MSE= \frac{\sum _{i=1}^{M}\sum _{j=1}^{N}\mid A(i,j)-S(i,j) \mid }{M*N} \end{aligned}$$
    (27)

    A(ij), S(ij) are the grey value of both segmented and source images within \(i^{th}\) row and \(j^{th}\) the column in matrices A, and B that have the size of rows and columns equal to M, and N, respectively.

  3. 3.

    Structured similarity index metric (SSIM): SSIM (Hore et al. 2010) is different about PSNR because it takes in its consideration the structure of the segmented image compared with the original image. Generally, it measures the brightness, structure similarity, and contrast distortion between the source and predicted images. Mathematically, SSIM is formulated as following:

    $$\begin{aligned} SSIM(O,S)=\frac{(2\mu _{o}\mu _{s}+a)(2\sigma _{os}+b)}{(\mu _{o}^{2}+\mu _{s}^{2}+a)(\sigma _{o}^{2}+\sigma _{s}^{2}+b) } \end{aligned}$$
    (28)

    where \(\mu _{0},\mu _{s}\) express the mean intensities of both original and predicted image; \(\sigma _{0}\) and \(\sigma _{s}\) indicate SD of the same two images respectively; a,and b is fixed values and assigned to 0.001 and 0.003 respectively. This metric is maximized until reaching better accuracy.

6.3 Stability and CPU time

Starting with stability, to measure the convergence between the outcomes produced by each algorithm, the average of SD was calculated on all datasets within 30 independent runs for each one and displayed in Fig. 8. Figure 8 shows that HMPA could produce more converged outcomes in comparison with the other algorithm. As a result, the performance of our proposed algorithm, HMPA, is more stable within 30 independent runs. Ending with CPU time, the improvements on MPA may significantly affect running time, so we calculate the running time result of each algorithm and then show those outcomes within Fig. 9. Inspecting Fig. 9 told us that the improvements done on MPA don’t affect significantly the speedup of MPA and hence it is a strong alternative to the existing image segmentation techniques because it could fulfill better outcomes within almost converged CPU time.

Fig. 8
figure 8

Comparison the average of SD values obtained by each algorithm

Fig. 9
figure 9

Comparison of the CPU Time values obtained by each algorithm

6.4 Graphically performance analysis


The effectiveness of the proposed algorithms compared with the other algorithms under different performance metrics will be observed within this section. Generally, this section is organized under graphical depictions as follows:

  1. 1.

    Comparison of fitness values.

  2. 2.

    Comparison under PSNR values.

  3. 3.

    Comparison under SSIM values.

  4. 4.

    Comparison under various threshold levels: small and large levels.

  5. 5.

    Depiction of the fitness values using the interval plot.

(1) Comparison under Fitness value.


Figure 10 shows the average of the fitness values obtained by each algorithm within 30 independent runs under all threshold levels on all the test images. Observing Fig. 10 shows that HMPA could reach the first rank with a value of 35.17, MPALS reach the second rank with 34.81, while FPA came as the last one with a value of 33.91. This superiority is caused by both LIS and RUS that could accelerate the convergence toward the best solution and at the same time take the solutions out of the local optima problem.

Fig. 10
figure 10

Depiction of the average fitness values under all threshold levels for all test images


(2) Comparison under PSNR values.


In this section, the quality of the predicted image using the proposed algorithms and the others will be compared under the PSNR metric. After calculating the average PSNR values within 30 runs for each level on each image, and calculating the averages under all levels on all images, they are shown in Fig. 11. After observing Fig. 11, it is concluded that the proposed algorithm, HMPA, could achieve the best value compared with the others and occupies the first rank with a value of 23.45, and both WOA and MPALS could come in the second rank with a value of 25.03, while FPA came in the last rank with 24.06. Ultimately, it is concluded that HMPA could reach the threshold values which accurately separate the objects in an image compared to the other compared algorithm, and subsequently, HMPA considers a strong alternative to the existing techniques for tackling the image segmentation problem.

Fig. 11
figure 11

Depiction of the average PSNR values under all threshold levels for all test images


(3) Comparison under SSIM values.


In this part, the mean of the SSIM values obtained by each algorithm within 30 independent runs on all threshold levels under all the images will be discussed to see any algorithm could reach better accuracy. According to Fig. 12, HMAP could be the best with a value of 0.9320 and EO, WOA, and SMA as the second-best ones with 0.9318, while FPA is the worst with 0.9300. Unfortunately, MPALS could only overcome ITSA and FPA over this metric as the main limitation to this variant solved using the RUS, which could explore more intractable regions for fulfilling better outcomes for all employed performance metrics: F-value, PSNR, SSIM, SD, and CPU time.

Fig. 12
figure 12

Depiction of the average SSIM values under all threshold levels for all test images


(4) Comparison under various threshold levels: small and large levels.


In this section, the various algorithms have been compared based on the threshold level to see their performance with small and high threshold levels. After computing the average of SSIM, PSNR, and F-value on the threshold levels ranging between 2 and 7 as the small levels and presenting the outcomes in Fig. 13, it is notified that all algorithms except FPA are almost converged under those three performance metrics and subsequently any of them could be used to segment any image with small threshold levels ranging between 2 and 7. However, with the high threshold levels ranging between 10 and 40, HMPA could be superior for the three employed performance metrics: SSIM, PSNR, and F-value as depicted in Fig. 14. In general, HMPA considers a strong alternative for tackling the image segmentation problem for images with small or high threshold levels contradicted most of the compared algorithms which have good performance for only the small levels.

Fig. 13
figure 13

Comparison based on various performance metrics: F-value. PSNR, and SSIM on small threshold levels ranging between 2 and 7

Fig. 14
figure 14

Comparison based on various performance metrics: F-value. PSNR, and SSIM on large threshold levels ranging between 10 and 40


(5) Comparison under interval plot.


Within this section, the Boxplot is used to check the performance of the algorithms under Fitness values on each image with a threshold level (T) equal to 40. Specifically speaking, each algorithm is run 30 times on some test images under T=40 and the fitness values within those 30 runs are drawn in Figs. 15, 16 for this algorithm. Figs. 15, 16 prove the superiority of HMPA under T=40 on all the test images, where HMPA could come in the first rank superior to all the other algorithms, while MPALS occupies the second rank on all the test images and the third rank is occupied by WOA. These experiments show the superiority of HMPA on the images with high threshold levels, so it is considered as an outstanding alternative to solve the multilevel thresholding image segmentation, especially with high threshold levels.

Fig. 15
figure 15

Fitness values on all images under T = 40

Fig. 16
figure 16

Fitness values on all images under T = 40

6.5 Descriptive performance analysis

In this section, the various performance metrics will be measured according to each algorithm within 30 independent runs ad introduced within the following tables. Broadly speaking, Tables 2 and 3 introduces the F-values obtained by each algorithm on each test image. Inspecting Tables 2 and 3 shows that HMPA could be competitive and superior in 110 cases out of 154, while MPALS could achieve the best and equal with some other algorithms in 84 out of 154 in terms of the F-values. Both MPALS and HMPA as our proposed variants could be competitive to the others, which reach the same outcomes, in 52 cases, while could be superior in 83 others, and hence those proposed variants are strong alternatives to solve the image segmentation problems, especially HMPA which could outperform the other variants for most test cases.

Table 2 Performance evaluations using F-value on all images
Table 3 Performance evaluations using F-value on all images

In Tables 4 and 5, the PSNR values obtained based on the segmented images achieved based on the fitness values assigned in Tables  2 and 3 are exposed on each threshold level for each image. Inspecting this table show that HMPA could be the best and equal with the other algorithms in 70 test cases, while MPALS could be superior and competitive in 37 cases. Based on that, HMPA considers the best-proposed variant, and the best compared to the other compared algorithms since the nearest compared algorithm in terms of the PSNR is EO which could be superior and competitive in only 42 cases.

Table 4 Performance evaluations using PSNR on all images
Table 5 Performance evaluations using PSNR on all images

In Tables 6 and 7, the SSIM values are exposed on each threshold level for each image. From this table, it is concluded that HMPA could be the best and equal with the other algorithms in 90 test cases, while MPALS could be superior and competitive in 57 cases. Meanwhile, the two-proposed variants could reach better and competitive outcomes compared to the other algorithms in 102 cases. Based on that, HMPA considers the best.

Table 6 Performance evaluations using SSIM on all images
Table 7 Performance evaluations using SSIM on all images

6.6 Comparison under Wilcoxon rank-sum test

In this section, the Wilcoxon rank-sum test (Lam and Longnecker 1983) is used to compare the outcomes of HMPA with those obtained by the competing algorithms on some test images used in our experiments and presenting the outcomes in Table 8. This test returns the p-value of the two-sided Wilcoxon rank-sum test, and if this p-value is less than a significant level recommended 5% then there is a difference between paired data; otherwise, the null hypothesis will be accepted, which no difference between paired data. In our experiments which compare the data obtained by HMPA with each competing algorithm and their outcomes are presented in Table 8, it is obvious that the p-value for most test cases on threshold levels higher than 7 is less than 5%, and hence there is a difference between the outcomes of the HMPA and the other competitors. However, for threshold levels lower than 7, the outcomes of HMPA were significantly different from those of some of the competing algorithms and similar to the others. Note that, NaN value in this table indicates that the outcomes of each pair of algorithms are the same.

Table 8 Comparison between HMPA and each competing algorithm under the p-value

7 Conclusion and future work

In this paper, a new multilevel thresholding image segmentation algorithm based on the improved marine predators algorithm (MPA) is developed, this algorithm is improved with a novel strategy called the linearly increased worst solutions improvement strategy (LIS) to accelerate the convergence by steering gradually a number np of the worst solutions in the right direction of the best-so-far solution, and randomly within the search space of the problem to help in avoiding stuck into local minima. this LIS is integrated with the standard MPA to propose a new variant, namely MPALS, for the ISP. Further, another strategy called ranking-based updating strategy (RUS) has been here proposed and employed to strengthen the exploration and exploitation capability of MPALS for reaching other regions which are intractable by MPALS. This improved MPALS was abbreviated as HMPA. The two proposed variants: HMPA and MPALS have been validated on 14 test images and compared with seven state-of-the-arts meta-heuristic algorithms. The experimental results show the superiority of HMPA for all performance metrics: PSNR, F-value, SSIM, and SD except CPU time as its main limitation addressed in future work. Broadly speaking, the HMPA could occupy the first rank because it was competitive with some algorithms for the small threshold levels and superior for the high threshold levels; meanwhile, MPALS, WOA, IMPA, EO, SMA, HHA, ITSA, and FPA are respectively ranked from the second-best one to the worst for the fitness values and PSNR. Unfortunately, MPALS come in the seventh rank in term of the SSIM which were considered as its main limitation addressed using the RUS in the second variant: HMPA. Our future work includes investigating the performance of the marine predator algorithm when tackling DNA fragment assembly problems, feature selection problems, and flow shop scheduling problems, in addition to tackling the CPU time problem related to the proposed algorithms.