# Particle Swarm Optimization-Based Unconstrained Polygonal Fitting of 2D Shapes
## 4 Experimental Evaluation
\(Pr(m/IoU)\) is quantified as the percentage of shapes of the datasets where the method \(m\) outperforms the others under the IoU, defined as follows:  
\[Pr(m/IoU)=\frac{\sum_{I\in D}H(IoU_{m}(I)-max_{n\
eq m}IoU_{n}(I))}{|D|} \tag{7}\]  
where \(H\) is the unit step function, \(|D|\) denotes the number of shapes of dataset \(D\) and \(IoU_{m}(P)\) is the \(IoU\) metric of method \(m\) given the binary image \(I\). This also means that the value \(100\%-\sum_{m}Pr(m/IoU)\) gives the percentage of images, for which there is no clear winner method. Tables 1 and 2 present the average IoU, DICE and Pr(m/IOU) metrics computed on all images from the MPEG7 and LEMS datasets, respectively. It holds that _UPF-PSO_ and _UPF-PSO-EA_ clearly outperform the other methods in any dataset. UPF-PSO slightly outperforms _UPF-PSO-EA_. _UPF-PSO_ or _UPF-PSO-EA_ outperform all the other methods in about 80% of shapes under MPEG-7 and LEMS datasets. _SM_ or _SM-EA_ outperform all the other methods in about 17% of shapes under MPEG-7 dataset and LEMS dataset. _DP_ or _DP-EA_ outperform all the rest methods in about 3% of shapes under MPEG-7 and LEMS datasets. Figure 3 depicts the average IoU of _UPF-PSO_, _UPF-PSO-EA_, _DP_, _DP-EA_, _SM_ and _SM-EA_ computed for different values of \(N\in\{3,...,10\}\) in the two datasets used. _UPF-PSO_ and _UPF-PSO-EA_ clearly outperform the rest methods under any dataset and \(N\leq 8\). As expected, the lower the \(N\), the better outer-performance of the proposed methods compared to the classical PA methods. For high values of \(N\) (\(N>8\)), the problem search space increases, so it is more difficult for the PSO to find near-optimal solutions. At the same time, when \(N\) obtains high values, the solutions of classical PA significantly better approximate the given shape, reducing the gap from the UPF methods. Theoretically, it holds that as \(N\) tends to infinity, the optimal solution of both problems (classical PA and UPF) converges to the initial shape having IoU equal to one (\(lim_{N\rightarrow\infty}IoU=1\)). When equal area principle is applied it holds that the EA-results slightly underperforms the corresponding solutions. The equal area principle provides better results for the special case of \(N=3\), where the fitting polygon is less complex. The results under DICE metric depicted in Figure 4 agree with the results of Figure 3.  
Figure 5 illustrates the _Pr(m/IoU)_, \(m\in\{\)_UPF-PSO_, _UPF-PSO-EA_, _DP_, _DP-EA_, _SM_, _SM-EA_\(\}\) over the 1400 images of MPEG-7 dataset (Figure 5a) the 1462 of LEMS dataset (Figure 5b). The results agree with the results of Figure 3. If we sum the cases where _UPF-PSO_ or _UPF-PSO-EA_ outperforms all the rest methods, it holds that for \(N\leq 8\) is more than 70% and 68% under MPEG-7 dataset and LEMS dataset. As it was expected, when \(N=3\), _UPF-PSO_ or _UPF-PSO-EA_ clearly outperform the rest method on more than 98% of shapes and any dataset. Figure 4: (a) The DICE metric of _UPF-PSO_, _UPF-PSO-EA_, _DP_, _DP-EA_, _SM_, _SM-EA_ methods over (**a**) the 1400 images of MPEG-7 dataset and (**b**) the 1462 of LEMS dataset. Figure 3: (a) The IoU metric of _UPF-PSO_, _UPF-PSO-EA_, _DP_, _DP-EA_, _SM_, _SM-EA_ methods over (**a**) the 1400 images of MPEG-7 dataset and (**b**) the 1462 of LEMS dataset. Finally, Figures 6-8 depict several output examples of the proposed methods and baselines to further study their behavior. The DICE-IoU metrics and the used method-\(N\) are depicted in the title and caption of each result, respectively. These figures depict results for \(N=3,6,9\) vertices on a turtle, bat, and horse shapes from MPEG 7 and LEMS datasets. The results of \(N=3\), \(N=6\) and \(N=9\), corresponds to low, middle, and high values of \(N\) according to the proposed framework. In most of the cases, the proposed methods outperform the baselines.