## 3 Materials and Methods
### Regional Topic Model and Its Online Inference Algorithm
Meanwhile, because of the samples number difference between different regions, the abnormal events probabilities of the region including few samples is lower, so we add a sample number weight for each region. We regard the five most regions of r_NLL value as the most possible abnormal events regions. Furthermore, we utilize receiver operating characteristic curve (ROC) and AUC (area under ROC) to evaluate the abnormal detecting performance of our model, which are independent of threshold selection. Obviously, for ROC, the closer to the top left corner, the performance of abnormal detection is better. Similarly, the closer to 1 the AUC value is, the better the performance of abnormal detection. The running platform of experiment is shown in Table 1.

### Datasets and Parameter Settings

In order to get the comprehensive evaluation of our model and its inference algorithm, we analyze the performance based on two types of dataset. The first one is a simulation video dataset constructed by specific steps, and the second one is a real video dataset. \begin{table}
\begin{tabular}{l l} \hline \hline CPU & Intel\({}^{\text{\tiny\textregistered}}\) Core(TM) 2 Duo CPU E8400 @ 3.00 GHz 3.00 GHz \\ Memory & 2.00 G \\ OS & Window7 \\ Programing platform & Python 2.7.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Software and hardware platform. #### 4.2.1 Simulation Video Dataset

We make a simulation video dataset for simulating the traffic intersection. Each image of a frame was divided into a 6 by 6 grid (a total of 36 positions) and five valid regions (including the sides of up, middle, down, right, and left). Meanwhile, each valid region is composed by 4 grids, that there are in total of \(4\times 5=20\) locations to simulate one center and four directions of traffic intersection, as shown in Figure 3.

In Figure 3, white texts represent the valid region number \(r\in\{0,1,2,3,4\}\), and red texts represent the valid location number \(i\in\{0,\dots,19\}\). Four directions are represented as down (green), left (blue), up (purple) and right (red), whose number is \(\omega\in\{0,1,2,3\}\). Then, the number of locations is \(I=20\), and the number of motion directions is \(\Omega=4\). \((i,\omega)\) is used to denote a motion word, where \(i\in\{0,\dots,I-1\}\),\(\omega\in\{0,\dots,\Omega-1\}\), and the number of motion words is \(W=I\times\Omega=80\). The latent motion topic is constructed by combining region number \(r\) and direction number \(\omega\). Regarding \((i\in r=0,\omega=0)\) as an instance, it means that one location of region 0(that location number is one of \(\{0,1,2,3\}\)) is moving in direction 0(down). Then, normal and abnormal motions are able to be constructed by above way. There are five kinds of normal motion states and two kinds of abnormal motion states. The generative algorithm of simulation video is described below:

Generate an initial motion direction \(\omega\) randomly. Choose a motion topic, where the probability of abnormal motion topic is 5%, and the probability of abnormal motion topic is 95%. Generate 100 samples by

Based on the chosen motion topic, choose a motion state randomly. Based on the chosen motion state, generate an observed sample \((\omega^{\prime},\ i^{\prime})\) randomly. Figure 4 shows the generated training set and test set by above steps. The color of arrow represents the direction, and the brightness represents the probability in motion topic. Figure 4: Generated simulation datasets. (**a**) Training set. (**b**) Test set. Figure 3: Directions and regions of simulation video

#### 4.2.2 Real Video Dataset

We use the QMUL street intersection dataset [41] for evaluating abnormality detection performance of this model. This standard video is 50 min in length, frame rates are 30 fps, resolution is 360 \(\times\) 288, and there are 90,000 frames. Video codec is mpeg-4 compression encoding. The whole traffic light cycle is about 1.5 min; the average duration of abnormal event is 4.3 s (129 frames).