# Particle Swarm Contour Search Algorithm

^{*}

## Abstract

**:**

## 1. Introduction

**landscape). The ultimate goal is to find a set of solutions which represent a good approximation of the**contour. In the literature on optimization algorithms, such optimization problems can be modelled as multi-modal optimization problems [5] with the difference that we only want to identify the multi-modal solutions which are located at the border of an object. Similar to multi-modal problems, all of these multi-modal solutions map to the same fitness function.

## 2. Problem Definition

## 3. Related Works

- Set the start pixel ${s}_{1}$ and the current pixel c to be the encountered black pixel. Set the current direction d to “$up$”
- Examine the neighbours of c in a clockwise order from the current direction. The first encountered black pixel is the next pixel on the contour. If $c={s}_{1}$, the found pixel is saved as the second pixel ${s}_{2}$. If no point is found, the contour consists of a single pixel and the algorithm terminates.
- Set the step direction from the current pixel to the new pixel as the new direction. If the direction is diagonal, it is set to a counterclockwise of this direction.
- If the current point and the new point are identical to the starting point ${s}_{1}$ and the second point s, respectively, a complete contour is found. If not, repeat from step 2 with the current point and direction set to the new point and direction.

## 4. Particle Swarm Optimisation

## 5. Particle Swarm Contour Search (PSCS)

Algorithm1: Baseline PSCS algorithm |

Input: S, $PopSize$, $\theta $, $\epsilon $, A, $SubSwarmSize$; Output: A; $A=$∅; $SubSwarms=$∅; |

#### 5.1. Initialisation

#### 5.2. Object Search Phase

Algorithm 2: PSCS global search phase |

#### 5.3. Contour Search Phase

Algorithm 3: PSCS contour seach and trace phase |

Input: $\epsilon ,SubSwarms,\theta $; Output: A; |

#### 5.4. Contour Trace Phase

## 6. Evaluation

#### 6.1. Parameter Setting

#### 6.2. Experiments

#### 6.3. Experiments on Different Shapes

**Different sizes of the object:**In order to investigate the impact of the size of the object and therefore the size of the contour, we have changes the size of the object in the image to smaller (50%) and larger (150%) than the object in Figure 3a. For larger sizes we expect the IGD indicator to increase, as more area needs to be covered by the same amount of particles and the amount of reference-points increases. The experimental results shown in Figure 5 confirm this expectation, although the effect is only really noticeable for the larger step sizes. The parameters used for this experiment were the ones recommended above, with the exception of the sub-swarm size, which was chosen to be 1.

**Multiple objects:**In the following experiments, we study the performance of our proposed approach in comparison with the results from the state-of-the-art [19] on images with several distinct objects. For this purpose, we create two images, one with two blots (Figure 3b) and the second with four blots (Figure 3c). Since the particles within one sub-swarm will never leave a contour after it is detected, we expect that the amount of sub-swarms and particles have a major impact on the performance. Figure 6 shows the IGD-performance of the algorithm with two and four objects.

**Image with fuzzy contour:**So far we have tested PSCS on binary images. In the following experiments, we intend to study PSCS on images with fuzzy contours as shown in Figure 3f. To obtain a reference set for the IGD metric using the OpenCV contour search algorithm, which only works for binary images, we convert the image to a binary image using a threshold value of 127. This is the same value used for the threshold $\theta $ in the PSCS algorithm, which is executed on the grey-scale image. The results of IGD comparison in Figure 10 show that PSCS delivers a comparable result to those on the binary images, indicating that the algorithm is capable of performing accurately in non-binary search spaces.

## 7. Conclusions and Future Work

## Author Contributions

## Funding

## Conflicts of Interest

## Abbreviations

PSCS | Particle Swarm Contour Search |

PSO | Particle Swarm Optimisation |

IGD | Inverted Generational Distance |

## References

- Canny, J.F. A Computational Approach to Edge Detection. IEEE Trans. Pattern Anal. Mach. Intell.
**1986**, PAMI-8, 679–698. [Google Scholar] [CrossRef] - Kass, M.; Witkin, A.; Terzopoulos, D. Snakes: Active contour models. Int. J. Comput. Vis.
**1988**, 1, 321–331. [Google Scholar] [CrossRef] - Seo, J.; Chae, S.; Shim, J.; Kim, D.; Cheong, C.; Han, T.D. Fast Contour-Tracing Algorithm Based on a Pixel-Following Method for Image Sensors. Sensors
**2016**, 16, 353. [Google Scholar] [CrossRef] [PubMed][Green Version] - Kennedy, J.; Eberhart, R. Particle swarm optimization (PSO). In Proceedings of the IEEE International Conference on Neural Networks, Perth, Australia, 27 November–1 December 1995; pp. 1942–1948. [Google Scholar]
- Li, X. Adaptively choosing neighbourhood bests using species in a particle swarm optimizer for multimodal function optimization. In Genetic and Evolutionary Computation Conference; Springer: Berlin/Heidelberg, Germany, 2004; pp. 105–116. [Google Scholar]
- Zambrano-Bigiarini, M.; Clerc, M.; Rojas, R. Standard particle swarm optimisation 2011 at cec-2013: A baseline for future pso improvements. In Proceedings of the 2013 IEEE Congress on Evolutionary Computation, Cancun, Mexico, 20–23 June 2013; pp. 2337–2344. [Google Scholar]
- Kulkarni, R.V.; Venayagamoorthy, G.K. Particle swarm optimization in wireless-sensor networks: A brief survey. IEEE Trans. Syst. Man, Cybern. Part (Appl. Rev.)
**2010**, 41, 262–267. [Google Scholar] [CrossRef][Green Version] - Mostaghim, S.; Steup, C.; Witt, F. Energy aware particle swarm optimization as search mechanism for aerial micro-robots. In Proceedings of the 2016 IEEE Symposium Series on Computational Intelligence (SSCI), Athens, Greece, 6–9 December 2016; pp. 1–7. [Google Scholar]
- Poli, R. Analysis of the Publications on the Applications of Particle Swarm Optimisation. J. Artif. Evol. Appl.
**2008**, 2008, 1–10. [Google Scholar] [CrossRef] - Canny, J. A computational approach to edge detection. In Readings in Computer Vision; Elsevier: Amsterdam, The Netherlands, 1987; pp. 184–203. [Google Scholar]
- Yitzhaky, Y.; Peli, E. A method for objective edge detection evaluation and detector parameter selection. IEEE Trans. Pattern Anal. Mach. Intell.
**2003**, 25, 1027–1033. [Google Scholar] [CrossRef] - Perona, P.; Malik, J. Scale-space and edge detection using anisotropic diffusion. IEEE Trans. Pattern Anal. Mach. Intell.
**1990**, 12, 629–639. [Google Scholar] [CrossRef][Green Version] - Duda, R.O.; Munson, J.H. Graphical-Data-Processing Research Study and Experimental Investigation; Technical Report; Stanford Research Institute: Menlo Park, CA, USA, 1967. [Google Scholar]
- Suzuki, S.; Abe, K. Topological structural analysis of digitized binary images by border following. Comput. Vision Graph. Image Process.
**1985**, 30, 32–46. [Google Scholar] [CrossRef] - Oldewage, E.T.; Engelbrecht, A.P.; Cleghorn, C.W. The Importance of Component-Wise Stochasticity in Particle Swarm Optimization. In Swarm Intelligence; Dorigo, M., Birattari, M., Blum, C., Christensen, A.L., Reina, A., Trianni, V., Eds.; Springer International Publishing: Cham, Switzerland, 2018; pp. 264–276. [Google Scholar]
- Yang, S.; Wang, M.; Jiao, L. A quantum particle swarm optimization. In Proceedings of the 2004 Congress on Evolutionary Computation, CEC2004, Portland, OR, USA, 19–23 June 2004; Volume 1, pp. 320–324. [Google Scholar] [CrossRef]
- Blackwell, T.M.; Bentley, P.J. Dynamic search with charged swarms. In Proceedings of the 4th Annual Conference on Genetic and Evolutionary Computation; Morgan Kaufmann Publishers Inc.: Burlington, MA, USA, 2002; pp. 19–26. [Google Scholar]
- Blackwell, T.; Branke, J. Multi-swarm optimization in dynamic environments. In Workshops on Applications of Evolutionary Computation; Springer: Berlin/Heidelberg, Germany, 2004; pp. 489–500. [Google Scholar]
- Bradski, G. The OpenCV Library. Available online: https://www.drdobbs.com/open-source/the-opencv-library/184404319 (accessed on 16 March 2020).
- Zitzler, E.; Thiele, L.; Laumanns, M.; Fonseca, C.M.; Da Fonseca, V.G. Performance assessment of multiobjective optimizers: An analysis and review. IEEE Trans. Evol. Comput.
**2003**, 7, 117–132. [Google Scholar] [CrossRef][Green Version]

**Figure 1.**A black circle as an object in a search space. The highlighted area illustrates the set P representing the contour.

**Figure 2.**Contour Tracing Phase: Particle i is inside the object with velocity ${\overrightarrow{v}}_{i}(t)$ and ${\overrightarrow{e}}_{i}(t)$ = $\overrightarrow{out}{\phantom{\rule{-0.166667em}{0ex}}}_{i}(t)$. ${\overrightarrow{v}}_{i}(t+1)=0.5({\overrightarrow{v}}_{i}(t)+{\overrightarrow{e}}_{i}(t))+{\overrightarrow{n}}_{i}(t)$.

**Figure 3.**Test images. (

**a**) Blot; (

**b**) DoubleBlot; (

**c**) QuadrupleBlot; (

**d**) Sierpinski triangle; (

**e**) Rorschach; (

**f**) Blot Blur.

**Figure 4.**Inverted Generational Distance (IGD) for different step- and population sizes for Figure 3a.

**Figure 5.**IGD for Figure 3a with different scaling.

**Figure 7.**IGD over time for the QuadrupleBlot image in Figure 3c.

**Figure 8.**IGD for images in Figure 3d,e.

**Figure 10.**IGD for the blurred blot image in Figure 3f.

Category | Parameter | Values |
---|---|---|

General | Population Size | 1,5,30 |

Sub-swarm Size | 1,5,30 | |

initial distribution | Line, Point, Random | |

Contour search/trace phase | Step-size s | 1,5,10,25,50 |

Threshold $\epsilon $ | 25 |

© 2020 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 (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Weikert, D.; Mai, S.; Mostaghim, S.
Particle Swarm Contour Search Algorithm. *Entropy* **2020**, *22*, 407.
https://doi.org/10.3390/e22040407

**AMA Style**

Weikert D, Mai S, Mostaghim S.
Particle Swarm Contour Search Algorithm. *Entropy*. 2020; 22(4):407.
https://doi.org/10.3390/e22040407

**Chicago/Turabian Style**

Weikert, Dominik, Sebastian Mai, and Sanaz Mostaghim.
2020. "Particle Swarm Contour Search Algorithm" *Entropy* 22, no. 4: 407.
https://doi.org/10.3390/e22040407