1. Introduction
The application of Information and Communication Technologies (ICTs) in real contexts is a key factor for the development of smart cities, where proper levels of quality of life and environment, safety, and sustainability are the main targets [
1].
The benefits related to the use of ICTs affect everyday life in both normal and emergency conditions. The occurrence of accidental or catastrophic natural events (e.g., sudden floods, earthquakes, fires, etc.) and the adoption of inadequate management strategies are the main causes of the occurrence of emergency conditions in structures and infrastructures. These causes can affect the structural health status of the abovementioned assets, which in turn can affect the health and safety of highly populated areas (i.e., urban contexts, buildings, occasional assembly points for crowds, theme parks, etc.). Significant improvements in disaster management are expected if artificial and human intelligence are integrated (e.g., Disaster City Digital Twin paradigm; cf. [
2]), affecting the efficiency of real-time monitoring (by social and remote sensing), of the data analysis (to detect and monitor human activities, damages, and relief needs), and of the scenario simulations (for various and fair allocation of resources, or for training and planning purposes). Consequently, the main disaster management stages (e.g., preparedness and risk reduction, disaster response, recovery) can be boosted if proper information sharing, which includes different systems and stakeholders, is carried out [
3].
Furthermore, emergency conditions are defined as the presence or the spreading of high concentrations of pollutants (environmental risk), or of diseases and epidemics caused by bacteria or viruses (biological risk). In the first case, thresholds can be determined, and pollutants can be monitored (e.g., using ICT solutions based on fixed and mobile sensor nodes that actively include citizens in the information gathering [
4]) to verify that the pollutants’ concentrations are under the given thresholds, or to trigger predefined alarms. In the second case, it is crucial to manage the spatiotemporal distribution of the crowds by using technologies that allow for the implementation of specific and well-designed measures, such as physical distancing (or social distancing) and movement restrictions [
5], which are well-known strategies to reduce infection and mortality risks [
6,
7].
1.1. Literature Review on Available Solutions
In order to face the above problems, several approaches have been proposed. Among them, noteworthy examples of Internet of Things Wireless Sensor Networks (IoT -WSNs), monitoring platforms and recommender systems are reported in the following (
Table 1), also exploiting the use of machine learning (ML) in IoT systems [
8]. Importantly, the applicability of the WSNs mainly depends on the lifetime of the sensor nodes, and, for this reason, it is important to design this type of system while bearing in mind this crucial aspect and selecting the more convenient energy efficient routing protocol [
9,
10,
11]. Other important design parameters are [
10,
12,
13]: (i) the limited storing and computational resources of each sensing nodes, (ii) the costs (i.e., cheap sensors are prone to failure, while expensive sensors need good housing and cannot be used for dense deployments), (iii) the position of each sensing node, which cannot be predetermined and depends on the accessibility of the point where the node should be placed, (iv) the sensing nodes’ deployment (to collect the needed data, to have the required coverage and connectivity, to extend the network lifetime, and to minimize energy consumption), and (v) the minimum number of time slots required to aggregate data along the edges of a data-gathering tree spanning all the nodes in a WSN (a.k.a., minimum aggregation delay), if the gathered data are aggregated before the transmission to the control center. The solution presented in this paper was designed while bearing in mind all the design parameters mentioned above, focusing, in particular, on maximizing the exploitation of the nodes’ storing and computational resources, on minimizing the system cost and on optimizing the system deployment.
Another group of solutions for the problems mentioned above is represented by software platforms (
Table 2).
Other important and innovative examples of ICT solutions for emergency management refer to: (a) smartphone-based information systems [
34]; (b) mobile post-disaster management systems based on free and open source technologies [
35]; (c) satellite remote sensing for disaster management [
36]; (d) exploiting data from social media [
37]; (e) using deep learning to identify survivors in debris from images gathered by smart infrastructures [
38]; (f) using an IoT ecosystem (wellbeing-wearable and home automation system sensors with varying communication protocols) to empower the elderly population to self-manage their own health and stay active, healthy, and independent as long as possible within a smart and secured living environment [
39].
Recommender systems technology aims at reducing the consumer over-choice due to the huge amount of information available on the web [
40]. These systems use information (e.g., location, preferences, past interaction, item features, etc.), gathered through few interactions with its user, to create a customized selection of items (e.g., recommendation list) that can interest the user and can facilitate a better user experience [
40,
41]. Recommender systems could be further improved if Machine Learning (ML; users extract the features from raw data to feed the algorithm) and Deep Learning (DL; the algorithm automatically extracts features from raw data) algorithms were used for information retrieval [
40]. Noteworthy applications of recommender systems in smart cities include: 1) a mobile IoT recommender system for users that need to find Park-and-Ride infrastructures to switch from a private to a public transportation mode [
42]; 2) an autonomous situation-aware evacuation route recommender architecture, optimized in real time, to obtain smart buildings [
43]; 3) a recommendation system based on the concept of Social IoT (SIoT), i.e., use and reuse data generated by various IoT applications, and adapt the services provided by the single IoT system, to improve the user experience [
44].
Based on the literature, different strategies can be adopted to derive/recognize safe routes and assembly points. Traditionally, the problems above can be solved using Shortest Path Finding (SPF) algorithms that belong to the mathematical field of Combinatorial Optimization. Noteworthy examples are: (1) Prim’s algorithm, which can be used to derive the Minimum Spanning Tree (MST; i.e., a tree diagram without circles) [
45]; and (2) the Dijkstra’s and the A* algorithms, which allow one to derive the shortest path between two points [
46]. In the Matlab environment, it is possible to find different tools (e.g., “shortestpath” and “digraph”) that allow one to solve this problem [
47].
This study also refers to a bidirectional exchange of information between a platform and its users, which can be satisfied using NFC technology [
48].
The efficiency of the solutions presented above is strictly related to the real-time knowledge of the spatiotemporal distribution of the population, which is fundamental for risk analysis and emergency management (i.e., for an estimation of human exposure and vulnerability) [
49]. One of the most used techniques to model or track moving crowds is Computer Vision [
50]. Convolutional Neural Networks (CNNs) represent the key algorithms in computer vision, and recently [
51], enhanced versions of the tree growth and firefly metaheuristics algorithms have been proposed to automatize the hyperparameters’ optimization process (i.e., find the right set of hyperparameters that allow one to obtain the best CNN model accuracy), obtaining better performances (in terms of image classification accuracy and the use of computational resources) than the traditional approaches (that require time expertise). Furthermore, faster regions CNN (Faster R-CNN) is considered one of the most important techniques for automatic pedestrian detection from video [
52], and, if automatic color enhancement (ACE) is used, good performances (in terms of recognition rate and offset of target selection) can be obtained because of the reduced susceptibility to the diversity of pedestrians’ appearances and the light intensity in specific scenarios (e.g., a subway) [
52]. Other suitable techniques, such as satellite imagery processing, could be used as an aid for the automatic recognition of vegetation, landslides, and geospatial data [
53,
54]. Note that an easy detection of a full-body person in perspective can be carried out using other methods, such as Mask R-CNN [
55], Pose2Seg [
56], and EfficientDet [
57]. Finally, Convolutional Neural Networks are methods specialized in a grid-like structure or multiple arrays form [
58,
59].
1.2. Objectives and Scopes
In light of the above, previous works [
60,
61] presented an innovative IoT-WSN platform that was designed as a decision support tool for an Italian theme park. The main limit of the proposed platform was to provide solutions (emergency plans) that neglected the people density (number and spatiotemporal distribution). However, the literature review reported above allows one to identify solutions, i.e., the recommender system and the computer vision applications, which can be effectively used to improve the abovementioned tool. Hence, for this reason, in the study described in the following sections, we report the results of the integration of these solutions into the previous platform.
The main novelty of the study refers to the integration in an all-in-one solution, for the first time as per the authors’ knowledge, of available and new algorithms and ICT solutions that allow one to solve two important problems related to the theme park, i.e., the overcrowding and the emergency management, which were presented as two case studies in this paper.
Consequently, the remaining part of the paper is organized as follows. The following section (
Section 2) describes the IoT system, based on the platform cited above (Hardware in
Section 2.1), and how the system uses input data (Software in
Section 2.2) to carry out the main objective of this study, i.e., obtain a multipurposes IoT-WSN-based system that can be used by authorities for emergency and crowd management, and by authorized customers as a decision support tool. Subsequently,
Section 3 describes two case studies that were used to validate the proposed system, including dataset generation and algorithms application.
Section 4 reports the main results related to the case studies mentioned above, which were derived from simulations. Finally, the last two sections contain the main conclusions derived from this study and some anticipatory remarks about future works.
4. Results and Discussions
Algorithm 1 was tested using Anaconda, which is a free and open-source distribution of the Python and R programming languages for scientific computing. The performances were estimated using several prerecorded videos that compared the output to the manual counting of the people, showing an accuracy above 90%.
Algorithm 2 was tested using Keras, a deep-learning library that allows for easy and fast prototyping. Algorithm 2 showed a test accuracy of about 85%.
Algorithm 3 (see
Figure 10) was tested using Matlab, taking as inputs the output of Algorithms 1 and 2 and modifying, accordingly to the above results, the G graph. When it is executed with data coming from Algorithm 1, the Algorithm 3 shows the areas that are closed because of the activation of the overcrowding alarm. In the case of data coming from Algorithms 1 and 2, the Algorithm 3’s output represents the safest and fastest path to reach an exit or assembly point in case of active environmental or structural alarms.
The following figures (
Figure 11 and
Figure 12) show the results of the Algorithm 1 in two simulated cases of overcrowding alarm according to those shown by
Figure 6. Note that
Figure 11a is an example of a graph of the theme park without alarm, while
Figure 11b is an example of a graph with alarm. The latter was automatically generated because of the activation of the overcrowding alarm at node 4, which led to the closing of the area number 4 (please note that the name of node 4 changed from “N4” to “A4 CLOSED”). Meanwhile,
Figure 11c is a table that shows the overall conditions and that consists in the columns: (i) “Area”, which reports the six areas into which the theme park was divided; (ii) “People_in”, which reports the number of people entering in each area (which will be provided by the Algorithm 1 in the real application of the IoT system); (iii) “People_out”, which reports the number of outgoing people from each area (provided by the Algorithm 1 in the real application); (iv) “People_inside”, which reports the number of people that are inside each area at the time t
1 (when the crowd management plan was generated), which was calculated by subtracting the entering and outgoing people in relation to each area (note that only the positive values are reported, while the null and the negative ones are represented with zeros); (v) “Threshold”, which reports the maximum number of people allowed to stay at the same time in each area; and (vi) “Alarm”, which can be “NO” and “ACTIVE” if the overcrowding alarm is inactive and active, respectively. Note that, when an area is closed, it is only possible to leave the area (see the arrows on the graphs), and specific messages, shown by the digital signages installed in the park, prevent the access to the closed area.
As in
Figure 11,
Figure 12 shows the results of the Algorithm 3 in case of an overcrowding alarm, but, in this case, this alarm was detected by nodes 2 and 5, contemporaneously.
The next figures (
Figure 13,
Figure 14,
Figure 15,
Figure 16,
Figure 17 and
Figure 18) show two examples of the Algorithm 3’s output, which were obtained by carrying out two simulations according to
Figure 8 (i.e., environmental/structural alarm active at node 3 (see
Figure 13,
Figure 14 and
Figure 15) and at nodes 1, 3, and 5 (
Figure 16,
Figure 17 and
Figure 18)).
In particular,
Figure 13a shows the weighted graph (the weights are the people on the path between two nodes) of the theme park without an alarm, while
Figure 13b shows the graph in case of an alarm. In more detail, as shown by
Figure 13b, when an alarm is detected by the Algorithm 2 at an i-th node (node 3 in this case), the Algorithm 3: (1) changes the name of the i-th node in the graph to point out the node in which the alarm is active (see “N3 ALARM” in
Figure 13b); (2) removes the edge between the i-th node and the other node without an alarm; (3) if the i-th nodes are those that are near one exit (i.e., nodes 1 and 3), the name of the exit changes as well (see “E2 CLOSED” in
Figure 13b).
Note that, in order to improve the clarity of the figure below, the position of node 6 was defined so as to show the node 6-node 3 connection in a better way, and that, in case of an alarm, the weights were removed from the related graphs.
Figure 14 and
Figure 15 show the safest (i.e., that do not include nodes with active alarms) and fastest (i.e., that consider the people on the edges as a resistance to the crowd flow) paths. These paths can be used by the people near each node of the system (from node 1, N1, to node 6, N6) to face the environmental/ structural emergency detected by node 3 (N3). Importantly, the Algorithm 3 also provides a path for people that are near N3 where the alarm was detected. In addition, a table that summarizes the overall conditions is reported in
Figure 15c. This table shows: (i) the “Start Node”, which is the node from which the paths start; (ii) the “End Node”, which is the final destination of the people reaching a safe place (i.e., an assembly point); (iii) the safest and fastest path, consisting of the edges between the i-th node (Ni) and the n-th node (Ni+3); (iv) the node(s) where the alarm(s) was/were detected.
Finally,
Figure 16,
Figure 17 and
Figure 18 report a second example of the application of the Algorithm 3, which was derived according to that shown in
Figure 8b. In this case, nodes 1, 3, and 5 detected an alarm. Consequently, the exits 1 and 2 (herein called E1 and E2) were closed, and the target of the Algorithm 3 became the Assembly Points 1 and 2 (that are also indicated as nodes 9 and 10, or N9 and N10, in the figure below).
Note that
Table 6 and Equation 2 report the results of a scalability analysis carried out considering a system consisting in 6, 60, 240, 480, 960 and 1200 nodes, two exits and two assembly points. Alarms were simulated considering that, in each case, 20% of the nodes (randomly selected and indicated in the following with “A”) triggered an emergency alarm. The results refer to one of the worst conditions, i.e., the definition of the safest and shortest path to reach the exit 2 from node 1 (cf.
Figure 2a) considering that: (i) node 1 is adjacent to the exit 1; (ii) the exit 1 is closed; and (iii) the people around node 1 have to cross the whole park while avoiding all the emergencies (i.e., the nodes “A”) to reach the exit 2. In each of the six abovementioned cases, the system’s response times, using a desktop PC equipped with Intel
® Core™ i5-7400 CPU @ 3.00GHz, 8.00 GB of RAM, were calculated by averaging the results of 50 simulations for each case. The results of the scalability analysis described above are reported in
Table 6.
The results in
Table 6 were used to define the law that better describes how the response time of the algorithm 3 decays if the number of nodes increases (Equation (2) was derived).
where
t is the response time of the algorithm 3 (seconds) as a function of the number of sensing nodes
N.
Finally, all the algorithms have been developed and tested in a desktop PC and in a Raspberry PI, showing a computational time compatible with the level of risk associated with the safety application (<3 sec) in the case of actual nodes. The possibility to run a Raspberry PI on a Wireless Local Area Network (WLAN) is also powerful in the case of a network communication interruption, as the algorithms can be implemented in low computational and standalone devices.
Future works include (1) the implementation on low computational devices (e.g., microcontrollers), (2) the comparison with other simple neural network classifiers, such as a K-Means algorithm or a tree-based method (e.g., random forest or decision tree), or Convolutional Neural Networks and (3) the usage of a “flow graph” created by means of a min-cut max flow algorithm in order to maximize the number of people per unit of time who can move out of the park (e.g., using the number of people per unit of time who can use the path as capacities, and the actual number of people who are expected to use it at any given time based on a decision for evacuation as a flow value. In this way, crowds can be redirected from all the nodes simultaneously, and the flow is maximized).