scieee AI-readable full text Open interactive document viewer

Analysis of users at bus stops with computer vision

Bedmar Martínez, Adrià

Abstract

This Final Degree Project has developed a computer vision system for tracking peo-ple at bus stops to extract analytics on user behaviour. The project contains an evaluation of different detection models and monitoring algorithms to check the capabili-ties for the specific case described. Next, the different tracking technologies have been applied to videos recorded at a bus stop and algorithms have been developed to extract analytics of the waiting time of users and the number of entrances and exits during each stop. It has been possible to conclude the possibility of using these technologies, the limitations and the improvements necessary for the implementation of an effective monitoring system.

Full text

Analysis of users at bus stops with computer vision Bachelor’s Degree Thesis Submitted to the Faculty at the Escola Tècnica Superior d'Enginyeria de Telecomunicació de Barcelona de la Universitat Politècnica de Catalunya by Adrià Bedmar Martínez In partial fulfilment of the requirements for the DEGREE IN TELECOMUNICATION TECHNOLOGIES AND SERVICES ENGINEERING Advisor: Ramon Morros Rubió Barcelona, 10 2024 -2- -3- Resum Aquest Treball de Fi de Grau ha desenvolupat un sistema basat en visió per computador per el seguiment de persones a les parades autobús per tal de extreure analítiques del comportament dels usuaris. El projecte conté una avaluació de diferents models de detecció i algoritmes de seguiment per comprovar les capacitats pel cas concret descrit. Seguidament s’han aplicat les diferents tecnologies de seguiment a vídeos gravats a una parada d’autobús i s’han desenvolupat algoritmes per extreure analítiques del temps d’espera dels usuaris i el nombre d’entrades i sortides durant cada parada. S’han pogut concloure la possibilitat d’ús d’aquestes tecnologies, les limitacions i les millores necessàries per l’aplicació d’un sistema de seguiment efectiu. Resumen Este Trabajo de Fin de Grado ha desarrollado un sistema basado en visión por computadora para el seguimiento de personas en las paradas autobús con el fin de extraer analíticas del comportamiento de los usuarios. El proyecto contiene una evaluación de diferentes modelos de detección y algoritmos de seguimiento para comprobar las capacidades para el caso concreto descrito. Seguidamente se han aplicado las diferentes tecnologías de seguimiento a vídeos grabados en una parada de autobús y se han desarrollado algoritmos para extraer analíticas del tiempo de espera de los usuarios y el número de entradas y salidas durante cada parada. Se han podido concluir la posibilidad de uso de estas tecnologías, las limitaciones y las mejoras necesarias para la aplicación de un sistema de seguimiento efectivo. Summary This Final Degree Project has developed a computer vision system for tracking people at bus stops to extract analytics on user behaviour. The project contains an evaluation of different detection models and monitoring algorithms to check the capabilities for the specific case described. Next, the different tracking technologies have been applied to videos recorded at a bus stop and algorithms have been developed to extract analytics of the waiting time of users and the number of entrances and exits during each stop. It has been possible to conclude the possibility of using these technologies, the limitations and the improvements necessary for the implementation of an effective monitoring system. -4- ACKNOWLEDGEMENTS I would like to express my gratitude to Ramon Morros for the guidance throughout the course of the project. The assistance provided has been paramount for the completion of this project. Special recognition to Arnau Bosque, whose final project also is focused on exploring the use of computer vision for the analysis of bus stops, for the help and companionship during this journey. -5- REVISION HISTORY AND APPROVAL RECORD Revision Date Description 1.0 29/05/2024 Document creation 1.1 12/06/2024 Review of State of the art and methodology 1.2 15/09/2024 Results and Sustainability 2.0 04/10/2024 Document revision 3.0 05/10/2024 Final version Document distribution list Role Surname(s) and Name Student Adrià Bedmar Martínez Project Supervisor Josep Ramon Morros Rubió Written by: Reviewed and approved by: Date 29/05/2024 Date 04/10/2024 Name Adrià Bedmar Martínez Name Josep Ramon Morros Rubió Role Project Author Role Project Supervisor -6- CONTENTS 1. Introduction ----------------------------------------------------------------------------------- 9 1.1. Requirements and specifications -------------------------------------------------------- 9 1.2. Work plan ------------------------------------------------------------------------------------- 10 2. State of the art ------------------------------------------------------------------------------ 12 2.1. Object detection models ------------------------------------------------------------------- 12 2.2. Tracking algorithms ------------------------------------------------------------------------ 13 3. Methodology -------------------------------------------------------------------------------- 15 3.1. Data and datasets ---------------------------------------------------------------------------- 15 3.2. Metrics------------------------------------------------------------------------------------------ 16 3.3. Detection --------------------------------------------------------------------------------------- 19 3.4. Tracking --------------------------------------------------------------------------------------- 20 3.5. Annotation ------------------------------------------------------------------------------------ 20 3.6. Analytics --------------------------------------------------------------------------------------- 21 4. Results ---------------------------------------------------------------------------------------- 23 4.1. Algorithm evaluation ----------------------------------------------------------------------- 23 4.2. Bus stop video tracking evaluation ----------------------------------------------------- 25 4.3. Bus stop video analytics ------------------------------------------------------------------- 27 4.4. Limitations ------------------------------------------------------------------------------------ 31 5. Sustainability Analysis and Ethical Implications --------------------------------- 32 5.1. Sustainability matrix ----------------------------------------------------------------------- 32 5.2. Environmental impact --------------------------------------------------------------------- 32 5.2.1. Development ------------------------------------------------------------------------------------------- 32 5.2.2. Execution ----------------------------------------------------------------------------------------------- 33 5.2.3. Risks and limitations --------------------------------------------------------------------------------- 33 5.3. Economic impact ---------------------------------------------------------------------------- 34 5.3.1. Development ------------------------------------------------------------------------------------------- 34 5.3.2. Execution ----------------------------------------------------------------------------------------------- 34 5.3.3. Risks and limitations --------------------------------------------------------------------------------- 35 5.4. Social Impact ---------------------------------------------------------------------------------- 35 5.4.1. Development ------------------------------------------------------------------------------------------- 35 5.4.2. Execution ----------------------------------------------------------------------------------------------- 35 5.4.3. Risks and limitations --------------------------------------------------------------------------------- 36 5.5. Ethical Implications and Sustainable Development Goals ----------------------- 36 -7- 6. Conclusions and Future Work ---------------------------------------------------------- 38 6.1. Conclusions ----------------------------------------------------------------------------------- 38 6.2. Future Directions ---------------------------------------------------------------------------- 39 List of Figures -------------------------------------------------------------------------------------- 40 List of Tables---------------------------------------------------------------------------------------- 41 Abbreviations -------------------------------------------------------------------------------------- 42 Bibliography ---------------------------------------------------------------------------------------- 43 -8- Analysis of bus stops with CV 1 Introduction -9- 1. INTRODUCTION Improving the public transportation systems is paramount to promote a sustainable urban mobility. Gathering information can help urban planners in the design of the public transportation network and the improvement of public transportation systems. Gathering this information can suppose a challenge, but the use of computer vision tools for the detection and tracking of the users can enable the analysis of the mobility in a challenging environment like in a bus stop. The purpose of this project is to develop an application based on computer vision to obtain data from cameras installed on a few bus stops that would benefit the design of the transportation network. The analytics to extract would include the number of persons that enter and exit a bus or the waiting time of the users. The project was born as a first approach to develop solutions based on computer vision for the transportation network of Barcelona as a collaboration between the UPC and the Transports Metropolitans de Barcelona (TMB). The experimental methodology will consist of installing cameras at a few bus stops and then use person detection and tracking to get the data and elaborate a few analytics. 1.1. REQUIREMENTS AND SPECIFICATIONS Project requirements: - Evaluate relevant algorithms for detection and tracking for people and buses. - Acquire videos from bus stops by filming relevant scenarios to test the specific use case for this project. - Creation of a dataset by annotating the recordings. - The system should extract tracking data from people and buses in videos with a considerable degree of accuracy. - The system should provide relevant analytics from the detection and tracking like waiting time, number of waiting users, entries and exits. - Evaluation of the analytics. Analysis of bus stops with CV 3 Methodology -16- The videos from the bus stop were recorded on 2024-04-11, around 18:00 h in a wide two-way street in Barcelona with volunteer UPC students. Two cameras were used a Pixel 7 Pro at 2X zoom that recorded 3 videos and a Pixel 3XL at 1X zoom that recorded 4 videos. The cameras were attached to a streetlight pole with adhesive tape. Figure 2 shows the setup and Figure 3 show an example of the recording. Figure 2: Process of recording Figure 3: Frame from recording with zoom x1 Some of the videos recorded contain multiple buses going both ways and in the other side of the street there is also a stop. There are some pedestrians walking by or waiting. At the arrival of the buses some people get on and only one gets off at the analysed stop. The summary of all the recordings is in Table 2. Name FPS Resolution Length (frames, min:sec) Zoom Annotation Camera PXL_20240411_160913410.LS-na 30.01 1024x768 8974(05:21) x1 Yes static PXL_20240411_161555136-na-04 30.1 1920x1080 5193(02:53) x1 Yes static PXL_20240411_162114840-na 30.1 1920x1080 3622(02:00) x1 Yes static PXL_20240411_162532117-na 30.1 1920x1080 12799(07:06) x1 No static PXL_20240411_164010201.TS-na 30 3840x2160 3121(02:44) x2 Yes static PXL_20240411_164438893.TS-na 30 3840x2160 2722(01:30) x2 Yes static PXL_20240411_164831873.TS-na 25 3840x2160 3732(02:04) x2 Yes static Table 2: Bus stop recordings From the 7 recordings 6 have been annotated for the evaluation of the models and metrics developed. The format used in the annotation is the same as in the MOT Challenge. 3.2. METRICS There are different metrics to evaluate the challenge the different challenges of localization, detection and association. There are a few basic metrics that are use through a most of the complex ones. True Positives (TP) occur when the detected objects are Analysis of bus stops with CV 3 Methodology -17- correctly matched with the corresponding ground truth objects. In object detection it usually involves using an Intersection over Union (IoU) threshold. False Positives (FP) arise when there is a misclassification of the detected object. False Negative (FN) refer to situations where detections fail to match with existing ground truth objects, indicating missed detections. Localization measures the spatial alignment of one predicted detection and one ground truth. The basic metric is the Intersection Over Union (IOU) that is calculated as the area of overlap between the boxes relative to the area of union of the two boxes. For the case of multiple objects, the localization average can be used. 𝐿𝑜𝑐𝐴=1 |𝑇𝑃|∑𝐿𝑜𝑐−𝐼𝑜𝑈(𝑐) 𝑐∈𝑇𝑃 Detection measures the alignment between the set of all predicted detections and the set of all ground truth detections. 𝐷𝑒𝑡−𝐼𝑜𝑈= |𝑇𝑃| |𝑇𝑃|+|𝐹𝑁|+|𝐹𝑃| Detection can be decomposed to get the Precision and Recall. 𝐷𝑒𝑡𝑅𝑒= |𝑇𝑃| |𝑇𝑃|+|𝐹𝑁| 𝐷𝑒𝑡𝑃𝑟= |𝑇𝑃| |𝑇𝑃|+|𝐹𝑃| Association measures how well a tracker links detections over time into the same identities (IDs), given the ground-truth set of identity links in the ground-truth tracks. The correct association of tracks are called True Positive Associations (TPA). The remaining predicted tracks incorrectly matched or not matched at all are the False Positive Associations (FPA). The rest of not matched ground truth tracks are False Negative Associations (FNA). 𝐴𝑠𝑠−𝐼𝑜𝑈= |𝑇𝑃𝐴| |𝑇𝑃𝐴|+|𝐹𝑁𝐴|+|𝐹𝑃𝐴| It also can be decomposed into precision and recall for associations. Association recall measures how well predicted trajectories cover ground-truth trajectories and Association precision measures how well predicted trajectories keep to tracking the same ground-truth trajectories. 𝐴𝑠𝑠𝑅𝑒= |𝑇𝑃𝐴| |𝑇𝑃𝐴|+|𝐹𝑁𝐴| Analysis of bus stops with CV 3 Methodology -18- 𝐴𝑠𝑠𝑃𝑟= |𝑇𝑃𝐴| |𝑇𝑃𝐴|+|𝐹𝑃𝐴| Since the Ass-IoU measures the alignment between two tracks it can be expanded to the overall Association Accuracy (AssA) can be measured by averaging the Ass-IoU over all pairs of matching predicted and ground-truth detections in the whole dataset. 𝐴𝑠𝑠𝐴= 1 |𝑇𝑃|∑𝐴𝑠𝑠−𝐼𝑜𝑈(𝑐) 𝑐∈𝑇𝑃 All the different metrics are used to perform the High Order Tracking Accuracy (HOTA) to measure the overall performance by integrating the previous ones. It performs the geometric mean between detection and association and applies a range of thresholds on the Loc-IoU to include localization accuracy in the score. 𝐻𝑂𝑇𝐴𝛼=√𝐷𝑒𝑡𝐴𝛼 ∙ 𝐴𝑠𝑠𝐴𝛼=√∑𝐴𝑠𝑠−𝐼𝑜𝑈𝛼(𝑐) 𝑐∈𝑇𝑃𝛼 |𝑇𝑃𝛼|+|𝐹𝑁𝛼|+|𝐹𝑃𝛼| 𝐻𝑂𝑇𝐴= ∫𝐻𝑂𝑇𝐴𝛼𝑑𝛼 𝛼 0≈1 19 ∑ 𝐻𝑂𝑇𝐴𝛼 𝛼=0.95 𝛼=0.05 ; 𝛼𝑡+1= 𝛼𝑡+0.05 The different metrics can be visualized in the Figure 4 and Figure 5 [20]. Figure 4: Representation of how HOTA can be decomposed Analysis of bus stops with CV 3 Methodology -19- Figure 5: Visualization of tracking metrics The metrics used for evaluating the performance of both detection and tracking was easily performed by the repository TrackEval [21], that contains code for performing the MOT Challenge benchmark which provides a good analysis of the performance of the system tracking pedestrians. For the visual analysis of the performance two scripts provided by Josep Ramon Morros were used. The first plots the tracks with appearances, swaps and disappearances over time. And the second one is the video with the bounding boxes and the trail of the tracks. 3.3. DETECTION Faster RCNN is composed of the Fast R-CNN and the Region Proposal Network (RPN) and both use the same output feature map from the CNN. One of the keys is that the CNN is trained to output good features both for region proposal and object detection. It also proposes the innovative anchor-based method that regresses bounding boxes with reference to anchor boxes of multiple scales and aspect ratios. The code is publicly available and for this project was used the Pytorch implementation with the Res- Net-50-FPN backbone [22]. The model is pretrained with the COCO dataset. YOLOv8m is an evolution of the YOLO single stage detector with CSPDarknet53, the advanced backbone pretrained in the COCO dataset. The feature pyramid network provides object detection at different scales with better accuracy with fast inference speeds. Its code is also publicly available, and the implementation is supported by the Ultralytics library with good documentation. Analysis of bus stops with CV 3 Methodology -20- 3.4. TRACKING SORT is a simple online tracking algorithm with Kalman filter for state prediction and Hungarian method for data association and without any appearance model. The emphasis is on computational efficiency and provides a fast and easy to implement starting point. All the code is publicly available with a Python implementation [23]. Deep SORT introduced the deep appearance descriptor to the SORT algorithm which improved the track association added to the motion information. The implementation used for the project is the Python module deep-sort-realtime [24], that also includes a few improvements to the original source code. Most notably the ability to choose between different appearance feature embedders from different libraries. The one used is the TorchReID, a person re-identification library written in PyTorch. More specifically, from the zoo of models the appearance features are performed by an Omni-Scale Network with instance normalisation trained with the ImageNet dataset. For the detection and tracking of all the recorded videos and sequences from MOT Challenge, the server CALCULA from the UPC has been used. To run the experiments batch processing has been used with a High-performance computing (HPC) system to do the processing. The used partition was 1 GeForce GTX 1080 Ti GPU with 11GB of RAM. 3.5. ANNOTATION The ability to develop computer vision systems depend on the quality and quantity of annotations. These are needed both for training and validating deep learning models and for the purposes of this project the annotations are useful for both the validation of the models and the metrics developed. There are multiple software solutions for the task of labelling and annotating tracks. For this project the annotations needed to be able to label the regions of the frames with the pedestrians and buses and the tracks to follow the movement. The tool used for it was the Computer Vision Annotation Tool (CVAT) [25] , a free open-source and web-based tool capable of it with the UI shown in Figure 6. CVAT has many powerful features like interpolation of bounding boxes between key frames or automatic annotation with already implemented deep models. The videos recorded on the bus stop have been annotated with the tracks calculated with the detection of the Faster RCNN and the tracking of the DeepSORT model as a baseline and the manual correction with the CVAT tool. The manual annotation consisted of using keyframes to merge diverging tracks, eliminating erroneous detections and exchange of identities. Analysis of bus stops with CV 3 Methodology -21- Figure 6: CVAT UI After the manual annotation and since the region of interest is not all the frame a python script was used to eliminate all detections outside of the blue shaded region in Figure 7. The annotation of the frames between key frames have been interpolated linearly with a python script. Finally, the errors corresponding to detections when the pedestrians where occluded were manually eliminated with CVAT. 3.6. ANALYTICS The project aims to provide useful insights on the use of the public transport and for that some videos have been acquired from a single bus stop in Barcelona. And the tracking performed with the different algorithms have been used for this purpose. Leveraging the static camera, two regions have been defined in the scene, the bus stop and the rest. Only the people waiting in the bus stop is of interest and there is no need to consider the pedestrians walking on the other side of the street. This division also provides a good reference to check if a bus is stopping next to the one we are analysing and not in the other side of the street. To do this a polygon is extracted for each video corresponding the selected area. Analysis of bus stops with CV 3 Methodology -22- Figure 7: Division of scene The first analytic is the number of people waiting at the bus stop with an algorithm that checks if the tracked person stays in the scene for a minimum amount of time. It only considers the pedestrians in the blue shaded area of the Figure 7. The tracking also provides the capability to know when each user starts waiting. The last analytic developed in the project provides the number of users that get on or off when a bus stops. When this happens, the algorithm checks if the waiting pedestrians gets close to the bus and if in the subsequent moments the person is no longer tracked it counts that they have gotten on. At the same time if a newly tracked person appears next to the bus and it walks away from the bus it counts that they have gotten off. This scenario provides a great complexity due to the number of crossing paths and rapidly moving objects. For the visualization and evaluation of the results a few plots have been developed with the number of waiting people, duration of the wait and exchange of users during a bus stop. Analysis of bus stops with CV ___________ 4 Results -23- 4. RESULTS The following section will show the findings from the developed system. The results from the evaluation of the different models and algorithms with the MOT Challenge sequences and from the videos recorded at the bus stop are going to be presented. Also, the analysis and visualization of the tracking on the videos recorded on the bus stop. Finally, the results of the developed analytics applied to these videos with an analysis of good and edge cases where the system does not perform as intended. 4.1. ALGORITHM EVALUATION The detection was performed by the Faster RCNN and the YOLOv8m model and subsequently tracked with SORT and DeepSORT. For the evaluation the TrackEval codebase was used to execute the MOT Challenge Benchmark described previously. Visualizing the detections it can be seen the difference between the two models. Faster RCNN is very good at detecting even small pedestrians with high degrees of occlusion (Figure 8) and YOLO doesn’t detect the small and highly compacted groups of people (Figure 9). It also struggles with occlusions. This could be critical in the application of the system in a bus stop since it’s a situation with these characteristics. The Faster RCNN in the other hand detect one person as multiple ones and some objects that are not people. The issues with the detection model could be addressed with preprocessing, bigger models or fine tuning but for a prove of concept the Faster RCNN and YOLOv8 perform well. Figure 8: MOT17-04 Faster RCNN (blue) , GT (green) Figure 9: MOT17-04 YOLOV8M (blue) , GT (green) The average processing time per 3840x2160 frame detection with the YOLOv8m model is 0.4s and for the detections made with the Faster RCNN model is 0.6s. Using Faster RCNN is slower, but there is a slight performance increase that can be worth for Analysis of bus stops with CV ___________ 4 Results -24- a use case where there is no need for the information to be in near real time. For the detections a threshold of 0.5 confidence has been applied to both models to minimize false detections in some capacity. The tracking evaluation of the models and algorithms used can be summarised with the different metrics described previously in Table 3. Table 3: HOTA evaluation for MOT17 The TrackEval codebase provides detailed metrics with the HOTA metric decomposition as shown in Table 4 as well as the number of different identities tracked compared to the ground truth in Table 5. Tracking model Detection model HOTA DetA AssA DetRe DetPr AssRe AssPr LocA SORT Faster RCNN 0.4 0.41 0.39 0.47 0.7 0.42 0.81 0.81 SORT YOLOv8m 0.35 0.29 0.42 0.3 0.82 0.44 0.87 0.85 DeepSORT Faster RCNN 0.42 0.41 0.43 0.5 0.61 0.48 0.72 0.8 DeepSORT YOLOv8m 0.38 0.31 0.48 0.33 0.8 0.52 0.83 0.85 Table 4: HOTA details for different models for MOT17 Benchmark Tracking model Detection model Identities Ground truth identities SORT Faster RCNN 2454 546 SORT YOLOv8m 831 546 DeepSORT Faster RCNN 5785 546 DeepSORT YOLOv8m 1416 546 Table 5: Number of identities tracked and ground truth for MOT17 As it can be seen in the tables the detection performance by the Faster RCNN model is better overall than the YOLOv8m and the tracking algorithm DeepSORT performs better than SORT. The better detection recall of Faster RCNN is tied directly to a better score since lost detections can’t be tracked. Even though YOLOv8m has better detection precision it still performs worse. Both detection models have high precision for the SORT tracker which means that there aren’t many false positives. It changes with DeepSORT since the appearance association increases the number of false positives. In terms of associations YOLOv8m performs slightly better, but both have low association recall, meaning that the tracker splits an object into multiple predicted tracks. It gets slightly better with the combination of movement and appearance for prediction using DeepSORT. The visualization of the tracks has been used to perform a further analysis of the methods used, it can be seen in figures 10 to 13. HOTA Faster RCNN YOLOv8m SORT 0.4 0.35 DeepSORT 0.42 0.38 Analysis of bus stops with CV ___________ 4 Results -25- Figure 10:MOT17-04 DeepSORT - YOLOv8M Figure 11:MOT17-04 DeepSORT – Faster RCNN Figure 12: MOT17-02 SORT - YOLOv8m Figure 13: MOT17-02 SORT – Faster RCNN With DeepSORT the 60 previous frames were used to compare the appearance descriptors of the detected people and there are tracks that disappear, but a few frames latter are detected and correctly identified, but there are still confusions between identities. The SORT algorithm in general creates more identities. The average processing time per frame detection with the SORT algorithm is 1.5ms and for the detections made with the DeepSORT algorithm is 150ms. The SORT algorithm is over 100 times faster than the DeepSORT. The analysis suggests that the better model and algorithm for detection and tracking in a low refresh rate or offline setting is the Faster RCNN with DeepSORT. 4.2. BUS STOP VIDEO TRACKING EVALUATION The bus stop videos recorded have been analysed with the same method as with the MOT Challenge Benchmark and visually. For the tracking evaluation the ground truth used is the one developed as it has been described in the section 3.5 and the tracking evaluation can be summarised with the different metrics in Table 6. Analysis of bus stops with CV 5 Sustainability analysis and ethical implications -32- 5. SUSTAINABILITY ANALYSIS AND ETHICAL IMPLICATIONS The following section evaluates the environmental, social, and economic impacts, as well as potential ethical implications derived from the project. This analysis guarantees the alignment of the project with the principles of sustainability and ethical responsibility in scientific research. The project is also meant to be a proof of concept for a system that could be implemented but the analysis will not go deep into the different stages of its lifecycle since the focus has been on the data analysis. 5.1. SUSTAINABILITY MATRIX The sustainability matrix in Table 6 provides a concise way of presenting the results of the evaluation in the Environmental, Economic and Social aspects on the development, execution and risk and limitations. Development Project Execution Risks and Limitations Environmental Environmental impact Environmental impact Environmental risk sand limitations Economic Cost Viability analysis Economic risks and limitations Social Personal impact Social impact Social risks and limitations Table 10: Sustainability matrix 5.2. ENVIRONMENTAL IMPACT 5.2.1. DEVELOPMENT The environmental impact of the project will mainly come from the energy consumed to develop the system. The energy consumption from the resources used in kWh can be estimated with the power to run them and the total work time. The main components in this regard are the use of a personal computer used throughout the full project and the server CALCULA used to run specific experiments with the HPC partitions with GPUs. The approximated hours per week of development during the project have been 20h and the specific instances using the GPUs approximate to a total of 35h of work. Analysis of bus stops with CV 5 Sustainability analysis and ethical implications -33- Device Power Hours Energy Personal computer 60 W 500 h 30 kWh GPU CALCULA server 250 W 35 h 8.75 kWh Total 38.75 kWh Table 11: Energy consumption In terms of carbon footprint, a rough approximation can be calculated with a few parameters like the number of emails send, video calls and the energy calculated previously. According to Mike Berners-Lee’s book” How Bad are Bananas?: The Carbon Footprint of Everything” [26] the CO2 emissions data broken down are the following. CO2eq Number Total E-mail without attachments 0.3 g 36 10.8 g CO2eq E-mail with attachments 50 g 3 150 g CO2eq Video calls 0.164 g/min 2160 min 354.24 g CO2eq Energy 77 g/kWh [27] 38.75 kWh 2.98 kg CO2eq Total 3.5 kg CO2eq Table 12: Carbon footprint 5.2.2. EXECUTION The project has been developed to test different technologies and methods but also as a proof of concept for the possibility of the developing a tracking system at public transports stops and waiting areas. Assuming the use of the pipeline YOLO-DeepSORT the system could work at real time for one camera with the use of GPUs, but it could also be scaled back to lower frame rates for less intensive processing needs. The environmental impact of the execution would be much higher than the development. A side from the energy requirements, there would be the need of purchasing HD cameras, installing them on the selected stops and maintaining the service. Not only that but the extraction of the information and analytics would probably be done in some servers and there would need to be a network to send the video recordings from the cameras positioned in the streets. 5.2.3. RISKS AND LIMITATIONS The environmental risks of the project come from the increase on energy demands and hardware requirements to develop a more complex system or a broader implantation. But since the computer vision field is a rapidly evolving field it’s difficult to speculate since new models, algorithms and technologies could provide a solution in the framework of the project with very different environmental impacts. Analysis of bus stops with CV 5 Sustainability analysis and ethical implications -34- 5.3. ECONOMIC IMPACT 5.3.1. DEVELOPMENT The overall cost of the project will be calculated with the main parameters from the environmental impact. The cost mainly comes from the worked hours, the hardware used, and the price of the energy consumed as shown in Table 9. The software and datasets used are all open source and free. Personal Rate Hours Cost Computer Vision Expert 60 €/hour 30 1800 € Developer 10 €/hour 500 5000 € Total 6800 € Table 13: Cost of human resources This considers the time spent by the main developer and by the tutor during the full project. The cost of the hardware used is detailed in the Table 10. Device Units Unit Cost Cost Computer 1 1000 € 1000 € GPU NVIDIA GTX 1080 Ti 1 760 € 760 € Camera 1 30 € 30 € Total 1790 € Table 14: Cost of the devices To simplify the other indirect costs like workspace, internet or heating I have computed the cost of a coworking space for the working hours. In Barcelona in 2024 it would be 2 €/h so the total is 1000 €. Finally, the cost of the energy consumed by all the hardware at the rate of 0.1489 €/ kWh at 21/06/2024 totals 6.21 €. The total cost comes to an approximate 9596 €. 5.3.2. EXECUTION In this project the focus has been on the research of the different technologies without much consideration on the costs related to the implementation of those in a real-world production environment for some commercial purpose. With this considered the costs for the implementation of the basic system developed in a large scenario is out of the scope of this project since it would require a study of the trade-offs of a lot of variables like the number of stops to monitor or the necessity of providing analytics in real time or not. Also, the optimization of the system would change to a large degree the costs compared to the prototype developed. Analysis of bus stops with CV 5 Sustainability analysis and ethical implications -35- 5.3.3. RISKS AND LIMITATIONS The fact that the field of computer vision is changing rapidly in recent years would impose a risk on the application of this system since it could become outdated. The viability in the long term would be very dependent on creating a robust framework that could be updated if necessary and that provides a good enough baseline for the main analytics. The economic analysis is a complex topic for a system that would need to define constraints and trade-offs from multiple perspectives to provide a more conclusive analysis of the economic impact and costs. 5.4. SOCIAL IMPACT 5.4.1. DEVELOPMENT The project has required the development on technical and professional aspects, specifically on the research and implementation of computer vision technologies and the documentation of technical projects. It has involved a reflection on the current state of the public transport and the impact it has on the everyday life of people. Also, the ethical discussions on using AI based surveillance tools for the improvement of public services has increased the awareness on the necessity to be responsible on all the stages of development. The language used throughout the research is inclusive and non-sexist, reflecting our commitment to respectful and mindful communication. 5.4.2. EXECUTION This project could help the development of a more efficient and effective public transport. The ability to define policies based on the bast amount of information that computer vision technology provides could provide a cost-effective improvement to the current public transport system in a lot of cities. The first beneficiary of an implementation would be the companies running the public transport since it would provide highly granular data from very complex systems. This data would provide a better understanding of the status and with the correct protocols in place it would translate to a better service overall for the users. Analysis of bus stops with CV 5 Sustainability analysis and ethical implications -36- 5.4.3. RISKS AND LIMITATIONS As previously discussed, the application of the technologies studied and developed on this project could be detrimental to specific segments of the population in a critical sector as the public transport. The misuse of video-based surveillance technologies is a highly discussed topic and preoccupation in our society, and it would need to be highly regulated. Also, the implicit bias of AI models could be detrimental to already marginalized groups. The study of these risks is out of the scope of the project and would be an important part of the development of this system in a real-world use case. 5.5. ETHICAL IMPLICATIONS AND SUSTAINABLE DEVELOPMENT GOALS The scope of the project is focused on the research and development of a tool assisted by computer vision to track pedestrians waiting at a bus station to analyse the behaviour and assist in developing a better public transport service. This means that the system could function as a baseline for a much larger project with possible ethical implications. The ethical implications in the scope of the project that have been considered pertain to the privacy concerns of data collection and the ethical use of AI. The acquiring of videos at a public setting was done with consideration to the privacy of the individuals since there is no explicit consent. The data has only been used for the purpose of the research and all the publications respect the anonymity of the citizens, as it can be seen in the images of the report. The use of different pre trained AI models have implicit bias and can perpetuate existing inequalities. The deployment of a surveillance system with AI technology would need to follow strict regulations and audits to minimize the risk of misuse. In terms of the sustainable development goals the project is aligned directly with SDG 3 (Good health and Well-being), SDG 13 (Climate Action) and SDG 11 (Sustainable Cities and Communities) since the development of better public transport reduces greenhouse gas emissions, improves the quality of life and benefits the health of citizens. It's also aligned with SDG 9 (Industry, Innovation and Infrastructure) since it includes the advancement of technological innovations for the development of the system. Analysis of bus stops with CV 5 Sustainability analysis and ethical implications -37- The development of further analytics based on the tracking of pedestrians and vehicles, the application of this technology in the public space or the use of it to implement policies in a critical area such as the public transport would need to address in much detail the ethical implications. In terms of professional ethics this project follows the principles in the UPC code of ethics [28] and code of research integrity [29]. Analysis of bus stops with CV Conclusions and Future Work -38- 6. CONCLUSIONS AND FUTURE WORK 6.1. CONCLUSIONS This project’s aim, as said on the introduction, has been to create a system capable of tracking people and buses for the development of analytics that provide information from a bus stop using computer vision. The work has included a review of two detection models and two tracking algorithms to stablish a benchmark for the system capabilities. The evaluation with the MOT Challenge benchmark for different videos with people waking concluded that the YOLOv8m with DeepSORT tracking is the best tested pipeline with a HOTA of 0.49 in the recordings of the bus stop, better than the other combinations using Faster RCNN detection and SORT tracking. Once the evaluation was performed, the videos from a real bus stop in Barcelona were filmed and the different tracking methods were used to get the results and visualize them. With YOLOv8m and DeepSORT as the best pair the capabilities for the specific scenario seem to have difficulties with giving good and consistent tracks. With the tracking done the mobility analytics that classifies the waiting people, if there is a bus stopped and how many people enter, and exit was performed. The results were mixed, and the analytics were evaluated to show the main problems and possible solutions or improvements. The entire base code of the original project plus all my contributions developed within the framework of this thesis can be found in the GitHub of the project called Bus_Stop_CV [30]. In conclusion, the research and development of the project has been enriching and fulfilling. The use of computer vision technology to tackle a real-world problem has been exciting and the process of discovery and problem solving to produce a proof-of- concept has provided a lot of insight into this area of study. It has been a pleasure to dive deep into an evolving and interesting subject and the experience gained has been very valuable. Analysis of bus stops with CV Conclusions and Future Work -39- 6.2. FUTURE DIRECTIONS Finally, some guidelines for future research will be detailed based on the work carried out and the conclusions obtained from the results. - With this project it has been determined that the detection and association recall for the analysed models and algorithms are low and should be improved for a difficult scenario such as a bus stop, this could be done with newer or more advanced techniques. Other improvements to the detection and algorithm would be finding better parameters. - One key point would be the filming of more videos at different stations or settings to develop a clearer view of the challenges for the system and doing it considering the take aways of this project, like the angle and distance of the camera. Also, annotating them would be very beneficial to the analysis of the performance for the tracking algorithms. - The analytics could also be improved with better or faster code and algorithms and more analytics could be added to the system. - For a future work having the input and feedback from experts in the mobility industry such as the AMB would be very beneficial to the development of a useful tool for the future of mobility. Analysis of bus stops with CV List of Figures -40- LIST OF FIGURES Figure 1: Final Gannt diagram ................................................................................................................................................. 11 Figure 2: Process of recording….. ........................................................................................................................................... 16 Figure 3: Frame from recodring with zoom x1…………………………………………………………………………………16 Figure 4: Representation of how HOTA can be decomposed ..................................................................................... 18 Figure 5: Visualization of tracking metrics ........................................................................................................................ 19 Figure 6: CVAT UI .......................................................................................................................................................................... 21 Figure 7: Division of scene ......................................................................................................................................................... 22 Figure 8: MOT17-04 Faster RCNN (blue) , GT (green) .................................................................................................. 23 Figure 9: MOT17-04 YOLOV8M (blue) , GT (green) ....................................................................................................... 23 Figure 10:MOT17-04 DeepSORT - YOLOv8M ................................................................................................................... 25 Figure 11:MOT17-04 DeepSORT – Faster RCNN ............................................................................................................. 25 Figure 12: MOT17-02 SORT - YOLOv8m ............................................................................................................................. 25 Figure 13: MOT17-02 SORT – Faster RCNN....................................................................................................................... 25 Figure 14: Video of the bus stop with the tracks ............................................................................................................. 27 Figure 15: People entering the bus at zoom x2 and x1 ................................................................................................. 27 Figure 16: Waiting pedestrians (Tracking blue, ground truth yellow) for PXL_20240411_161555136-na recording ........................................................................................................................................................................................... 29 Figure 17: Id's of waiting pedestrians for PXL_20240411_161555136-na recording (x1 zoom) ............. 29 Figure 18: Ground truth Id's for PXL_20240411_161555136-na recording (x1 zoom) ................................ 29 Figure 19: Tracking of waiting pedestrians, entries and exits for PXL_20240411_162114840-na recording (x1 zoom) ..................................................................................................................................................................... 30 Figure 20: Waiting pedestrians and bus presence for PXL_20240411_164438893.TS recording (zoom x2) ......................................................................................................................................................................................................... 30 Figure 21: Ground truth presence of bus. entries and exits for PXL_20240411_164438893.TS recording (zoom x2) .......................................................................................................................................................................................... 31 Analysis of bus stops with CV List of Tables -41- LIST OF TABLES Table 1: MOT17 sequences for training .............................................................................................................................. 15 Table 2: Bus stop recordings .................................................................................................................................................... 16 Table 3: HOTA evaluation for MOT17 .................................................................................................................................. 24 Table 4: HOTA details for different models for MOT17 Benchmark ...................................................................... 24 Table 5: Number of identities tracked and ground truth for MOT17 ..................................................................... 24 Table 6: HOTA evaluation for Bus Stop Videos ................................................................................................................ 26 Table 7: HOTA details for different models for all Bus Stop Videos ....................................................................... 26 Table 8: Number of identities tracked and ground truth for Bus Stop Recordings ......................................... 26 Table 9: Bus stop Video analytics vs ground truth ......................................................................................................... 28 Table 10: Sustainability matrix ............................................................................................................................................... 32 Table 11: Energy consumption ................................................................................................................................................ 33 Table 12: Carbon footprint ........................................................................................................................................................ 33 Table 13: Cost of human resources ....................................................................................................................................... 34 Table 14: Cost of the devices .................................................................................................................................................... 34