Artificial Intelligence for Urban Safety: A Case Study for reducing road accident in Genoa

: This study explores the application of Machine Learning (ML) and citizen engagement in improving road safety for vulnerable populations (pedestrians, cyclists) in Genoa, Italy. Aligned with the UN's 2030 Agenda for Sustainable Development, the project aims for a 50% reduction in traffic accidents by 2030.The AI4PublicPolicy initiative introduces the Virtual Policy Management Environment (VPME) platform. VPME utilizes ML, Deep Learning (DL), Natural Language Processing (NLP), and chatbots to empower the policy development lifecycle. Citizen feedback is integrated through workshops and surveys, fostering a citizen-centric approach. The Genoa pilot program demonstrates VPME's capabilities. ML models analyse historical accident and Geographic Information Systems (GIS) data to predict future high-risk areas. These predictions inform resource allocation and targeted interventions for pedestrian crossings and school walking routes ("Pedibus"). Dashboards visualize the model outputs, allowing users to assess risk levels and predict accident occurrences. Future improvements include incorporating additional data sources (demographics, real-time traffic) for enhanced model accuracy. Citizen engagement played a vital role. Co-creation workshops facilitated stakeholder participation in defining Use Cases, User Stories, and project objectives. Discussions focused on integrating data from environmental, traffic, and citizen reporting systems with VPME solutions. Participants evaluated the project approach and provided valuable feedback. The project highlights the potential of AI and citizen collaboration for data-driven policymaking. This approach empowers municipalities to make informed decisions that prioritize public safety and well-being.


Introduction
The Municipality of Genoa is committed to enhancing road safety, particularly for pedestrians, aligning with UN and EU directives and Italy's National Road Safety Plan (PNSS) 2021-2030.Building on prior interventions focusing on user requests and PNSS Horizon 2020 guidelines, the city implemented a program in 2020 to strengthen ten pedestrian crossings.These improvements included dedicated lighting systems and enhanced markings.Recognizing the need for a systematic approach, Genoa developed a methodology in 2021 for prioritizing interventions based on objective road safety parameters and departmental priorities.This approach aims to standardize interventions across the city.Furthermore, Genoa established a Smart Mobility office in 2020, promoting sustainable transportation options.In line with this commitment to a "green" future, Genoa selected road safety for vulnerable people as its pilot project for the AI4PublicPolicy initiative.This pilot will explore a novel AI-based and citizencentric approach to policy development.It aims to identify crucial needs, optimize resource allocation, and improve departmental collaboration, ultimately reducing decisionmaking time, anticipating risks, and enhancing citizen engagement in policy decisions.This project seeks to leverage AI tools to monitor and bolster road safety for vulnerable populations, supporting a safer and more mobile future for Genoa.Public administrations face ever-growing challenges in managing mobility, sustainability, security, and resilience within their communities.AI4PublicPolicy (1), a collaborative effort between policymakers and AI experts, tackles these challenges by harnessing the power of Artificial Intelligence (AI) for citizen-centric public policy development.This project introduces a novel Open Cloud platformthe AI4PublicPolicy Platform (VPME).This platform leverages AI technologies like Machine Learning (ML), Deep Learning (DL), Natural Language Processing (NLP), and chatbots to empower the entire policy development lifecycle.VPME facilitates data extraction, simulation, evaluation, and optimization of public policies, with a strong emphasis on citizen participation through integrated feedback loops.By incorporating citizen input, AI4PublicPolicy fosters a truly citizen-centric approach to policymaking.Beyond the VPME platform, AI4PublicPolicy supports public administrations in transitioning from traditional to AI-based models.This transition ensures effective policymaking that leverages the power of data analysis and citizen involvement.The project demonstrates the VPME's capabilities through a pilot program in Genoa, Italy.This pilot focuses on reducing traffic accidents involving vulnerable users like pedestrians and cyclists.Aligned with the UN's 2030 Agenda for Sustainable Development, the project aims for a 50% reduction in traffic accidents by 2030.AI models play a crucial role in this pilot.By analysing historical accident data and Geographic Information Systems (GIS) data, the models predict future accidents.This predictive capability empowers Genoa's municipality to prioritize interventions and allocate resources efficiently towards improving road safety for vulnerable subjects.

Use case #1: Determine the danger index of city areas
The new National Road Safety Plan (PNSS) 2030 aligns itself with the "Safe System" approach advocated by the European Commission and the UN 2030 Agenda.This ambitious approach aims to achieve a significant reduction in road accident fatalities and serious injuries by 2030.Specifically, the goal is to halve the number of victims compared to 2019 and ultimately eliminate all fatalities and serious injuries caused by road accidents.A crucial innovation of the PNSS 2030 is its focus on targeted strategies for different risk categories.The plan recognizes that various groups of road users face different levels of risk.It identifies six categories considered most at risk: children and adolescents, young drivers, people over 65 years old, cyclists, pedestrians, and motorized two-wheeler users.For each of these categories, the PNSS outlines specific actions to improve their safety.This particular use case specifically targets reducing road accidents involving vulnerable people.It aims to explore how AI tools can be most effectively utilized to address the complex challenges of road safety and urban security.The objective is to support policymakers and experts in developing more effective solutions, particularly for preventing accidents involving the vulnerable user categories outlined by the PNSS 2030.The City of Genoa provided a comprehensive dataset encompassing all traffic accidents that occurred within its boundaries between 2019 and the present day (March 2024).This rich data includes details on various categories of people involved in accidents, including pedestrians, passengers in fourwheeled vehicles (cars, taxis, etc.), and passengers in twowheeled vehicles (motorcycles, scooters, etc.).The dataset further classifies accidents according to severity, differentiating between those resulting in injuries and those tragically leading to fatalities.Location information for each accident is provided in the form of geographic coordinates, using the EPSG:3003 standard which specifies latitude and longitude.By leveraging Geographic Information Systems (GIS) software like QGis, we were able to subdivide the city of Genoa into a grid of small squares, each approximately 300 meters by 300 meters as it shows in the figure n° 1 .This granular approach allows us to analyse not only the spatial distribution of accidents over time within these squares but also to consider the surrounding environment.The dataset also includes a wealth of information on relevant points of interest (POIs) within the city, provided by the Municipality of Genoa.These POIs encompass a wide range of locations that may influence pedestrian and traffic flow, including public buildings (offices, libraries, etc.), schools, hospitals, public transportation stops, pedestrian crossings, shopping malls, and even tree-lined avenues.Notably, the accident data incorporates hourly timestamps, providing a detailed picture of accident occurrences from 2019 to March 2024.The proposed concept entails the development of a predictive model designed to discern, based on designated temporal and spatial parameters, the likelihood of an accident transpiring within a specified urban block.The envisioned model aims to ascertain whether the probability of an accident within said block is negligible, moderate, or indicative of the potential for multiple pedestrian-related incidents.It is pertinent to note that the municipality of Genoa is subdivided into nine distinct neighbourhoods.Consequently, upon selecting a particular neighbourhood as the focal point, the resultant dashboard would resemble the illustration denoted as Figure n* 2. Within this dashboard, areas devoid of notable risk would be denoted by a verdant hue, while instances of recorded accidents would be represented in a luminous yellow shade.Furthermore, the prospect of multiple accidents within a given area would be visually indicated by a conspicuous red hue.While we had access to a vast amount of datathe number of accidents recorded in each individual square for every hour of the daythe resulting dataset presented a challenge.This was because, across an entire year, there were approximately 8,760 hours to consider for each square.However, the actual number of accidents that occurred was statistically very low.In fact, only about 0.01% of those hourly slots had a recorded accident.This meant that a Machine Learning (ML) model trained on this data would likely always predict a zero chance of an accident for every hour in every square.This wouldn't be particularly helpful.Therefore, in collaboration with the Municipality of Genoa, we decided to adjust our approach.Instead of focusing on individual squares (roughly 300 meters by 300 meters), we opted to utilize data from larger urban planning units.This approach, as illustrated in Figure n* 3, resulted in a more manageable dataset with 71 blocks instead of the original 3,200 squares.This aggregation allowed for a better chance of capturing accident patterns and building a more effective prediction model.We then took an additional step to refine the data sampling process.Initially, we had structured the data as one series for each hour, representing the accident counts for that specific hour within a particular urban planning unit.However, we recognized that this level of granularity might not be optimal for capturing broader trends.Therefore, we decided to modify the data by upsampling it from hourly series to daily series.This means we combined the accident data for each hour within a day, resulting in a single data point representing the total number of accidents that occurred in that specific urban planning unit for that particular day.We applied this up sampling technique to historical data collected for various urban planning units between January 1st, 2021, and mid-2023.The resulting historical series, visualized in Figure n* 4., illustrate the impact of up sampling.As you'll see, some units reveal significant variations in daily accident counts, suggesting potential patterns worth exploring.However, for other units, up sampling didn't lead to a substantial change in the data behaviour.This might indicate that these specific areas experience a consistently low or high accident rate, regardless of the time of day.Our methodology involved the utilization of a particular Python library specialized in handling time series data employing Deep Learning techniques.Our selection criteria led us to opt for the neuralforecast library, which afforded us the opportunity to conduct an extensive evaluation encompassing three distinct model architectures: NHITS, NBEATS, and PatchTST.

N-BEATS, which stands for Neural Basis Expansion Analysis
for Time Series forecasting [2], is a deep learning model specifically designed to predict future values in time series data.Here's a breakdown of its key features:

•
Focus on univariate forecasting: N-BEATS works best for predicting a single variable over time, unlike models that handle multiple interconnected variables.

•
Deep Neural Network Architecture: It utilizes a deep stack of fully-connected layers, similar to other deep learning models.These layers are responsible for extracting complex patterns from the data.

•
Backward and Forward Residual Links: This is a unique characteristic of N-BEATS.These residual links help the model by allowing information to flow directly from earlier layers to later ones, ensuring that crucial details aren't lost during processing.

•
Building Block Approach: The model is built by stacking together multiple identical blocks.Each block receives the input data and produces two outputs: N-HiTS, which stands for Neural Hierarchical Interpolation for Time Series forecasting [3] , is an improvement on the existing N-BEATS model.It aims to deliver more accurate predictions while requiring less computational power.Here's how it achieves this:

•
Multi-rate sampling: N-HiTS utilizes a technique called "multi-rate sampling."This involves splitting the model into stacks, each focusing on different timescales within the data.Similar to zooming in and out, some stacks analyze short-term variations using smaller "kernels" (data windows), while others focus on long-term trends with larger kernels.

•
MaxPool layer: This is the key element that enables multi-rate sampling.It acts like a filter, capturing the most prominent value within a specific data window (kernel size).Large kernels emphasize long-term trends, while smaller ones highlight shortterm fluctuations.

•
Improved Long-Term Forecasting: Patching enables the model to capture long-term relationships within the data, leading to more accurate forecasts over extended periods.

•
Faster and Lighter Model: Patching reduces the number of tokens processed, making the model computationally efficient and allowing it to handle longer input sequences.

•
Potential for Better Performance: Selfsupervised learning can further enhance the model's ability to learn complex patterns and potentially outperform other forecasting models.

•
For a deeper understanding of the mathematical details behind PatchTST, the original research paper is recommended.This article provides a high-level overview of the model's architecture and its core strengths in time series forecasting.

•
A backcast: This signifies the block's attempt to reconstruct the input data itself.This helps the model focus on the most informative parts of the data.

•
Strength in Simplicity: Despite its deep architecture, N-BEATS is known for being relatively simple and interpretable compared to other forecasting models.This can be beneficial for understanding how the model arrives at its predictions.
We performed a comparison for each of the proposed models: in reference to a specific urban planning unit we obtained the following graph presented in figure n° 5.The graph depicts a comparison between the three models' forecasting abilities and the real timeseries since specified in blue line.This comparison focuses on a specific forecast horizonapproximately 100 days.To conduct this evaluation, we utilized a validation set spanning from January 1st, 2023, to the end of May 2023.It's important to understand how the models were trained and tested.Each model was given a specific amount of historical data to learn from.In this case, the models were trained on information about the number of accidents that occurred in the previous 4 days (4 observations).Based on this historical window, the models were tasked with predicting the number of accidents for the next 2 days.This process was then repeated by sliding the time window across the entire validation dataset, allowing the models to generate forecasts for various points in time throughout the validation period.Using the MAE and MSE metrics we obtained the following values for the three models (table n° 1):

Table 1. Neuralforecast Model's selection
The values obtained indicated to us that the best model to use for the data at our disposal is the PatchTST for a not high MSE value.The figure n* 6 shows the dashboard ) that will allow the policy makers to predict the incident risk in a certain area of the city at a selected date.

Use case #2: Identifying Pedestrian crossings with the most urgent need of improvements
In the development of this AI solution, a variety of datasets was utilized to ensure a comprehensive understanding of the cityscape and its dynamics.The first dataset includes the historical data of all road accidents that occurred in the city of Genoa for a total of 3 years, complete with Geographic Information System (GIS) coordinates.This data provides valuable insights into accident-prone areas and patterns.The second dataset is a GIS polygon representation of the city of Genoa, which offers a detailed spatial understanding of the city's layout.The third dataset consists of the GIS coordinates of all pedestrian crossings in the city, crucial for understanding pedestrian movement and safety.Lastly, a dataset containing the GIS coordinates of all points of interest in the city was used, which helped in analysing the correlation between these locations and the occurrence of accidents.These datasets collectively contribute to robust and comprehensive AI solutions for urban safety analysis.The objective of this study, which is centred on mitigating road accidents involving vulnerable individuals, is to explore the optimal and most efficacious application of Artificial Intelligence tools to address the pressing issue of road accidents and urban safety.This research aims to assist policy officers and experts in devising more effective preventative measures, particularly for accidents involving individuals from previously specified vulnerable categories.The initial segment of this research endeavor places a concentrated focus on the pivotal subject matter of pedestrian crossings.These crossings are recognized as a fundamental component in the broader context of urban safety.In recognition of this, the Municipality of Genoa has proactively embarked on a dedicated program.This program is specifically designed with the objective of implementing enhancements to these pedestrian crossings, with the ultimate aim of mitigating the risks associated with accidents.However, the successful execution of this program necessitates additional support.Specifically, it requires assistance in the task of classifying these crossings.The classification is to be based on the level of risk associated with each crossing, and it is this classification that will aid in the identification of the most pressing priorities for intervention.The overarching objective of this policy is to establish a system for categorizing pedestrian crossings.This system is based on an index of urgency, which is in turn determined by the risk of accidents associated with each crossing.Once established, this index will serve as a critical tool in determining a ranking system.This ranking system will then guide the prioritization of interventions, ensuring that resources and efforts are strategically directed towards the areas of greatest need, thereby reinforcing the safety measures in place.In order to train a Machine Learning model with the capability to accurately identify pedestrian crossings that present a high risk, thereby enabling interventions to be precisely targeted, it was deemed necessary to generate a concise dataset comprising pre-classified pedestrian crossings.This dataset was meticulously curated by the municipality of Genoa, with each pedestrian crossing contained within this dataset having been previously classified by engineers following a thorough examination.Each pedestrian crossing within this dataset was associated with an "Urgency Index".This index was utilized to determine the category into which each pedestrian crossing would be classified.A decision was made to use three distinct categories: "Very Urgent", "Less Urgent", and "Not Urgent".The "Very Urgent" category encompasses those pedestrian crossings that necessitate immediate intervention in order to enhance their safety.The "Less Urgent" category includes those pedestrian crossings that, while not requiring immediate attention, will likely necessitate attention in the future.Lastly, the "Not Urgent" category comprises those pedestrian crossings that are already deemed to be safe.This categorization system allows for a more structured and efficient approach to improving pedestrian safety in the city.A substantial portion of the pre-classified dataset was allocated for the training of a multitude of Machine Learning models.A smaller, yet significant, portion of this dataset was reserved for the purpose of comparing the performance metrics of these models.

Model
In the context of this project, the model that exhibited superior performance was the Support Vector Regressor (SVR).This model is a potent tool in the realm of machine learning, specifically designed for tackling regression tasks.It is rooted in the concept of Support Vector Machines (SVMs), but diverges in its application.Instead of being used for classification tasks, the SVR is employed to predict real-valued outputs.The fundamental principle underpinning the SVR is the identification of a function that can approximate the data in the most effective manner, while maintaining a level of simplicity.This is accomplished by defining a margin of tolerance, referred to as the ε-insensitive tube, within which errors are not penalized.The model strives to minimize both the complexity of the function and the extent to which predictions deviate from this tube.The SVR's ability to handle non-linear relationships between variables is enhanced through the use of kernel functions.This feature renders the SVR a versatile instrument, capable of addressing a wide array of regression problems.
In order to augment the practical application of the Machine Learning solution, a sophisticated Dashboard was meticulously designed and implemented (figure n* 7 that will allow the user to easily classify the risk index of any pedestrian crossing of the city of Genoa ).This interactive Dashboard exhibits a detailed map of the city of Genoa, providing a comprehensive visual display of pedestrian crossings.These crossings are distinctly categorized as either pre-classified or yet to be classified.Each pedestrian crossing is uniquely represented on the map, differentiated by a specific colour that signifies its respective category.This color-coded system enhances the user's ability to discern between the various categories of pedestrian crossings at a glance.When an unclassified pedestrian crossing is selected for review, the Dashboard presents an intuitive interface for data entry.This feature allows the user to conveniently input the necessary information required by the Machine Learning model.
Once the required information is provided, the model processes this data to classify the selected pedestrian crossing.This seamless integration of data input and processing facilitates an efficient and user-friendly experience, thereby significantly enhancing the usability of this Machine Learning solution.

Use case #3: Evaluate the safety of Pedibus paths
Pedibus is a unique program designed to enhance children's safety on their way to school.It functions like a "walking minibus," with a designated route that picks up children from various areas where they live.One or more adults supervise the group, ensuring a safe and secure journey.This program aims to create a supportive walking community for children, fostering a sense of companionship while prioritizing their well-being.The current evaluation of Pedibus path safety relies solely on a single indicator: the Pedibus safety index.This index attempts to capture the overall safety level of the walking route by considering the types of pedestrian crossings and zones encountered along the path.These zones could include elements like traffic lights, designated crosswalks, areas with limited car access, or even specific areas known for high pedestrian activity.The dashboard for this policy allows selecting a pedibus path and viewing it on the map, together with its safety index, calculated on the basis of the areas and pedestrian crossings affected by the path for a specific date/time and meteorological forecast.Figure 8 shows the result of the dashboard for the path "Green Line Primary School A. Spinola (I.C.Oregina)".As in Use cases #1 and #2 the Policy maker can simulate the impact of possible risk reduction actions.

Citizen-centric approach
Citizen engagement and participation in Genoa pilot activities have been strictly helped by the co-creation workshops, crucial for the development of AI4PublicPolicy overall, as well as the definition of the Use Cases and User Stories of the Genoa pilot.The use of design thinking techniques and the methodologies of open participatory approach combined with a co-creation approach, allowed the participating stakeholders to share their views, evaluate the feasibility of the ideas and validate the processes.
The sharing of ideas, insights and indications allowed for in detail analysis of the individual issues related to the subjects of the Use Cases and User Stories and enabled to extrapolate relevant aspects of the services while keeping the focus on citizens and administration.The result was a complete analysis focusing on the pilot's concrete objectives in relation to the specific Use Cases, a detailed map of the relevant stakeholders of each Use Case and the development of the User Stories with process validation, including details and technological features, needs and objectives of the citizens and the administration.
The main outcome of the co-creation workshops experience has been the common census reached on the importance of determining danger indexes of city areas for all vulnerable categories, and the purposefulness to integrate data taken from environmental, traffic and citizens' reporting systems with the project's solutions.
The central part of the debate had been focused on Genoa pilot solutions available through the VPME, especially connected to the "Reduction of road accidents against vulnerable people" Use Case.The dashboard for the risk assessment of pedestrian crossings, based on a machine learning model, for the prioritization of upgrading interventions was then presented.The attendees have been involved in a co-creation process, engaging in guided discussions on various elements of the VPME.This included discussions around the datasets, the policy KPIs (Key Policy Indicators) in place, the design and functionality of the policy dashboards, and the methodology behind the policy surveys.Moreover, the participants were provided with the link and QRcode to anonymously participate to the policy surveys created in the VPME.Finally, each participant was asked to evaluate the project's approach and policy results and provide considerations to bring to the debate on what can be tackled leveraging the project's solutions and AI-Based tools.
The main outcome was a very good evaluation of the project approach, the use cases and the new AI-based policy development process provided by the VPME.
Another important outcome has been the importance of reaching a better integration of datasets and data systems for road accidents prevention within the Municipality infrastructure and among all external Institutions responsible for that kind of public service.AI and Machine Learning approaches utilised in AI4PublicPolicy have been considered innovative and adequate tools to reach that goal.

Future work.
The forthcoming advancements, which are currently in an advanced stage of development, entail the creation of a model designed to not only consider the historical data series of accidents but also incorporate the geometric layout of the terrain and the intricate interrelations among various urban planning units.Building upon an existing work [5], we have initiated an assessment of the data interaction between the time series aggregated at the neighborhood level and the historical records of each individual urban planning unit.This analysis is further bolstered by the utilization of Graphs, which aim to capture the similarities and physical disparities among the diverse urban planning units.Should our developed model demonstrate promising outcomes, there exists the potential to introduce an additional tier of analysis, focusing on individual squares measuring 300m x 300m.Furthermore, there is a prospect of evaluating the initial time series, which were sampled hourly, enabling predictions of accident probabilities on an hourly basis.An empirical observation has revealed that the time series exhibit at least three levels of seasonality.Firstly, there is a temporal pattern observed within daily time slots, with accidents peaking typically during the 8-10 am and 5-7 pm intervals.Secondly, there exists a weekly seasonality, where weekdays witness a higher incidence of accidents compared to weekends and potentially public holidays.Lastly, there is a monthly seasonality, with a decrease in accidents during summer months juxtaposed with an increase during the Christmas period.Consequently, it is imperative to ensure that the model accommodates these distinct seasonal trends.Upon analyzing the series trends from 2019 to the present day, it becomes apparent that the trajectory is far from stable and displays a noticeable degree of heteroscedasticity.Each successive year demonstrates an uptick in the overall number of accidents, underscoring the dynamic nature of the data.

Conclusion
AI4PublicPolicy presents a groundbreaking approach to public policy development.This project harnesses the power of Artificial Intelligence (AI) and citizen engagement to empower municipalities like never before.Here's how it works: • AI Expertise: AI4PublicPolicy utilizes advanced AI technologies like Machine Learning and Natural Language Processing (NLP) to analyse vast amounts of data.This data could encompass everything from historical accident reports to pedestrian traffic patterns.By analysing these trends, the AI can identify potential safety risks and areas for improvement.

•
Citizen Participation: AI4PublicPolicy doesn't stop at just AI analysis.The project actively seeks citizen participation, creating a platform where residents can voice their concerns and suggestions.This two-way communication ensures that policy decisions are not only data-driven but also reflect the real-world experiences and needs of the community.

•
Data-Driven Decisions: The combined power of AI analysis and citizen feedback empowers municipalities to make data-driven decisions.They can prioritize safety measures based on objective risk assessments while ensuring these measures align with the concerns of the community they serve.

•
Enhanced Public Safety and Well-Being: Ultimately, AI4PublicPolicy aims to enhance public safety and overall well-being.By creating safer walking routes, for example, the project can encourage more residents to walk or cycle, leading to healthier lifestyles and reduced traffic congestion.
In essence, AI4PublicPolicy fosters a collaborative approach to public policy, leveraging the strengths of both AI and citizen engagement to create safer and more liveable communities.

Figure 4 .Figure 5 .
Figure 4. Time series Genoa Urban Units This combination leverages both short-term and long-term insights for a more accurate overall prediction.A forecast: This represents the model's prediction for the future value(s).
ratio varies.For instance, a stack analyzing hourly data predicts for every timestep, while another analyzing data every 12 hours predicts less frequently (reducing computation).Combining predictions: Finally, N-HiTS merges the forecasts from each stack at different timescales using hierarchical interpolation.