Analysis of moving cluster with scene constraints for group behavior pattern mining

Group behavior pattern mining in traffic scenarios is a challenging problem due to group variability and behavioral regionality. Most methods are either based on trajectory data stored in static databases regardless of the variability of group members or do not consider the influence of scene structures on behaviors. However, in traffic scenarios, information about group members may change over time, and objects' motions show regional characteristics owing to scene structures. To address these issues, we present a general framework of a moving cluster with scene constraints (MCSC) discovery consisting of semantic region segmentation, mapping, and an MCSC decision. In the first phase, a hidden Markov chain is adopted to model the evolution of behaviors along a video clip sequence, and a Markov topic model is proposed for semantic region analysis. During the mapping procedure, to generate snapshot clusters, moving objects are mapped into the corresponding sets of moving objects according to the semantic regions where they are located at each timestamp. In the MCSC decision phase, a candidate MCSC recognition algorithm and screening algorithm are designed to incrementally identify and output MCSCs. The effectiveness of the proposed approach is verified by experiments carried out using public road traffic data.


Introduction
With the development of computer vision and network technology, the intelligent video surveillance system has become an important part of an intelligent transportation system (ITS). Video sensor nodes enable the timely and accurate capture of the visual appearance of moving objects, and the extraction of information about them, such as through object detection, tracking, and behavior analysis. The research focus of intelligent video surveillance is shifting to the understanding of behavior patterns extracted from traffic video data using machine learning methods, which has attracted attention in the field of computer vision [1].
Current research on behavior understanding includes the steps of establishing behavior models from training samples and matching test samples with established models [2,3], where typical behavior models are obtained by clustering trajectory data. In traffic monitoring scenarios, combined with scene knowledge, semantic interpretation of behaviors can be given, such as heading straight, turning left, turning right, making a U-turn, reverse driving, and illegal lane changing [4][5][6][7]. These are classified as individual patterns (regular patterns of an individual) according to the granularity of trajectory patterns [8]. Individual behaviors are identified by matching with established behavior models, whose training samples generally come from static datasets, which cannot reflect real-time patterns of behavior and incrementally output results.
The discovery of group behavior patterns differs fundamentally in that the patterns of discovery follow a given notion of common patterns of different objects. These can be exploited to describe traffic scenarios in real time, answer group behavior questions such as ''when and where do the aggregation and segregation of objects' movements?'' and ''what are the traffic behavior rules in scenarios at the current time?'' Through the identification of these group behavior patterns, the rules and trends of group movements and the occurrence of various mass incidents can be more effectively reflected, so as to better manage traffic infrastructure. However, these problems cannot be resolved by extracting individual patterns.
Studies have been proposed to discover group patterns [9][10][11][12][13][14][15][16][17][18], whose common point, such as a group [9], flock [10], convoy [11], swarm [12], traveling companion [13], or loose traveling companion [14], is that the objects' groups are required to contain the same collection of moving objects. However, this does not always conform to the actual situation. In a monitoring scene, within a certain time interval, the set of objects continually changes as they enter or exit. In addition, due to regional characteristics shown by group behavior patterns (such as convergence and divergence), moving objects may pass through different combinations of semantic regions, which correspond to different behavior categories. The sets of moving objects within these clusters change over time, while a trajectory cluster has a constant set of objects regardless of their temporal information. It is critical that all the objects' motions are constrained by scene structures. Based on this, we define moving clusters with scene constraints (MCSCs), where two consecutive snapshot clusters share many common objects. Hence, the above group patterns [9][10][11][12][13][14] are unsuitable to model an MCSC.
Other kinds of group patterns also exist, such as the moving cluster [15], gathering [16,17], or evolving convoy [18], which have no strict requirements that objects' groups contain the same moving objects, allowing members to leave a group during its life cycle, while new members can join it. To retrieve these group patterns, density-based clustering algorithms such as DBSCAN [19] and OPTICS [20] are adopted to cluster moving objects at each timestamp. However, in traffic monitoring scenarios, moving behaviors of vehicles are related to semantic regions passing by, but not to vehicle density. Density-based clustering algorithms have difficulty identifying group movements of vehicles.
Existing methods cannot effectively support the discovery of MCSCs, because of challenges including the following: (1) Group variability: The membership information of MCSCs may change over time. However, many state-of-the-art trajectory-based approaches and group discovery methods require the group to contain a constant set of objects, ignoring changes in group membership; (2) Behavioral regionality: Due to scene structures, objects' motions in the same semantic region have similar semantic interpretations. However, clusters identified by density-based clustering algorithms, which are adopted by most group discovery methods at each timestamp, do not always consist of objects in the same semantic region. Therefore, they cannot be directly used for MCSC discovery; (3) Incremental discovery: To describe traffic scenarios and answer group behavior problems in real time, MCSCs should be reported incrementally, i.e., the discovery algorithm should output the results while processing the trajectory data flow.
We propose a framework to extract meaningful group behavior patterns from traffic video data. Using a hidden Markov chain to model the evolution of behaviors along a video clip sequence, the Markov topic model (MTM) learns the distribution of topics and maps the learned topics to semantic regions in a scene. Under our framework, video clips are treated as documents, and trajectory points (positions and moving directions) of moving objects as motion words. Topics model semantic regions, which correspond to common paths, are taken by objects in a scene. At each timestamp, instead of clustering moving objects using density-based clustering algorithms, moving objects passing through the same semantic region are mapped to the corresponding moving object sets to generate snapshot clusters, which is more consistent with the actual movement situation of vehicles in traffic scenarios. In the MCSC decision phase, at each timestamp, lists of candidate MCSCs are constructed by a candidate MCSC recognition algorithm, and MCSCs in the candidate lists are identified and output incrementally by a screening algorithm, which effectively reduces the number of redundant MCSCs.
The remainder of this paper is organized as follows. Section 2 discusses related work, and Sect. 3 states the problem of MCSCs in traffic scenarios. A Markov topic model is introduced for semantic region analysis in Sect. 4. Section 5 describes discovery algorithms of MCSC patterns. Section 6 presents our experimental results, and we discuss our conclusions and suggest future work in Sect. 7.

Behavior understanding based on trajectory analysis
Trajectory analysis is the most popular method for vehicle behavior understanding in traffic video surveillance. After constructing a trajectory similarity/distance matrix based on the computed similarity/distance between trajectories, clustering algorithms such as spectral clustering [21,22], fuzzy C-means [23], and agglomerative hierarchical clustering [24] can be used to group the objects' motion trajectories into different behavior categories. Such unsupervised trajectory pattern classification methods have been extensively used. Other learning methods of trajectory patterns do not need to calculate pairwise similarities between trajectories. GMMs [25], HMMs [26], and selforganizing neural networks [27,28] can also be used to model the trajectory distribution patterns of moving objects for atypical event recognition and behavior prediction. The above methods model behaviors with the whole trajectory. However, they may ignore common sub-trajectories that are useful in many applications. Lee et al. [29] proposed a partition-and-group framework that partitions a trajectory into a set of line segments according to the minimum description length (MDL) principle and clusters them using a density-based line-segment clustering algorithm to discover the common sub-trajectories. However, the presented trajectory clustering algorithm TRACLUS is sensitive to the input parameters e and MinLns, and the trajectory data model ignores the time dimension. Piciarelli et al. [30] proposed a tree-like structure to represent trajectories as a tree of clusters, during whose creation the trajectories are divided into sub-trajectories due to splits. Sub-trajectories are clustered to generate path regions with semantically similar descriptions. A path, represented by all pixels covered by objects with the same behavior cluster along their course, is conceptually related to the proposed semantic region, which is defined as a subset of a path [31]. However, the tree-like structure does not inherently provide a probabilistic interpretation for behavior analysis, and it cannot handle group moving behaviors.

Learning behavior with topic models
Behaviors are closely related to scene structures, since objects' motions are constrained by them. Wang et al. [31] employed dual-HDP to segment semantic regions, which correspond to the common paths taken by objects in a scene, for activity analysis from trajectories. Li et al. [32][33][34] segmented monitoring scenarios into multiple semantic regions according to the distribution of low-level atomic video events, where scene segmentation was regarded as an image segmentation problem. The object was for behaviors in each segmented semantic region to have similar characteristics and to be represented by some kind of atomic video events. Zhou et al. [35] proposed a random field topic (RFT) model including sources and sinks as high-level semantic priors to learn semantic regions from tracklets (fragments of trajectories). Similar to Wang et al. [31], these semantic regions corresponded to common paths taken by objects, whose motions in the same semantic region have similar semantic interpretations.
Traffic scenarios include many kinds of behaviors that evolve according to a certain temporal order of traffic flow. The topic model itself ignores the time factor and cannot model the temporal relationships between behaviors. We use a hidden Markov chain to model the temporal correlation between behaviors and propose an MTM to model semantic regions to generate snapshot clusters.

Problem statement
Let T ¼ t 1 ; t 2 ; . . .; t n f gbe the set of all timestamps, and O ¼ o 1 ; o 2 ; . . .; o m f gthe set of all moving objects that have moved during T in the database. Moving object o j has its own lifetime T o j from entering to leaving the scene. A snapshot S i of T is a subset of O, which is located at t i . The concept of a snapshot is employed as the projection of moving objects' spatial information at one timestamp. The regularity of objects' motions can be reflected by the concurrence of trajectories of the same category (similar moving directions and adjacent spatial positions) in the spatial regions. Such regions are defined as semantic regions.
Let C ¼ C 1 ; C 2 ; . . .; C K È É be the set of the learned semantic regions in the monitoring scene, which is viewed as the set of general classes. K represents the number of semantic regions. Then, at each timestamp, moving objects are mapped to a certain general class according to the semantic regions in which they are located. Ultimately, the set of snapshot clusters Þ is a snapshot cluster at timestamp t i and m is the total number of moving objects.
An MCSC is a sequence of snapshot clusters at consecutive timestamps, whose definition can be generalized as follows.
Á be a sequence of snapshot clusters, C q t i the snapshot cluster at the next timestamp of C p t iÀ1 , and h the coincidence rate threshold. If q j w KÞ, the sequence of snapshot clusters g is defined as an MCSC. Figure 1 shows an example of an MCSC. There are three semantic regions in a monitoring scene, and their spatial locations and shapes remain constant at each timestamp. Let t 1 , t 2 , and t 3 be three consecutive timestamps. At each timestamp is a set of snapshot clusters corresponding to the set of general classes mapped to the semantic regions in the scene, and o t 1 j , o t 2 j , and o t 3 j are the representations of moving object o j at these timestamps. Note that object o 7 enters the scene at timestamp t 2 and object o 5 leaves the scene at t 3 . In other words, the membership information of MCSCs may change over time.
Let h ¼ 1 4 Semantic scene modeling using markov topic model

Markov topic model
In our method, a video is segmented into non-overlapping clips with equal frame length N f , whose value is between 100 and 300, depending on the nature of the traffic scene. We treat a video clip as a document, and the trajectory points of moving objects as motion words. Each video clip is mapped to a motion word bag and embodies a kind of behavior pattern. Finally, the video sample is represented by a behavior sequence (motion word package sequence). Because the topic model itself ignores the temporal relationship between words, it cannot model the temporal correlation between behaviors. We incorporate a hidden Markov chain to model these and propose an MTM to model a video clip sequence as a Markov chain of behaviors. Figure 2 shows the graphical representation of an MTM. Let M traffic videos constitute a video set Þis divided into t-segment video clips, and each video clip v t shows a specific kind of behavior, y t .
We model the behavior sequence y t f g T t¼1 as a Markov chain, and the behavior y t evolves along the sequence direction of the video clip sequence according to a multinomial distribution, The behavior pattern Y j of video V j is a behavior sequence composed of video clip behavior y t , All of the trajectory points of moving objects in each video clip v t are encoded, and a video clip is represented as a word bag containing N motion words, where w t is the set of motion words w t;i contained in v t , Each video clip is represented by a random mixture distribution over K latent topics (semantic regions). Each topic in video clip v t is essentially a distribution of trajectory points that constitute the semantic regions in the scene. The mixed ratio h t of various topics is determined by the Dirichlet parameter a as The mixed ratio h t is the multinomial distribution of topics in the video clip v t , and the topic z t;i is determined by the parameter h t as The motion word w t;i in video clip v t is determined by The generative process of the MTM is described as follows: 1. For each latent topic z 2 1; 2; . . .; k; . . .K, draw discrete distributions u k of motion words from a Dirichlet prior b, and construct K Â L dimensional matrix u $ Dirichlet b ð Þ; 2. For each video V j , j 2 1; 2; . . .; M, draw discrete distributions g of behavior types from Dirichlet prior c: g $ Dirichlet c ð Þ; 3. Generate any video clip v t in video V j as follows: a. Sample the corresponding behavior type y t $ multinominal g y tÀ1 À Á ; b. Draw discrete distribution h t of topics from a Dirichlet prior, a: h t $ Dirichlet a ð Þ; c. Generate motion word w t;i in video clip v t as follows: i.
Draw the corresponding topic z t;i : The number L of basic motion words in the dictionary and the number K of topics are predetermined. The conditional probability p w t;i jz t;i ; u À Á is calculated by the matrix u of dimension KL, where u ij is the generating probability of motion word w j under the condition of the current known topic type z i , i.e., Given a, c, and b, the joint distribution of topic mixture parameter h, motion word mixture parameter u, behavior mixture parameter g, behavior type y t , topics z t ¼ z t;i È É , and motion words where N j is the number of motion words in video clip v t .

Model learning
We adopt Gibbs sampling based on the Markov chain Monte Carlo method to estimate the parameters of MTM. Due to the Dirichlet-multinomial conjugate structures of the model, the parameters g; h; u f g can be automatically eliminated during the Gibbs sampling procedure.
The parameters h and u are eliminated from the conditional probability, and the Gibbs sampling conditional probability for topic is obtained as Neural Computing and Applications (2022)  where z t;:i denotes all z variables except z t;i , n w z t is the number of basic motion words in the dictionary assigned to topic z t , P w n w z t is the total number of motion words assigned to topic z t , n z y is the number of topic types assigned to behavior type y, P z n z y is the total number of topics assigned to behavior type y, L is the number of basic motion words in the dictionary, and K is the number of topic types. The parameters g and h are eliminated from the conditional probability, and the Gibbs sampling conditional probability for behavior type is obtained as where y :t denotes all y variables except y t ; n z y t is the number of topic types assigned to behavior types y t ; n z :y t is the number of topic types not assigned to behavior types y t ; P z n z y t is the total number of topics assigned to behavior type y t ; P z n z :y t is the total number of topics not assigned to behavior type y t ; n y t ;y tþ1 is the count of behavior type y tþ1 following behavior type y t ; P y tþ1 n y t ;y tþ1 is the total count of behavior type y t , followed by other behavior types; M is the number of behavior types; and I is the identity function, which returns the value 1 if its argument is true. After sampling converges, parameters can be estimated aŝ 5 Discovery algorithms of MCSC patterns By learning from MTM, the trajectory points of moving objects (co-occurring motion words) in video clips (documents) can be clustered into semantic regions (topics).
Then we get the set of snapshot clusters C t i ¼ at timestamp t i according to the description of the mapping process in Sect. 3, where cluster C j Þ is one of the snapshot clusters at timestamp t i , K is the number of semantic regions (topics), and m is the total number of moving objects.
The MCSCs can be discovered by using the candidate MCSC recognition algorithm to construct lists of candidate MCSCs and using the screening algorithm to distinguish MCSCs in the candidate lists. We give the following definitions.
these moving objects are the decisive factors for MCSC; 3) S j j ! minS: there are at least minS objects in set S.
Definition 3 (Candidate MCSC): Let S be a key set of moving objects. S; G is a candidate MCSC, where S is the intersection of the set of moving objects contained in snapshot cluster C p t iÀ1 and C q t i , and G ¼ C p t iÀ1 C q t i .
A queue L of candidate MCSCs is called the list of candidate MCSCs. At timestamp t i , all current candidate MCSCs are stored in list L.
The process of identifying MCSCs is to construct and update the lists of candidate MCSCs at each timestamp, step by step. Figure 3 shows a running example of the candidate MCSC recognition algorithm (CMCR). There are seven objects and three timestamps ( and o t 3 j are the representations of moving object o j at different timestamps. We set h ¼ 1 4 and minS ¼ 2 in this example. At each timestamp, the key set of moving objects is constructed and updated in list L together with the corresponding sets of snapshot clusters. The lists corresponding to timestamps t 1 , t 2 , and t 3 are L t 1 , L t 2 , and L t 3 , respectively.

Update and insertion rules for candidates
According to the above definitions, we introduce the following lemma.
Lemma 1 Let C p t iÀ1 C q t i , and C q t i C r t iþ1 be MCSCs. C p t iÀ1 C q t i C r t iþ1 is an MCSC.
Proof Since C p t iÀ1 C q t i and C q t i C r t iþ1 are MCSCs, we have We give the following update and insertion rules. Fig. 3, o 1 ; o 6 f g; In fact, candidate item u is extended by snapshot cluster C 3 t 3 in L t 3 to form a valid MCSC. It should be noted that C 1 t 1 and C 1 t 2 are different representations of the learned semantic region C 1 at timestamps t 1 and t 2 , respectively. Rule 2: For any candidate item È É is created and inserted in list L. In Fig. 3,

are all candidate items created under rule 2.
Rule 3: For any snapshot cluster C q t i at timestamp t i , if  ; o 6 f g ; C 1 t 1 is the initial candidate item that should be inserted in list L when initialized.

Candidate MCSC recognition algorithm
The above rules construct the list L of candidate MCSCs and the set of added candidate items at current timestamp t i . The candidate MCSC recognition algorithm maintains candidate list L by updating and inserting candidate items in list L according to rules 1-3 at each timestamp.
Algorithm 1 presents the pseudocode of CMCR.
In the first step, at timestamp t 1 , we generate initial candidate items utilizing the nonempty snapshot clusters in snapshot S 1 , and insert them in ML t 1 and L (lines 1-2). At each subsequent timestamp, snapshots S i and S iÀ1 are examined to update and insert candidate items (lines 4-10). When scanning through snapshot S i , ML t i includes candidate items containing snapshot clusters in S i (lines [11][12][13][14][15]. The set ML of added candidate items at each timestamp is used to extend candidate MCSCs to closed candidates in the screening algorithm.

Screening algorithm
Our goal is to discover the complete set of MCSCs from the candidates, i.e., the MCSCs with the largest continuous timestamps. To avoid mining redundant MCSCs, we define a closed candidate.

Definition 4 (Closed Candidate):
For a candidate MCSC u in list L, if there does not exist another candidate v such that u:G v:G, then u is a closed candidate.
We use the example in Fig. 2 which is a closed candidate. Based on the above output set ML at each timestamp, the screening algorithm can retrieve all MCSCs based on the construction of closed candidates. This is described as Algorithm 2.
When examining ML t iÀ1 , ML t iÀ1 includes the added candidate items at timestamp t iÀ1 . Each candidate item u 2 ML t iÀ1 is checked to verify whether u can be extended by any v 2 ML t i to form a valid MCSC (lines 6-10). The candidate items in ML t iÀ1 that were not extended at t i are output. ML t i to be used at the next iteration consists of candidate items in ML t iÀ1 that were extended at t i . In this manner, the screening algorithm misses no closed candidates and outputs no redundant items.
Note that the original snapshot cluster C 1 t 1 splits into snapshot clusters C 1 t 2 and C 2 t 2 at timestamp t 2 . Since In the case of symmetry, a similar phenomenon is observed, i.e., two snapshot clusters merge into one snapshot cluster at the next timestamp, which is called traffic convergence.
6 Experimental evaluation

Datasets
We evaluated the effectiveness of the proposed framework of MCSC discovery for group behavior pattern mining using QMUL junction and roundabout datasets. The two datasets were collected from real-world public road surveillance scenarios with large numbers of moving objects exhibiting typical group behavior patterns.
Junction Dataset This dataset contains 60 min of 25 fps video of a busy urban road junction with a frame size of 360 9 288 pixels. The scene contains many objects moving at different regions and exhibiting complex behaviors. The traffic lights govern the behaviors of moving objects, which form four types of traffic flow patterns in a certain temporal order, as shown in Fig. 4.
Roundabout Dataset This dataset contains about 60 min of 25 fps video of a traffic roundabout with a frame size of 360 9 288 pixels. Similar to the urban road junction, moving objects show complex behaviors. Three types of traffic flow patterns are controlled by traffic lights in a certain temporal order, as shown in Fig. 5.

Semantic region segmentation
Experiments were performed to decompose each scene into semantic regions on the QMUL junction and roundabout datasets. For the junction, 33 non-overlapping sub-videos were obtained after segmenting the video according to the temporal order of traffic flow. Each sub-video contains all traffic flow patterns in the scene, and they constitute video set D. The roundabout video dataset was similarly cut into 66 non-overlapping sub-videos, constituting video set D. Each sub-video was segmented into non-overlapping clips with an equal length of 100 frames. Each video clip was considered a document, and the trajectory points of moving objects within video clips were considered motion words in documents. To build the motion dictionary, the 360 9 288 surveillance scene was quantized into 40 9 32 cells of size 9 9 9, and the moving directions were quantized into four directions perpendicular to each other. So, the size of the dictionary was 40 9 32 9 4. We set the model parameters a ¼ K/50, b ¼ 0:01, c ¼ 1, and segmented each scene into semantic regions. K is the number of topics (semantic regions). Our proposed method decomposed the junction and roundabout scenes into nine regions, as shown in Figs. 6a and 7a. For comparison, in Figs. 6b and 7b, the junction and roundabout scenes were segmented into six and nine regions, respectively, using the modified spectral clustering algorithm of Li et al. [34], which represents the state of the art of semantic scene segmentation. Li et al. treated the semantic region segmentation problem as an image segmentation problem, except that they represented each pixel location of a scene by pixel-wise feature vectors instead of RGB and texture feature values. The modified spectral clustering algorithm was employed to segment the scene into different non-overlapping semantic regions. As shown in Figs. 6b and 7b, those areas not belonging to traffic lanes and waiting zones were also divided into semantic regions. From this point of view, the result of region segmentation is somewhat rough. This segmentation result has been useful enough for learning behavior spatial context, but is unsuitable for our MCSC discovery scenarios. Other than that, both methods display meaningful distributions of semantic regions, which almost correspond to various traffic lanes and waiting zones. Moving objects passing through the same combination of semantic regions tend to follow a similar behavior pattern. Thus, it can be seen that inappropriate segmentation of semantic regions makes it more difficult to find meaningful group behavior patterns. For example, Figs. 6c and 7c show the segmented semantic regions using the original Zelnik-Perona (ZP) method [33] at an urban road junction and traffic roundabout, from which it is evident that, no matter C 1 C 2 C 3 and C 3 C 2 C 1 at the urban road junction, or C 1 C 2 and C 2 C 1 at the traffic roundabout, these are not meaningful group moving behaviors, which cannot reflect meaningful traffic flow patterns in real scenarios.

Traffic group behavior pattern mining evaluation
We evaluate the identified quality of traffic divergence, which is the typical traffic group behavior pattern, as obtained by MCSC discovery. With the learned semantic regions, the set of snapshot clusters at each timestamp is  obtained by mapping moving objects to semantic regions (see Sect. 3). In the real world, streaming trajectory data generated by moving objects may arrive in different semantic regions of the monitoring scenarios at different timestamps. With rigorous constraints on time, inappropriate setting of timestamps makes it more difficult to discover meaningful MCSCs. For all of the datasets of the experiments, considering the lifetime of moving objects in these scenarios, the interval between consecutive timestamps was set at one second, i.e., the movement data of moving objects were output each second to produce snapshot clusters. To retrieve all of the MCSCs, the candidate list L was reported at each timestamp in the form of S; G in the MCSC decision phase. G is considered to discover MCSCs by constructing closed candidates. The remaining S is the intersection of the set of moving objects contained in two adjacent snapshot clusters. This can be applied to extract more information, such as to identify the key moving objects from the process of generating MCSCs and describing their semantic behaviors, which is beyond the scope of this paper.
We generated ground truth by manually and exhaustively labeling all traffic divergence in the video timestamps from both datasets. The outputs of the different approaches were compared with the ground truth and evaluated by Precision and Recall, which are proportions of correct discoveries based on all retrieved results and the ground truth, respectively.
Baselines: We compared the proposed MCSC discovery approach with three state-of-the-art baselines: 1) the swarm (SW) pattern [12], which captures groups whose members move together in clusters of arbitrary shape for certain (possibly non-consecutive) time intervals; 2) the traveling companion (TC) pattern [13], which requires that group members are close together for certain consecutive snapshots; 3) and the moving cluster (MC) [15], which allows members to leave or join a group during its life cycle, where the proportion of common members in any two consecutive snapshot clusters does not fall below a threshold.
Parameter settings: Experimental parameters were set based on observations on the two datasets, and were selected intuitively according to the nature of the traffic scene. The sample points query operation in radius range widely used in DBSCAN [19] is supported by dividing the surveillance scene into 40 9 32 cells of size 9 9 9, i.e., 42 rows and 30 columns. Objects distributed on both sides of the traffic lane in parallel were required to be in a cluster. DBSCAN with MinPts = 2 and Eps = 6 was applied to generate clusters for SW, TC, and MC patterns at each timestamp. We set default size thresholds of min o ¼ 2 (number of objects) and min t ¼ 2 (consecutive timestamps, i.e., half of the shortest time span of traffic flows) for both datasets. For discovery of MC and MCSC patterns, we considered h ¼ 1 4 and separately for MCSC patterns, we set minS ¼ 1, which are restricted by scene structures. Figure 8a and b plot the precision and recall of different approaches on the junction and roundabout datasets, according to the default setting. As indicated in Fig. 8a, MCSC, MC, TC, and SW achieved precision of 93.0%, 40.0%, 29.0%, and 21.9%, respectively, on the junction dataset, with corresponding recall of 76.0%, 48.5%, 33.3%, and 25.1%. On the roundabout dataset, Fig. 8b indicates precision for MCSC, MC, TC, and SW of 94.0%, 55.8%, 37.8%, and 28.2%, respectively, with corresponding recall of 81.3%, 66.7%, 41.8%, and 36.1%. As shown in figures, our proposed approach gains the preferable performance on both traffic scenarios. SW, TC, and MC utilized the DBSCAN algorithm to generate snapshot clusters at each timestamp, which cannot well reflect datasets with changeable data density because of the adopted global density parameter. When the density of the dataset is not uniform and the distance between clusters is very different, the quality of clustering is poor. In the two datasets, under different traffic flow conditions, the density of vehicles varied greatly. In extreme cases, all high-density moving objects were in one group, so it was difficult to distinguish snapshot clusters. In the case of sparse moving objects, objects with different motion behaviors could be grouped into one class, resulting in more false positives.
In traffic monitoring scenarios with entering or exiting moving objects, MC is more suitable than SW and TC because MC groups satisfy the overlap threshold between snapshot clusters distributed on consecutive timestamps, while the latter are the results of the intersection of the (continuous or with an allowed time-gap) snapshot clusters. SW generates more false positives that degrade performance. In addition, the performance of SW, TC, and MC on the roundabout dataset was significantly better than on the junction dataset. This is because DBSCAN does not consider the moving directions of objects, which leads to more false positives when the spatial positions of moving objects are adjacent and the moving directions are opposite. Traffic flow pattern B (see Fig. 4b) at an urban road junction is a typical scene of false positives.
It is also interesting that the high-frequency traffic differences identified from the junction and roundabout datasets can reflect their typical traffic flow patterns, as shown in Figs. 9 and 10.
To further investigate the influences of parameters K and h on the quality of traffic divergence identification, we used the junction dataset from the previous experiment and varied K from 6 to 12, and h from 1/4 to 1/2. As shown in Fig. 11, both the precision and recall increase when K increases in the range of 6-9, because semantic regions that better conform to the scene structure identify more traffic divergences with fewer false positives. When K increases in the range of 9-12, the precision increases and recall decreases because inappropriately segmented semantic regions eliminate traffic divergences that fail to satisfy the h criterion, and the probability of error recognition is smaller. If K is set greater than 11, 100% precision can be achieved. However, the recall under this setting is extremely low. We also observe that the precision increases and recall decreases when h increases, because when h is large, the probability of discovering MCSCs at consecutive timestamps is small, and the probability of false positives also decreases.
Finally, we conducted experiments while changing the values of the size threshold min o on the junction dataset. Figure 12 shows the precision and recall of MCSC, MC, TC, and SW. It should be noted that we considered the default setting of minS ¼ 1 for MCSC instead of changing the value because, in a real-world traffic scene, a large number of snapshot clusters generated by mapping moving objects to semantic regions can only contain one moving object due to the size of the semantic regions. In addition, we did not consider the influence of the duration threshold min t because that only two different snapshot clusters at two consecutive timestamps, respectively, are needed to determine whether traffic divergence is possible. Therefore, we took the duration threshold min t as the default setting. As shown in Fig. 12, the recall of MC, TC, and SW  decreased as min o increased, because the snapshot clustering available for traffic divergence detection was reduced affected by semantic regions. When the duration threshold min o increased from 2 to 3, the precision of all approaches increased, because fewer snapshot clusters could pass a higher threshold with fewer false positives.

Conclusion
We introduced the challenging problem of MCSC discovery, which yields to group variability and behavioral regionality. Different from previous learned behavior clusters, the membership information of MCSC may change over time, and objects' motions show regional characteristics owing to scene structures. Since densitybased clustering algorithms cannot reflect the movement of vehicles restricted by scene structures, we proposed a Markov topic model to segment semantic regions, which are viewed as subsets of a path that objects move along. At each timestamp, snapshot clusters are obtained by mapping moving objects to semantic regions, rather than through the conventional density-based clustering algorithms. Finally, a candidate MCSC recognition algorithm and screening algorithm, executed at each timestamp, incrementally identified and output MCSCs in real time. Extensive experiments on two real-world public road surveillance scenarios demonstrated the effectiveness of the proposed framework. At present, the number of topics is mainly determined through domain knowledge or cross-validation. Our future work will focus on optimizing hyperparameters and intelligently training the number of topics. The coordination of multi-camera monitoring functions and the fusion of video data information are also a focus of further research.

Declarations
Conflict of interest The authors declare that they have no conflict of interest.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons. org/licenses/by/4.0/.