Traffic safety detection method and system based on big data analysis
Through the traffic safety detection method based on big data analysis, the traffic situation fusion template is generated using the fusion characterization information and historical data sets of the traffic IoT data set, which solves the limitations of the existing traffic congestion detection methods in data fusion and dynamic changes, and achieves more accurate and efficient traffic congestion detection.
Patent Information
- Application Number
- CN202510231507.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-03-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing traffic congestion detection methods have limitations. A single data source is difficult to fully reflect the dynamic changes of the road network, the misjudgment rate is high, and the ability to model spatiotemporal correlation and the dynamic evolution of sensor data is lacking when dealing with heterogeneous data fusion, resulting in limited generalization performance in complex traffic situations.
The traffic safety detection method based on big data analysis is adopted, and the traffic situation fusion characterization information is mined by obtaining the traffic IoT data set to be detected, and the first fusion characterization information is generated. Based on this information index, multiple historical traffic IoT data sets matching the data set to be detected, a traffic situation fusion template is generated to detect traffic congestion levels.
It improves the accuracy and efficiency of traffic congestion detection, can more comprehensively reflect dynamic changes in the road network, reduce the misjudgment rate, enhance the generalization ability of complex traffic situations, and can dynamically adjust the detection strategy to improve matching efficiency.
Smart Images

Figure CN119723898A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and more specifically, to a traffic safety detection method and system based on big data analysis. Background Art
[0002] With the increasing complexity and intelligent demand of urban traffic systems, traffic safety detection technology based on the Internet of Things and big data has become a research focus in the field of traffic management. Traditional traffic congestion detection methods mainly rely on local data collection from a single sensor, combined with static threshold judgment or simple time series analysis to evaluate the congestion level. However, such methods have significant limitations. A single data source is difficult to fully reflect the dynamic changes of the road network, resulting in an increase in the misjudgment rate. Secondly, when dealing with heterogeneous data fusion, existing technologies often use simple feature splicing or weighted average strategies, lacking the ability to model the spatiotemporal correlation and dynamic evolution of sensor data, which limits the generalization performance of congestion detection models in complex traffic scenarios. In addition, traditional methods are insufficient in historical data matching and knowledge transfer. Most systems use fixed rules or static databases for historical pattern retrieval, and cannot dynamically adjust the retrieval strategy according to the real-time traffic status, resulting in low matching efficiency for historical similar scenarios. For example, when a sudden traffic accident causes local congestion, it is difficult for existing systems to timely associate historical cases with similar spatiotemporal distribution but different event causes, affecting the timeliness of warnings. Summary of the invention
[0003] In view of this, an embodiment of the present application provides a traffic safety detection method and system based on big data analysis.
[0004] According to one aspect of the present application, a traffic safety detection method based on big data analysis is provided, including: obtaining a traffic IoT data set to be detected, and performing fusion representation information mining on the traffic IoT data set to be detected to obtain first fusion representation information, wherein the first fusion representation information includes multiple data dimension representation information corresponding to multiple data dimensions respectively; indexing multiple historical traffic IoT data sets that match the traffic IoT data set to be detected based on the first fusion representation information, each of the historical traffic IoT data sets corresponding to a traffic congestion level mark; generating a traffic situation fusion template based on the second fusion representation information corresponding to each of the historical traffic IoT data sets and the traffic congestion level mark corresponding to each of the historical traffic IoT data sets, as well as the first fusion representation information of the traffic IoT data set to be detected; and detecting the traffic congestion level mark of the traffic IoT data set to be detected based on the traffic situation fusion template.
[0005] According to another aspect of the present application, a computer system is provided, comprising: a processor; and a memory, wherein the memory stores a computer-readable code, and when the computer-readable code is executed by the processor, the processor executes the method described above.
[0006] The present application obtains a traffic IoT dataset to be detected, and mines fused representation information of the traffic IoT dataset to be detected, generates first fused representation information covering representation information of multiple data dimensions, and indexes multiple historical traffic IoT datasets that match the traffic IoT dataset to be detected based on the first fused representation information. Each historical traffic IoT dataset corresponds to a traffic congestion level mark. The historical traffic IoT dataset contains rich reference information and provides valuable historical semantics for the detection of the traffic IoT dataset to be detected. A traffic situation fusion template is generated based on the second fused representation information corresponding to each historical traffic IoT dataset and the traffic congestion level mark corresponding to each historical traffic IoT dataset, as well as the first fused representation information of the traffic IoT dataset to be detected. Based on the traffic situation fusion template, congestion level detection is not limited to monotonous data, but is compared before and after through the marks and fused representation information of multiple historical traffic IoT datasets, so as to provide comparison information for detecting the traffic congestion level mark of the traffic IoT dataset to be detected, so as to efficiently and accurately detect the traffic congestion level mark of the traffic IoT dataset. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 It is a schematic diagram of the architecture of the application environment provided by this application; Figure 2 It is a flow chart of a traffic safety detection method based on big data analysis provided by this application; Figure 3 It is a structural diagram of a computer system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0008] In order to facilitate a clearer understanding of the present application, the application environment of the traffic safety detection method based on big data analysis of the present application is first introduced. Figure 1 As shown, the application environment may include a computer system 10 and a terminal cluster, and the terminal cluster may include one or more terminals, and the number of terminals is not limited here. Figure 1 As shown, the terminal cluster may specifically include terminal 1, terminal 2, ..., terminal n; it can be understood that terminal 1, terminal 2, terminal 3, ..., terminal n can all be connected to the computer system 10 through a network, so that each terminal can exchange data with the computer system 10 through the network connection.
[0009] It is understandable that the computer system 10 may refer to an electronic device that executes the method of the present application, for example, it may be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal may specifically refer to a vehicle-mounted terminal, various sensors (such as geomagnetic sensors, millimeter wave radars, vehicle flow sensors, vehicle speed sensors, etc.), but is not limited to this. Each terminal and server may be directly or indirectly connected via wired or wireless communication. At the same time, the number of terminals and computer systems may be one or at least two, and the present application does not limit this.
[0010] For further information, see Figure 2 , is a flow chart of a traffic safety detection method based on big data analysis provided by an embodiment of the present application. Figure 2 As shown, this method can be Figure 1 The computer system in the embodiment is used for execution, wherein the traffic safety detection method based on big data analysis may include the following steps: Step S100: obtaining a traffic IoT dataset to be detected, and performing fusion representation information mining on the traffic IoT dataset to be detected to obtain first fusion representation information, where the first fusion representation information includes multiple data dimension representation information corresponding to multiple data dimensions.
[0011] The goal of step S100 is to extract multi-dimensional fusion representation information from the traffic IoT data set to be detected, and provide a unified feature expression for subsequent traffic congestion level detection. The fusion representation information is, for example, a high-dimensional vector. The data dimension is the type or mode of the data, for example, it can be sensor data, spatiotemporal trajectory data, environmental data, etc. In the embodiment of the present application, the traffic IoT data of the target area can be collected in real time through the Internet of Things communication protocol to obtain the traffic IoT data set. The data sources include physical sensors deployed on the road, vehicle terminals, meteorological monitoring equipment and traffic management platforms; physical sensors, for example, include geomagnetic coils, millimeter wave radars and cameras, output time series data such as vehicle flow, vehicle speed, and vehicle model distribution; the vehicle terminal generates a longitude and latitude coordinate point set with a timestamp through the GPS module to form the vehicle spatiotemporal trajectory data; the meteorological monitoring equipment collects temperature, humidity, rainfall and visibility information; the traffic management platform provides structured data such as signal light phase and electronic road sign status. When the computer system performs fusion representation information mining on the above multimodal heterogeneous data, it can use a sliding time window mechanism to divide the original data stream into multiple data subset sequences, each subset covers a fixed time length (such as 5 minutes), and perform standardized preprocessing on each subset to eliminate dimensional differences. For sensor data, the computer system uses a time series convolutional network to extract local fluctuation features, and its convolution kernel weight matrix Acting on a time window (k is the window size, d is the sensor dimension), output feature vector ,in is the bias term; for spatiotemporal trajectory data, the graph attention network is used to model the vehicle interaction relationship, and the node feature update formula is ,in represents the attention weight between vehicle i and its neighbor vehicle j, is the set of neighboring nodes of vehicle i, is the shared weight matrix, is the activation function is the feature vector of the neighboring vehicle; the environmental data is converted into a low-dimensional dense vector through the embedding layer, for example, the rainfall intensity value is mapped to ,in is the pre-trained embedding matrix. The computer system uses the cross-modal alignment loss function Constrain the feature space consistency of the outputs of encoders of different modalities, and They are sensor encoder and track encoder respectively. are the sensor and trajectory data samples in the same time window, and N is the number of samples. The fusion representation information finally generated is the weighted splicing result ,in is a learnable modal weight parameter optimized by back propagation; for example, the fusion representation of a certain intersection during the morning rush hour may include the vehicle flow peak feature h in the sensor dimension sensor = [120 vehicles / minute, 25km / h], vehicle aggregation characteristics in trajectory dimension h trajectory = [0.78,0.92] (representing trajectory density and speed variance), rainfall characteristics in the environmental dimension h environment = [0.35, 0.67]. The computer system uses a distributed stream processing framework (such as Apache Flink) to perform window processing on real-time data streams. Each window triggers a feature extraction and fusion calculation. In the feature aggregation stage, the maximum pooling operation is used to filter the significant features in each data subset. The formula is , where T is the set of time steps in the window. The dynamic feature alignment module projects the sensor features into the trajectory feature space through a pre-trained multi-layer perceptron. The projection function is ,parameter Pre-trained via cross-modal contrastive learning.
[0012] Step S200: multiple historical traffic IoT data sets are matched with the traffic IoT data set to be detected according to the first fusion representation information index, and each historical traffic IoT data set corresponds to a traffic congestion level mark.
[0013] Step S200 retrieves historical traffic IoT datasets with similar features to the current detection scene from the historical database through the first fusion representation information generated in step S100, providing a reference for subsequent traffic congestion level detection. The computer system uses a multimodal feature matching mechanism to achieve efficient retrieval based on the pre-built historical traffic dataset index library: the first fusion representation information is used as the retrieval input, which is essentially an abstract expression of the multi-dimensional features of the traffic IoT dataset to be detected, covering the fusion semantics of sensor data, spatiotemporal trajectory data and environmental data; the historical traffic IoT dataset index library stores a large amount of fusion representation information of historical scenes and their corresponding traffic congestion level marks, which include but are not limited to discrete levels or continuous numerical scores such as "unblocked", "mild congestion", "moderate congestion" and "severe congestion". The computer system calculates the similarity measurement value between the first fusion representation information and the fusion representation information of each sample in the historical dataset, selects the historical dataset whose similarity exceeds the preset threshold as the candidate set, and selects the Top-K most relevant samples as the matching results according to the similarity sorting. The similarity measurement function adopts the weighted Euclidean distance model, and the formula is: ; in Represent the feature vectors of sensor, trajectory, and environment dimensions respectively, is a configurable weight coefficient that satisfies For example, in a scenario that emphasizes real-time traffic flow analysis, you can set To give sensor data a higher weight. The computer system accelerates the similarity calculation of large-scale historical data through a distributed indexing engine. The indexing engine uses a tree structure (such as KD-Tree) or a graph structure (such as NSW) to organize high-dimensional feature vectors and supports approximate nearest neighbor search to balance accuracy and efficiency. During the retrieval process, the system dynamically adjusts the similarity threshold to adapt to the traffic characteristics of different regions and time periods: for example, during the morning rush hour in the core area of the city, due to the drastic changes in traffic conditions, the threshold is set to 0.8 to screen highly similar historical cases; while during the off-peak period in the suburbs, the threshold is reduced to 0.6 to include more reference samples. In order to improve the diversity of retrieval results, the computer system introduces a multimodal cross-validation mechanism: if the concentration of matching results in a single dimension (such as sensor data) is too high, the system automatically increases the weight coefficients of other dimensions (such as trajectory data), triggering a secondary search to expand the coverage of the candidate set. The historical data set index library is regularly updated through offline batch processing, and the newly added data is incrementally added to the index structure after being processed by the isomorphic fusion representation in step S100, ensuring that the system can continuously learn the latest traffic patterns. For example, when the first fusion representation information of the data set to be detected reflects that the traffic volume at a certain intersection has dropped by 60% within 10 minutes, the average speed has dropped to 15km / h, and the trajectory data shows that multiple vehicles frequently change lanes, the computer system retrieves a data set with similar characteristics from the historical database (such as a 55% drop in traffic volume, a speed of 18km / h, and a high frequency of lane changes), and its label may be "accident-induced congestion". The problem of feature dimension differences needs to be solved in technical implementation. The computer system unifies the scale of multimodal features through a normalization layer, such as using the Z-Score normalization formula The sensor data is mapped to a zero-mean unit variance space, and the maximum and minimum normalization is used to compress the trajectory features to the [0,1] interval. To deal with data sparsity, the system introduces a feature interpolation model based on the attention mechanism to repair missing or noisy data. The interpolation weights are learned through historical data distribution. The computer system evaluates the credibility of the retrieval results by defining an interpretability score. The scoring formula is , where D i is the distance between the i-th candidate sample and the target, D max is the maximum distance of the candidate set, L i is the confidence of the sample label (such as historical detection accuracy), and K is the number of candidate samples; when the score is lower than the threshold, an alarm is triggered, indicating that manual review or additional testing is required. The multi-dimensional visualization module of the retrieval results will compare and display the sensor waveforms, trajectory heat maps and environmental parameters of the matching historical cases to assist operation and maintenance personnel in understanding the basis for system decision-making.
[0014] Step S300: Generate a traffic situation fusion template based on the second fusion representation information corresponding to each historical traffic IoT data set and the traffic congestion level mark corresponding to each historical traffic IoT data set, and the first fusion representation information of the traffic IoT data set to be detected.
[0015] Step S300 retrieves multiple historical traffic IoT data sets and their associated traffic congestion level marks obtained in step S200, and combines the first fusion representation information of the data set to be detected to construct a traffic situation fusion template that can guide real-time detection. The computer system semantically aligns and structurally combines the sensor data representation, spatiotemporal trajectory representation, and environmental state representation contained in the historical data set with the features of the current detection scene through multimodal feature fusion and dynamic context coding technology to form a unified input template containing historical reference cases and real-time detection data. The essence of the traffic situation fusion template is a machine-parseable symbolic sequence, and its structure follows predefined grammatical rules: historical reference cases are organized in the form of "input-output" pairs, the input part is the second fusion representation information of the historical data set (including multi-dimensional features such as sensors and trajectories), and the output part is the corresponding traffic congestion level mark; the real-time detection data is placed at the end of the template as the input part to be inferred, guiding the model to perform analogical reasoning based on historical patterns. The computer system eliminates the modal differences and timing deviations between historical data and real-time data through a dynamic feature alignment module. For example, dynamic time warping (DTW) is performed on the time series of sensor data to match historical records with different sampling frequencies. The calculation formula is: , where Q and C are two time series, \pi is the alignment path; the spatial similarity measurement based on Hausdorff distance is used for spatiotemporal trajectory data, and the formula is , where A and B are two trajectory point sets, and d(a,b) is the Euclidean distance. After the computer system maps the second fusion representation information of the historical data set and the first fusion representation information of the real-time data into the same semantic space, it constructs a template sequence through separator markers (such as "[HIST]" for historical blocks and "[CURRENT]" for real-time blocks), for example: "[HIST] Sensor features: [0.6, -0.2, 0.8] Trajectory features: [0.5, 0.7] Environmental features: [0.3] → Congestion level: 3 [ / HIST] [HIST] Sensor features: [0.5, -0.3, 0.7] Trajectory features: [0.6, 0.65] → Congestion level: 2 [ / HIST] [CURRENT] Sensor features: [0.58, -0.25, 0.78] Trajectory features: [0.55, 0.68] → ?". In this process, the computer system uses the attention weight mechanism to assign influence weights to different historical cases. The weight calculation function is: ,in Score the match between the i-th historical data set obtained in step S200 and the current data, is the temperature coefficient (e.g. =0.1), the features of high-weight historical cases will be encoded preferentially in the template. To enhance the spatiotemporal consistency of the template, the computer system introduces a contextual state encoding layer, embedding environmental parameters such as the time period (such as morning rush hour), weather (such as rainfall), and road conditions (such as construction) of the current detection scene into a dense vector and concatenating it with the feature vector. The embedding formula is: ,in is the time period embedding vector, is the weather embedding vector, is the road state embedding vector, Represents a vector concatenation operation. The computer system uses a template compression algorithm to remove redundant historical cases. For example, historical data sets with similarities exceeding a threshold (such as 0.95) are clustered and only the samples with the highest matching scores in each class are retained. The clustering distance function is defined as ,in is the sensor feature cosine similarity, is the Euclidean distance of trajectory features, is the clustering weight coefficient (such as The traffic situation fusion template generated finally is transmitted to the detection module through a distributed message queue (such as Kafka). Its binary serialization format includes a protocol header, a feature block, a marker block, and a checksum. The protocol header stores the template version number, timestamp, and data source identifier. The feature block stores multimodal feature vectors in a columnar storage structure to optimize reading efficiency. For example, when the first fused representation information of the data set to be detected shows that the traffic volume at a certain intersection dropped by 70% within 15 minutes, the average speed dropped to 10 km / h, and the number of emergency brakes in the trajectory data reached 12 times / minute, the computer system may generate the following template: "[HIST] sensor:[0.68,-0.18,0.72]traj:[0.48,0.82]env:[0.25]→Level4[ / HIST] [HIST]sensor:[0.65,-0.22,0.75]traj:[0.52,0.78]→Level3[ / HIST] [CURRENT]sensor:[0.67,-0.20,0.73] traj:[0.50,0.80]→?", where the historical case Level 4 corresponds to "major accident causing paralysis" and Level 3 corresponds to "multiple vehicles rear-ending causing congestion". The timeliness of historical data needs to be addressed during technical implementation, and the computer system defines the weight of data freshness ,in is the age of the i-th historical dataset (in days), is the attenuation coefficient (e.g. = 0.05), the freshness weight and the matching score weighted to get the final influence weight , ensuring that recent data is given higher priority. The computer system prevents memory overflow by defining a template capacity threshold (such as a maximum of 20 historical cases). When the candidate historical data exceeds the threshold, press w i 'Descending truncation. The cross-region template migration module allows optimized templates from other regions (such as high-density vehicle flow detection templates in traffic hubs) to be loaded into the current system. During the migration process, the domain adaptation loss function is used Align feature distribution, where is the mean and variance of the source region template feature, Corresponding statistics of real-time data in the target area.
[0016] Step S400: Detect the traffic congestion level mark of the traffic IoT data set to be detected based on the traffic situation fusion template.
[0017] Step S400 uses the traffic situation fusion template generated in step S300 to accurately detect the traffic congestion level of the traffic IoT dataset to be detected, and outputs the target traffic congestion level label. Based on the pre-trained traffic congestion level detection network, the computer system uses the fusion template representation information set as the dynamic context input to achieve end-to-end mapping of multimodal features to congestion levels. The architecture of the traffic congestion level detection network adopts a Transformer-based multi-head attention mechanism, and its input sequence consists of historical reference case blocks and real-time detection data blocks. The historical block contains the second fused representation information and its label of the historical dataset retrieved in step S200, and the real-time block contains the first fused representation information of the dataset to be detected; the network captures the correlation pattern between historical cases and real-time data through the self-attention layer, and the calculation formula is: , where Q is the real-time data feature matrix, K and V are historical case feature matrices, and d k is the feature dimension. The computer system injects spatiotemporal information through learnable position encoding, and the encoding formula is , where pos is the position of the data block in the sequence and i is the dimension index, ensuring that the model perceives the temporal relationship of the input sequence. The output layer of the detection network uses the Softmax function with a temperature coefficient to generate the probability distribution of the congestion level, and the formula is ,in is the logit value of category c (e.g., congestion levels 1-5), is the temperature parameter (such as =0.5), which is used to adjust the smoothness of the prediction confidence. The computer system integrates the label information of historical reference cases by defining a dynamic weight fusion strategy: the contribution weight of each historical case is determined by its matching score with the real-time data. and timeliness factor Jointly decided, the calculation formula is ,in , is the age of the historical dataset (in hours), is the decay rate (e.g. =0.01). The computer system ensures the reliability of the test results by defining a multi-level verification mechanism: the primary test results are directly generated by the network, and the secondary verification module calculates the anomaly score based on the characteristic deviation between real-time data and historical cases. , if A exceeds the threshold (such as A>0.7), the auxiliary decision-making process based on the rule engine is triggered, and the predefined conditional logic in the rule base (such as "traffic flow <20 vehicles / minute and speed >60km / h→equipment failure") will cover the network output. The interpretability of the detection results is achieved through attention weight visualization: each congestion level mark output by the model is associated with a set of attention weight vectors, indicating which historical cases and feature dimensions have the greatest impact on the decision. For example, in a certain detection, the attention weight is concentrated on the sensor feature dimension (weight 0.62) of the historical case H023 (labeled "severe congestion"), indicating that the current detection result is mainly driven by historical events such as abnormal sensor readings. Optimize detection latency by deploying an edge-cloud collaborative computing architecture: edge nodes perform feature extraction and template construction, and the cloud completes large-scale model inference. The two parties synchronize model parameter updates through a differential privacy protocol. The parameter synchronization formula is ,in is the learning rate, is the gradient update amount. In order to respond to sudden traffic events (such as traffic accidents and large-scale events), the computer system can dynamically load domain adaptation plug-ins. The plug-ins contain historical case libraries and feature encoders for specific scenarios, and are integrated with the main system through interface protocols. For example, after the "traffic accident detection plug-in" is loaded, the template construction phase will prioritize the retrieval of historical data containing sudden braking and trajectory deviation features, and the output layer of the detection network will be expanded to a multi-task prediction head containing accident types. The problem of category imbalance needs to be solved during technical implementation. The computer system uses the focal loss function (Focal Loss) to adjust the training weights. The formula is: ,in is the weight coefficient of category c, is the focus parameter (such as =2), in order to improve the detection sensitivity of rare congestion levels (such as "extreme congestion"). The post-processing module of the detection results smoothes the output fluctuations through the time sliding window. The weighted average formula of the continuous detection results in the window is: ,in is an exponential decay weight (e.g. =0.1), T is the window size (such as T=5), to avoid level jumps caused by transient noise.
[0018] As an implementation manner, in step S100, the fusion representation information mining is performed on the traffic IoT dataset to be detected to obtain the first fusion representation information, including: Step S110: extracting multiple data subsets from the traffic IoT data set to be detected, and dividing the multiple data subsets into multiple data subset sequences; Step S120: sampling a target data subset from a plurality of data subset sequences, extracting sensor representation information from the target data subset, and obtaining first sensor data representation information; Step S130: obtaining first spatiotemporal trajectory data corresponding to the traffic IoT data set to be detected, and extracting spatiotemporal trajectory representation information from the first spatiotemporal trajectory data to obtain first spatiotemporal trajectory representation information; Step S140: obtaining first fusion representation information according to the first sensor data representation information and the first spatiotemporal trajectory representation information.
[0019] As mentioned above, the goal of step S100 is to extract multi-dimensional fusion representation information from the traffic IoT data set to be detected, and provide a unified feature expression for subsequent traffic congestion level detection. The computer system collects traffic IoT data of the target area in real time through the Internet of Things communication protocol (such as MQTT, CoAP). The data sources include physical sensors deployed on the road (geomagnetic coils, millimeter wave radars, cameras), vehicle terminals (GPS trajectories, OBD status), meteorological monitoring equipment (temperature and humidity, visibility) and traffic management platforms (signal phase, electronic road sign information). The original data is stored in a distributed database (such as Apache Kafka) in the form of time series. Each data point contains a timestamp, device ID, value type (flow, speed, vehicle model, etc.) and original reading. When the computer system mines the fusion representation information of the above multimodal heterogeneous data, the sliding time window mechanism is used to divide the original data stream into multiple data subset sequences. Each subset covers a fixed time length (such as 5 minutes), and the window step size is configurable (such as 1 minute overlap). The data in the window is pre-processed by standardization to eliminate dimensional differences. For vehicle-mounted GPS trajectory data, the computer system maps the longitude and latitude coordinates to discrete grid units (e.g., 50 m × 50 m) through spatial gridding. The grid coding formula is: ,in is the grid side length, and N is the number of grids in the latitude direction, so that the continuous trajectory is discretized into a grid sequence.
[0020] In step S110, the computer system extracts multiple data subsets from the original data stream according to a preset time window, each subset contains synchronized slices of sensor data, trajectory data and environmental data. For example, the data subset within the time window 08:00-08:05 includes: the traffic flow sequence output by the geomagnetic coil [115, 118, 122, 119, 117] vehicles / minute, the millimeter wave radar speed measurement sequence [45, 43, 40, 38, 35] km / h, the vehicle type distribution recognized by the camera [sedan: 70%, truck: 20%, bus: 10%], and the GPS trajectory point set of 50 vehicles in this period. After the data subset division is completed, the computer system selects the target data subset through random sampling or active sampling strategy based on significance detection. For example, when the variance of sensor data in a certain window exceeds a threshold (such as ), it is determined as a significant window and is sampled first. The sampling probability calculation formula is: ,in is the variance of each window.
[0021] In step S120, the computer system extracts sensor representation information from the target data subset and uses a temporal convolutional network (TCN) to capture the local fluctuation pattern of the sensor data. The network structure includes two layers of one-dimensional convolution (kernel size 3, number of channels 32→64) and a global maximum pooling layer. The convolution operation formula is: ,in is the convolution kernel of the lth layer, is a sliding window of the input sequence, is the bias term; for example, after convolution of the geomagnetic coil flow sequence [115, 118, 122, 119, 117], the output feature vector .
[0022] In step S130, the computer system extracts spatiotemporal trajectory data from the target data subset, first removes redundant points using a trajectory compression algorithm (such as Douglas-Peucker), with the compression threshold set to 0.5 meters, and then uses a graph attention network (GAT) to model the spatial interaction relationship between vehicles. The node feature update formula is: ,in is the attention coefficient, a is the learnable parameter vector, Represents vector concatenation; for example, a vehicle trajectory point set is processed by GAT to generate a trajectory feature vector , characterizing its path stability, speed fluctuation, and interaction intensity with other vehicles. Environmental data (such as weather and road conditions) are converted into low-dimensional dense vectors through the embedding layer. The embedding matrix is obtained through pre-training. For example, the rainfall intensity "2.5mm / h" is mapped to v_{rain} = [0.4, -0.1, 0.6].
[0023] In step S140, the computer system uses a cross-modal alignment loss function Constrain the spatial consistency of sensor data representation information and spatiotemporal trajectory representation information, where They are sensor data encoder and spatiotemporal trajectory data encoder, are the sensor and trajectory data samples in the same time window, and N is the number of samples; the aligned features are weighted concatenated to generate the first fusion representation information , weight Dynamic calculation through the attention mechanism: , where q is the learnable query vector, is the weight matrix. For example, the fusion representation of a certain intersection during the morning rush hour may include the vehicle flow peak feature h in the sensor dimension sensor = [0.7, -0.3, 1.2], vehicle clustering feature h in trajectory dimension trajectory = [0.8, -0.2, 0.5], rainfall characteristics of environmental dimension h environment = [0.4, -0.1, 0.6], the dynamic weight is calculated as , the final fusion feature F = [0.42, -0.18, 0.72, 0.24, -0.06, 0.15, 0.04, -0.01, 0.06]. In the technical implementation, the computer system uses Apache Flink to implement window processing and feature extraction of real-time data streams, and the feature alignment module optimizes the encoder parameters through the automatic differentiation mechanism. For the problem of missing data, the system introduces an interpolation model based on bidirectional LSTM, inputs the historical context window (such as the data before and after 10 minutes) to predict the current missing value, and the loss function is ,in Weigh the predicted value and gradient smoothness. The dynamic weight calculation module captures cross-modal dependencies through a multi-head attention mechanism. The number of heads is set to 4. Each head calculates the weight independently and then splices and fuses through a fully connected layer. The storage of fused representation information adopts a columnar compression format (such as Parquet), where each column corresponds to a feature dimension, and adds timestamps, location codes, and data source metadata for subsequent retrieval and visualization.
[0024] As an implementation method, the first fusion representation information includes target sensor representation information and first spatiotemporal trajectory representation information. Then, step S200, based on the first fusion representation information index, multiple historical traffic IoT datasets that match the traffic IoT dataset to be detected include: Step S210: obtaining a pre-deployed sensor representation information index set and a spatiotemporal trajectory representation information index set, wherein the sensor representation information index set includes matching results between each standby traffic IoT data set and the sensor representation information corresponding to the standby traffic IoT data set, and the spatiotemporal trajectory representation information index set includes matching results between each standby traffic IoT data set and the spatiotemporal trajectory representation information corresponding to the standby traffic IoT data set; Step S220: indexing the sensor representation information index set and the spatiotemporal trajectory representation information index set respectively according to the target sensor representation information, and indexing the sensor representation information index set and the spatiotemporal trajectory representation information index set respectively according to the first spatiotemporal trajectory representation information, to obtain a plurality of target candidate traffic IoT data sets matching the traffic IoT data set to be detected; Step S230: determining a historical traffic IoT dataset from among the multiple target standby traffic IoT datasets based on a dataset commonality measure between the multiple target standby traffic IoT datasets and the traffic IoT dataset to be detected.
[0025] As mentioned above, the goal of step S200 is to retrieve historical traffic IoT datasets with similar characteristics to the current detection scene from the historical database through the first fusion representation information generated in step S100, so as to provide a reference for subsequent traffic congestion level detection. The computer system uses multimodal cross-retrieval and dynamic weight fusion strategies to achieve efficient matching based on the pre-built sensor representation information index set and spatiotemporal trajectory representation information index set. The sensor representation information index set stores the sensor feature vectors of all standby historical datasets and their corresponding traffic congestion level tags. Each entry contains a sensor feature code (such as the mean value of geomagnetic coil flow, radar speed measurement variance), a timestamp, a geographic location code, and an associated traffic event label; the spatiotemporal trajectory representation information index set stores the trajectory feature vectors of the standby dataset (such as vehicle path complexity, emergency braking frequency, speed distribution entropy value) and metadata of the same dimension. The computer system manages the index set through a distributed vector database (such as Milvus), and uses shard storage and parallel query mechanism to optimize retrieval efficiency. Each shard corresponds to a specific time range or geographical area. For example, shard 01 stores historical data of the core area of City A in 2023, and shard 02 stores data of the suburbs of City B in 2023. In step S210, the computer system loads the index set from the persistent storage. Step S220 performs multimodal cross retrieval, for example, including four retrieval paths: 1) Sensor→Sensor: The target sensor representation information is stored in the shard 01. All candidate sensor features in the sensor index set To calculate the cosine similarity, the formula is: , return the Top-K similar candidate data set; 2) Trajectory → Trajectory: represent the target trajectory information Calculate the Euclidean distance with the candidate trajectory features in the trajectory index set , return the Top-K nearest neighbor candidate data set; 3) Sensor → trajectory: convert the target sensor features The cross-modal similarity calculation is performed with the candidate trajectory features in the trajectory index set. The formula is: ,in is the learnable weight matrix, Represents vector concatenation; 4) Trajectory → Sensor: Transform the target trajectory features Reverse cross-modal retrieval is performed with candidate sensor features in the sensor index set, and the similarity calculation method is the same as The four-way search results are merged to form the initial candidate set. The computer system removes duplicate candidate data sets through Bloom Filter. The hash function group of Bloom Filter is set to , where seed i is the random seed, m is the length of the bit array, and the misjudgment rate is calculated by the formula Controlled below 1%, where k represents the number of hash functions used in the Bloom filter. Each element will be mapped to a different position in the bit array by k different hash functions; m represents the length of the bit array in the Bloom filter, and n represents the number of elements that have been inserted into the Bloom filter.
[0026] In step S230, the computer system calculates the multi-dimensional matching score between each candidate data set in the candidate set and the current detection scene. The scoring model integrates four dimensions: sensor similarity, trajectory similarity, spatiotemporal proximity, and environmental consistency: sensor similarity weight Determined by the confidence of the target sensor feature (such as the geomagnetic coil data quality score), the calculation formula is ,in is the data quality assessment value; trajectory similarity weight Depending on the completeness of the trajectory features (such as GPS trajectory point coverage), it is calculated as , is the number of valid trajectory points, is the total number of valid trajectory points; spatiotemporal proximity The model is modeled by the space-time attenuation function, and the formula is ,in is the time difference (hours), is the geographical distance (km), is the attenuation coefficient; environmental consistency The classifier is used to determine the matching degree between the candidate data set and the current environmental parameters (weather, road conditions). If they are completely consistent, =1, otherwise it decreases according to the number of different items. Final matching score ,in is the maximum trajectory distance in the candidate set. For example, the sensor similarity between a candidate dataset and the current detection scene =0.85 (data quality q=0.8 so = 0.7), trajectory distance =0.3 (trajectory integrity =0.9, =1.2), space-time proximity =0.6 (time difference 2 hours, distance 5 kilometers), environmental consistency = 0.8 (same weather but different road conditions), then The computer system sorts the candidate sets in descending order according to the score S and sets a dynamic threshold ( is the average score, is the standard deviation, k=1.5) to filter out the final historical traffic IoT dataset, such as the average score of the candidate set =2.0, standard deviation =0.5, then =2.0-1.5×0.5=1.25, all The candidate data set is selected. In the technical implementation, the computer system uses locality sensitive hashing (LSH) to perform fast approximate retrieval of high-dimensional feature vectors. The LSH hash function is defined as , where w is a random Gaussian vector, b is the intercept of the uniform distribution, and r is the bucket width; by building a multi-layer hash table (such as 3 layers, each layer contains 50 hash functions), the recall rate and computational overhead are balanced. The interpretability of the retrieval results is achieved through feature contribution analysis. The contribution of each dimension to the matching score is calculated as , such as sensor similarity contribution , trajectory similarity contribution , thereby helping operation and maintenance personnel understand the matching logic. The computer system filters out obviously irrelevant candidate data sets by defining spatiotemporal constraint rules, such as excluding historical data that is more than 50 kilometers away from the current detection scene or has a time difference of more than 30 days, while allowing administrators to dynamically adjust constraint thresholds through the configuration interface. During the retrieval process, the system monitors the hardware resource usage (such as GPU memory, CPU load) in real time. If resources are tight, it will automatically downgrade to single-mode retrieval (only using sensor → sensor path) to ensure real-time performance, and record the downgrade event through logs for subsequent analysis. For example, when the first fused representation information of the data set to be detected contains the sensor feature h sensor =[0.6, -0.2, 0.8] (corresponding to medium to high traffic, low speed, and high proportion of trucks) and trajectory characteristics h traj=[0.5, 0.7] (low path stability, high frequency of emergency braking), the computer system retrieves the candidate data set H042 (h sensor =[0.58, -0.18, 0.79], label “moderate congestion”), and retrieve the candidate dataset H087 (h traj =[0.48, 0.72], label “severe congestion”), cross-modal retrieval found H155 (sensor feature h sensor =[0.5, -0.3, 0.7] and trajectory feature h traj =[0.6, 0.65] highly matched), after scoring calculation, H042 scored 2.8, H087 scored 2.5, and H155 scored 2.6, all exceeding the threshold S th =1.25, so all three are selected as historical transportation IoT datasets.
[0027] As an implementation mode, the multiple target standby traffic IoT datasets include multiple target standby traffic IoT datasets obtained by indexing each indexing mechanism. Based on this, step S230, according to the dataset commonality measurement between the multiple target standby traffic IoT datasets and the traffic IoT dataset to be detected, determines the historical traffic IoT dataset in the multiple target standby traffic IoT datasets, including: Step S231: obtaining multiple target standby traffic IoT datasets for each indexing mechanism index, and determining a matching score between the traffic IoT dataset to be detected and each target standby traffic IoT dataset; Step S232: for each target standby traffic IoT dataset, determining the average matching score between the target standby traffic IoT dataset and the traffic IoT dataset to be detected in each index mechanism; Step S233: determining a historical traffic IoT dataset from a plurality of target standby traffic IoT datasets according to the matching score average.
[0028] The goal of step S230 is to select the historical traffic IoT dataset that is most relevant to the current detection scenario from the candidate set through a multi-dimensional matching scoring mechanism. After the computer system loads the index set in step S210 and completes the multi-modal cross-search in step S220, it obtains the initial candidate set (that is, a set consisting of multiple target candidate traffic IoT datasets, such as 100 candidate datasets), and needs to further determine the final historical dataset through refined scoring and sorting.
[0029] In step S231, the computer system calculates the multimodal matching score between each candidate data set and the data set to be detected. The scoring model integrates four dimensions: sensor feature similarity, trajectory feature similarity, spatiotemporal proximity, and environmental consistency. The specific formula is: ,in is the cosine similarity of sensor→sensor paths, is the normalized Euclidean similarity of trajectory→trajectory path (calculated as ), are the cross-modal similarity of sensor→trajectory and trajectory→sensor paths, and the weight coefficient Trained through historical data, ; For example, the similarities of a candidate dataset in four-way retrieval are , the weight configuration is , then the total score The computer system dynamically adjusts the weight coefficient to adapt to different scenarios: when the sensor data is unreliable due to equipment failure, the and improve and , for example, set , making the system more dependent on trajectory data; in severe weather conditions, it increases To enhance the environmental consistency weight.
[0030] In step S232, the computer system calculates the average influence score of each candidate data set in all search paths. The influence score reflects the stability of the data set in different modes. The calculation formula is: ,in is the set of retrieval paths, s p is the similarity of path p, is the standard deviation of the similarity of the candidate set on path p; for example, if the similarity of a dataset in four-way retrieval is ,The high score indicates that the dataset performs stably under multi-modality.
[0031] In step S233, the computer system calculates the weighted total score of the comprehensive score S and the influence score I. Sort the candidate sets with weight w S and w I Determine by grid search optimization (such as w S =0.7, w I =0.3), and finally the Top-K candidate datasets are selected as the historical traffic IoT datasets. The threshold K is adaptively adjusted according to the density of the candidate set. The density calculation formula is: ,in is the mean and standard deviation of the total score T of the candidate set. When D>0.5, K is increased to cover more potential patterns, and vice versa, K is reduced to improve the screening strictness. The computer system adopts a double-layer filtering mechanism: first, based on the comprehensive score S, the candidates below the dynamic threshold are eliminated. The candidate dataset ( is the mean and standard deviation of the candidate set score), and then sort the remaining data sets by total score T to select Top-K; for example, there are 100 data sets in the candidate set, ,but After removing 30 datasets with S<0.45, T is calculated for the remaining 70 and the top 10 are selected. The computer system handles candidate datasets with the same score by defining a conflict resolution strategy: the dataset with a closer timestamp is preferred; if the timestamps are the same, the dataset with a closer geographical location is selected. The interpretability of the retrieval results is achieved through the feature contribution heat map, and the contribution of each dimension to the total score T is calculated as , for example, the contribution of sensor feature dimension j , using visualization tools to display the impact of each dimension. For example, when the first fusion representation information of the dataset to be detected is h sensor =[0.6, -0.2, 0.8], h traj =[0.5, 0.7], the sensor feature of a historical data set H042 in the candidate set is h sensor =[0.58, -0.18, 0.79], the trajectory feature is h traj =[0.48, 0.72], and we get s ss =0.98 (cosine similarity), s tt =0.95 (normalized Euclidean similarity), s st =0.82, s ts =0.85, weight ,but ; In the calculation of influence score, it is assumed that the standard deviation of the candidate set in each path is ,but ; Weighted total score , ranked first in the candidate set, so H042 was selected as the historical data set. The computer system updates the weight coefficients regularly. To adapt to the evolution of traffic patterns, the update strategy adopts an online learning framework: the weights are fine-tuned every 24 hours using the new detection data of the day, and the loss function is ,in is the actual congestion level, is the predicted level based on the current weights, is the weight parameter, is the regularization coefficient.
[0032] As an implementation manner, the first fusion characterization information includes first sensor data characterization information, and the second fusion characterization information includes second sensor data characterization information, wherein the sensor data includes geomagnetic coil data, radar data, traffic flow data and vehicle speed data of the traffic road.
[0033] Based on this, step S300 generates a traffic situation fusion template according to the second fusion representation information corresponding to each historical traffic IoT data set and the traffic congestion level mark corresponding to each historical traffic IoT data set, and the first fusion representation information of the traffic IoT data set to be detected, including: Step S310: performing dynamic feature alignment on the first sensor data representation information to obtain a first dynamic traffic scenario code, and performing dynamic feature alignment on the second sensor data representation information corresponding to each historical traffic IoT data set to obtain a second dynamic traffic scenario code corresponding to each historical traffic IoT data set; Step S320: Acquire the first spatiotemporal trajectory data corresponding to the traffic IoT dataset to be detected and the second spatiotemporal trajectory data corresponding to each historical traffic IoT dataset; Step S330: Generate a traffic situation fusion template based on the second dynamic traffic situation code, the second spatiotemporal trajectory data and the traffic congestion level mark corresponding to each historical traffic IoT data set, as well as the first dynamic traffic situation code and the first spatiotemporal trajectory data.
[0034] Step S300 retrieves multiple historical traffic IoT data sets and their associated traffic congestion level markers obtained in step S200, and combines the first fusion representation information of the data set to be detected to construct a traffic situation fusion template that can guide real-time detection. In step S310, the computer system performs a dynamic feature alignment operation to map the sensor features of the data set to be detected and the sensor features of the historical data set to the same semantic space, eliminating feature offsets caused by differences in sensor type, sampling frequency, or deployment location. The dynamic feature alignment module uses a timing matching algorithm based on dynamic time warping (DTW) to perform nonlinear alignment of sensor time series (such as geomagnetic coil flow, radar speed measurement), minimizing the impact of timing differences on feature comparability. The calculation formula is: , where Q and C are the real-time and historical sensor sequences, respectively. To align the path, is the timing deviation penalty coefficient (such as =0.1), by introducing a path deviation penalty term to avoid excessive distortion of the timing relationship. For example, when the real-time sensor traffic sequence is Q=[120,118, 35, 30, 28] (unit: vehicle / minute) and the historical sequence is C=[115, 112, 110, 108, 105], the DTW algorithm may generate an aligned path , and calculate the minimum cumulative distance as ; However, if there is a sampling delay in the historical sequence (such as C=[110,108, 105, 102, 100]), the alignment path may become , thereby correcting the timing difference. The aligned sensor features are projected to a unified dimension through a fully connected layer. The projection formula is: ,in is the learnable weight matrix, is the original sensor feature vector. The second fusion representation information of the historical data set is processed by the same alignment module to generate a second dynamic traffic situation encoding that is consistent with the feature space of the real-time data, ensuring the modal comparability across data sets.
[0035] In step S320, the computer system obtains the spatiotemporal trajectory data of the dataset to be detected, which is generated by the fusion of traffic metadata identification, multi-source event trigger signals and spatiotemporal state labels. Traffic metadata identification includes device ID (such as intersection camera number), geographic location code (such as GeoHash value) and timestamp; multi-source event trigger signals come from abnormal events of geomagnetic coils (such as a sudden drop in traffic of more than 50%), radar speed measurement anomalies (such as speed variance exceeding a threshold) or structured logs output by video event detectors (such as "vehicle driving in the opposite direction" and "pedestrian intrusion"); spatiotemporal state labels are obtained in real time through environmental sensors (such as weather stations, road surface state detectors), including weather codes (such as "heavy rain" and "haze"), road conditions (such as "slippery" and "construction") and time period classification (such as "morning rush hour" and "night"). The computer system uses a spatiotemporal trajectory synthesis algorithm based on a rule engine to convert the above multi-source inputs into standardized trajectory feature vectors. For example, when a certain intersection detects three geomagnetic flow drop events and two radar speed measurement anomalies during the period of 08:00-08:05 and the weather label is "heavy rain", the synthetic trajectory feature vector h traj =[0.6, -0.2, 0.8, 0.5], where each dimension represents the event frequency, spatial distribution density, velocity fluctuation coefficient and environmental impact factor respectively.
[0036] In step S330, the computer system generates a traffic situation fusion template based on the dynamic traffic situation coding, spatiotemporal trajectory data and congestion level mark of the historical data set, combined with the real-time data. The template structure follows the predefined context grammar rules: each historical case starts with "[HIST]", contains the aligned sensor features, trajectory features and environmental features, followed by an arrow "→" and a congestion level mark, and ends with "[HIST]"; the real-time data block is marked with "[CURRENT]", and the feature structure is consistent with the historical case but marked with "?" to indicate that it is to be inferred. For example, the template fragment of historical case H042 is "[HIST]sensor:[0.68,-0.18,0.72] traj:[0.48,0.82]env:[0.25] → Level 4 [ / HIST]", which means that the historical data shows a decrease in traffic peak (0.68), speed fluctuation (-0.18) and an increase in the proportion of trucks (0.72) in the sensor dimension, path mutation (0.48) and high frequency of emergency braking (0.82) in the trajectory dimension, and rainfall intensity of 0.25 in the environmental dimension, and is finally marked as Level 4 (severe congestion). The computer system assigns different influences to different historical cases through the attention weight allocation mechanism. The weight calculation function is ,in Scoring the matching between the historical data set and the real-time data in step S200, is the temperature parameter (such as =0.1), the features of high-weight cases in the template will be encoded first. For example, if the matching score of historical case H042 is =0.92, case H045 is =0.88, then the weights are , the feature vector of H042 in the template will be scaled to 0.52 times the original value, and H045 will be scaled to 0.48 times to reflect the differentiated reference value. The computer system uses the time decay function Adjust the freshness weight of historical data, where is the age of the data (in hours), =0.01, so that the weight of data 24 hours ago decays to exp(-0.24)≈0.787, and 48 hours ago decays to exp(-0.48≈0.619, ensuring that the model gives priority to recent data. The traffic situation fusion template finally generated optimizes the transmission and reading efficiency through column storage format. The feature blocks are stored in dimensional order (such as sensor features in front, trajectory features in the middle, and environmental features in the back). The marker block uses One-Hot encoding to indicate the congestion level. The protocol header contains the template version, timestamp, data source hash value and checksum to ensure data integrity and traceability. For example, when the real-time data feature is sensor h sensor=[0.67,-0.20,0.73], trajectory h traj =[0.50,0.80], environment h env =[0.30], and matches the historical case H042 (h sensor =[0.68,-0.18,0.72], h traj =[0.48,0.82], label Level 4) and H045 (h sensor =[0.65,-0.22,0.75], h traj =[0.52,0.78], label Level 3), the generated template is: "[HIST]sensor:[0.68,-0.18,0.72] traj:[0.48,0.82]env:[0.25] → Level 4 [HIST] [HIST]sensor:[0.65,-0.22,0.75] traj:[0.52,0.78]→ Level 3 [HIST] [CURRENT]sensor:[0.67,-0.20,0.73] traj:[0.50,0.80]env:[0.30] → ?", where the historical cases are arranged in descending order of weight, and the real-time data blocks retain complete features for model reasoning. The computer system prevents resource overload by defining an upper limit on the template capacity (e.g., a maximum of 20 historical cases). When the candidate historical data exceeds the threshold, the product of the matching score and the freshness weight wi' = wi·f(t i ) sorting truncation to ensure that high-value cases are retained first.
[0037] As an implementation manner, the first sensor data representation information is multiple. Then, step S310, performing dynamic feature alignment on the first sensor data representation information to obtain a first dynamic traffic scenario code, includes: Step S311: Aggregating the representation information of the plurality of first sensor data representation information to obtain target sensor representation information; Step S312: Based on the representation domain information unification component injected with prior knowledge, the target sensor representation information is matched and mapped to the preset spatiotemporal trajectory representation domain to obtain the first dynamic traffic scenario code.
[0038] Step S310 maps the sensor features of the dataset to be detected and the sensor features of the historical dataset to a unified semantic space through dynamic feature alignment technology, eliminating data distribution offsets caused by equipment differences, inconsistent sampling frequencies, or environmental interference, thereby ensuring the comparability of features across datasets. In step S311, the computer system aggregates multiple first sensor data representation information to generate target sensor representation information. Specifically, the first sensor data representation information comes from time series data of different types of sensors (such as geomagnetic coils, millimeter-wave radars, and infrared cameras), and the feature extraction module of each sensor generates an independent high-dimensional vector (such as geomagnetic coil flow feature vector). , radar speed measurement features , Camera Model Distribution Characteristics ), the aggregation process uses a multi-head attention mechanism to dynamically calculate the weight coefficient of each sensor feature, and the formula is ,in is the learnable query vector, is the weight matrix, is the feature vector of the i-th sensor; for example, when the system processes the 08:00-08:05 time window data of a certain intersection, the geomagnetic coil flow feature , radar speed measurement features 、Camera Model Features After the attention weight is calculated, , aggregated target sensor representation information The computer system enhances the stability of the aggregation module by introducing residual connections. The residual term is the mean vector of each sensor feature. , the final target sensor representation information is corrected to , thereby preserving the global statistical properties of the original data.
[0039] In step S312, the computer system aligns the target sensor representation information to the preset spatiotemporal trajectory representation domain through a pre-trained representation domain information unification component, which is composed of a multi-layer perceptron (MLP) and a cross-modal contrastive learning framework. In the pre-training stage, the computer system uses paired samples of historical sensor data and spatiotemporal trajectory data to maximize the mutual information loss function. ,in is the similarity score, is the learnable projection matrix, =0.1 is the temperature coefficient, K=1024 is the number of negative samples, forcing the sensor characteristics Corresponding trajectory features Align in projected space; for example, when a magnetic coil detects a sudden drop in flow ( =[0.8, -0.3,…]), the corresponding trajectory feature h traj=[0.7, 0.5,…] (characterizing sudden braking and path deviation), the model minimizes The similarity between the two after projection is higher than that of random negative samples. In the inference stage, the representation domain information unification component inputs the target sensor representation information hsensor into the three-layer MLP (dimension 64→128→64) to generate the aligned dynamic traffic situation encoding. ,in is the weight matrix, is the bias term; for example, when h sensor =[0.50,…] After MLP processing, we get h aligned =[0.6, -0.2, 0.8,…], whose dimension is consistent with the spatiotemporal trajectory representation domain (e.g., 64 dimensions) and is consistent with the trajectory feature h extracted in step S130 traj =[0.5, 0.7,…] The cosine similarity in the projection space reaches 0.92, which meets the cross-modal alignment requirements. The computer system ensures the alignment quality by checking the consistency of feature distribution and calculating the KL divergence of features before and after alignment. , where P sensor and P traj are the dimensional distribution histograms of sensor and trajectory features respectively. If D KL >0.1, the feature realignment process is triggered. The computer system adapts to different scenario requirements by defining dynamic alignment thresholds: when the device is in good condition and the data quality is high, the threshold is lowered to 0.5 to include more features, and when the sensor noise is large, the threshold is raised to 0.7 to enhance robustness. The residual connection module maintains global statistics through a sliding window mean update mechanism. The window size is set to 100 time steps, and the mean update formula is: ,in For old data that slides out of the window, To add new data, N=100 is the window capacity to ensure real-time performance. The computer system allocates tasks through a heterogeneous computing architecture: sensor feature aggregation is performed in parallel on the GPU, while feature alignment calculation is performed on the FPGA for low-latency processing. The two are interconnected at high speed through the PCIe Gen4 bus, with a data throughput of 16GB / s. The fault tolerance mechanism monitors the output anomalies of the feature alignment module in real time (such as NaN or numerical overflow). Once an error is detected, the system automatically falls back to the original unaligned features and triggers the online retraining process. The loss function is ,in are the MLP parameters, =0.01 is the regularization coefficient, and recent data is used to fine-tune model parameters to quickly restore performance. The computer system maintains multiple feature alignment models (such as "sunny model" and "rainy model") through version management, and dynamically loads the adaptation model according to real-time environmental parameters. For example, when the rain sensor is activated, the pre-trained rainy alignment model is loaded, and its MLP weights are specially optimized for rainy data, which can better handle sensor noise caused by slippery roads.
[0040] As an implementation manner, step S320, obtaining first spatiotemporal trajectory data corresponding to the traffic IoT dataset to be detected and second spatiotemporal trajectory data corresponding to each historical traffic IoT dataset, includes: Step S321: obtaining the traffic metadata identifier of the traffic IoT dataset to be detected, the multi-source event trigger signal of the traffic IoT dataset to be detected; and the spatiotemporal state label of the traffic IoT dataset to be detected; Step S322: Generate first spatiotemporal trajectory data according to the traffic metadata identifier, the multi-source event trigger signal and the spatiotemporal state label.
[0041] Step S320 generates the spatiotemporal trajectory data of the traffic IoT dataset to be detected by integrating multi-source heterogeneous data, providing the feature expression of the spatiotemporal dimension for the subsequent traffic situation fusion template. In step S321, the computer system obtains the traffic metadata identifier, multi-source event trigger signal and spatiotemporal status label of the dataset to be detected, where the traffic metadata identifier includes the unique device code (such as the intersection camera ID "CAM-1024"), the geographic location code (the longitude and latitude coordinates are converted into a string code using the GeoHash algorithm, for example, the GeoHash value corresponding to 39.9042° north latitude and 116.4074° east longitude is "wx4g09y"), timestamp (accurate to milliseconds, such as "2023-10-01T08:00:00.000Z") and data source type identifier (such as "geomagnetic coil" and "millimeter wave radar"); the multi-source event trigger signal originates from the event detection module of each sensor, for example, when the geomagnetic coil detects a sudden drop in traffic of more than 50%, an event code "E-001" is generated. (corresponding to "traffic anomaly"), when the millimeter-wave radar detects that the speed variance exceeds the threshold, it generates the event code "E-005" (corresponding to "speed mutation"), and when the video event detector identifies that the vehicle is driving in the opposite direction, it generates the event code "E-012" (corresponding to "traffic violation"). Each event signal is accompanied by a confidence score (such as "E-001" confidence is 0.92) and a time interval (such as the start time "08:00:00" and the end time "08:00:30"); the spatiotemporal state labels are obtained in real time through the interface between the environmental sensor and the traffic management platform, including weather state codes (such as "W-03" corresponding to "heavy rain"), road state codes (such as "R-02" corresponding to "slippery"), time period classification codes (such as "T-01" corresponding to "morning rush hour") and special event markers (such as "S-001" corresponding to "road construction"). The computer system uses the spatiotemporal alignment engine to unify the timestamps of the above multi-source data to the UTC time zone, and uses a sliding time window (such as a 5-minute window with a step size of 1 minute) for slicing processing to ensure the consistency of the data in the time dimension; spatial alignment uses the GeoHash grid to map the device geographic location code to a unified spatial resolution level (such as level 7 corresponds to a grid of approximately 153 meters × 153 meters).
[0042] In step S322, the computer system generates the first spatiotemporal trajectory data through the spatiotemporal trajectory synthesis algorithm based on the traffic metadata identifier, the multi-source event trigger signal and the spatiotemporal state label. The algorithm can set three core processing modules: event spatiotemporal aggregation, feature vector generation and environmental context embedding. The event spatiotemporal aggregation module first clusters the multi-source event signals according to the time window and the spatial grid. For example, in the time window of 08:00-08:05, 3 geomagnetic flow anomaly events (E-001), 2 radar speed mutation events (E-005) and 1 video traffic violation event (E-012) occurred in the same GeoHash grid "wx4g09y". After clustering, a composite event code "CE-001" is generated, and its intensity value is the weighted sum of the confidence of each event. The feature vector generation module converts the composite event code, spatiotemporal state label and metadata identifier into numerical features, for example, including: 1) event frequency features (such as the number of occurrences of E-001 in a unit time window); 2) spatial distribution features (such as the density of events in the GeoHash grid); 3) spatial distribution features (such as the density of events in the GeoHash grid); 4) spatial distribution features (such as the density of events in the GeoHash grid); 5) spatial distribution features (such as the density of events in the GeoHash grid); 6) spatial distribution features (such as the density of events in the GeoHash grid); 7) spatial distribution features (such as the density of events in the GeoHash grid); 8) spatial distribution features (such as the density of events in the GeoHash grid); 9) spatial distribution features (such as the density of events in the GeoHash grid); 10) spatial distribution features (such as the density of events in the GeoHash grid); 11) spatial distribution features (such as the density of events in the GeoHash grid); 12) spatial distribution features (such as the density of events in the GeoHash grid); 13) spatial distribution , where area is the grid area); 3) Time distribution characteristics (such as the variance of the time interval between events ; 4) Environmental coupling characteristics (such as the correction coefficient of event intensity under the "heavy rain" state , where I rain is the rainfall intensity). For example, 5 E-001 events (frequency characteristic is 5) are detected in a certain time window, and the spatial density =0.02 events / m2, time interval variance =4.0 seconds², environmental correction factor =1.2, then the eigenvector h is generated event =[5, 0.02, 4.0, 1.2]. The environmental context embedding module converts the spatiotemporal state labels into dense vectors through the pre-trained embedding layer. For example, the weather code “W-03” is mapped to v weather =[0.3, -0.2, 0.5], the road status code “R-02” is mapped to v road =[0.1, 0.6, -0.3], the time period code "T-01" is mapped to v time =[0.7, 0.1, 0.2], the final environment context vector is =[0.3,-0.2, 0.5, 0.1, 0.6, -0.3, 0.7, 0.1, 0.2]( represents vector concatenation). The computer system uses the feature fusion layer to combine the event feature vector h event With the environment context vector v env For cross-modal fusion, the formula is ,in is the fusion weight matrix (assuming ), is the bias term, the output As the representation vector of spatiotemporal trajectory data. The computer system detects the rationality of the features through the spatiotemporal trajectory verification module. For example, when the speed variance feature exceeds 3 times the historical maximum value, it is determined to be an abnormal trajectory and triggers the data cleaning process. The cleaning strategy includes replacing the abnormal value with the sliding window mean. The formula is , where k=5 is the window size. In the technical implementation, the event spatiotemporal aggregation module uses a distributed stream processing framework (such as Apache Flink) to achieve real-time clustering, and defines event association logic through CEP (complex event processing) rules; the feature vector generation module uses GPU-accelerated matrix operation libraries (such as cuBLAS) to improve computing efficiency; the environmental context embedding module dynamically updates the embedding vector through a pre-trained Transformer model to adapt to newly added weather or road status categories. The computer system defines a versioned storage format for spatiotemporal trajectory data, including a protocol header (version number, timestamp, data source hash), a feature block (floating point array), and a check block (CRC32 code), and optimizes disk I / O performance through columnar storage. The fault recovery mechanism monitors the trajectory generation pipeline in real time. If data loss or check failure is detected, the trajectory data is recalculated and repaired from the original event log to ensure the integrity of the subsequent processing flow.
[0043] As an implementation mode, step S330 generates a traffic situation fusion template according to the second dynamic traffic situation code, the second spatiotemporal trajectory data and the traffic congestion level mark corresponding to each historical traffic IoT data set, as well as the first dynamic traffic situation code and the first spatiotemporal trajectory data, including: Step S331: generating input and output samples according to the first data separator used to separate different types of data in the same traffic IoT dataset, and the second dynamic traffic scenario code, the second spatiotemporal trajectory data, and the traffic congestion level mark corresponding to the same historical traffic IoT dataset, so as to obtain multiple input and output samples corresponding to multiple historical traffic IoT datasets; Step S332: combining the multiple input and output samples to obtain a combined sample, wherein the multiple input and output samples in the combined sample are distinguished based on a second data separator used to separate data from different traffic IoT data sets; Step S333: generating a detection sample according to the first data delimiter, the first dynamic traffic situation code and the first spatiotemporal trajectory data; Step S334: Generate a traffic situation fusion template based on the combined sample and the detection sample.
[0044] Step S330 generates a traffic situation fusion template by structurally combining the dynamic traffic situation coding, spatiotemporal trajectory data and congestion level mark of the historical data set, combined with the real-time features of the data set to be detected, to provide contextual reasoning basis for the subsequent detection model. In step S331, the computer system generates a traffic situation fusion template based on the first data separator (such as " <s>”) to segment different types of data in the same traffic IoT dataset, and encode the second dynamic traffic scenario of the historical dataset (such as sensor alignment features = [0.68, -0.18, 0.72]), second spatiotemporal trajectory data (such as trajectory features = [0.48,0.82]) and traffic congestion level labels (such as "Level 4") are used to construct input-output samples in a predefined format to form learning examples. For example, the input-output samples of the historical dataset H042 are represented as " <s>sensor:[0.68,-0.18,0.72] traj:[0.48,0.82]env:[0.25]→Level 4 <s>", where "sensor", "traj", and "env" represent sensor features, trajectory features, and environmental features, respectively, "→" separates input and output, and "Level 4" represents the congestion level label. <s>" is the sample terminator. The computer system ensures the scale consistency of each modal feature through feature normalization, and the sensor feature adopts the Z-Score normalization formula ( is the mean and standard deviation of historical sensor features), the trajectory features are normalized using the maximum and minimum , environmental features are represented by one-hot encoding (e.g., weather "heavy rain" is encoded as [0,0,1]) or embedding vectors (e.g., time period "morning rush hour" is mapped to [0.7, 0.1, 0.2]).
[0045] Step S332 arranges the input-output samples of the multiple historical data sets in chronological order or in descending order of matching scores, and separates them by a second data separator (such as " <d>”) separates different data sets to form a combined sample sequence, such as " <s>sensor:[0.68,-0.18,0.72] traj:[0.48,0.82]env:[0.25]→Level 4 <s> <d> <s>sensor:[0.65,-0.22,0.75] traj:[0.52,0.78] → Level 3 <s> <d>",in" <d>" identifies the boundary of the data set to prevent the model from confusing the contextual information of different historical cases. The computer system removes redundant samples through a sliding window screening mechanism. For example, when the cosine similarity of the sensor features of two historical samples exceeds a threshold (such as 0.95) and the Euclidean distance of the trajectory features is less than a threshold (such as 0.1), only the samples with higher matching scores are retained. The redundancy determination formula is: , where I is the indicator function.
[0046] Step S333 encodes the first dynamic traffic scenario of the data set to be detected (eg =[0.67, -0.20, 0.73]) and the first spatiotemporal trajectory data (e.g. =[0.50, 0.80]) is constructed as a test sample, the format is " <s>sensor:[0.67,-0.20,0.73] traj:[0.50,0.80]env:[0.30] →? <s>", where "?" represents the congestion level mark to be inferred, and the environmental feature "env:[0.30]" is obtained through the real-time meteorological interface and encoded as an embedding vector corresponding to the rainfall intensity of 0.3. The construction of the detection sample must ensure that the feature dimension is strictly consistent with the historical sample. For example, the sensor feature dimension is 64, the trajectory feature dimension is 64, and the environmental feature dimension is 32. The insufficient part is processed by zero filling or interpolation. The interpolation formula is: , where t is the current timestamp, is the characteristic value of adjacent time windows.
[0047] Step S334 combines the combined sample and the detection sample to generate a complete traffic situation fusion template, whose structure is "[combined sample] [detection sample]", for example <s>sensor:[0.68,-0.18,0.72] traj:[0.48,0.82]env:[0.25]→Level4 <s> <d> <s>sensor:[0.65,-0.22,0.75] traj:[0.52,0.78]→Level3 <s> <d> <s>sensor:[0.67,-0.20,0.73] traj:[0.50,0.80]env:[0.30] → ? <s>The template uses the protocol header to identify the version (such as "T-Ver:1.2"), timestamp (such as "2023-10-01T08:00:00Z") and data source hash (such as "SHA-256: a1b2c3..."), and adds a CRC32 checksum (such as "CRC: 0x7D0F3A2B") to ensure data integrity. The computer system controls the model's attention range for historical samples through the attention mask mechanism, for example, assigning higher attention weights to recent samples. The weight calculation function is ,in is the time decay factor, is the data age, =0.01 is the attenuation rate, =0.1 is the temperature coefficient, which increases the data weight by about 30% within 24 hours. After the template is generated, the system uses the feature visualization engine to overlay the sensor waveform, trajectory heat map and environmental parameters to assist operation and maintenance personnel in verifying the rationality of the template. For example, it highlights the abnormal trajectory area (such as the emergency braking point density exceeding 5 times / minute) on the map and overlays and compares it with historical congestion events. In technical implementation, the parsing of data delimiters depends on the finite state machine (FSM), and the state transition rule is defined as: initial state → read" <s>"Enter sample parsing → read "sensor" "traj" "env" tags to extract features → encounter" → "switch to tag parsing → read" <s>"Return to the initial state; The storage of combined samples uses the compressed sparse row (CSR) format to optimize memory usage, and the non-zero element index and value of the feature matrix are stored separately, with a compression rate of up to 60%; The real-time generation of detection samples is accelerated by FPGA hardware, and the pipeline parallel architecture is used to reduce the feature splicing delay to microseconds. The exception handling module monitors feature overflow (such as values outside the [-1,1] range), label missing or separator errors during template generation, and triggers the automatic correction process: when the feature overflows, the truncation formula is used When a label is missing, the label of the most similar sample is retrieved from the historical data as a placeholder. When the separator is wrong, the correct position is predicted and inserted through the bidirectional LSTM model. The computer system manages template iterations through a version rollback mechanism, and each update generates an incremental snapshot (such as "Template v1.2→v1.3 ”) and recorded in the blockchain distributed ledger to ensure that it cannot be tampered with. The hash chain generation formula is: , where T n is the nth template version. For example, when the system detects that the sensor feature of a certain intersection in the time window of 08:00-08:05 is = [0.67, -0.20, 0.73], the trajectory characteristics are = [0.50, 0.80], the environmental feature is env=[0.30], and it matches the historical sample H042 ( =[0.68,-0.18,0.72], =[0.48,0.82], label Level 4) and H045 ( =[0.65,-0.22,0.75], =[0.52,0.78], label Level 3), the generated traffic situation fusion template is:" <s>sensor:[0.68,-0.18,0.72] traj:[0.48,0.82]env:[0.25]→Level 4 <s> <d> <s>sensor:[0.65,-0.22,0.75] traj:[0.52,0.78]→Level 3 <s> <d> <s>sensor:[0.67,-0.20,0.73] traj:[0.50,0.80]env:[0.30] → ? <s>", where historical samples are arranged in descending order according to the matching score, and the detection sample is at the end. The model infers the current congestion level based on this template and outputs that it is Level 4 (92% confidence). The computer system prevents memory overload by defining a template capacity threshold (such as a maximum of 20 historical samples). When the candidate historical data exceeds the threshold, it is weighted by the score. Sorting truncation, retaining the top-20 samples, among which is the time decay function. The cross-modal consistency check module calculates the projection similarity of the sensor and trajectory features. If it is lower than the threshold (such as 0.6), the feature realignment process is triggered to ensure the semantic consistency of the multimodal data in the template.
[0048] As an implementation mode, step S400, based on the traffic situation fusion template, detects the traffic congestion level mark of the traffic IoT data set to be detected, including: Step S410: encoding the set representation information of the traffic situation fusion template to obtain a set of fusion template representation information, where the set representation information is execution data of the traffic congestion level detection network; Step S420: loading the fusion template representation information set into the traffic congestion level detection network, the traffic congestion level detection network is based on maintaining the initial network variables of the preset neural network unchanged, and optimizing the newly added network variables of the neural network according to the training fusion template representation information set, and the newly added network variables are related to the incremental tuning components (such as LoRA) added to the neural network; Step S430: Obtain the target traffic congestion level mark of the traffic IoT data set to be detected output by the traffic congestion level detection network.
[0049] Step S400 uses the traffic situation fusion template generated in step S300 to accurately predict the traffic congestion level of the dataset to be detected, and outputs the target traffic congestion level label. In step S410, the computer system encodes the collective representation information of the traffic situation fusion template and converts it into an input format that can be processed by the traffic congestion level detection network. The collective representation information encoding process is based on the pre-trained cross-modal Transformer architecture, which uniformly maps the historical sample blocks and real-time detection blocks in the template to a low-dimensional semantic space, and specifically includes the following processing: 1) Structured parsing: The delimiters (such as " <s>”" <d>”), extracting information such as sensor data representation of each historical sample , space-time trajectory representation information , Environmental Characterization Information (optional) and label , sensor data representation information of real-time detection block , space-time trajectory representation information and environmental characterization information ; 2) Feature alignment: Use the dynamic feature projection layer to eliminate the modal offset between historical and real-time data. The projection formula is ,in is the projection matrix, are the dimensions of sensor data representation information, spatiotemporal trajectory representation information, and environment representation information, respectively, and d=256 is a unified dimension; 3) Position code injection: In order to preserve the temporal relationship of the template, a learnable position code is added to each sample block. , where pos is the sequential position of the sample in the template (such as historical samples pos=1,2,…, real-time samples pos=N+1), and the encoding formula is and ; 4) Context mask generation: To prevent the model from snooping into future information during training, a lower triangular attention mask matrix is generated ,in If and only if ,otherwise , ensuring that the real-time detection block can only focus on the historical sample block. For example, when the template contains 2 historical samples (pos=1,2) and 1 real-time sample (pos=3), the mask matrix is: ; The encoded fusion template represents the information set It will be used as the input of the detection network, where N is the number of historical samples.
[0050] Step S420 loads the fusion template representation information set into the traffic congestion level detection network, which is based on the pre-trained large language model (such as LLaMA-7B) architecture and uses low-rank adaptation (LoRA) technology to efficiently fine-tune parameters. Specifically, the detection network retains all the parameters of the original language model. And freeze, only the newly added low-rank matrix Conduct training, including is a trainable parameter, r=8 is the rank, and the weight after fine-tuning is The network input sequence is constructed as " ”, where [CLS] is the classifier, [SEP] is the separator, and each H_i is the projection feature vector of the i-th sample. The model captures the association pattern between historical samples and real-time data through a multi-head self-attention mechanism, and the attention is calculated as: ;in is the query, key, and value matrix, is the projection weight, is the dimension of each attention head (h=32 is the number of heads). The hidden state corresponding to the classifier [CLS] Mapped to the congestion level probability distribution through the fully connected layer: ;in is the classification layer parameter, and C=5 is the number of congestion level categories (such as Level 1~5).
[0051] In step S430, the computer system obtains the target traffic congestion level mark output by the detection network, specifically including: 1) Probability threshold filtering: if the highest probability , it is judged as a low confidence prediction, triggering the manual review process; 2) Time smoothing: The prediction results of the continuous time window are subjected to exponential weighted moving average (EWMA), and the smoothing formula is ,in =0.8 is the smoothing factor, y t is the prediction level of the current window; 3) Context consistency check: calculate the KL divergence between the current prediction level and the historical sample label ,like >1.0, the prediction result is considered to deviate too much from the historical pattern, and the correction logic based on the rule engine is activated (such as "traffic < 20 vehicles / minute → equipment failure"). For example, when the probability distribution of the detection network output for real-time samples is P=[0.1, 0.2, 0.4, 0.25, 0.05] (corresponding to Level 1~5), the highest probability p max =0.4 (Level 3), but due to p max <0.7, the system automatically retrieves labels with similar features in historical samples (such as Level 4 with a frequency of 60%), combined with EWMA (assuming that the previous window =3.2) Calculation , rounded to Level 3, but the KL divergence check found that D KL =1.2 exceeds the threshold, triggering the rule engine to cover the output to Level 4. In the technical implementation, the set representation encoding module uses the Apache Arrow memory format to achieve zero-copy data transmission, and uses the SIMD instruction set to accelerate projection matrix operations; the detection network is deployed on the NVIDIA A100 GPU, and the TensorRT optimization inference engine is used to compress the delay to less than 50ms; low-rank adaptive training is implemented through the LoRA plug-in of PyTorch, and the AdamW optimizer (learning rate 1e-4, weight decay 0.01) is used for fine-tuning on 100,000 historical samples, and the loss function is the cross entropy with category weights. ,in , N c is the number of samples of category c. The exception handling module monitors the GPU memory usage in real time. If it exceeds 80%, it dynamically unloads the historical templates used in low frequency to the CPU memory and quickly recovers through the RDMA network; the result visualization engine superimposes the prediction results on the digital twin road network model, displays the congestion propagation trend in the form of a heat map, and compares it with typical cases in the historical event library (such as "2023-09-15 morning rush hour accident") to assist operation and maintenance decision-making.
[0052] As an implementation method, the traffic congestion level detection network is trained by the following steps: Step S41: obtaining first training sensor representation information, first training spatiotemporal trajectory data, and first training traffic congestion level mark corresponding to the first traffic IoT training data set, and second training sensor representation information, second training spatiotemporal trajectory data, and second training traffic congestion level mark corresponding to the second traffic IoT training data set; Step S42: performing a representation domain unification operation on the first training sensor representation information and the second training sensor representation information according to the initial representation domain information unification component injected with prior knowledge, obtaining a first training dynamic traffic scenario code and a second training dynamic traffic scenario code, and generating a training traffic situation fusion template according to the first training dynamic traffic scenario code, the first training spatiotemporal trajectory data and the first training traffic congestion level mark, and the second training dynamic traffic scenario code and the second training spatiotemporal trajectory data; Step S43: encoding the set representation information of the training traffic situation fusion template to obtain the training fusion template representation information set; Step S44: adding the incremental tuning component to the neural network, so as to add new network variables to the neural network based on the incremental tuning component; Step S45: The initial network variables of the neural network are maintained unchanged, and the newly added network variables of the neural network are optimized according to the training fusion template representation information set and the second training traffic congestion level mark to obtain a traffic congestion level detection network.
[0053] In step S41, the computer system reads the first traffic IoT training data set and the second traffic IoT training data set from the distributed storage node, wherein the first data set includes the magnetic field strength time series data collected by the geomagnetic coil sensor, the vehicle three-dimensional point cloud coordinates output by the millimeter wave radar, the minute-level traffic flow data counted by the camera, and the vehicle speed sequence reported by the vehicle-mounted GPS device, and the data dimensions are respectively (60 minutes magnetic field sampling), (100 point cloud coordinates), (60 flow values per hour) and (vehicle speed per minute), generating the first training sensor representation information through the multimodal fusion network (⊕ indicates feature concatenation), outputs a 256-dimensional tensor; and extracts road topology coding at the same time , event coding and vehicle trajectory sequence , the first training space-time trajectory data is generated by the space-time encoder , output a 128-dimensional vector; the second data set is generated by the same process to generate X2 and S2.
[0054] In step S42, the computer system calls the pre-trained initial representation domain information unification component, which is composed of a residual convolution module and a graph attention network, and the parameters include the convolution kernel weight And graph attention coefficient calculation function , perform cross-modal alignment on X1 and X2 to generate the first training dynamic traffic scenario encoding Dynamic traffic scenario coding with the second training ; The computer system will , Traffic congestion level marking with the first training Construct input and output samples according to the separator rule, where the separator vector and Learned through the embedding layer, generating sample sequences , the second data set construction sample , multiple samples through Splice into combined samples , the test sample is constructed as , together form a training traffic situation fusion template .
[0055] In step S43, the computer system uses a 12-layer bidirectional Transformer encoder to encode the template's collective representation information. The self-attention mechanism calculation formula is: , where the mask matrix To prevent future information leakage, the position encoding adopts an absolute-relative hybrid encoding scheme and , output fusion template representation information set (L is the total length of the sequence).
[0056] In step S44, the computer system integrates the incremental tuning component in the preset neural network, and the specific operations include: injecting a low-rank adaptive parameter matrix into the fully connected layer ,in , rank r=8, original weight Keep frozen, and the forward propagation formula is corrected to (α=0.3 is the scaling factor); insert the adapter module in the multi-head attention layer, and its structure is a two-layer MLP: ,in , σ is the GELU activation function.
[0057] In step S45, the computer system loads the fusion template representation information set H into the incremental tuning network and performs forward propagation to calculate the inference result. ,in is the encoding vector corresponding to the detection sample, is the classification layer weight; the loss function uses label smoothed cross entropy (smoothing factor ε=0.1), gradient calculated by chain rule and , the LAMB optimizer is used to update the parameters, the learning rate is set to 2e-5, the weight decay coefficient is 0.02, and mixed precision calculation (FP16 precision storage, FP32 precision update) is applied during training. A total of 300 cycles are iterated. After each cycle, the macro-average F1 score is calculated on the validation set to select the optimal model. For example, when the geomagnetic data fluctuates periodically (cycle ≈ 5 minutes) and the vehicle density detected by the radar exceeds the threshold (> 30 vehicles / 100 meters), the dynamic context encoding triggers the high-dimensional feature response. Combined with the label distribution corresponding to the matching pattern in the historical template (such as 80% probability of level 3 congestion), the network outputs the predicted value of the congestion level of the current period as level 3, with a confidence of 0.87.
[0058] As an implementation mode, in step S45, the newly added network variables of the neural network are optimized according to the training fusion template representation information set to obtain a traffic congestion level detection network, including: Step S451: loading the training fusion template representation information set into the neural network with the incremental tuning component added, and obtaining the inference training mark output by the neural network; Step S452: Optimize the newly added network variables of the neural network according to the error between the inference training mark and the second training traffic congestion level mark to obtain a traffic congestion level detection network.
[0059] Based on this, the method provided above also includes: Step S46: Optimizing the component parameters of the initial representation domain information unified component according to the error between the inference training mark and the second training traffic congestion level mark.
[0060] In sub-step S451 of step S45, the computer system trains the set representation information set of the traffic situation fusion template Loaded into the neural network with the incremental tuning component integrated, the forward propagation calculation process is performed: the input data is processed by the 12-layer Transformer encoder, and the multi-head self-attention mechanism calculation formula of each layer is , where the query, key, and value weight matrices are , the 8 attention head outputs are concatenated and transformed by the low-rank adaptive layer, and the formula is ,in is a new parameter, the original output weight Freeze; the feedforward network part also injects a low-rank matrix , and its calculation formula is ,in is the original parameter, σ is the GELU activation function; the final output layer is trained through the classification weight Generate inference training labeled probability distribution ,in is the encoding vector corresponding to the detection sample, and N is the number of categories.
[0061] In sub-step S452, the computer system calculates the inference training mark With the true label The loss value of , using the improved focal loss function: ; The category weight coefficient Used to balance the uneven distribution of data at different congestion levels, focus on parameter β=2.0 to enhance learning of difficult samples; calculate the loss through the automatic differentiation engine to add parameters The gradient of , adopts the layered adaptive learning rate strategy: the learning rate of the base layer parameters is set to , the attention adapter parameter learning rate is set to , the classification layer learning rate is set to , apply gradient clipping (threshold 1.0) and weight attenuation (coefficient 0.01); the optimization process uses the LAMB optimizer, and its parameter update formula is: ;in is the first-order moment and second-order moment estimation, λ=0.01 is the weight attenuation coefficient, and φ is the trust coefficient calculation function; after 500 iterations, the computer system saves the optimal parameter combination that makes the verification set F1 score reach 0.89.
[0062] In step S46, the computer system synchronously optimizes the parameters of the initial representation domain information unified component, and its gradient calculation is transferred through the chain rule: for the convolution module parameters , the gradient calculation formula is: ; Where B is the batch size and T is the time step; graph attention parameter The gradient update of uses sparse matrix optimization techniques and only performs calculations on non-zero adjacent edges: ; The learning rate is set to , using a cosine annealing scheduler with a cycle length of 50 iterations; during the backpropagation process, the computer system implements a dynamic weight freezing strategy: when the relative change in the parameter update When the parameter is frozen, the training efficiency is improved. For example, when the geomagnetic sensor data is periodically disturbed (amplitude standard deviation > 15μT) and the radar detects a sudden increase in vehicle density, the gradient amplitude of the dynamic traffic scenario encoding increases significantly, prompting the graph attention layer to strengthen the learning of abnormal spatial correlation patterns, which improves the network's detection accuracy of sudden congestion events by 12.7%.
[0063] See also Figure 3 , is a schematic diagram of the structure of a computer system provided in an embodiment of the present application. Figure 3 As shown, the above-mentioned computer system 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer system 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device away from the aforementioned processor 1001. As Figure 3 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.
[0064] exist Figure 3 In the computer system 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the device control application stored in the memory 1005 to implement the method provided in the above embodiment.
[0065] It should be understood that the computer system 1000 described in the embodiments of the present application can execute the above Figure 2 The description of the traffic safety detection method based on big data analysis in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated here.
[0066] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.< / d> < / s> < / s> < / s> < / d> < / s> < / s> < / d> < / s> < / s> < / s> < / s> < / s> < / s> < / d> < / s> < / s> < / d> < / s> < / s> < / s> < / s> < / d> < / d> < / s> < / s> < / d> < / s> < / s> < / d> < / s> < / s> < / s> < / s>
Claims
1. A traffic safety detection method based on big data analysis, characterized in that: include: Acquire a traffic IoT dataset to be detected, and perform fusion representation information mining on the traffic IoT dataset to be detected to obtain first fusion representation information, where the first fusion representation information includes multiple data dimension representation information corresponding to multiple data dimensions respectively; A plurality of historical traffic IoT data sets that match the traffic IoT data set to be detected according to the first fusion representation information index, each of the historical traffic IoT data sets corresponding to a traffic congestion level mark; Generate a traffic situation fusion template according to the second fusion representation information corresponding to each of the historical traffic IoT data sets, the traffic congestion level mark corresponding to each of the historical traffic IoT data sets, and the first fusion representation information of the traffic IoT data set to be detected; According to the traffic situation fusion template, the traffic congestion level mark of the traffic IoT data set to be detected is detected.
2. The method according to claim 1, characterized in that The first fusion representation information includes first sensor data representation information, the second fusion representation information includes second sensor data representation information, and the sensor data includes geomagnetic coil data, radar data, vehicle flow data, and vehicle speed data of the traffic road; the traffic situation fusion template is generated according to the second fusion representation information corresponding to each of the historical traffic IoT data sets and the traffic congestion level mark corresponding to each of the historical traffic IoT data sets, and the first fusion representation information of the traffic IoT data set to be detected, including: Performing dynamic feature alignment on the first sensor data representation information to obtain a first dynamic traffic scenario code, and performing dynamic feature alignment on the second sensor data representation information corresponding to each of the historical traffic IoT data sets to obtain a second dynamic traffic scenario code corresponding to each of the historical traffic IoT data sets; Acquire the first spatiotemporal trajectory data corresponding to the traffic IoT dataset to be detected and the second spatiotemporal trajectory data corresponding to each of the historical traffic IoT datasets; The traffic situation fusion template is generated according to the second dynamic traffic situation code, the second spatiotemporal trajectory data and the traffic congestion level mark corresponding to each of the historical traffic IoT data sets, as well as the first dynamic traffic situation code and the first spatiotemporal trajectory data.
3. The method according to claim 2, characterized in that The first sensor data representation information is a plurality of pieces of information; and the first sensor data representation information is dynamically aligned to obtain a first dynamic traffic scenario code, including: Aggregating the representation information of the plurality of first sensor data representation information to obtain target sensor representation information; The representation domain information unification component based on prior knowledge injection matches and maps the target sensor representation information to a preset spatiotemporal trajectory representation domain to obtain the first dynamic traffic scenario encoding.
4. The method according to claim 2, characterized in that The generating of the traffic situation fusion template according to the second dynamic traffic situation code, the second spatiotemporal trajectory data and the traffic congestion level mark corresponding to each of the historical traffic IoT data sets, as well as the first dynamic traffic situation code and the first spatiotemporal trajectory data, comprises: Generating input and output samples according to the first data separator used to separate different types of data in the same traffic IoT dataset, and the second dynamic traffic scenario code, the second spatiotemporal trajectory data, and the traffic congestion level mark corresponding to the same historical traffic IoT dataset, so as to obtain multiple input and output samples corresponding to multiple historical traffic IoT datasets; Combining the multiple input and output samples to obtain a combined sample, wherein the multiple input and output samples in the combined sample are distinguished based on a second data separator used to separate data from different traffic IoT data sets; generating a detection sample according to the first data delimiter, the first dynamic traffic scenario code and the first spatiotemporal trajectory data; Generating the traffic situation fusion template according to the combined sample and the detection sample; The obtaining of the first spatiotemporal trajectory data corresponding to the traffic IoT dataset to be detected and the second spatiotemporal trajectory data corresponding to each of the historical traffic IoT datasets includes: Acquire the traffic metadata identifier of the traffic IoT dataset to be detected, the multi-source event trigger signal of the traffic IoT dataset to be detected; and the spatiotemporal state label of the traffic IoT dataset to be detected; The first spatiotemporal trajectory data is generated according to the traffic metadata identifier, the multi-source event trigger signal and the spatiotemporal state label.
5. The method according to claim 1, characterized in that The first fusion representation information includes target sensor representation information and first spatiotemporal trajectory representation information; The plurality of historical traffic IoT data sets that match the traffic IoT data set to be detected according to the first fusion representation information index include: Acquire a pre-deployed sensor representation information index set and a spatiotemporal trajectory representation information index set, wherein the sensor representation information index set includes a matching result between each standby traffic IoT data set and the sensor representation information corresponding to the standby traffic IoT data set, and the spatiotemporal trajectory representation information index set includes a matching result between each standby traffic IoT data set and the spatiotemporal trajectory representation information corresponding to the standby traffic IoT data set; Indexing the sensor representation information index set and the spatiotemporal trajectory representation information index set respectively according to the target sensor representation information, and indexing the sensor representation information index set and the spatiotemporal trajectory representation information index set respectively according to the first spatiotemporal trajectory representation information, to obtain a plurality of target candidate traffic IoT data sets matching the traffic IoT data set to be detected; The historical traffic IoT dataset is determined from among the multiple target standby traffic IoT datasets according to a dataset commonality measure between the multiple target standby traffic IoT datasets and the traffic IoT dataset to be detected.
6. The method according to claim 5, characterized in that The multiple target standby traffic IoT datasets include multiple target standby traffic IoT datasets obtained by indexing each indexing mechanism; the determining the historical traffic IoT dataset from the multiple target standby traffic IoT datasets based on the dataset commonality measurement between the multiple target standby traffic IoT datasets and the traffic IoT dataset to be detected includes: For each indexing mechanism, the plurality of target standby traffic IoT datasets are obtained by indexing, and a matching score between the traffic IoT dataset to be detected and each target standby traffic IoT dataset is determined; For each target standby traffic IoT dataset, determining an average of matching scores between the target standby traffic IoT dataset and the traffic IoT dataset to be detected in each index mechanism; Determining the historical traffic IoT dataset from the multiple target standby traffic IoT datasets according to the matching score average; The step of mining the fusion representation information of the traffic IoT dataset to be detected to obtain the first fusion representation information includes: Extracting multiple data subsets from the traffic IoT data set to be detected, and dividing the multiple data subsets into multiple data subset sequences; Sampling a target data subset from the plurality of data subset sequences, extracting sensor representation information from the target data subset, and obtaining first sensor data representation information; Acquire first spatiotemporal trajectory data corresponding to the traffic IoT data set to be detected, and extract spatiotemporal trajectory representation information from the first spatiotemporal trajectory data to obtain first spatiotemporal trajectory representation information; The first fusion representation information is obtained according to the first sensor data representation information and the first spatiotemporal trajectory representation information.
7. The method according to any one of claims 1 to 6, characterized in that: The detecting of the traffic congestion level mark of the traffic IoT data set to be detected according to the traffic situation fusion template includes: Encoding the traffic situation fusion template with set representation information to obtain a fusion template representation information set, wherein the set representation information is execution data of a traffic congestion level detection network; Loading the fusion template representation information set into the traffic congestion level detection network, the traffic congestion level detection network is based on maintaining the initial network variables of the preset neural network unchanged, and optimizing the newly added network variables of the neural network according to the training fusion template representation information set, the newly added network variables are related to the incremental tuning components added to the neural network; Obtain a target traffic congestion level mark of the traffic IoT data set to be detected output by the traffic congestion level detection network.
8. The method according to claim 7, characterized in that The traffic congestion level detection network is trained by the following steps: Acquire first training sensor representation information, first training spatiotemporal trajectory data, and first training traffic congestion level mark corresponding to the first traffic IoT training data set, and second training sensor representation information, second training spatiotemporal trajectory data, and second training traffic congestion level mark corresponding to the second traffic IoT training data set; According to the initial representation domain information unification component injected with prior knowledge, the first training sensor representation information and the second training sensor representation information are respectively subjected to a representation domain unification operation to obtain a first training dynamic traffic scenario code and a second training dynamic traffic scenario code, and a training traffic situation fusion template is generated according to the first training dynamic traffic scenario code, the first training spatiotemporal trajectory data and the first training traffic congestion level mark, and the second training dynamic traffic scenario code and the second training spatiotemporal trajectory data; Encoding the set representation information of the training traffic situation fusion template to obtain the training fusion template representation information set; Adding the incremental tuning component to the neural network to add the newly added network variable to the neural network based on the incremental tuning component; The initial network variables of the neural network are maintained unchanged, and the newly added network variables of the neural network are optimized according to the training fusion template representation information set and the second training traffic congestion level mark to obtain the traffic congestion level detection network.
9. The method according to claim 8, characterized in that The step of optimizing the newly added network variables of the neural network according to the training fusion template representation information set to obtain the traffic congestion level detection network includes: Loading the training fusion template representation information set into the neural network to which the incremental tuning component is added, and obtaining the inference training mark output by the neural network; According to the error between the inference training mark and the second training traffic congestion level mark, optimizing the newly added network variable of the neural network to obtain the traffic congestion level detection network; The method further comprises: According to the error between the inference training mark and the second training traffic congestion level mark, the component parameters of the initial representation domain information unification component are optimized.
10. A computer system, characterized in that: include: processor; and a memory, wherein the memory stores a computer-readable code, and when the computer-readable code is executed by the processor, the processor executes the method as claimed in any one of claims 1 to 9.
Citation Information
Patent Citations
Control system for solving highway traffic congestion problem based on cross-domain data deep integration
CN108510733A
Urban road congestion degree prediction method based on time sequence traffic events
CN109697852A
Burst congestion discrimination method and system based on multi-source traffic big data fusion
CN111680745A
Aspect level sentiment analysis method and device based on transfer learning
CN114912423A
Regional information identification method and device, electronic equipment and storage medium
CN115292620A
Cited By
Remote visual monitoring shelter data management system based on cloud platform
CN120179714A
Meteorological fusion data-based fusion media intelligent generation, production and analysis system
CN120179928A
GNSS real-time deception jamming detection method and system based on deep learning
CN120334955A
Traffic conflict identification method and system for road interleaving area
CN120340256A
Congestion prediction method based on highway network monitoring
CN120412267A