# Efficient Crowd Anomaly Detection Using Sparse Feature Tracking and Neural Network
## 3 Materials and Methods
### Crowd Representation and Behaviour Descriptors
#### 3.1.4 Visual Descriptors  
A wide array of visual descriptors is extracted to depict various crowd characteristics, which are subsequently used for the analysis. These descriptors encapsulate diverse crowd-related semantic data, capturing the spatial and temporal aspects of the scene. By concurrently considering both individual and interactive properties, a comprehensive analysis of the crowd is enabled. The suggested visual descriptors are divided into individual behaviour descriptors and interactive descriptors. The individual behaviour descriptors exploit temporal features like tracklets and motion vectors, while the interactive descriptors integrate spatial features. 1. Individual Behaviours In order to scrutinise individual actions within the crowd, we utilise two descriptors that are specifically tailored towards capturing dynamics at the individual level. Descriptors like flow directions and velocity offer insights into various aspects of individual behaviour, thereby enabling the greater comprehension of crowd interactions and movement. 2. Flow Direction This descriptor characterises individual behaviours in terms of the motion direction, distinguishing between smooth and chaotic motions by capturing variations in tracklets' directions [37]. This is achieved by utilising the complete history of each trajectory, which is divided into \(F\) segments \(\left\{S_{i}^{k},S_{i}^{k-\tau_{2}},\ldots,S_{i}^{k-(F-1)\tau_{2}}\right\}\), enabling a detailed analysis of directional changes over time. Following this, the variation in flow direction \(D^{\text{var}}\left(V_{i}^{k}\right)\) is determined by calculating the average of the angular differences across all trajectory segments, as given in Equation (7). This calculation provides insights into the changes in the flow direction throughout the trajectory. \[D^{\text{var}}\left(V_{i}^{k}\right)=\frac{1}{F}\cdot\sum_{f=0}^{F-2}d_{\theta} \left(S_{i}^{K-f\tau_{2}},s_{i}^{k-(f+1)\tau_{2}}\right) \tag{7}\]  
where \(S_{i}^{j}=\overrightarrow{v_{I_{1}^{j-2}V|i^{j}}}\), and \(\tau_{2}\). \(F=\left\lfloor\left(\Delta t_{i}^{k}/\tau_{2}\right)\right\rfloor\), and \(d\theta\) is defined for vectors and b as in Equation (8),  
\[d_{\theta}(a,b)=\Delta_{\theta}\Big{(}\big{|}\theta_{(a)}-\theta_{(b)}\big{|} \Big{)} \tag{8}\]  
with \(\theta_{(a)}\) representing the angle between the vector \(a\) and the \(x\)-axis, \(\Delta_{\theta}(a)=\left\{ \begin{array}{c}a,\text{ if }a<\pi\\ 2\pi-a,\text{ otherwise.}\end{array} \right.\)
* Velocity The velocity of individuals is computed using the motion vectors as defined in Equation (4). To ensure accuracy, the motion vectors from the most recent frame history are considered, specifically those that exceed a predefined threshold for acceleration and velocity. By identifying these informative motion vectors, the velocity can be determined by dividing the vector norm by the total number of frames, as given in Equation (9). \[D^{\text{veloco}}\left(V_{i}^{k}\right)=\frac{1}{\tau_{1}}\cdot\left\lVert \overrightarrow{V_{i}^{k-\tau_{1}}V_{i}^{k}}\right\rVert_{2}\] (9)  
To optimise the computational efficiency, the Euclidean distance is calculated between each motion vector's origin and current position, rather than summing the distances across fragments [37]. Empirical evidence indicates that both methods yield equivalent results, validating our decision to use the more computationally efficient method. It is worth noting that the descriptor parameter is adapted based on the video's frame rate. This adaptation effectively compensates for perspective distortions within and between videos by incorporating perspective map weights into the motion vector's norm. The velocity descriptor plays a vital role in capturing individuals' speed, proving particularly valuable in scenarios where individuals exhibit variations in their speed due to factors such as danger or urgency. 2. Interactive Behaviours Besides individual behaviour descriptors, we highlight the significance of integrating interactive descriptors for a comprehensive analysis.