TRUST: A Novel Framework for Vehicle Trajectory Recovery from Urban-Scale Videos

: We study a new type of path inference query against urban-scale video databases. Given a vehicle image query, our goal is to recover its historical trajectory from the footprints captured by surveillance cameras deployed across the road network. The problem is challenging because visual matching inherently suffers from object occlusion, low camera resolution, varying illumination conditions, and viewing angles. Furthermore, with limited computation resources, only a fraction of video frames can be ingested and indexed, causing severe data sparsity issues for visual matching. To support efﬁcient and accurate trajectory recovery, we develop a select-and-reﬁne framework in a heterogeneous hardware environment with both CPUs and GPUs. We construct a proximity graph from the top-k visually similar frames and propose holistic scoring functions based on visual and spatial-temporal coherence. To avoid enumerating all the paths, we also propose a coarse-grained scoring function with monotonic property to reduce search space. Finally, the derived path is reﬁned by examining raw video frames to ﬁll the missing cameras. For performance evaluation, we construct two largest-scale video databases generated from cameras deployed upon real road networks. Experimental results validate the efﬁciency and accuracy of our proposed trajectory recovery framework.


Introduction
Due to the strong support of artificial intelligence, high-performance computing, and 5G networks [1], more and more surveillance cameras are being deployed in all corners of cities, and large-scale video analysis has great potential to provide a wider range of applications scenarios for smart cities, which brings huge improvement space for transportation services, public safety, etc..However, at the same time, effective real-time massive video-processing technology is urgently needed.Scalable video analysis and query optimization have become a cross-cutting topic of deep learning [2] and database management, which has sparked new research hotspots in recent years.A large number of video database systems have emerged, such as NoScope [3], Focus [4], Chameleon [5], BlazeIt [6], and MIRIS [7], which can efficiently deal with all types of video queries in target detection, identification, and tracking tasks.
Shahri [8] provided a graph-based approach using the identity of neighboring vehicles to improve the performance of tracking vehicles.Liu [9] proposed a PathRank algorithm to support the vehicle trajectory search.However, the above two methods did not solve the problem of sparsity and noise.In this paper, we study a novel path inference query for a large video database that can be obtained from thousands of surveillance cameras deployed in a city; experiment results validate the efficiency and accuracy of our proposed trajectory recovery framework.As shown in Figure 1, the input to the query is an image of a vehicle or pedestrian, and the goal is to locate its possible footprints and recover its historical trajectory on the road network from visual snapshots captured by cameras.It is an intersection of computer vision and database management.It can be applied to recover its historical trajectory on the road network from visual snapshots captured by cameras.It is an intersection of computer vision and database management.It can be applied to many lives, public security, and criminal scenarios to provide new technical support for smart-city construction and public-security governance [10].The algorithm can be applied to missing-person tracking, suspicious-vehicle queries, security management prevention, and other fields, providing new technical ideas and support for smart cities and public security.For example, database queries may be used to locate missing persons or stolen cars or to help solve crimes by effectively identifying the travel logs of suspicious vehicles and people.The queries proposed in this paper are related to Multi-Target Multi-Camera (MTMC) tracking [11] and vehicle re-identification [12-14] (Vehicle-ReID), but there are substantial differences.In the MTMC task, no query image is used as input, and its purpose is to connect the partial-motion trajectory captured by a single camera to the complete-motion trajectory of all vehicles appearing in the video database.Vehicle reidentification belongs to a type of entity matching, and its main purpose is to learn a deep neural network to efficiently determine whether two pictures of vehicles point to the same real-world entity.This approach cannot eliminate the interference caused by false-positive examples to pair matching and does not have the ability of path inference.An improved approach to solve this query is to apply target detection to video frames and then extract the visual features of the detected vehicles by the latest vehicle re-identification model and build an effective index for high-dimensional similarity search [15].We use this solution for vehicle trajectory recovery because of the lack of real-time GPS data from the vehicle [16].Given an input image, the method uses an index to retrieve visually matched candidates and then uses spatial-temporal cues in the road network to infer the travel route with the highest probability.This task is somewhat similar to map matching [17,18], since they share the same goal of projecting a set of uncertain or noisy tuples onto a road network and inferring the driving route with the highest probability.Although GPS map matching has been able to achieve high accuracy, recovering trajectories from video databases is more challenging due to sparsity and noise problems [19,20].The queries proposed in this paper are related to Multi-Target Multi-Camera (MTMC) tracking [11] and vehicle re-identification [12-14] (Vehicle-ReID), but there are substantial differences.In the MTMC task, no query image is used as input, and its purpose is to connect the partial-motion trajectory captured by a single camera to the complete-motion trajectory of all vehicles appearing in the video database.Vehicle re-identification belongs to a type of entity matching, and its main purpose is to learn a deep neural network to efficiently determine whether two pictures of vehicles point to the same real-world entity.This approach cannot eliminate the interference caused by false-positive examples to pair matching and does not have the ability of path inference.An improved approach to solve this query is to apply target detection to video frames and then extract the visual features of the detected vehicles by the latest vehicle re-identification model and build an effective index for high-dimensional similarity search [15].We use this solution for vehicle trajectory recovery because of the lack of real-time GPS data from the vehicle [16].Given an input image, the method uses an index to retrieve visually matched candidates and then uses spatial-temporal cues in the road network to infer the travel route with the highest probability.This task is somewhat similar to map matching [17,18], since they share the same goal of projecting a set of uncertain or noisy tuples onto a road network and inferring the driving route with the highest probability.Although GPS map matching has been able to achieve high accuracy, recovering trajectories from video databases is more challenging due to sparsity and noise problems [19,20].
The computational cost of applying target detection to every video frame, as mentioned by many of the video analysis systems that have been proposed, is enormous.YOLOv3 [21] processes 960 × 540 video frames at around 30 fps on the NVIDIA Tesla V100, while Mask R-CNN only achieves 3 fps [22] and MATNet only achieves 2 fps [23].An

R E T R A C T E D
Sensors 2022, 22, 9948 3 of 21 urban road network with 1000 cameras and surveillance videos at a frame rate of 30 fps will produce a video stream of 30,000 frames per second, which is far beyond the absorption capacity of current state-of-the-art target detection models.
This paper presents an effective selection-refinement framework called TRUST (Trajectory Recovery from Urban-Scale video databases).Its general idea is to use spatial and temporal coherence as complementary cues to correct the weaknesses of probabilistic visual matching and to allow verification of unindexed original video frames to address the sparsity problem.
The major contributions of this paper are summarized as follows: • A new research problem is proposed, i.e., recovering the historical trajectories of query vehicles from city-scale surveillance videos.

•
We construct a similarity graph based on top-k visually matched candidates and propose an overall path-scoring function that integrates camera importance, visual coherence, and motion coherence for path inference.

•
An efficient and robust selection-optimization algorithm is proposed to solve the problems of sparsity and noise.

•
To improve efficiency, an efficient path-expansion algorithm is proposed, which relies on a coarse-grained scoring function with monotonic properties, and a novel pruning strategy is derived based on this function.We utilize its parallel computing capabilities to accelerate query processing and allocate suitable workloads for GPU processing, and the entire algorithm is implemented in a heterogeneous hardware environment with CPUs and GPUs.

•
For performance evaluation, we built two of the largest video databases on real road networks for our experiments.TRUST is robust in situations of data sparsity and matching uncertainty and achieves high accuracy and better recall.
The remainder of the paper is organized as follows: We review the related work in Section 2 and cover the proposed algorithm in Section 3. We present experimental results in Section 4. Finally, the conclusion and suggestions for future work are provided in Section 5.

Related Works
In this section, we introduce areas related to trajectory recovery, including multiobjective multi-camera tracking, vehicle re-identification, map matching, and VDBMS querying.Multi-target multi-camera tracking focuses on connecting segments of trajectories across cameras from a single camera; vehicle re-identification aims to train a deep neural network to identify whether two images point to the same entity in the real world; map matching projects GPS points to a location in a roadway; and existing VDBMS queries focus on efficiently querying for frames that meet specific requirements.

Multi-Target Multi-Camera Tracking
Given a video captured by a surveillance camera, multi-object tracking (MOT) [24][25][26] can be considered a data-association problem that aims to associate all detected objects in a sequence of video frames.A widely used approach is to construct a bipartite graph between two sets of detected objects in adjacent frames, where the weights of the edges are determined by the deep-association metric [24], and then the Hungarian algorithm is used to determine the best match.Multi-objective multi-camera (MCMT) tracking, on the other hand, extends MOT by considering scenes across cameras [11]; deep learning has greatly improved the performance of scene parsing [27,28], RGB-based deep convolutional neural networks can achieve high performance for salient object detection [29,30].In the literature [31], a spatial-temporal attention mechanism was designed to generate robust local trajectory-embedding representations.MCMT can be considered as an operator for semantic connectivity between adjacent frames and cameras and can be processed in a batched manner.This operation is costly and does not scale to large video databases.The most commonly used benchmark dataset in this domain is CityFlow [11], containing 3.25 h of video from 25 cameras covering 10 intersections in a road network.

Vehicle Re-Identification
The purpose of Vehicle-ReID is to retrieve all images that point to the same entity as the query image from a large gallery of images taken from various cameras in different locations, with different angles and corresponding timestamps.A common approach to visual feature extraction is to apply Convolutional Neural Networks (CNNs) to learn local specific features and then merge them into a single vector representation.In recent work, a novel Spatial Temporal Graph Convolutional Network (STGCN) [32] has emerged to model the temporal relationships of different frames and the spatial relationships within frames.To overcome the dynamic appearance changes under different viewpoints, a Parsing-based View-aware Embedding Network (PVEN) [12] was proposed to align viewpoint features and improve the accuracy of vehicle re-identification.We can apply state-of-the-art Vehicle-ReID models to extract visual features, but the focus will be on the part of path inference, i.e., identifying the correct trajectory from visually similar candidate objects.

Map Matching
Given a trajectory with GPS points, map-matching projects each point to a location in the road segment and the output is the complete path in the road network.Taguchi [33] proposed using Hidden Markov Models (HMM) and inferred the most likely route by heuristically estimating the transition probability.ST-Matching [17] uses spatial and temporal constraints to estimate the transition probability between two mapped points and constructs a candidate map to infer the best matching path using the transition probability as an edge weight.IF-matching [34] uses velocity and direction of motion as additional cues and blends them with the historical spatial-temporal context to estimate the transition probability.In the literature, a distributed framework for efficient and scalable offline map matching is constructed on top of Spark [18].

Query Processing in VDBMS
The use of deep neural networks for target detection is costly and two alternative solutions are available.The first approach avoids applying powerful but costly models (e.g., YoLov2 [35], YoLov3 [21], YOLOv4 [36], and [37]) and instead trains approximate but faster models that sacrifice accuracy for performance acceleration.NoScope [3] is a pioneering work that uses smaller but faster-dedicated networks for target detection, but with lower efficiency.Focus [4] takes a different strategy by building inexpensive CNNs to build inverted indices and using clustering to eliminate redundancy.Recently, various novel deep learning techniques, called graph neural networks (GNNs), have been developed to process graph data.Many works have combined GNNs with other deep learning techniques to handle traffic tasks, where GNNs are responsible for extracting spatial correlations in traffic networks [10].
The second strategy is to use downsampling to reduce the number of processed frames.MIRIS [7] uses uniform downsampling to compensate for the accuracy degradation by allowing the re-examination of some of the original video frames and applying the full model to them to improve performance.To support more complex queries, the literature [6] extended the concept of NoScope to support aggregated queries and restricted queries.
Like these visual-analysis systems, the trajectory recovery method suffers from the limited number of processing frames.Trajectory recovery can be considered as a new type of query predicate in large VDBMS that focuses on inferring the correct driving route from a set of visually similar candidate objects.

Methodology
First, the problem definition of trajectory recovery is introduced.Then, we describe the pre-processing steps, including a video synthesizer based on multi-source real data, spatialtemporal camera network distillation, video-frame ingestion, and index establishment.Finally, the processing flow of the whole trajectory recovery method is described, which

R E T R A C T E D
Sensors 2022, 22, 9948 5 of 21 contains four main modules: searching for top-k visually matching candidate objects, similarity graph establishment, path selection, and path downsampling refinement.

Problem Definition
Let G = (C, E) be a road network in a city where surveillance cameras are deployed throughout the network to support intelligent transportation and enhance public safety.Each camera is associated with a spatial location in the road network G, represented by an edge number and an offset, to generate a continuous stream of video frames.We use the tuple F = < F c , F v , F s , F t > to represent a video frame, where F c is the number of the camera corresponding to the video, F v is the original image with pixel information, F s is the spatial location inherited from the camera, and F t is the timestamp corresponding to the frame.The entire collection of video frames constitutes the original video database, D raw .
Considering that the speed of generating video streams with city-scale cameras is much faster than the speed of video being ingested and processed, we assume that only a small fraction of the video frames in D raw are semantically analyzed in an offline manner by target-detection and visual-feature-extraction models.Video frames are ingested at a fixed rate using downsampling.Each selected video frame, F, is transformed into multiple visual objects denoted as O = < O f , O v , O s , O t >, where O f is the corresponding frame number and O v is the high-dimensional visual feature extracted from the image, and O s and O t are the spatial and temporal attributes inherited from F. The entire set of visual objects constitutes the video database, D ing , after ingestion.
The spatial video database refers to the concatenation of the original video frames, D raw , and the ingested visual objects, D ing , denoted as D = D raw ∪ D ing .Based on the video database model, we formally define the trajectory recovery problem as set out below.

Definition 1. Trajectory recovery
Given a spatial video database, D, and a picture of an object, O q , as query input, the task of trajectory recovery is to identify a camera sequence, c 1 → c 2 → • • • → c m , so that these cameras capture O q sequentially in an ascending order of timestamps.
It should be noted that since the trajectory recovery query in this paper is for the spatial video database without obtaining the vehicle GPS trajectory in advance, this paper uses camera sequences rather than road-segment sequences to approximate the historical trajectory of the query object.In addition, the method is unknown for the real driving route of a vehicle between two neighboring cameras, c i and c i+1 .

Pre-Processing
In this section, we describe the offline processing steps, including synthesis methods for video datasets, spatial-temporal knowledge distribution of the camera network, video ingestion over sampled frames, and index construction of visual features.The input information includes the query features, the road network, and the feature library obtained by downsampling the large-scale video.

Video Synthesizer Based on Multi-Source Real Data
Multiple video or image datasets were currently collected from real surveillance cameras, which are publicly accessible and used for the tasks of multi-target multi-camera tracking and vehicle re-identification.However, these datasets are not applicable for performance evaluation of trajectory recovery.We propose an alternative approach to integrating multiple real data sources, including road networks, GPS trajectories, image libraries generated from vehicle re-identification, and surveillance video clips generated from multi-objective multi-camera tracking, as a way of efficiently generating city-scale videos and using them for database building for trajectory recovery.We used the Singapore road network and its cab GPS dataset [38] as an example to describe the process of building a city-level video database.

R E T R A C T E D
Sensors 2022, 22, 9948 6 of 21 We deployed a set of surveillance cameras on the road network.For simplicity, we placed the cameras in the middle of the road section so that each camera was associated with a unique edge identification in the road network.We use-the query-image injection operation to synthesize videos that were able to support the trajectory recovery task.The main idea was to apply real GPS trajectories to represent the motion patterns of query objects in the road network and inject images from the vehicle re-identification dataset into the associated video segments of the cameras to simulate the scenario where the query objects are captured by the surveillance cameras.
The video-composer algorithm used in this paper for querying objects is described in Algorithm 1.In order to inject the image into the video clip associated with the camera, we first applied map matching and determined the time period [t s , t e ] when the query object appeared in the camera frame.This was achieved by estimating the travel speed of the road section and calculating the time to reach positions p s and p e .p s , p e was the field of view that could be captured by the camera.Then, we implemented target detection and tracking by using the framework in YOLOv4 [36] and Deep-SORT [24].Deep-SORT was already open source in GitHub.In order to inject the query object into the video, we needed to select a detected object, O s , and replace it with the image of the query object.The sequence of bounding boxes of O s could be overridden by resizing the image of the query object.

Spatial-Temporal Knowledge Distillation
The spatial-temporal information related to the road network was loaded in advance, mainly including the distance between two points, the travel time distribution, and the neighbors associated with each point.A predicate P produced a Burr output given one or more tracks F → F → ⋯ F .Queries that selected individual tracks consisted of a Burr distribution of geometric predicates over the distance and travel time.
For each pair of cameras, we preserved the hop count of their shortest paths in the original road network.In addition, we maintained the passage time distribution between

Spatial-Temporal Knowledge Distillation
The spatial-temporal information related to the road network was loaded in advance, mainly including the distance between two points, the travel time distribution, and the

R E T R A C T E D
Sensors 2022, 22, 9948 7 of 21 neighbors associated with each point.A predicate P produced a Burr output given one or more tracks F 1 → F 2 → • • • F m .Queries that selected individual tracks consisted of a Burr distribution of geometric predicates over the distance and travel time.
For each pair of cameras, we preserved the hop count of their shortest paths in the original road network.In addition, we maintained the passage time distribution between every two cameras.Various distributions have been studied in the literature [39], and the Burr distribution provides the highest acceptance rate for modeling the passage time distribution.The Burr distribution is a continuous probability distribution of non-negative random variables with a probability distribution function formulated as follows: To verify whether the Burr distribution was suitable for the Singapore cab dataset chosen for this paper, we selected the start and end pairs that occurred frequently in all trajectories and plotted the passage time distribution, as shown in Figure 3.It can be seen that the Burr distribution provided a good approximation.

Video Ingestion and Index Building
We adopted a uniform sampling strategy for visual feature extraction, and for each sampled frame, we applied YOLOv4 [36] for object detection.This step generated a rectangular bounding box in each image containing an object and associated with a class label.To extract effective visual features from bounding boxes, we applied Fast ReId [40], which is designed to extract unique features of entities and use them for the reidentification of people or vehicles.For each bounding box, high-dimensional features with 2048 dimensions could be obtained.
Visual matching is actually a classic k-nearest neighbor search in high-dimensional space, and the latest methods can be used for feature indexing.We chose product quantization [41] and built an inverted multi-index that divided d-dimensional features into m segments and quantized each subspace separately.For each subspace, k-means clustering was performed, and each segment was approximately encoded by the clustered index.

Trajectory Recovery Algorithm
In this section, we introduce trajectory recovery algorithms that work in heterogeneous hardware environments with CPUs and GPUs.As shown in Figure 4, the workflow can be decomposed into three functional modules:

Video Ingestion and Index Building
We adopted a uniform sampling strategy for visual feature extraction, and for each sampled frame, we applied YOLOv4 [36] for object detection.This step generated a rectangular bounding box in each image containing an object and associated with a class label.To extract effective visual features from bounding boxes, we applied Fast ReId [40], which is designed to extract unique features of entities and use them for the re-identification of people or vehicles.For each bounding box, high-dimensional features with 2048 dimensions could be obtained.
Visual matching is actually a classic k-nearest neighbor search in high-dimensional space, and the latest methods can be used for feature indexing.We chose product quantization [41] and built an inverted multi-index that divided d-dimensional features into m segments and quantized each subspace separately.For each subspace, k-means clustering was performed, and each segment was approximately encoded by the clustered index.

R E T R A C T E D
Sensors 2022, 22, 9948 8 of 21

Trajectory Recovery Algorithm
In this section, we introduce trajectory recovery algorithms that work in heterogeneous hardware environments with CPUs and GPUs.As shown in Figure 4, the workflow can be decomposed into three functional modules:

•
Candidate Object Retrieval for Visual Matching.This step is essentially a top-k similarity search in a high-dimensional database.

•
Score-based route selection.Given the top-k video frames that are similar to the query image, a large number of candidate routes can be constructed from the cameras associated with these video frames.To solve the problem that the search space was too large, we constructed a proximity graph between cameras and proposed a scorebased route selection algorithm that was able to efficiently identify routes with high accuracy.Since this process involves complex computational logic and data structures, we implemented the process in a CPU environment.

•
Path refinement for ingesting video.In the path selected in the previous step, there was a high possibility that some cameras that actually matched were missed due to the inability to ingest and index all video frames and the false negative generated in the first two steps.We identified those missed cameras again to improve the recall rate of track recovery.Given that the computational logic in this step was relatively simple and easy to parallelize, we implemented it in the GPU.
Sensors 2022, 22, x FOR PEER REVIEW 9 of 22 rate of track recovery.Given that the computational logic in this step was relatively simple and easy to parallelize, we implemented it in the GPU.The three modules were pipelined through a message-passing mechanism in shared memory.After retrieval of visual-match candidates, the first k video frames were stored in shared memory and retrieved by the route selection module to construct a neighborhood graph and perform path inference.The video-ingestion function was encapsulated as an asynchronous function and called by the path refinement function to find the missing camera.

Object Retrieval by Visual Matching
We searched for the k features that were most similar to the query features as candidates in the pre-indexed high-dimensional feature library, denoted as top-k.
The goal of visual-matching-candidate object retrieval was to use visual cues to narrow down the search space to a smaller set of video frames.We ultimately used Faiss, a product quantization algorithm using GPU optimization [42], which was able to immediately return approximate kNN results from a billion-scale database.The three modules were pipelined through a message-passing mechanism in shared memory.After retrieval of visual-match candidates, the first k video frames were stored in shared memory and retrieved by the route selection module to construct a neighborhood graph and perform path inference.The video-ingestion function was encapsulated as an asynchronous function and called by the path refinement function to find the missing camera.

Object Retrieval by Visual Matching
We searched for the k features that were most similar to the query features as candidates in the pre-indexed high-dimensional feature library, denoted as top-k.

R E T R A C T E D
Sensors 2022, 22, 9948 9 of 21 The goal of visual-matching-candidate object retrieval was to use visual cues to narrow down the search space to a smaller set of video frames.We ultimately used Faiss, a product quantization algorithm using GPU optimization [42], which was able to immediately return approximate kNN results from a billion-scale database.

Path-Selection Algorithm
On the basis of the approximate graph, all possible paths were enumerated in turn, starting from length 2, and the initial candidate paths were obtained by using a scoring function with monotonic properties, combined with a threshold for early termination and a unique pruning rule for further acceleration.
Given k candidate video frames {F 1 , F 2 , • • • , F k } that were visually most similar to the query image, our goal was to infer the correct trajectory of the vehicle on the road network corresponding to that query image, denoted as which can be seen as joining matching frames in an ascending order of timestamps.The search space containing all possible paths can be seen as a tree structure, where the nodes in the tree are video frames, and, if the timestamp of F i is less than F j , then the tree connects out one side, F i → F j .

Proximity Map Creation
The top-k was ranked according to the time series, and for each pair of points in it the coherence scores in the temporal, spatial, and visual dimensions were calculated; and if the scores were exceeded, the corresponding edges were added to the similarity graph.
The path-inference algorithm needed to be implemented on the basis of a similarity graph in which each edge, F i → F j , indicated that F i and F j were close in time and that the same vehicle was captured together in their frames.If F i → F j appeared in the correctly labeled path P * , we needed an edge-weight criterion to assign a higher score to it.Then, the search space for path inference could be significantly reduced by setting a threshold, δ, to eliminate edges with small scores.To achieve this goal, we first used the visual similarity between F i and F j as a scoring factor.
where D v F i , F j is the Euclidean distance between two high-dimensional vectors F i and F j ,MAX v = maxD v F i , F j is the parameter used for normalization.In addition to visual coherence, we further enhanced the spatial and temporal proximity between F i and F j to avoid connecting frames that matched but were not adjacent in P * .We defined the spatial proximity between F i and F j , which was mainly obtained by normalizing the shortest distance between the corresponding cameras on the road network.
Temporal proximity was also defined in a similar way by Ultimately, the weights of the edges were calculated using a linear combination of the similarity of the visual, spatial, and temporal dimensions to obtain the following: To avoid the effect of the adjustment parameters, we simply set w 1 = w 2 = w 3 = 1 and relied mainly on the path-inference algorithm on similar graphs to recover the correct trajectory.The three parameters (MAX v , MAX s , MAX t ) used for normalization could be estimated from the correctly labeled paths in the history query.

Overall Path Scoring Function
In this subsection, we introduce an overall path-scoring function that takes into account the importance of the camera, visual coherence, and motion coherence.The candidate paths selected by the coarse-grained method are then filtered again, using the fine-grained method to obtain the final candidate paths.The multiple candidate paths from the finegrained method are combined using frequency and time overlap to obtain a longer path: Given a path P = F 1 → F 2 → • • • F m containing multiple edges, we used the visual coherence of video frames and the temporal coherence of motion patterns as two key metrics for path scoring.To measure the visual coherence among a set of high-dimensional features f i , the method chooses to calculate their variance and expects visual features belonging to the same vehicle to have a small variance. where For the spatial-temporal coherence of the motion patterns, we chose the velocity variance between each pair of neighboring cameras in path P as the scoring metric.Let C 1 → C 2 → • • • C z (z ≤ m) be a sequence of cameras that is the shortest network distance between C i and C i+1 , and t i2 be the time interval between two frames F j and F j+1 , F j ∈ C i and F j+1 ∈ C i+1 .The variance of the velocity can be calculated by the following equation: where The visual and velocity variances can be normalized to the interval [0, 1] in a similar manner to the edge-scoring strategy to obtain two coherence scores, norm(σ v 2 ) and norm(σ s 2 ).Ultimately, we defined a linear combination of path-score node weights, visual coherence, and velocity coherence as follows:

Path-Inference Algorithm
A straightforward path-inference algorithm used the scoring function of the overall path to traverse all possible paths in a similar graph and eventually retrieve a path with the highest score.
To reduce the number of enumerated paths and facilitate the retrieval of more complete paths, the goal of path inference was set to find the longest path with a score above a threshold δ.
Algorithm 2 shows the pseudo-code of the path-inference strategy.The top-k visual candidates were sorted by their timestamps, denoted as F 1 , F 2 , • • • , F k .For each pair of video frames F i , F j , they were concatenated if they had timestamps i < j and score ( F i , F j > δ) between them.From the similarity network generated by the candidate

R E T R A C T E D
frames, we obtained all points in ascending order of timestamps.For each point F i , the set of all partial routes to the endpoint F i was maintained, denoted as R(F i ).To build R(F i ), we used F → F i to access its incoming neighbor nodes and merge into F i after extending the corresponding local paths in R F .To further improve efficiency, a novel two-stage retrieval strategy is proposed in this paper.It applies a coarse-grained scoring function with strong pruning ability to retrieve a set of candidate paths, which are then re-ranked by the original overall scoring function.The definition of the coarse-grained function still considers three ranking factors-node weight, visual coherence, and speed coherence-but in a different way.
Given a path P = F 1 → F 2 → • • • F m , we changed the aggregation operator from average to min to account for the effect of the node weights, i.e., ∑ m i=1 score(F i )/m be- came min score(F i ).As for visual coherence, we dropped the use of variance and instead used the interval length I v = [min v , max v ], where min v = min D v F i , F j and max v = max D v F i , F j .The coherence of the velocity was defined in a similar way, using another interval I s = [min s , max s ], where min s (max s ) was the minimum (maximum) of the velocity of all node pairs in the path.Ultimately, the path scores were still obtained from a linear combination of three factors: where norm(•) is calculated in the same way as score(P).

Path Refinement
Along the only path after merging, we checked all cameras' neighboring cameras in turn for possible missed target objects suspected of appearing, supplementing and refining them based on the results of the visual inspection.
Using the paths returned from the path inference algorithm, we proposed a refinement algorithm that improves recall by examining the original video frames to fill in those missing cameras.The inputs to the verification operation include the camera number c i , the expected time window [t s , t e ], the features of the query image F q , and a threshold value that determines whether two high-dimensional features point to the same vehicle.We set the value of to the maximum distance between F q and the top-k visual-match candidates.If c i was found to contain the same vehicle as the query image, we returned True.
In order to apply the verification operation on the already reasoned path F 1 → F 2 → • • • F m , two scenarios needed to be considered.In the first scenario, for 1 ≤ i ≤ m − 1, we checked whether there were missing cameras between F i and F i+1 .The method computed the shortest path between these two cameras and checked if there were other cameras deployed along that path.If such a camera existed, we applied the distribution information of the passage time between pairs of cameras that were distilled and stored offline to estimate the time window

R E T R A C T E D
[t s , t e ] for verification.If the verification operation returned True, we completed the camera into the path that had been reasoned out.In the second case, we checked whether the starting and ending cameras of the inferred path P needed to be extended.The average network distance between two neighboring cameras in P, denoted by r, was calculated and set as the radius of expansion.We retrieved the cameras whose network distance from F 1 was less than the radius r and applied the verification operation to these cameras.If no matching candidate could be found in these cameras, the expansion terminated.Otherwise, we selected the camera with the maximum number of matching frames and repeated the expansion step.
At this point, all modules of the trajectory recovery algorithm and their details had been introduced, and the pseudo-code of the complete algorithm flow was as shown in Algorithm 3. The input information included the query features, the road network, and the feature library obtained after processing the large-scale video downsampling.After all steps were terminated, the algorithm output a complete vehicle trajectory.

Experiments
We conducted experiments on two large-scale video datasets built to evaluate the performance of TRUST in terms of both effectiveness and efficiency.The entire track recovery query algorithm was implemented in Python and all experiments were performed on a server with 6TB of disk space, 40 CPU cores (2.30 GHz Intel Xeon CPU E5-2650), 2 GPUs (NVIDIA GTX 1080), and 256G of RAM.

Data Set
In this experiment, two datasets were generated to evaluate the performance of TRUST-Veri-SG and Carla-Big.Detailed information is shown in Table 1.Veri-SG: The specific synthesis steps are described in detail in Section 3.2.1.We used the road network from the Singapore-Taxi [38] dataset, where some cameras were deployed and distilled the corresponding camera network.Tracks of specific lengths (10,15,20,25) were selected among the cab tracks as the correctly labeled set for the query.The MTMC

R E T R A C T E D
dataset from AI City Challenge [43] was selected as the background video pool and the Veri [44] dataset was used as the query and insertion image pool, and the corresponding correctly labeled images were inserted on the randomly selected videos from the video pool, based on the trajectory information.
Carla-Big: Using a simulation dataset generated by the Carla [45] game engine, we used our own Big Town map as the base road network, on which 140 cameras were deployed.Using 16 different car models and random car body colors, a 5 min video of 150 cars passing on the road network was generated on a sunny background and 40 of them were as queries.

Comparison Method
The HMM algorithm in map matching was chosen as the baseline of this paper's algorithm, and two other variants were proposed in the trajectory recovery algorithm as the comparison algorithm.
HMM: The top-m matching cameras in the camera network were selected according to their importance scores [46], and the corresponding transfer probability maps (Directed Acyclic Graph) were created for them.Starting from the earliest vertex, HMM traversed each vertex in chronological order and calculated all possible paths from the previous vertex to that point based on the score formula (which was the same as in the TRUST algorithm), keeping the path with the highest score each time.The path with the highest score was kept each time until the latest point was passed and the corresponding optimal path was output as the result of trajectory recovery.
TRUST-fine: The original version of the trajectory recovery algorithm proposed, which applied variance to calculate the complete-path score and reason out the final trajectory.It included four modules: top-k, map-building, path-selection, and path-refinement.
TRUST-coarse: The accelerated version of the trajectory recovery algorithm proposed, which used visual and velocity intervals to calculate the score formula with monotonic properties and applied the corresponding pruning rules to accelerate.It contained five modules: top-k, graph-building, coarse-grained-selection, fine-grained-verification, and path-refinement.

Performance Metrics
To measure the accuracy of trajectory recovery, we referred to MIRIS [7] to use precision and recall as two performance metrics.Let T g be the sequence of correctly labeled cameras in ascending timestamp order and let T r be the sequence output by the algorithm.Let match be the number of correct (time-matched) cameras that co-occur in T g and T r , f p be the number of cameras that are only present in T r but not in T g , and f n be the number of cameras that are in T g but are missed by T r quantity.You then obtain: precision = match match + f p (13) recall = match match + f n (14) Query times: in terms of efficiency, we reported query latency, which mainly refers to the time it takes to raise a query until the inference path is returned.Query times were all evaluated in the CPU environment.

Experimental Results
In the Veri-SG dataset, we constructed 50 queries each with trajectory lengths of 10, 15, 20, and 25; network sizes ranging from 220 to 987 cameras; and video durations ranging from 8 to 15 min.There were two parameters: the number of images most similar to the query image k, and a score threshold δ used in building the similarity graph and path  It can be seen that with the increase in the trajectory length, the precision curve showed a trend of rising first and then falling.This was because the number of correct nodes increased and the mutual support became stronger.The algorithm judged whether a point should be added more strictly to the path.The recall curve continued to decline with the growth of the trajectory length, which could reflect the increasing difficulty of finding all the correct points.For the query time, as the trajectory length increased and the road network scale became larger, the scale became larger and larger and the corresponding search space also increased sharply, so the required inference time increased.
Compared with HMM, the TRUST proposed showed a greater advantage in accuracy within the acceptable range of time.The TRUST-fine was slightly better than TRUSTcoarse in both precision and recall, but when the data size increased significantly, the TRUST-coarse was able to reduce the time by more than half.From this, it can be seen that TRUST-coarse compared with TRUST-fine, the larger the data scale, the greater the degree of acceleration and the less the accuracy declined, which was within the acceptable range.
In the Carla-Big dataset, we constructed a road network with 140 cameras, and recorded videos of 150 vehicles driving on the road network, with a duration of 5 min and 41 queries.Among them, the lengths of correctly labeled vehicle trajectories were not uniform, as we could not control the driving route of the vehicles.Under the experimental setup of k = 100, δ = 0.6, the results are shown in Table 2.It can be seen that on this smaller dataset, the scale of top_k was correspondingly smaller, and the query time of the three algorithms decreased.The performance of HMM was acceptable in precision, but the recall was too low; the performance of the TRUSTcoarse and TRUST-fine algorithms proposed was close.On this dataset, the performance of the accuracy rate declined, because the length of the vehicle trajectory was It can be seen that with the increase in the trajectory length, the precision curve showed a trend of rising first and then falling.This was because the number of correct nodes increased and the mutual support became stronger.The algorithm judged whether a point should be added more strictly to the path.The recall curve continued to decline with the growth of the trajectory length, which could reflect the increasing difficulty of finding all the correct points.For the query time, as the trajectory length increased and the road network scale became larger, the scale became larger and larger and the corresponding search space also increased sharply, so the required inference time increased.
Compared with HMM, the TRUST proposed showed a greater advantage in accuracy within the acceptable range of time.The TRUST-fine was slightly better than TRUSTcoarse in both precision and recall, but when the data size increased significantly, the TRUST-coarse was able to reduce the time by more than half.From this, it can be seen that TRUST-coarse compared with TRUST-fine, the larger the data scale, the greater the degree of acceleration and the less the accuracy declined, which was within the acceptable range.
In the Carla-Big dataset, we constructed a road network with 140 cameras, and recorded videos of 150 vehicles driving on the road network, with a duration of 5 min and 41 queries.Among them, the lengths of correctly labeled vehicle trajectories were not uniform, as we could not control the driving route of the vehicles.Under the experimental setup of k = 100, δ = 0.6, the results are shown in Table 2.It can be seen that on this smaller dataset, the scale of top_k was correspondingly smaller, and the query time of the three algorithms decreased.The performance of HMM was acceptable in precision, but the recall was too low; the performance of the TRUSTcoarse and TRUST-fine algorithms proposed was close.On this dataset, the performance of the accuracy rate declined, because the length of the vehicle trajectory was uncontrollable and short (mostly around 5-7), and correct trajectories did not reflect a greater advantage in the score formula related to path length.showing great advantages.The results were similar to those for a trajectory length of 10 in the Veri-SG dataset.

Parameter Adjustment
The algorithm involved a total of two parameters: k, used to search for the number of images most similar to the query image, and a score threshold, δ, used in building the similarity graph and path selection module.In this section, we tune each parameter and show the corresponding experimental results.From Figure 6, we can see that as k grew, the precision decreased while recall rose and then decreased, and the query time increased significantly with the expansion of the search space.For the change of the accuracy rate, we analyzed that the possible reasons were that the number of correct candidate points was increasing with the initial growth of top-k, and some newly appeared correct nodes and some noisy points were connected to the trajectory at the same time, so the precision decreased but recall increased.uncontrollable and short (mostly around 5-7), and correct trajectories did not reflect a greater advantage in the score formula related to path length.showing great advantages.The results were similar to those for a trajectory length of 10 in the Veri-SG dataset.

Parameter Adjustment
The algorithm involved a total of two parameters: k, used to search for the number of images most similar to the query image, and a score threshold, δ, used in building the similarity graph and path selection module.In this section, we tune each parameter and show the corresponding experimental results.From Figure 6, we can see that as k grew, the precision decreased while recall rose and then decreased, and the query time increased significantly with the expansion of the search space.For the change of the accuracy rate, we analyzed that the possible reasons were that the number of correct candidate points was increasing with the initial growth of top-k, and some newly appeared correct nodes and some noisy points were connected to the trajectory at the same time, so the precision decreased but recall increased.Considering the small size of the Carla dataset, the interval [50, 200] with a step size of 50 was chosen for adjusting k.The direction of the time curve was consistent with that of the Veri-SG dataset in Figure 7.The overall trend of the two accuracy curves was consistent with Veri-SG but showed an increasing trend in the interval [50,100].This rising segment was easy to understand and was a reflection of an improvement in the number of correct candidate nodes.Considering the small size of the Carla dataset, the interval [50, 200] with a step size of 50 was chosen for adjusting k.The direction of the time curve was consistent with that of the Veri-SG dataset in Figure 7.The overall trend of the two accuracy curves was consistent with Veri-SG but showed an increasing trend in the interval [50,100].This rising segment was easy to understand and was a reflection of an improvement in the number of correct candidate nodes.uncontrollable and short (mostly around 5-7), and correct trajectories did not reflect a greater advantage in the score formula related to path length.showing great advantages.The results were similar to those for a trajectory length of 10 in the Veri-SG dataset.

Parameter Adjustment
The algorithm involved a total of two parameters: k, used to search for the number of images most similar to the query image, and a score threshold, δ, used in building the similarity graph and path selection module.In this section, we tune each parameter and show the corresponding experimental results.From Figure 6, we can see that as k grew, the precision decreased while recall rose and then decreased, and the query time increased significantly with the expansion of the search space.For the change of the accuracy rate, we analyzed that the possible reasons were that the number of correct candidate points was increasing with the initial growth of top-k, and some newly appeared correct nodes and some noisy points were connected to the trajectory at the same time, so the precision decreased but recall increased.Considering the small size of the Carla dataset, the interval [50, 200] with a step size of 50 was chosen for adjusting k.The direction of the time curve was consistent with that of the Veri-SG dataset in Figure 7.The overall trend of the two accuracy curves was consistent with Veri-SG but showed an increasing trend in the interval [50,100].This rising segment was easy to understand and was a reflection of an improvement in the number of correct candidate nodes.We further adjusted the threshold δ in building the similarity graph and path selection so that only edges or paths with scores above the threshold were able to enter the candidate queue.The test on Veri-SG is shown in Figure 8.We further adjusted the threshold δ in building the similarity graph and path selection so that only edges or paths with scores above the threshold were able to enter the candidate queue.The test on Veri-SG is shown in Figure 8.It can be seen that the effect of parameter δ on the accuracy results was small, and the corresponding curves of all three compared algorithms were close to the level, showing a strong robustness.The reason may be that the results of the scored paths appeared to be polarized, i.e., the correct paths had high scores while the noisy paths had low scores.In this case, the strategy of additional pruning with the monotonicity law on top of the score screening showed a greater advantage.Therefore, the changes in the time curves of HMM and TRUST-fine were small, but the curve corresponding to TRUSTcoarse decreased steadily.
In the Carla-Big dataset in Figure 9, the scores of correct and noisy paths were more mixed and the influence of this score threshold was greater, and the experimental results were more sensitive to its value.The corresponding curves for both precision and recall decreased sharply with increasing δ.The reason is that the scores of correct and noisy paths were just scattered in the interval, and the larger the δ was, the more stringent the filtering condition was.The decrease in the time curves was due to the limitation of δ, which substantially reduced the exploration space and, therefore, the corresponding inference delay.

Breakdown Analysis
In this section, we record the time of each module in the algorithm and analyze it.The TRUST-fine and TRUST-coarse methods were mainly selected.Considering that the path refinement part involved video reading, target detection, and feature extraction, we left aside the results of these modules for now.The corresponding experimental results on the two datasets are shown in Figures 10-13 It can be seen that the time distributions of each module for both algorithms were close when k varied, corresponding to the time profile in Figure 6.Among them, the time to search for visual candidates most similar to the first k using the high-dimensional index was very constant.In addition, as k increased, the overhead of computing visual, spatial, and temporal coherence between two pairs increased, which was reflected by a small increase in the top-k computation and graph building modules.On this basis, the exploration space of path selection was expanded, so the corresponding module time had a significant increase.It can be seen that the effect of parameter δ on the accuracy results was small, and the corresponding curves of all three compared algorithms were close to the level, showing a strong robustness.The reason may be that the results of the scored paths appeared to be polarized, i.e., the correct paths had high scores while the noisy paths had low scores.In this case, the strategy of additional pruning with the monotonicity law on top of the score screening showed a greater advantage.Therefore, the changes in the time curves of HMM and TRUST-fine were small, but the curve corresponding to TRUST-coarse decreased steadily.
In the Carla-Big dataset in Figure 9, the scores of correct and noisy paths were more mixed and the influence of this score threshold was greater, and the experimental results were more sensitive to its value.The corresponding curves for both precision and recall decreased sharply with increasing δ.The reason is that the scores of correct and noisy paths were just scattered in the interval, and the larger the δ was, the more stringent the filtering condition was.The decrease in the time curves was due to the limitation of δ, which substantially reduced the exploration space and, therefore, the corresponding inference delay.TRUST-coarse and TRUST-fine showed a large difference in variation, corresponding to the time curves in Figure 8.With k fixed, the times to search for the first k visual matches, to compute the two-two pairs in top-k, and to build the similarity graph were also very fixed.Then, when the score threshold of the fine-grained method was unable to have a large impact due to the data distribution, the coarse-grained method benefited from its additional monotonicity pruning strategy and showed a large advantage in time.
On the Carla-Big dataset, the pattern of the posterior images for k changes was similar to that of Veri-SG.However, both the coarse-grained and fine-grained strategies were affected more when the threshold δ was changed, which corresponded to the time profile shown in Figure 9.
In general, the times to search for the first k visual-matching candidates, calculate the coherence of all objects in top-k, and build the approximation graph were affected by the fluctuation of parameters, but the differences were small and more stable in the overall time.The path selection algorithm fluctuated greatly and was affected by the multiple influences of the top-k base, score formula evaluation, threshold screening, and monotonicity rule pruning, which had a strong influence in the algorithm and had more room for optimization.It can be seen that the time distributions of each module for both algorithms were close when k varied, corresponding to the time profile in Figure 6.Among them, the time to search for visual candidates most similar to the first k using the high-dimensional index was very constant.In addition, as k increased, the overhead of computing visual, spatial, and temporal coherence between two pairs increased, which was reflected by a small increase in the top-k computation and graph building modules.On this basis, the exploration space of path selection was expanded, so the corresponding module time had a significant increase.
fluctuation of parameters, but the differences were small and more stable in the overall time.The path selection algorithm fluctuated greatly and was affected by the multiple influences of the top-k base, score formula evaluation, threshold screening, and monotonicity rule pruning, which had a strong influence in the algorithm and had more room for optimization.TRUST-coarse and TRUST-fine showed a large difference in variation, corresponding to the time curves in Figure 8.With k fixed, the times to search for the first k visual matches, to compute the two-two pairs in top-k, and to build the similarity graph were also very fixed.Then, when the score threshold of the fine-grained method was unable to have a large impact due to the data distribution, the coarse-grained method benefited from its additional monotonicity pruning strategy and showed a large advantage in time.
On the Carla-Big dataset, the pattern of the posterior images for k changes was similar to that of Veri-SG.However, both the coarse-grained and fine-grained strategies were affected more when the threshold δ was changed, which corresponded to the time profile shown in Figure 9.

Conclusions and Future Work
In this paper, we proposed a complete-path-inference workflow.First, a similarity graph was constructed based on top-k visually matched candidates, and a scoring function for the overall path was proposed, taking into account the importance weights of the cameras, as well as the visual coherence and motion coherence among the candidate objects.To improve efficiency, a coarse-grained scoring function with monotonicity was proposed as a pruning strategy.The experimental results verified that the TRUST method proposed in this paper has good accuracy while taking efficiency into account.In general, the times to search for the first k visual-matching candidates, calculate the coherence of all objects in top-k, and build the approximation graph were affected by the fluctuation of parameters, but the differences were small and more stable in the overall time.The path selection algorithm fluctuated greatly and was affected by the multiple influences of the top-k base, score formula evaluation, threshold screening, and monotonicity rule pruning, which had a strong influence in the algorithm and had more room for optimization.

Conclusions and Future Work
In this paper, we proposed a complete-path-inference workflow.First, a similarity graph was constructed based on top-k visually matched candidates, and a scoring function for the overall path was proposed, taking into account the importance weights of the cameras, as well as the visual coherence and motion coherence among the candidate objects.To improve efficiency, a coarse-grained scoring function with monotonicity was proposed as a pruning strategy.The experimental results verified that the TRUST method proposed in this paper has good accuracy while taking efficiency into account.
Due to the limited resources of a real data source, it does not fully reflect the complex environment of real road scenes.In future work, we can further optimize the scoring formula by expanding larger datasets and reduce the computational overhead of path refinement to achieve further improvements in recall and query time.We will also focus on reducing the complexity of the calculation of the combination number in order to improve the efficiency of the actual application.We can try to apply the algorithm in the fields of missing-person tracking, suspicious-vehicle queries, security management prevention, etc., providing new technical ideas and support for smart-city construction and public-security governance.

Algorithm 1 :Figure 2 22 Figure 2 .
Figure 2 provides an example of injecting the query object (yellow car) into different video clips.The video database preserves the background complexity of the actual scene and the correctly labeled driving trajectories across the cameras follow the real transportation.The video composer proposed was based on real videos and was fast to generate.Sensors 2022, 22, x FOR PEER REVIEW 7 of 22

Figure 2 .
Figure 2. Example of vehicle image injection.

Figure 3 .
Figure 3. Distribution of passage time between two cameras.

Figure 3 .
Figure 3. Distribution of passage time between two cameras.
module.Video frames were processed with a downsampling frequency of 5 fps.Under the default setting of k = 300, δ = 0.6, the experimental results are shown in Figure5.Sensors 2022, 22, x FOR PEER REVIEW 15 of 22 path selection module.Video frames were processed with a downsampling frequency of 5 fps.Under the default setting of k = 300, δ = 0.6, the experimental results are shown in Figure 5.

4. 5 . 1 .
Variation in the Number of Visual Matches k First, the value of k corresponding to the first k visual matches was adjusted, and the result of this step, top-k, defined the search space for building similarity graphs and path selection frames.In the Veri-SG dataset, we adjusted the range of k to [100, 500] and the step size to 100, and the experimental results are shown below.

4. 5 . 1 .
Variation in the Number of Visual Matches k First, the value of k corresponding to the first k visual matches was adjusted, and the result of this step, top-k, defined the search space for building similarity graphs and path selection frames.In the Veri-SG dataset, we adjusted the range of k to [100, 500] and the step size to 100, and the experimental results are shown below.

Figure 6 .
Figure 6.Results of Veri-SG adjustment of k.

Figure 7 .
Figure 7. Results of Carla adjustment of k.

Figure 6 .
Figure 6.Results of Veri-SG adjustment of k.

4. 5 . 1 .
Variation in the Number of Visual Matches k First, the value of k corresponding to the first k visual matches was adjusted, and the result of this step, top-k, defined the search space for building similarity graphs and path selection frames.In the Veri-SG dataset, we adjusted the range of k to [100, 500] and the step size to 100, and the experimental results are shown below.

Figure 6 .
Figure 6.Results of Veri-SG adjustment of k.

Figure 7 .
Figure 7. Results of Carla adjustment of k.Figure 7. Results of Carla adjustment of k.

Figure 7 . 2 .
Figure 7. Results of Carla adjustment of k.Figure 7. Results of Carla adjustment of k.

Figure 9 .
Figure 9. Results of Carla tuning delta.Figure 9. Results of Carla tuning delta.

Figure 9 .
Figure 9. Results of Carla tuning delta.Figure 9. Results of Carla tuning delta.
In this section, we record the time of each module in the algorithm and analyze it.The TRUST-fine and TRUST-coarse methods were mainly selected.Considering that the path refinement part involved video reading, target detection, and feature extraction, we left aside the results of these modules for now.The corresponding experimental results on the two datasets are shown in Figures10-13 .

Figure 10 .
Figure 10.Module time of TRUST-fine on Veri-SG.Figure 10.Module time of TRUST-fine on Veri-SG.

Figure 12 .
Figure 12.Module time for TRUST-fine on Carla.Figure 12. Module time for TRUST-fine on Carla.

Figure 12 .
Figure 12.Module time for TRUST-fine on Carla.Figure 12. Module time for TRUST-fine on Carla.

Figure 13 .
Figure 13.Module time for TRUST-coarse on Carla.

Figure 13 .
Figure 13.Module time for TRUST-coarse on Carla.

1
Sort the candidate frames by ascending order of timestamps and denote them by F 1 , F 2 , • • • , F k ;

Table 1 .
Data set information.