# Sustainable Parking Space Management Using Machine Learning and Swarm Theory--The SPARK System
## 4 Results  
The goal of this study is to evaluate the performance of the SPARK system in detecting both vehicles and available parking spaces within an urban environment. The system integrates advanced image detection algorithms and optimization techniques to provide a reliable solution to parking management in increasingly congested areas. This section presents the results obtained from a detailed analysis of the devices used, followed by a discussion on the implications of these findings. The key performance indicators assessed include precision, recall, and accuracy, which reflect the system's effectiveness in identifying vehicles and parking spots. A comparative analysis between the YOLOv9e Seg car detection model and the SPARK system's parking detection capability is also provided. This analysis was conducted on 120 pairs of images (from two cameras) selected every two hours. Below is a summary of the key metrics for YOLOv9e Seg car detection (with an optimal threshold of 0.72) and SPARK parking detection. The effectiveness of SPARK was evaluated using three metrics:  
Precision: This measures how well the model avoids false positives. The higher the precision, the fewer errors the model makes in predicting positive cases. The formula considers true positives (_TP_) and false positives (_FP_). \[\text{Precision}=\frac{TP}{TP+FP} \tag{2}\]  
Recall: Also referred to as sensitivity, it assesses how well the model identifies all positive cases. A higher recall means the model misses fewer true positives. The formula takes into account true positives (_TP_) and false negatives (_FN_). \[\text{Recall}=\frac{TP}{TP+FN} \tag{3}\]  
Accuracy: This is a general measure of how well the model classifies both positive and negative cases. It considers true positives (_TP_), true negatives (_TN_), false positives (_FP_), and false negatives (_FN_), indicating the overall correctness of the model's predictions. \[\text{Accuracy}=\frac{TP+TN}{TP+TN+FP+FN} \tag{4}\]  
where:  
* _TP_ (True Positives): The number of instances where the model correctly predicted a positive outcome. * _FP_ (False Positives): The number of instances where the model predicted a positive outcome, but the actual reality was negative. Figure 12: Data flow diagram for the parking management system (Source: Author’s own elaboration). * _FN_ (False Negatives): The number of instances where the model predicted a negative outcome, but the actual reality was positive. * _TN_ (True Negatives): The number of cases where both the model and reality correctly identified a negative outcome. Table 1 presents a summary of the average values of the parameters calculated for 120 pairs of test images. Regarding Table 1, the obtained results were interpreted as follows. Vehicle detection (YOLOv9e Seg) within the SPARK system for the test space in Kayseri city, with a threshold set at 0.72, achieved an average precision of 0.928, indicating excellent avoidance of false positives, with a low standard deviation (0.016). The model also performed well in detecting positive cases (average recall of 0.884), though some variability was observed (standard deviation of 0.064), suggesting occasional vehicle omissions in more complex scenarios. The overall accuracy of the model was 0.825. In terms of parking space detection, the system achieved a precision of 0.891, demonstrating that in most instances, available spaces were correctly classified. The recall (0.863) shows that the system detected the majority of available spaces, though some were missed in isolated cases (standard deviation of 0.122). The overall accuracy of the system averaged 0.833, with variability primarily arising in scenarios of low parking space density, which introduced greater uncertainty in feature extraction and classification processes.