# Sustainable Parking Space Management Using Machine Learning and Swarm Theory--The SPARK System
## 3 Methodology Concept
### Applied Algorithms and Technologies in This Study
#### 3.3.5 Application Architecture and Data Workflow  
For practical verification of the feasibility study, the system consists of functional and structural components, as shown in Figure 10:  
* Cameras: Image capture. * Server (SFTP (Secure File Transfer Protocol), Watchdog, Redis (Remote Dictionary Server), YOLO, ABC, PostgreSQL, Nginx, and Django):
* SFTP (server): Transmission of images from the cameras. * Watchdog (library): Monitoring the appearance of new image files. * Redis Queue (server): Processing queue. * YOLO Segmentation (module): Car image segmentation. * ABC Module: Optimization of parking spaces. * PostgreSQL (database): Storage of results. * Nginx (server): HTTPS handling, redirection to Django. * Django (application server): Data processing. * User (Browser, GPS (Global Positioning System), and Google Maps):
* Browser: System communication and visualization. * GPS (module): Location data. * Google Maps (service): Map visualization. Stationary cameras are installed on building facades at elevated heights, allowing for coverage of the largest possible parking area. Each camera is stabilized to ensure that its spatial orientation relative to the parking spaces remains constant, enabling continuous monitoring without frequent recalibration, even under external factors such as vibrations or weather conditions. Projective transformation techniques are employed to ensure the geometric accuracy of vehicle boundary predictions in the images. These transformations accurately convert the camera's image into a form suitable for detecting available parking spaces. The fixed orientation of the cameras, combined with the precision of the projective transformation, enables high accuracy in vehicle position analysis, generally within a sub-meter range depending on camera parameters and the monitored area. Figure 9: Optimization performance for a sample application (Source: Author’s own elaboration). The collected camera images are analyzed in real-time on the local server, without requiring user intervention for manual uploads, significantly accelerating and automating the detection of available parking spaces. All image data are processed locally on the server, minimizing delays and maximizing system performance. The system uses a specifically trained YOLOv9 module for detecting vehicles as a single class. As mentioned earlier, this model was developed using transfer learning from the publicly available YOLOv9e Seg model, focusing exclusively on vehicle detection. This approach optimized the system's performance and increased its accuracy under the specific conditions encountered in parking areas. The ABC algorithm is used to optimize the selection of the best parking spot based on multiple criteria, including minimizing distance, maximizing availability, and reducing the time needed to park. The data, representing parking areas as polygons and detected vehicles within those polygons, are passed to the ABC algorithm. Each polygon corresponds to a potential parking spot, and the ABC algorithm efficiently allocates vehicles to available spaces. Currently, the time required to optimize vehicle placement is a system bottleneck, requiring further optimization to enhance performance. The authors are actively investigating strategies to improve the system's speed and efficiency. The system operates on a server with Nginx as the HTTP server, handling HTTPS (Hypertext Transfer Protocol Secure) traffic through an SSL (Secure Sockets Layer) certificate provided by Let's Encrypt. Nginx functions as the front-end server, directing traffic to the Django-based application backend and ensuring secure, encrypted communication. The server also runs an SFTP (Secure File Transfer Protocol) server on Alpine Linux, with each camera having a dedicated directory for storing images. The presence of a new image triggers subsequent processing steps. The system monitors changes in the  
Figure 10: System architecture for parking monitoring and management: diagram of dependencies between components (Source: Author’s own elaboration).