**1. Introduction**

The development of image recognition methods is one of the difficult and involved tasks in AI. The development of image recognition methods is well studied in theory; however, there is no general method to solve it and the practical solution seems to be very difficult [1,2].

Complexly structured images often contain difficult and essential objects. These images are images with a difficult structure and they contain a large number of elements with required specifications. Images have a complex structure that contains many different semantics. These images contain the following attributes:


Examples of such images include geographic or topographical maps, remote sensing images of the earth, etc. Examples of such images are also medical images, including magnetic resonance imaging called MRI images or computed tomography images.

Recent research findings have demonstrated the potential for using techniques inspired by nature, such as ant, particle swarm (PSO), and bee colony optimizations. The application of biologically inspired techniques, including PSO, is still under-studied and more research is needed. In the article, it is proposed to modify the PSO algorithm to a Modified Exponential Particle Swarm Optimization algorithm (EPSO).

**Citation:** El-Khatib, S.; Skobtsov, Y.; Rodzin, S. EPSO Algorithm for Complexly Structured Images Segmentation. *Eng. Proc.* **2023**, *33*, 47. https://doi.org/10.3390/ engproc2023033047

Academic Editors: Askhat Diveev, Ivan Zelinka, Arutun Avetisyan and Alexander Ilin

Published: 13 July 2023

**Copyright:** © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

#### **2. Particle Swarm Optimization**

The PSO approach employs a collection of particles, each of which has a unique local solution [3,4]. According to its own habits and those of its neighbors, the particle's behavior varies every time it enters the search zone. Each particle keeps track of its own position coordinates with the best objective function and best neighbor, from which the best overall solution is derived.

Each particle stores the best fitness value and coordinates. This fitness value can be expressed as *yi* and named as a cognitive component. Similar to this, let us indicate the best global optimum obtained by all particles as *y*ˆ(*t*) and call it the social component.

Each *i*-th particle has properties such as velocity *vi*(*t*) and position *xi*(*t*) a time *t*. Particle location changes based on

$$
\varkappa\_i(t+1) = \varkappa\_i(t) + v\_i(t+1), \tag{1}
$$

where *xi*(0) ∼ *U*(*xmin*, *xmax*).

$$v\_{ij}(t+1) = v\_{ij}(t) + c\_1 r\_{1j}(t)[y\_{ij}(t) - x\_{ij}(t)] + c\_2 r\_{2j}(t)[\dot{y}\_j(t) - x\_{ij}(t)].\tag{2}$$

The best position (gbest) at a time (*t* + 1) can be obtained as follows

$$y\_i(t+1) = \begin{cases} y\_i(t) & \text{if } f(\mathbf{x}\_i(t+1)) \ge f(y\_i(t)) \\ \mathbf{x}\_i(t+1) & \text{if } f(\mathbf{x}\_i(t+1)) < f(y\_i(t)) \end{cases} \tag{3}$$

where *<sup>f</sup>* : *<sup>R</sup>n*<sup>∞</sup> <sup>→</sup> *<sup>R</sup>* is target function, that says if current position is optimal. *<sup>y</sup>*ˆ*j*(*t*) (pbest) at a time *t* can be calculated as follows

$$\hat{y}(t) \in \{y\_0(t) \dots y\_{n\_s}(t)\} | f(\hat{y}(t)) = \min\{f(y\_0(t)) \dots f(y\_{n\_s}(t))\}\tag{4}$$

where *ns* is the sum of all swarm particles.

#### **3. EPSO Algorithm for Complexly Structured Images Segmentation**

To obtain better segmentation results, a combined method has been proposed which utilizes all the advantages of K-means and PSO algorithms.

The EPSO algorithm is basically similar to the mixed ACO K-means algorithm [5].

Each swarm particle *xi* represents N areas (clusters) such as *xi* = (*mi*1, ... , *mij*, ... , *miN*) where *mij* is center for area *j* for swarm particle *i*. Target function can be represented as follows

$$f(\mathbf{x}\_i, \mathbf{Z}\_i) = \omega\_1 \bar{d}\_{\max}(\mathbf{Z}\_i, \mathbf{x}\_i) + \omega\_2 (z\_{\max} - d\_{\min}(\mathbf{x}\_{\min})),\tag{5}$$

where *zmax* <sup>=</sup> <sup>2</sup>*<sup>s</sup>* <sup>−</sup> 1 for image with s-bits; Z is representative table for connectivity between pixel and center of the area for particle *i*.

The table indicates if point *zp* is in area *cij* for swarm particle *i*. Constant values *ω*<sup>1</sup> and *ω*<sup>2</sup> are user-defined, ¯*dmax*—max average Euclidian distance from swarm particles to linked areas. It can be measured as follows:

$$\bar{d}\_{\max}(Z\_{i\prime}, \mathbf{x}\_{i}) = \max\_{j=1,\ldots,N} \{ \sum\_{\forall z\_p \in c\_{ij}} d(Z\_p m\_{ij} / |c\_{ij}|) \},\tag{6}$$

$$d\_{\min}(\mathbf{x}\_i) = \min\_{j\_1, j\_2, j\_1 \neq j\_2} \{ d(m\_{i/1}, m\_{i/2}) \} \tag{7}$$

Formula (7) contains minimal Euclidian distance among each pair of the area centers. In the next task, the swarm is used to achieve good clustering using the passed parameters. It was achieved through self-study. Each particle in the PSO algorithm represents a pixel. The pixel intensity is used as an input parameter for the PSO algorithm.

The Algorithm 1 includes the following steps:

#### **Algorithm 1** Exponential PSO segmentation algorithm

	- 2.1 Initialize starting position of the particle using vector *xi*.
	- 2.2 Starting position of the particle is currently known best position *yi* = *xi*.
	- 2.3 If *f*(*yi*) < *f*(*y*ˆ), then update best swarm's value replacing *y*ˆ to *yi*.
	- 2.4 Randomly initialize velocities of the particles *vi*.
	- 5.1 Update particle's velocity *vij* and position according to *xij* = *xij* + *vij*.

Thanks to the particle optimization algorithm, all particles tend to fly directly to the best location found by the best particle. This approach enables the rapid discovery of potential solutions. Using this mechanism, particles often accumulate in a local minimum instead of a global minimum, resulting in suboptimal solutions. To avoid this effect, El-Desouky [6] suggested making *ω* linear, for example

$$
\omega = (\omega - \omega\_1) \frac{(n\_{\max} - n)}{n\_{\max}} + \omega\_{\min} \tag{8}
$$

where *nmax* is maximum number of iterations, *n* is the number of the current iteration. Recommended values are *ωmax* = 0.9; *ωmin* = 0.4. *ω* can be decreased down to *ωmin* over 1500 iterations. In this article, we propose to change *ω* exponentially. In the presented algorithm, we propose to change *ω* in the following way:

$$
\omega = (\omega - \omega\_1)e^{\frac{(n\_{max} - n)}{n\_{max}}} + \omega\_{min} \tag{9}
$$

#### **4. Testing EPSO Segmentation Method**

To evaluate the efficiency of the algorithm, numerical experiments were provided. Six segmentation methods were considered. Among them are FC-Means [7], Darwinian PSO [8], PSO modification—K-means PSO [8], Grow cut [9], Modified HACO-K-means algorithm—K-means ACO [10,11], and Random Walker [12].

Table 1 represents the running time for three images from well-known image dataset [11] (Figures 1–3).


**Table 1.** Time taken for each image tested using different algorithms.

**Figure 1.** MRI image of the Brain. Params—421 × 392, 8 bits per pixel.

**Figure 2.** Noised brain image. Parameters: 151 × 166, 8 bits per pixel.

**Figure 3.** Sagittal MRI image of the knee. Parameters 802 × 450, 8 bits.

From Table 1 it can be observed that the proposed method outperforms all existing modifications of ACO and PSO and graph-based methods, except for Random Walker (in this case, the execution time affects the segmentation quality—EPSO- segment quality exceeded Random Walker by 15%).

#### **5. Conclusions**

In the presented paper, the modified EPSO algorithm for segmenting complexly structured images was introduced. A comparison of the results of the algorithm with other methods has been presented. In all cases, the algorithm produces a better final sharding time than the studied techniques (with the exception of the Random Walker algorithm, which has over 15% lower segmentation quality). All test results were obtained using the Ossirix MRI image dataset and own software products. The obtained results show that the transform EPSO algorithm can be used in digital image processing for images with complex structures.

**Author Contributions:** Co-authors: S.E.-K., Y.S., S.R. Description of the contribution of co-authors: Conceptualization, Y.S.; software, S.E.-K.; methodology, S.R.; validation, Y.S., S.R.; writing—original draft, Y.S.; investigation, S.E.-K.;writing—review and editing, S.E.-K.; formal analysis, S.E.-K.; methodology, S.R. All authors have read and agreed to the published version of the manuscript.

**Funding:** Presented research was supported by Russian Foundation for Basic Research according to the research project № 19-07-00570 "Bio-inspired models of problem-oriented systems and methods of their application for clustering, classification, filtering and optimization problems, including big data".

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

### **References**


**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
