# Particle Swarm Optimization-Based Unconstrained Polygonal Fitting of 2D Shapes
## 4 Experimental Evaluation  
The evaluation of the proposed approach was based on two standard datasets from the literature. More specifically, we employ:* MPEG-7 [21], which consists of 1400 binary shapes organized in 70 categories with 20 shapes per category. This dataset has been extensively used in shape tasks [13; 22]. * A subset of LEMS [23]; that is, 1462 shapes that come from the following categories of the original database: Buildings, Containers, Fish, Fruit and vegetables, Misc Animal, People, Robots, Toddlers, and Turtles [13]. Figure 2 shows twelve sample images form the MPEG-7 dataset and LEMS dataset. The code implementing the proposed method together with the datasets are publicly available at [[https://sites.google.com/site/costaspanagiotakis/research/unconstrained-polygonal-fitting](https://sites.google.com/site/costaspanagiotakis/research/unconstrained-polygonal-fitting)]([https://sites.google.com/site/costaspanagiotakis/research/unconstrained-polygonal-fitting](https://sites.google.com/site/costaspanagiotakis/research/unconstrained-polygonal-fitting)) (accessed on 4 January 2024). The proposed methods have been implemented using MATLAB. All experiments were executed on an Intel I7 CPU processor at 2.3 GHz with 40 GB RAM. The average processing time for the execution of _UPF-PSO_ given a single shape of our dataset is 0.809 s without any speed optimization and parallelization. It should be noticed that the processing time of the PSO based methods can be reduced up to 95% via the parallelization of the \(M=20\) particles. The average processing time of _DP_ and _SM_ methods is 0.013 and 0.213, respectively. The using of the equal area principle essentially does not affect the above processing times. We compared the proposed Unconstrained Polygonal Fitting based on Particle Swarm Optimization Algorithm (_UPF-PSO_) and _UPF-PSO_ under equal area principle (_UPF-PSO-EA_) methods with the Douglas-Peucker algorithm (_DP_) [4] and Douglas-Peucker algorithm under equal area principle (_DP-EA_) [4]. In each execution, the PSO based methods may yields slightly different results due to Particle Swarm Optimization, so we have executed 10 times each PSO based method (_UPF-PSO_, _UPF-PSO-EA_), getting the average IoU. Additionally, inspired by the Decremental Ellipse Fitting Algorithm method proposed in [13], which decreases the number of ellipses starting with a large number to approximate a given 2D shape with a number of ellipses, we have implemented a sequential baseline method of classical Polygonal Approximation that maximizes IoU. This method uses an initial polygonal curve that is given by the execution of the Douglas-Peucker algorithm (_DP_) with high number of vertices (e.g., \(50>>N\)). In each step, it sequentially removes the vertex of the polygonal curve so that the IoU of the resulting polygonal curve is maximized. The method terminates when the number of vertices are reduced to \(N\). This baseline method  
Figure 2: Twelve sample images form (**a**) the MPEG-7 dataset and (**b**) the LEMS dataset. is called Sequential Maximization of IoU (_SM_). After the execution of _SM_, the equal area principle can be applied yielding the _SM-EA_ method. In our experiments, we have evaluated the methods for different values of \(N\). Since our framework makes sense to be applied for low values of \(N\), where the difference in performance between the solutions of _UPF_ and _PA_ usually is significant, we have fitted polygonal curves with \(3\leq N\leq 10\) (eight cases). According to the formulation of the UPF problem, we have compared the performance of _UPF-PSO_, _UPF-PSO-EA_, _DP_, _DP-EA_, _SM_, and _SM-EA_ on the IoU metric. For a given dataset, we also compute \(Pr(m/IoU)\), where \(m\) is a method in {_UPF-PSO_, _UPF-PSO-EA_, _DP_, _DP-EA_, _SM_, _SM-EA_}.