Analysis of trajectories performed by moving entities in environments is an important topic for different fields such as video surveillance Hsieh2008, crowd/vehicle analysis Mahadevan2010; Akoz2014 and in general for monitoring systems, on which the dynamics of agents can lead to a better understanding of patterns and situations of interest Morris2011; Wang2011. Abnormality detection is one of the most explored applications that involves analysis of trajectories. In such approach, by characterizing agents’ motions, it is possible to learn and identify normal/abnormal situations in a certain environment.
In general, approaches for abnormality detection are based on a set of observations that define the regular behaviors in a scene. Afterwards, abnormalities are defined as behaviors that do not match with patterns previously learned as normal, i.e., behaviors that have not been observed before Kim2011
. Accordingly, observations that deviate from the characterized normal patterns are classified as potential abnormalities. Abnormality detection has been successfully used in real applications such as identification of hazardous massive crowdsHelbing2000; Li2015, recognition of group activities Vahid2015; Zhou2015, traffic event classification Hu2004; Akoz2014; Bastani2016; Haag2000; Lan2016, detection of anomalies in maritime trajectories Castaldo2014; Lei2016, among others.
The recognition of motion patterns and interactions from trajectories is a challenging task, in particular when dynamics of moving agents are nonlinear through time and space. Moreover, a quick analysis of existent bibliography shows that current methods usually claim robustness and reliability for highly restricted scenarios, broad sensor availability and short video footages Remagnino2007. To alleviate these issues, a common approach is to represent the state of agents under a probabilistic framework and characterize the motion patterns by following a nonlinear Bayesian state estimation. This approach has been successfully applied in surveillance environments and complex motion patterns Bastani2016; Nascimento2010.
In the present work, abnormalities from a proposed baseline model are used to parameterize characteristics of environments by looking at trajectories of individuals in an online way.
The majority of approaches that deal with analysis of trajectories are focused on characterizing agents’ dynamics through time Andersson2013; Lu2016; Cancela2013 or learning interactive forces exerted by multiple moving agents. The latter can be understood as an evolution of the seminal paper of Helbing and Molnár Helbing1995, on which crowd motions are described by a combination of simple interactive forces between pedestrians. The methodology proposed by the authors is based on social force models, a concept originally introduced by lewin1951. In a recent work, Seer et al. SEER2014 extend the work of Helbing by using three different shapes of social forces models, namely radial Helbing1995, elliptical Helbing2009 and a split version of forces Rudloff2011. The work of Seer is evaluated on real pedestrian trajectories.
A common trend in existent works, is the characterization of moving agents’ trajectories based on their interactions among them, without taking into account the environment and its effects in the state of agents. Our work is motivated by the approach of Seer SEER2014, with the main difference that the motion of our agents is characterized by environment forces revealed hierarchically due to interactions of the type agent-static zone.
This work tackles the analysis of moving agents in cases where the only information available is their location through time. The proposed strategy can be used in places on which a detailed map is unknown but agents’ positions can be obtained via GPS or other localization systems like Wi-Fi fingerprint for indoor environments Liu2012; Montorsi2014. Furthermore, the proposed approach provides information of the moving agents’ surroundings that can be useful in cases of places monitored by cameras that provide noisy measurements, partial/full occlusion or scenes with illumination changes Yilmaz2006.
The present work proposes a bank of Kalman filters (KFs) that explains the motion of agents in a hierarchical way. Models obtained from the bank of filters are incrementally learned by looking at abnormalities or deviations from a reference formulation based on a random walk behavior, such idea was first presented in Damian2016, where an off-line non-parametric method was proposed to characterize effects of static external objects in simulated environments.
In the current work, dynamical models that describe agents’ motions can be used to hypothesize a semantic representation of the environment effects Wang2011; Lou2002. In other words, the agents’ motions incrementally reveal characteristics of the environment. By considering a Bayesian approach, the proposed method learns sequentially the nonlinear dynamics of moving agents over segments in which their orientations are relatively stable. Consequently, such segments can be seen as letters that are part of a vocabulary learned dynamically. As a future work, these vocabularies are proposed to be used for identifying normal and abnormal situations related to environment’s characteristics revealed on the fly.
The novelties of this work are itemized as follows: i) It is proposed a Bayesian approach for understanding the physical and non-physical surrounding areas of moving agents based on their nonlinear dynamics. The proposed formulation allows to characterize parts of environments individually by using a bank of filters that encodes information about learned models in an incremental way. ii) A parametric force field model based on a switching process is proposed to understand agents’ motions. Such model includes information about how static areas influence the dynamics of moving agents. Additionally, only agents’ positions are necessary to understand the effect produced by static areas through time. iii) The proposed methodology does not need a broad sensor availability, since only location information is needed, any type of trajectory can be analyzed and modeled. Our approach is evaluated on synthetic data and real trajectories of pedestrians in an indoor place.
The rest of this article is organized as follows: A description of the agents considered in this work is provided in Section 2. Force model and problem definition are described in Section 3. A hierarchical representation of the environment is explained in Section 4. Results obtained with synthetic and real data are given in Section 5; and Section 6 concludes the article.
2 Agent paradigm
This work proposes a method for identifying and characterizing attractive areas in environments based on observations of cognitive entities that move through them. Accordingly, the present approach assumes that such moving entities can be represented as goal-based agents described in the work of Russell and Norvig Russell2003. Decisions made by such class of agents are based on a cognitive perception of their surroundings combined with a goal to be achieved. As can be seen in the diagram shown in Fig.1
, the agent’s goal plays a fundamental role at the moment of taking a decision.
In this work, agents’ goals are considered to be areas in the environment where agents tend to go. For modeling such areas, it is considered to use a formulation based on social force models. An idea introduced by Helbing and Molnár in Helbing1995 for understanding pedestrian dynamics. Consistently, each main effect described in their work is here contextualized with the final purpose of explaining effects produced by unknown attractive areas in environments.
Helbing and Molnár propose that there are three main effects with which the motion of single pedestrians can be explained: i) Destination to reach: It consists in the shortest path to follow in order to go towards a goal. ii) Influences caused by other pedestrians and barriers: In which they define a repulsive force model for describing the effect that pedestrians exert among others at the moment of avoiding people. They also propose a repulsive model to explain the effect of barriers, such as borders of buildings or obstacles. iii) Temporary attractive effects: They define a model that explains the sudden attractiveness that could be experienced by a pedestrian, it is the case of feeling attraction to other people (friends, street artists, etc.) or going towards static objects such as window displays.
Based on the three main effects described previously for understanding pedestrian dynamics, it is proposed to use the same reasoning to understand goal-based agents dynamics. From this viewpoint, main goals are assumed to be represented as i) Destinations to reach that can be modeled as attractive fields in the environment. ii) Influences caused by other pedestrians and barriers and iii) Temporary attractive effects are proposed to be modeled as noise that deviates agents from their main destinations. Accordingly, the diagram in Fig.2 explains the proposed model to understand the dynamics of moving agents in a scene.
In literature, the majority of works that deal with analysis of trajectories are focused on modeling and learning agents’ motions through time Morris2011; Bastani2016; Andersson2013; Lei2016; Lu2016; Cancela2013. However, in the proposed methodology, since an interaction between agents and the environment is assumed, it is useful to consider an attractive force model for explaining agents’ dynamics. Such model includes information about environment properties that define how moving agents are influenced by static areas in the scene. Accordingly, when an agent’s motion pattern is observed, the understanding of environment static characteristics is enriched.
By considering that dynamics of agents can be seen as the result of external forces acting on them, it is possible to associate such forces with the internal motivations that make agents perform certain actions (movements) Helbing1995 in order to reach a particular destination. From this perspective, each destination point is proposed to be modeled as an attractive area that exerts a force field in the environment.
The methodology proposed in this paper aims at the incremental understanding of attractive effects that static areas exert over moving agents. This work can be seen a method to improve the situation awareness (SA) of an environment by looking at moving entities. Formally, SA is defined as ”the perception of elements within a volume of time and space, the comprehension of their meaning, the explanation of their present (observed) status and the ability to project the same in near future instants.” Bhatt2012. Subsequently, the methodology proposed in this paper increases the SA of environments incrementally as agents’ motions are observed.
As an individual agent model is proposed, the current method aims at the understanding of agents’ surroundings in terms of attractive areas (goals) in cases where interactions with other agents are momentary, i.e., in situations where interactions between individuals can be modeled as a noise parameter. In cases of multi-agent systems composed by a large density of individuals as proposed in Masoud2007, the main goal of agents can be confused with the constant evasion of multiple individuals and the proposed approach would not work properly. Based on that, our method is focused on cases where there is a low density of agents that interact with each other.
3 Force model and problem definition
Taking into consideration a classical mechanics approach, a force is defined as a vectorial quantity that acts on a body to cause a change in its state of motion Wagh2012. Forces can be classified in action-reaction pairs: When bodies, which are in contact, change their momentum Wagh2012 and action-at-a-distance forces: When agents interact without being physically touched hesse2005. Throughout this work, motivations of agents are modeled as action-at-a-distance forces that can be characterized by looking at the motion of individuals.
A force field
is defined as a vector point-function which has the property that at every point of the space takes a particular value related to the magnitude and direction of a force acting on a particle placed there and whose mass is considered as oneTenenbaum2012. Accordingly, moving agents’ dynamics are used to learn the effects produced by force fields in the environment.
A central force field is a particular case of fields where the motion of agents is affected depending on the distance to the location of an attractive/repulsive force source, called center of force. is a unit vector that points in the direction of . Based on that, this article proposes radial force fields for modeling dynamics of agents through time.
For characterizing the effect that an attractive area exerts over moving agents, it is considered the second Newton’s law , where as proposed before. Therefore, it is direct to infer that , i.e., the force exerted by an attractive area in the environment can be measured as the agent’s acceleration at a particular point where it is located.
It is hypothesized that information about the agent’s speed can be inferred through time . Then, it is possible to relate agents’ speeds with their accelerations as can be seen in equation (1):
where and are two consecutive time instants, represents the force magnitude that acts over an agent at time and is an integration constant that represents the agent’s velocity at the instant . By considering a number of spatial dimensions from which trajectories of moving agents are observed, the location of a single agent can be expressed as shown in equation (2):
The velocity field experienced by an agent influenced by a central force field in terms of its location is shown in equation (3):
where it is possible to observe that dependencies of time can be substituted by spatial coordinates . Since force fields are fixed in one location and their influences are assumed to remain equal through time, agents’ dynamics will depend only on their own location .
A switching model is proposed to characterize the velocity fields perceived by agents due to the presence of attractive radial force fields. Based on this, two motion stages are defined: i) When the agent is near to an attractive center of force (near range of interaction) and ii) When the agent is far from it (far range of interaction).
3.1 Near range of interaction
In order to model the way by which moving agents arrive in attractive areas, it is considered a parametric function that describes their velocities depending on the distance to a center of force. The proposed model is based on a top speed from which the agent continuously experiments a deceleration according to a function inspired by the repulsive terms offered by Helbing1995; Helbing2009 and the deceleration factor described on Rudloff2011.
Consistently, for characterizing the arrival of agents in attractive areas, it is proposed a velocity field that defines how their dynamics vary as they approach closer to an attractive area. Two global terms can explain such velocity field, one related to a baseline velocity and other based on a deceleration term, as described in equation (4):
where is defined as the Euclidean distance between an agent and the attractive area in question, such that , where represents the agent’s location and is the unknown position of the attractive area. is an unknown parameter that defines the way in which moving agents decelerate while they approach the center of force . Low values of are associated with abrupt agent decelerations; and high values are related to smooth decrements of speed while agents advance towards . is the top speed from which agents start decelerating until they arrive at the attractive area. defines the final speed that an agent will have when arrives at . In the ideal case , which implies that moving agents reach the attractive point with a null speed. Fig.3 shows the proposed parametric function for approximating velocity fields in a near range of interactions over a two-dimensional plane . For visualization purposes, it is considered , , , , and .
Each velocity field in a near range of interactions can be described by the set of parameters . For estimating each of them, it is proposed an iterative gradient descent method explained in detail on section 4.3.
As can be seen in equation (4), since and are always positive, it is assumed that moving agents decrease their speeds while they approach the attractive areas. Accordingly, the proposed model applies to moving agents that tend to remain on the attractive center of forces, i.e., their speeds tend to be null near it. By taking into consideration the latter assumption, it is possible to define a distance , from which agents start decreasing their velocity at approaching to .
In this sense, the model described in equation (4) is valid for . When distances between agents’ locations and attractive areas are greater than , another model must be proposed to characterize the agents’ dynamics in terms of attractive forces. Under this perspective, the following section introduces a way to model agents’ velocities when they are located at far distances from .
3.2 Far range of interaction
When moving agents are located at a distance
from an attractive area, it is proposed to use a probability density function (PDF) to describe the agents’ velocities until they start reducing their speeds due to a near range of interactions effect previously explained in section3.1. From this viewpoint, the model of a far range of interaction works until agents present a continuous deceleration through time, which indicates they start approximating to an attractive area.
PDFs are proposed to characterize interactions at far distances from attractive centers of force due to their properties for representing stochastic phenomena. It is hypothesized that agents’ velocities at far ranges of interaction can be slightly affected by multiple factors different from the effect of attractive forces in the environment. Nonetheless, at this stage it is assumed a predominant agents’ velocity due to their interactions with an attractive area, i.e., it is assumed a main constant influence on the agents’ velocity due to a particular destination point (goal) that makes them move towards a center of force .
In this work, it is proposed to represent the velocity’s magnitude of an agent localized in as the norm among the velocities experienced in each spatial axis, such that , where represents the agent’s velocity in a single location measured in a far range of interaction. Based on that, the set of all velocities’ magnitudes due to an attractive area in a far range of interaction can be written as:
is the total number of measurements taken in a far range of interaction. Since a main constant velocity is assumed during this stage, it is defined a random variable
that distributes according to the log-normal distributionthat is adjusted based on . Such distribution allows to represent variables that are only defined for positive values and that can be concentrated mainly in one value, as it is the case of velocities’ magnitudes in far range of interactions. From this viewpoint, velocity fields in such stage can be written as shown in equation (5):
as explained before, is a random variable that distributes in accordance a log-normal distribution. After characterizing near and far interactions between agents and an attractive area of the environment, it is possible to define a full effect produced by a particular area , such as shown in equation (6):
Consequently, as different agents move through an environment, a total set of fields can be obtained, where is the number of identified attractive areas that have been characterized inside a scene. From this perspective, each effect can be seen as a letter that is part of a vocabulary which is learned hierarchically as new agents move inside an environment. The next section describes a methodology that aims at the incremental learning of environment properties based on moving agents’ observations.
4 Hierarchical environment representation
The present section explains a methodology by which effects generated by static attractive areas can be modeled as control parameters into an initial Kalman filter (KF) formulation from which effects of interactive areas can be extracted and then modeled into it. It is also shown how trajectories that are globally nonlinear in terms of space can be incrementally grouped into segments in which agents’ dynamics preserve a constant orientation. Each identified segment is here explained by an attractive velocity field whose effect is modeled through the switching formulation described in 3. Finally, it is proposed that each trajectory can be seen as a sequence of attractive areas acting on the moving agents. This process can be considered as the activation of different letters in the environment (each one associated to an attractive area) that gives a semantic representation of activities in the environment.
4.1 Kalman filter modeling
Supposing location measurements of single agents in an environment are defined as for each instant of time and assuming that such measurements are equally time spaced, i.e., remains constant, it is possible to define the agent state vector as its position and velocity at . Accordingly, let measurements and state of agents be related by the expression , where represents a zero-mean normal distributed noise due to errors on the measurements taken at time and is a matrix that maps the actual state space onto the observations .
Since the proposed method aims at the hierarchical learning of agents’ temporally non-linear motions, initially, a random walk model centered on agents’ observations is hypothesized as the most general way to represent unknown dynamical behaviors. Based on this, observations of moving agents that deviate from a random walk model can be used to incrementally explain effects of attractive areas in a particular location from which the deviation was observed.
Dynamics of agents are modeled by a bank of Kalman filters that grows sequentially as new patterns associated with attractive areas in the environment are revealed by looking at agents’ motions through time. Accordingly, equation (7) shows the initial KF dynamical model based on a random walk model from which the bank of filters is built up afterwards.
is a zero-mean normal distribution associated with the random noise of the proposed dynamic model and represents the number of observed dimensions of the environment as shown in equation (2).
Let be the prediction of a KF based on the random walk model described in equation (7) given the updated state estimation at the time , i.e., . It is assumed that significant deviations from the KF’s predictions carry information about effects of unknown attractive areas. Accordingly, when the measurement arrives, it is possible to compute , called innovation of measurement residual, which is defined as shown in equation (8):
where and it is defined as the random walk KF’s prediction. In general, innovations can be seen as a quantity that measures the deviation that a proposed dynamical model presents respecting observations. In the ideal case, the value would tend to zero, which means that the proposed model, based on a random walk dynamics, can explain the observations of agents in the environment correctly. Following this reasoning, in cases where innovations are significantly different from zero, the dynamical model should be modified in order to describe more accurately the observed agents’ dynamics. To do so, it is considered a modification in random walk model, the new model formulation is shown in equation (9):
where a control parameter is introduced in order to obtain innovations that tend to zero. can be seen as a velocity contribution that makes an agent follow certain motion when it is located at the coordinates . is a matrix that maps such velocity contribution into the agent’s state, such that .
Similarly to the random walk model, innovations of the proposed new model are defined as . Accordingly, in order to make , it is proposed to use the innovations produced by the random walk model, , into the control parameter of the proposed new model. By taking into consideration that , it is possible to rewrite the expression of innovations generated by the new model as shown in equation (10):
By substituting the updated state produced by the KF based on the proposed new model with the updated state found with the random walk based model, such that , it is possible to rewrite equation (10) as shown next:
from which it is possible to infer that:
As can be seen in equation (12), the control vector is a velocity quantity related to the effect that attractive forces exert over moving agents in the particular measurement . For this viewpoint, since different agents localized in the same coordinated point can be motivated by different attractive areas, each velocity field effect should be individuated and included into the KFs’ dynamic models that compose the proposed bank of filters as shown (13):
where , is the indexation of each potential attractive area and corresponds to the dynamical model associated to each of them. In this sense, each represents a new KF model built from the innovations produced by the random walk model described in (7). At the moment of defining an attractive model , information about innovations generated by the previously characterized set of dynamical models
should be taken into consideration in order to merge similar velocity field models. In this work, a merging process of similar velocity fields is considered as a post processing step and a classic k-means algorithm is used to group similar fields. From this viewpoint, the proposed bank of KFs is created incrementally by observing deviations from a reference random walk model. Each learned new model includes information about attractive properties of the environment.
In order to relate the proposed attractive field described in equation (6) to the control inputs , it is necessary to identify parts on a trajectory in which velocity effects produced by radial attractive force fields are valid. For this purpose, it is considered a method for segmenting trajectories explained in section 4.2.
4.2 Trajectory segmentation
Since it is hypothesized that movements of agents are produced by static areas that exert radial attractive force fields, it is expected that trajectories performed by agents are spatially quasilinear and pointing every time at the direction of a main attractive area. Nevertheless, in real cases, motions of agents do not have the same orientation in every moment. However, they can be divided into quasilinear segments on which the assumption of interactions with attractive radial fields is valid.
The possibility of dividing a trajectory into quasilinear segments can be associated with the presence of multiple motivations that an agent follows as time evolves. In other words, a moving agent can be attracted by multiple areas that can be seen as dynamical motivations that change in time as the agent moves through the environment reaching multiple goals. An example of this behavior can be clearly identified in airplane trajectories, where aircrafts perform different approaches to intermediate points during a flight. Fig.4 depicts an example of such behavior for a commercial flight that goes from Amsterdam to Brussels on a Latitude-Longitude plane.
In Fig.4, spatial quasilinear segments in the trajectory are identified with different colors. Red crosses show the points in which transitions between different quasilinear segments take place. Accordingly, from Fig.4, it is possible to see how multiple quasilinear paths can explain a single trajectory in terms of spatial transitions. Accordingly, each segment identified in Fig.4 is proposed to be explained by an attractive area that exerts a radial force field over the environment.
Angles produced by the estimated velocities are used in order to segment the trajectory into quasilinear motions in an online way. Since the control vector can be seen as the agent’s velocity due to the interaction with external forces when at observing , the orientation of this vector can be used as a measurement of alignment with attractive centers of force. If an agent is approaching to an attractive area in the environment, it is expected that orientations of do not change significantly through time. Based on this, it is proposed to define a window time in which directions of velocities remain stable. Let be the windowed version of the velocities such that:
where is the number of samples that fit in an interval of time . Once a number of velocities is obtained, the window data is used to approximate the parameters of a von Mises distribution and . This distribution is selected due to its properties of representing the direction of entities in a probabilistic way, represents distribution’s mean and
is analogous to the variance in a normal distribution.
Defining and as the estimated parameters of the von Mises distribution based on the window data , it is proposed a deviation angle from which it is possible to distinguish when an agent moving aligned to a particular attractive area. Accordingly, when an accumulated probability higher than is obtained in the range , it is hypothesized that the agent is attracted to an area. Velocity contributions calculated in following times, i.e., from onwards are compared with the current von Mises distribution through a Mahalanobis distance Mahalanobis1936, in order to evaluate whether it belongs to the previously estimated distribution of if it is necessary to hypothesize a new one. For doing so, a distance limit is introduced, such that if a number of velocities contributions produce a distance , the process is reinitialized with a new window , where is the minimum window size together with the following velocity contributions that were classified as part of the von Mises distribution estimated from the window .
In this work, each quasilinear segment, indexed with the letter , is associated with the presence of an attractive area in the environment, see equation (13). Accordingly, once a segment is detected, a velocity field approximation is iteratively performed based on an attractive force hypothesis. Algorithm 1 describes the proposed sequential process for identifying quasilinear motions in agents’ dynamics and approximating velocity fields from them.
Some algorithms for segmenting signals into linear components and reconstruction of trajectories were identified. However, for the particular problem addressed in this work, where moving agents are influenced by a main goal, information about the direction and magnitude of their velocities should be taken into consideration to make a correct segmentation in terms of attractive forces. The number of segments identified with this approach corresponds to the quantity of potential attractive areas in the environment. A list of the principal characteristics of identified algorithms for piecewise linear segmentation and reconstruction of trajectories are compared with the current proposal in table 1.
|Method used in||
|Input features||Error measure||Output|
|Data points series||
|Data points series||
|Identification of events|
|Data points series||
|Data points series||
From table 1, it can be seen that the proposed method presents the advantage of being online. additionally, it uses the dynamics of agents as inputs for performing the segmentation process. Since produced segments are assigned to central force fields, the agents’ velocity angles result to be an important feature for detecting alignment with goals that agents desire to reach by taking the shortest possible path.
It is possible to see from algorithm 1 that the final result of the proposed method consists of a set of velocity fields related to attractive areas identified by quasilinear segments in the agents’ motions. Accordingly, as a segment grows in time, an iterative estimation of the velocity field’s characteristics is performed based on the model described in sections 3.1 and 3.2. Section 4.3 explains in detail how this process is performed as new agents’ observations are obtained.
4.3 Learning of environment properties
Let the pair of vectors be the agent’s observations with their respective control vectors obtained by the KF based on the random walk model proposed in equation (7). Additionally, suppose that are acquired incrementally such that algorithm 1 is applied as new observations arrive such that are vectors that belong to a particular segment , i.e., they are produced due to an unique attractor.
Since parameters are related to velocity components that deviate agents from a random walk behavior, it is proposed to use them in order to fit the velocity field model presented in equation (6). Accordingly, for distinguishing between far and near ranges of interaction, magnitudes of are analyzed through consecutive time instants, such that: If values decrease continuously in a range of time , the moving agent is assumed to be in a near range of interaction, proposed in equation (4). For this case, its measurements and control vectors will be labeled as . Otherwise, the moving agent is assumed to follow the far range of interaction model described in equation (5), in such case, its measurements and control vectors will be labeled as .
In order to characterize the velocity field in a far range of interaction associated to a segment , the magnitudes are used to estimate the random variable , such as proposed in equation (5).
Estimating the center of force in a far range of interaction is not possible since there is not conclusive information about velocity decrements. Nonetheless, it is feasible to determine a line on which the center of force belongs. Such line is defined from the last observation and has a slope determined by the mean of .
are used to estimate the unknown parameters in equation (4) for a particular attractive area . The measurement and control input from which next values start decreasing are labeled as . The magnitude of is taken as an estimation of to the term of equation (4), such that . Additionally, it is assumed , such that moving agents tend to remain on the attractive center of force when they arrive in it. Then, an iterative gradient descent is proposed to minimize the error between magnitudes and the proposed velocity field formulation of equation (4) based on the sparse space representation of the observed data .
Accordingly, the function to optimize is the mean square error between and the proposed velocity field function described in (4) with the fixed values of and . By assuming a total number of measurements with their control inputs identified in a near attractive range of interaction for an area , i.e., with from 1 to , the function to optimize is shown in equation (14):
Since is a differentiable function respecting the parameters and , a classical gradient descent algorithm is performed by taking the partial derivative of the function respecting each of them. Both expressions are shown in equation (15):
As a moving agent is approaching an attractive center of force, the number of measurements identified in a near range of interaction will increase as more vectors are available. In other words, each time that increases, new estimations and made by gradient descent process are obtained. Supposing that a total number of estimations of and have been obtained by the multiple computations of the gradient descent method, it is proposed to fuse all of them for a given segment , i.e., where goes from to , by performing a weighted average over the estimations such as shown in equation (16):
where is a weight related to the number of samples with which the gradient descent was executed in the iteration . Each is normalized respecting the maximum number of samples with which the gradient descent have been performed. is a weight related to the error obtained on each iteration at estimating the properties of the attractor associated to the segment . values are normalized respecting the lowest error obtained.
The pair of parameters obtained by applying equation (16), is the final estimation of the velocity field parameters [,] related to the effects of an attractive area based on the segment . represents the estimated location of the attractive center of force associated to based the segment and encodes information about the shape of its effect in the environment.
By replacing the vector of parameters’ estimations in equation (4), it is possible to obtain an expression that explains the effect of an attractive area in a near range interactions, such that, . Similarly, for a far range of interaction, it is possible to write . Consequently, a final estimation of attractive effects can be defined as:
where represents the distance from which agents start decreasing their velocities at approaching the attractor and is the distance between an agent and its center of force. Estimated velocity fields can be used to rewrite equation (13) in terms of the proposed parametric function such as shown next:
As explained before, the purpose of this paper is to estimate the velocity fields generated by attractive areas in environments. From equation (17), it is possible to see that a bank of filters composed of the effects of attractive fields related to each segment is obtained by applying the proposed methodology. From this viewpoint, each KF dynamical model can be seen as a letter that is learned on the fly as patterns in agents’ motions are detected. Consequently, as multiple letters are observed and characterized, it is possible to build a vocabulary in terms of learned environment properties. In the next section, some results at modeling such properties in synthetic and real trajectories are shown and discussed.
The proposed method was tested in two different scenarios: i) Synthetic data, in which an environment with different attractive areas is proposed and whose characteristics are inferred based on agents that move towards different goals. ii) Pedestrian dataset, where dynamics of people moving through an indoor place are analyzed and attractive points in the environment are identified.
5.1 Synthetic data
In order to validate the proposed method, a simulated scenario in which moving agents are motivated by different attractive zones is considered. Three radial attractors that influence moving agents are proposed as shown in Fig.5.
It is proposed that agents interact with at least one attractor before they reach their final destination. In this sense, situations in which agents change dynamically their destinations (goals) are simulated and analyzed in an online way. This simulation assumes that agents always start moving from a random side of the environment such as shown in Fig.5
. Noise from a uniform distributionis considered in order to affect the motion of agents in directions and . The value of is selected according to the speed that agents present each instant of time, such that it is adjusted to a specific signal-to-noise ratio , where is the velocity exhibited by an agent in a location . Attractive areas’ effects are simulated according to the formulation shown in equation (4) with . The selected values of the parameters for each attractor are shown in the first column of table 2.
It was considered a total of 150 trajectories that start randomly from one side of the environment and whose final/intermediate(s) points of attraction are also selected at random. The proposed method was applied to the trajectories in order to recognize attractive effects in the environment.
By taking the estimations of attractive centers of force generated by agents that behave according to a near range of interaction explained in 3.1. It is possible to obtain a map with different locations of attractive points such as shown in Fig.6. As can been seen, similar centers of force can be clustered by using a classic k-means algorithm in order to identify attractive areas in the scene that combine information of similar attractors’ estimations.
From Fig.6, it can be seen that each identified cluster corresponds to an attractive zone. Crosses are calculated by taking the average position of all the velocity fields that belong to a particular cluster. Similarly, the average of and components of velocity fields is taken in order to characterize the properties of each merged attractor.
Attractors resulting from the clustering process can be seen as letters that conform a vocabulary that characterizes the environment. Accordingly, the parameters associated with each letter can be expressed as shown in equation (18):
where indexes each identified cluster composed by similar estimated fields that in turn are indexed as . represents the estimated parameters coming from a segment and relabeled according to the clusters (letters) reached with the k-means algorithm.
In order to evaluate the algorithm performance, it is possible compare the parameters estimated for each merged attractor with the respective ground truth values. Accordingly, table 2 shows the values estimated at different SNRs for each attractor.
From table 2, it can be seen that estimations of centers of force locations are not affected drastically at the presence of noise. However, it is observed a significant change in the estimations and when SNR is close to 1. Such behavior indicates that at low SNRs the main direction of trajectories is preserved but the magnitudes of their velocities are significantly affected.
In order to illustrate how the overall performance in the estimation of at different SNRs, it is proposed to take the following expression shown in equation (19):
and index the attractive zones and the different SNRs respectively. The total number of attractors and SNRs are represented with and . represents the ground truth of the parameters that define the attractor . is the estimation of attractive parameters related to an attractor at a specific SNR .
By taking the normalized error expressed in equation (19), it is possible to obtain the performance results shown in Fig.7 for different signal-to-noise ratios. Variances produced by estimations of the three attractive zones are plotted as error bars for each SNR case.
From results obtained with simulated data, it is possible to see that the proposed approach recognizes and characterizes radial attractive fields with different intensities and shapes at several SNR values by looking at the motion of individuals. Additionally, the proposed method does not need a large number of data vectors and parameterizes areas according to a known function. This represents a an advantage in comparison with our previous approach Damian2016 that needs trajectories all around the environment for estimating correctly the effects of force fields in environments. For validating our method on real data, it is proposed to analyze a dataset composed by pedestrians’ trajectories in an indoor environment.
5.2 Pedestrian dataset
The dataset proposed by Yi in Yi2015 was used to test our approach. The database is composed by 12,684 pedestrian trajectories in an indoor place where each individual is manually labeled from a one-hour crowd surveillance video. In their work, they identify 10 zones that act as source/destination points for pedestrians and it is manually labeled in Fig.8, as can be seen, an 11th zone is introduced as the center point of the scene that is hypothesized to be an attractor for some pedestrians that interact with it. Consequently, the plot shown in Fig.8 can be seen as a map of attractors in the scene. By using our approach, it is expected to identify those points in terms of their location and the effect they produce on moving pedestrians.
By grouping similar estimations of attractive centers of force generated by pedestrians that behave according to a near range of interaction, it is possible to obtain a map of the attractive zones’ locations such as shown in Fig.9. Similar to the case of synthetic data, parameters that belong to the same attractive zone are averaged based on equation (18) to obtain the parametrization of each merged version of attractive fields in the scenario. Estimations of attractive zones’ locations are depicted as red crosses on Fig.9.
In order to visualize the presence and effect of each attractive zone, it is proposed a map that is shown in Fig.10. Areas with null values (blue colors) represent the absence of attractive fields. Zones with larger values (red colors) represent the presence of attractors that where agents feel more attracted in terms of intensity. The shape of fields are visualized as the radius around each center of force (black cross) until the color map becomes totally blue. Consistently, the larger such radius is, the near range of interaction effect becomes broader, i.e., a larger period of deceleration is detected.
Results obtained in this database demonstrate that from the dynamics of moving agents it is possible to infer the locations and characteristics of attractive areas. Particularly, qualitative results can be seen by comparing our approximation of attractive centers of force shown in Fig.10 with the zones manually labeled by Yi2015 and depicted in Fig.8. It can be seen that zones labeled as in Fig.10 correspond respectively to the labels in Fig.8.
Since there is not a ground truth available to verify the intensity or shape of attractors associated to and values respectively, the only comparison that can be done it is terms of centers of force localizations between Fig.8 and Fig.10 as proposed before.
Additionally, it was identified the area labeled with letter corresponds to an effect of a queue that pedestrians follow through the video. Zones identified as and are related to pedestrians’ interactions with the central object of the scene. Both, queue and object’s effect are illustrated in Fig.11. According to that, it is demonstrated that the proposed methodology is capable of recognizing effects derived from contextual situations in the environment by looking at movements of dynamical agents through time.
A method for characterizing attractive forces in statical environments based on movements of agents is proposed. To do that, it is put forward a methodology based on the minimization of innovations from a Kalman filter based on a random walk model. Innovations from this model are used in order to the explain external effects that affect agents’ motions. Information that encodes properties of the environment effects on agents is proposed to be added as a control input into the initial random walk formulation.
An incremental learning of environment properties is considered. Characteristics of attractive zones around observed agents are learned on the fly. A method for individuating attractive fields effect based on radial force hypothesis is proposed based on a quasilinear segmentation of the agents’ dynamics. An iterative method that approximates velocity fields produced by attractive zones is proposed when only information about agents’ dynamics is available.
Obtained maps can be used to perform further analysis by following a semantic approach where each characterized attractive area (letter) can be considered as part of a vocabulary, if activation sequences of attractive areas are detected with the proposed bank of filters, it would be possible to extract information about situations in an environment.
For future work, it is proposed to adopt a semantic representation of learned static areas properties, such that more complex interactions between agents and environments can be characterized by applying the built bank of filters based on attractive effects to new trajectories. For this approach, it is planned to using the innovations with their covariance matrices produced by the built bank of filters to characterize repulsive effects in environments.
7 Competing interests
The authors declare that they have no competing interests of any type.
This work was partially developed within the MIE (Mobilità Intelligente Ecosostenibile) project, co-funded by the Italian Ministry of University and Research for the National Technological Cluster for the Smart Communities.
9 Authors’ contributions
All the authors have participated in writing the manuscript and have revised the final version. All authors read and approved the final manuscript.