Traffic violation snapshot control method and device, electronic equipment and storage medium
By standardizing and transforming the features of traffic scenario data of various types, a cross-scenario violation capture model is constructed, which solves the problem of insufficient cross-scenario adaptability in traditional technologies and achieves efficient and accurate violation capture.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEBEI GALAXY TECH DEV CO LTD
- Filing Date
- 2025-09-04
- Publication Date
- 2026-04-28
AI Technical Summary
Traditional traffic violation capture technologies struggle to process data from various traffic scenarios, lack a unified mechanism for cross-scenario features, and cannot adapt to complex and ever-changing traffic environments, resulting in decreased capture effectiveness.
By acquiring historical violation data and normal traffic data under various traffic scenarios, format standardization and interference filtering are performed. A feature extraction and transformation module is built to generate scenario feature vectors, a violation trigger judgment model is constructed, a violation probability prediction model is trained, and the model parameters are updated regularly.
It enables unified identification and judgment of violations across different scenarios, improves the accuracy and adaptability of the capture system, reduces false captures and missed captures, and enhances the level of intelligence in traffic management.
Smart Images

Figure CN121148146B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of traffic violation capture technology, and more specifically, it relates to traffic violation capture control methods and devices, electronic equipment, and storage media. Background Technology
[0002] In the development of intelligent transportation systems, the accurate capture of traffic violations has always been an important research direction. Traditional traffic violation capture technologies face many challenges in practical applications. Traffic scenarios are diverse, including intersections, road sections, checkpoints, and other types. The data collected from each scenario has different formats, and the data often contains various interfering information. This makes it difficult to process data from multiple types of traffic scenarios, making it hard to use directly for violation capture and judgment.
[0003] Violation and traffic characteristics vary across different scenarios. Traditional methods lack effective feature extraction and transformation mechanisms, failing to unify data from different scenarios into a common feature space for analysis, resulting in insufficient cross-scenario violation identification capabilities. Furthermore, most existing violation trigger judgment models are designed for single scenarios, making it difficult to adapt to changes in different scenarios and failing to accurately identify violations in complex and ever-changing traffic environments. Moreover, traditional methods typically use fixed thresholds when determining violation capture thresholds, without fully considering the historical violation data distribution characteristics of the target scenario, leading to unreasonable threshold settings and a high likelihood of false positives or missed detections.
[0004] Traffic scenarios are not static; traffic flow and vehicle behavior may change over time. Traditional systems lack effective model update mechanisms and cannot adapt to these changes in a timely manner, leading to a gradual decline in capture effectiveness. Therefore, there is an urgent need for a traffic violation capture and control method that can effectively process multi-type traffic scenario data, achieve cross-scenario feature unification, accurately predict violation probabilities, and dynamically adjust capture strategies. Summary of the Invention
[0005] The purpose of this application is to provide a method and device for capturing and controlling traffic violations, electronic equipment, and storage medium to solve the problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides a method for controlling traffic violations by camera, the method comprising:
[0007] Historical violation data and normal passage data under various traffic scenarios are obtained. The two types of data are processed for format standardization and interference filtering to obtain a standardized scenario dataset.
[0008] A feature extraction and transformation module is built to transform the violation features and passable features in the standardized scene dataset to a preset feature space and generate scene feature vectors.
[0009] A violation trigger judgment model is constructed based on scene feature vectors. By matching the differences in feature vectors of different scenes, a unified feature identifier across scenes is obtained.
[0010] Train a violation probability prediction model, using cross-scenario unified feature identifiers and real-time data of the target scenario as input data, and the violation occurrence probability as output data, to predict the current violation occurrence probability of the target scenario.
[0011] Based on the probability distribution of historical violation data in the target scene, a scene-level violation identification threshold is calculated. Combining the current probability of violation occurrence in the target scene with the scene-level violation identification threshold, it is determined whether to trigger violation capture, and the violation trigger judgment model parameters are updated regularly.
[0012] In one embodiment of this application, the specific method for obtaining historical violation data and normal passage data under multiple traffic scenarios, and performing format standardization and interference filtering on the two types of data to obtain a standardized scenario dataset is as follows:
[0013] From the data collection systems of three scenarios—intersection monitoring, road section inspection, and checkpoint monitoring—time stamps, vehicle status, and behavior record fields are extracted from historical violation data, as well as environmental parameters, driving trajectory, and response information fields from normal traffic data.
[0014] The extracted fields are standardized in terms of units and missing values are filled in. The sliding window method is used to filter out abnormal fluctuations in the time series data. The processed violation data and normal passage data are stored as structured forms respectively and then merged to obtain a standardized scenario dataset.
[0015] In one embodiment of this application, the specific method for constructing the feature extraction and transformation module to transform the violation features and passable features in the standardized scene dataset to a preset feature space and generate scene feature vectors is as follows:
[0016] A predefined feature extraction model is selected as the basic processing module. A feature transformation layer is added to the module input layer to convert the structured fields in the standardized scene dataset into vector form.
[0017] A feature space extractor is set in the middle layer of the module. The output of the middle layer is transformed into a fixed-dimensional feature space through a linear transformation layer. The violation features and the pass features are encoded respectively to obtain the violation feature vector and the pass feature vector in the corresponding scenario.
[0018] The method for building the feature transformation layer is as follows:
[0019] For numerical fields in the standardized scenario dataset, a linear transformation is used to map them to the 0-1 range; for text fields, a word frequency statistics algorithm is used to extract keyword vectors; the numerical mapping results are concatenated with the text keyword vectors as input data for the feature transformation layer, and a fixed-dimensional feature transformation vector is output through the linear transformation layer.
[0020] In one embodiment of this application, the specific method for constructing a violation trigger judgment model based on scene feature vectors and obtaining a unified feature identifier across scenes by matching the differences in feature vectors from different scenes is as follows:
[0021] Each scene is assigned a scene label, and the violation feature vector and the passable feature vector are used as inputs to construct an analysis network that includes a scene discriminator and a feature matcher.
[0022] The scene discriminator is used to identify the scene type to which the input feature vector belongs, and the feature matcher is used to adjust the distribution of the feature vector so that the feature vectors of different scene types overlap in the feature space.
[0023] By minimizing the classification error of the scene discriminator and maximizing the matching error of the feature matcher, the parameters of the violation trigger judgment model are optimized, resulting in a unified feature identifier across scenes.
[0024] In one embodiment of this application, the method for training the violation probability prediction model, using cross-scenario unified feature identifiers and real-time data of the target scenario as input data, and the violation occurrence probability as output data, to predict the current violation occurrence probability of the target scenario is as follows:
[0025] Collect historical violation data and normal passage data of the target scenario, extract their cross-scenario unified feature identifiers, mark the violation data with a violation label, and mark the normal passage data with a no violation label, and construct a training sample set;
[0026] A violation probability prediction model is trained based on a training sample set. The model takes a unified feature identifier across scenarios and the time series features of historical data of the target scenario as input, and the training objective is to accurately predict the violation occurrence label. The loss function used to train the violation probability prediction model is a binary classification cross-entropy loss function. The model training is completed when the loss function converges. The historical data of the target scenario includes historical violation data and historical normal passage data.
[0027] For the current passage data of the target scene, extract the cross-scene unified feature identifier of the target scene and the real-time time series features of the current passage data as input data, and output the probability of violation of the current passage in the target scene.
[0028] In one embodiment of this application, the specific method for calculating a scene-level violation identification threshold based on the probability distribution of historical violation data of the target scene, and determining whether to trigger violation capture by combining the current probability of violation occurrence in the target scene with the scene-level violation identification threshold, is as follows:
[0029] After inputting historical violation data of the target scenario into the violation probability prediction model, the probability of violation occurrence is statistically analyzed, and the cumulative distribution function of the probability value is calculated.
[0030] The probability value corresponding to the 95th percentile in the cumulative distribution function is selected as the scene-level violation identification threshold;
[0031] If the probability of a violation occurring in the target scene is greater than the scene-level violation identification threshold, a violation capture command is triggered; otherwise, it is marked as normal passage.
[0032] The specific process for triggering the violation capture is as follows:
[0033] When the probability of a violation occurring in the target scene is greater than the scene-level violation recognition threshold, capture information including passage time, vehicle identification, and violation probability is generated.
[0034] The captured information is sent to the corresponding scene management terminal and simultaneously recorded in the violation log database. The log content includes the capture time, violation level, and associated passage data.
[0035] In one embodiment of this application, the specific method for periodically updating the parameters of the violation trigger judgment model is as follows:
[0036] At fixed time intervals, newly added violation data and normal passage data from each scenario are collected, and the format is standardized and interference is filtered out again to generate an updated standardized scenario dataset.
[0037] The violation trigger judgment model was retrained using the updated standardized scene dataset. The parameters of the scene discriminator and feature matcher were adjusted through incremental learning to maintain the matching effect of feature vector distributions in different scenes.
[0038] The present invention also includes a traffic violation capture and control system for implementing the above-described traffic violation capture and control method, comprising:
[0039] The data processing module is used to acquire historical violation data and normal passage data under various traffic scenarios, and to perform format standardization and interference filtering on the two types of data to obtain a standardized scenario dataset.
[0040] The feature extraction and transformation module is used to transform the violation features and passable features in the standardized scene dataset to a preset feature space to generate a scene feature vector.
[0041] The violation trigger judgment model module is used to construct a violation trigger judgment model based on the scene feature vector, and obtain a unified feature identifier across scenes by matching the differences in feature vectors of different scenes;
[0042] The violation probability prediction model module is used to train the violation probability prediction model. It takes the cross-scenario unified feature identifier and the real-time data of the target scenario as input data and the violation occurrence probability as output data to predict the current violation occurrence probability of the target scenario.
[0043] The threshold calculation and judgment module is used to calculate the scene-level violation identification threshold based on the probability distribution of historical violation data of the target scene, combine the current probability of violation occurrence in the target scene with the scene-level violation identification threshold, determine whether to trigger violation capture, and periodically update the violation trigger judgment model parameters.
[0044] The present invention also includes an electronic device, the device comprising:
[0045] Processing unit;
[0046] A storage unit for storing the executable program of the processing unit;
[0047] The processing unit is configured to implement the above-described traffic violation capture and control method by executing the executable program.
[0048] The present invention also includes a storage medium storing a computer-readable storage program that, when executed by a processor, implements the above-described traffic violation capture and control method.
[0049] The beneficial effects of the traffic violation capture and control method, device, electronic equipment, and storage medium provided by this invention are as follows:
[0050] By acquiring historical violation and normal traffic data from various traffic scenarios and performing format standardization and interference filtering, a high-quality, standardized scenario dataset can be obtained, providing a reliable data foundation for subsequent feature extraction and model building. Secondly, a feature extraction and transformation module is built to transform violation and normal traffic features in the data to a preset feature space, generating scenario feature vectors. This method effectively extracts key features from the data, eliminates format differences between different scenarios, and makes the features more representative and comparable across scenarios.
[0051] A violation trigger judgment model is constructed based on scene feature vectors. By matching the differences in feature vectors from different scenes, a unified feature identifier across scenes is obtained. This process effectively integrates features from different scenes, enabling the model to uniformly identify and judge violations across different scenes, significantly improving the model's cross-scene adaptability. When training the violation probability prediction model, the unified feature identifier across scenes and real-time data of the target scene are used as input. This accurately predicts the probability of violations occurring in the target scene, providing a scientific basis for violation capture. The scene-level violation recognition threshold is calculated based on the probability distribution of historical violation data in the target scene, and combined with the current violation probability, it is determined whether to trigger a capture. This dynamic threshold setting method fully considers the actual situation of the target scene, making the capture judgment more accurate and effectively reducing false captures and missed captures.
[0052] The mechanism of regularly updating the parameters of the violation trigger judgment model enables the model to continuously optimize with the addition of new data, ensuring that the model always maintains good performance and adapts to the dynamic changes in traffic scenarios. Through the synergistic effect of these aspects, this method can achieve efficient and accurate violation capture in different traffic scenarios, improve the level of intelligence in traffic management, and provide strong technical support for maintaining good traffic order. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a schematic diagram illustrating the working principle of the traffic violation capture and control method described in this invention.
[0055] Figure 2 Flowcharts generated for standardized scenario datasets;
[0056] Figure 3 Flowchart for constructing a violation trigger judgment model;
[0057] Figure 4 This is a flowchart illustrating the operation of the feature extraction and transformation module. Detailed Implementation
[0058] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.
[0060] Please see Figures 1-4 This invention provides a method for capturing and controlling traffic violations, the specific implementation steps of which are as follows:
[0061] Historical violation data and normal traffic data from various traffic scenarios were acquired. The two types of data underwent format standardization and interference filtering to obtain a standardized scenario dataset. From the data collection systems of intersection monitoring, road segment inspection, and checkpoint monitoring, time stamps, vehicle status, and behavior record fields were extracted from historical violation data, while environmental parameters, driving trajectories, and response information fields were extracted from normal traffic data. The extracted fields were standardized in units and missing values were filled in. Anomalies in the time series data were filtered using a sliding window method. The processed violation data and normal traffic data were stored separately in structured forms and then merged to obtain the standardized scenario dataset.
[0062] A feature extraction and transformation module is constructed to transform the violation and common features in the standardized scene dataset to a preset feature space, generating scene feature vectors. A predefined feature extraction model is selected as the basic processing module. A feature transformation layer is added to the module's input layer to convert the structured fields in the standardized scene dataset into vector form. A feature space extractor is set in the module's intermediate layer, and a linear transformation layer transforms the intermediate layer output to a fixed-dimensional feature space, encoding the violation and common features respectively to obtain the corresponding violation and common feature vectors for the scene. The feature transformation layer is constructed as follows: for numerical fields in the standardized scene dataset, a linear transformation is used to map them to the 0-1 interval; for textual fields, a word frequency statistics algorithm is used to extract keyword vectors; the numerical mapping result and the text keyword vectors are concatenated as input data for the feature transformation layer, and the linear transformation layer outputs a fixed-dimensional feature transformation vector.
[0063] A violation triggering judgment model is constructed based on scene feature vectors. By matching the differences in feature vectors from different scenes, a unified feature identifier across scenes is obtained. A scene label is assigned to each scene. Violation feature vectors and permitted feature vectors are used as input to construct an analysis network containing a scene discriminator and a feature matcher. The scene discriminator identifies the scene type to which the input feature vector belongs, while the feature matcher adjusts the distribution of feature vectors so that feature vectors from different scene types overlap in the feature space. By minimizing the classification error of the scene discriminator and maximizing the matching error of the feature matcher, the parameters of the violation triggering judgment model are optimized, resulting in a unified feature identifier across scenes.
[0064] A violation probability prediction model is trained, using cross-scene unified feature identifiers and real-time data of the target scene as input data, and the violation occurrence probability as output data, to predict the probability of a violation occurring during current passage in the target scene. Historical violation data and normal passage data of the target scene are collected, and cross-scene unified feature identifiers are extracted. Violation data is labeled as "violation occurred," and normal passage data is labeled as "no violation," constructing a training sample set. The cross-scene unified feature identifiers and the time-series features of the target scene's real-time data are concatenated as input, and a binary classification cross-entropy loss function is used to train the violation probability prediction model, with the accurate prediction of violation occurrence labels as the training objective. Model training is complete when the loss function converges. For the current passage in the target scene, its cross-scene unified feature identifiers and real-time time-series features are extracted as input data, and the violation occurrence probability for that passage is output.
[0065] Based on the probability distribution of historical violation data for the target scene, a scene-level violation identification threshold is calculated. Combining the current violation probability of the target scene with the scene-level violation identification threshold, it is determined whether to trigger a violation capture, and the violation triggering judgment model parameters are updated periodically. The violation probability output from the violation probability prediction model after inputting historical violation data of the target scene is statistically analyzed, and the cumulative distribution function of the probability values is calculated. The probability value corresponding to the 95th percentile in the cumulative distribution function is selected as the scene-level violation identification threshold. If the current violation probability of the target scene is greater than the scene-level violation identification threshold, a violation capture command is triggered; otherwise, it is marked as normal passage. The specific process for triggering a violation capture is as follows: when the current violation probability of the target scene is greater than the scene-level violation identification threshold, capture information including passage time, vehicle identification, and violation probability is generated; the capture information is sent to the corresponding scene management terminal and simultaneously recorded in the violation log database. The log content includes the capture time, violation level, and associated passage data. The specific method for regularly updating the parameters of the violation trigger judgment model is as follows: every fixed time period, collect newly added violation data and normal passage data for each scenario, re-process them for format standardization and interference filtering, and generate an updated standardized scenario dataset; use the updated standardized scenario dataset to retrain the violation trigger judgment model, and adjust the parameters of the scenario discriminator and feature matcher through incremental learning to maintain the matching effect of feature vector distributions in different scenarios.
[0066] Example 1: The specific implementation process of this example involves acquiring historical violation data and normal traffic data from multiple traffic scenarios, and then performing format standardization and interference filtering on these two types of data to obtain a standardized scenario dataset. Traffic scenarios include three different types: intersection monitoring, road segment inspection, and checkpoint monitoring. Data is extracted from the acquisition systems of these three scenarios. For historical violation data, the timestamp, vehicle status, and behavior record fields are extracted. For example, in the intersection monitoring scenario, the time of a vehicle running a red light, the vehicle's speed and model, and the record of the red light violation are extracted; in the road segment inspection scenario, the time of a vehicle speeding, the vehicle's speed and type, and the record of the speeding behavior are extracted; in the checkpoint monitoring scenario, the time of a vehicle illegally changing lanes, the vehicle's relevant status, and the record of the illegal lane change behavior are extracted. For normal traffic data, extract environmental parameters, driving trajectory, and response information fields. For example, in intersection monitoring scenarios, weather conditions, vehicle driving trajectory at intersections, and vehicle response information to traffic lights; in road segment inspection scenarios, temperature, vehicle driving trajectory on road segments, and vehicle braking response information; in checkpoint monitoring scenarios, light intensity, vehicle driving trajectory when passing through checkpoints, and vehicle steering response information, etc.
[0067] After extracting the fields, the units need to be standardized. Time stamps may exist in different formats, some expressed as year, month, day, hour, minute, and second, others as timestamps. These need to be standardized to a standard time format, such as Beijing time (year, month, day, hour, minute, second). The speed field in vehicle status may be recorded as kilometers per hour or meters per second by different acquisition systems; it needs to be uniformly converted to kilometers per hour. The text descriptions in behavior records and response information need to be standardized in their expression to ensure consistency in the description of the same behavior. For missing value completion, if the temperature value in the environmental parameters is missing, temperature data recorded by adjacent monitoring devices within the same time period can be viewed, and linear interpolation can be used to complete the value. If the location data at a certain moment in the driving trajectory is missing, it can be estimated and completed based on the location data and driving speed at the preceding and following moments.
[0068] Next, a sliding window method is used to filter out outliers in the time series data. Taking vehicle trajectory time series data as an example, a sliding window size is set, for example, the window contains data from five consecutive time points. The mean and standard deviation of the data within the window are calculated. For the time point data at the center of the window, if the difference between its value and the mean exceeds three times the standard deviation, it is considered an outlier and is removed. Then, the mean of the other data within the window is used to replace the outlier data. In this way, outliers in time series data such as time stamps, vehicle speed, and trajectory are filtered out.
[0069] After processing the violation data and the normal passage data, they are stored separately as structured forms. The structured forms can adopt a table structure from a relational database, with each field corresponding to a column in the table. The field type is determined by the nature of the data; for example, timestamps are set to date / time, vehicle status to numeric, and behavior records and environmental parameters to text. Each data entry corresponds to a row in the table, ensuring a consistent and standardized data storage format. Finally, the structured forms storing violation data and normal passage data are merged, arranged chronologically to form a complete, standardized scenario dataset. This dataset contains historical violation and normal passage data for various traffic scenarios, and the data has undergone format standardization and interference filtering, providing high-quality data support for subsequent feature extraction and model building. Throughout the process, each step is strictly performed according to prescribed methods to ensure the accuracy and consistency of data processing, laying a solid data foundation for subsequent work.
[0070] Example 2: This example involves building a feature extraction and transformation module to transform the violation and common features in the standardized scene dataset into a preset feature space, generating scene feature vectors. Specifically, a predefined feature extraction model is first selected as the basic processing module. This predefined feature extraction model can be a common deep learning model, such as a convolutional neural network or a recurrent neural network, and its structure and parameters are initially set according to actual needs. A feature transformation layer is added to the module input layer. The function of this layer is to convert the structured fields in the standardized scene dataset into vector form for subsequent model processing.
[0071] A feature space extractor is set in the intermediate layer of the module, and a linear transformation layer converts the output of the intermediate layer to a fixed-dimensional feature space. The fixed dimension is determined according to the actual application scenario and model performance requirements, for example, it can be set to 256 dimensions or 512 dimensions. The feature space extractor encodes the violation features and the passable features separately, thereby obtaining the violation feature vector and the passable feature vector for the corresponding scenario.
[0072] The feature transformation layer is constructed as follows: For numerical fields in the standardized scene dataset, such as vehicle speed, specific values in time stamps, and temperature values in environmental parameters, a linear transformation is used to map them to the 0-1 interval. Specifically, the maximum and minimum values of the numerical field are first determined. Assuming the maximum value of a numerical field is Max and the minimum value is Min, for any value Value in this field, the mapping to the 0-1 interval is (Value - Min) / (Max - Min). For example, if the maximum vehicle speed is 120 km / h and the minimum is 0 km / h, when a vehicle speed is 60 km / h, the mapped value is (60 - 0) / (120 - 0) = 0.5.
[0073] For text-based fields, such as text descriptions in behavior records and text content in response information, a word frequency statistics algorithm is used to extract keyword vectors. First, the text is segmented into individual words. Common Chinese word segmentation tools, such as jieba, can be used for segmentation. After segmentation, the frequency of each word in the text is counted, and words with higher frequencies are selected as keywords. Then, a unique index is assigned to each keyword, and a keyword vector is constructed based on the index. The position value of the keyword in the vector is the frequency of that word, and other positions have a value of 0. For example, after segmenting a behavior record text, words such as "running a red light," "vehicle," "intersection," and "time" are obtained. "Running a red light" appears 3 times, "vehicle" appears 2 times, "intersection" appears 2 times, and "time" appears once. If keywords are defined as words with a frequency of 2 or more, i.e., "running a red light," "vehicle," and "intersection," the constructed keyword vector has a length of 3, and the values at the corresponding positions are 3, 2, and 2 respectively (assuming the frequency is directly used as the vector value, or normalized).
[0074] The mapping results of numerical fields are concatenated with the keyword vectors of text fields, serving as the input data for the feature transformation layer. For example, if the numerical field mapping result for a data point is [0.5, 0.3, 0.7] and the keyword vector for the text field is [3, 2, 2], the concatenated input data would be [0.5, 0.3, 0.7, 3, 2, 2]. This input data is then fed into the linear transformation layer of the feature transformation layer. The linear transformation layer performs a linear transformation operation using its weight matrix and bias vector, outputting a fixed-dimensional feature transformation vector. The weight matrix and bias vector of the linear transformation layer are determined through model training, with the goal of ensuring that the output feature transformation vector better represents the features of the original data.
[0075] Throughout the feature extraction and transformation process, each step must be strictly performed according to the established methods. The selection of the predefined feature extraction model requires comprehensive consideration of both the characteristics of the data and the model's performance. The design of the feature transformation layer must ensure that different types of fields can be effectively converted into vector form. The parameters of the linear transformation layer of the feature space extractor need to be optimized through appropriate training methods to ensure that the transformed feature vectors accurately reflect the violation and compliance features in the original data, providing effective feature representations for the subsequent violation trigger judgment model. Throughout the process, emphasis is placed on the accuracy of data processing and the effectiveness of feature representation, ensuring that each step meets expectations, thereby enabling the generated scene feature vectors to satisfy the needs of subsequent models.
[0076] Example 3: This example implements a violation trigger judgment model based on scene feature vectors. By matching the differences in feature vectors from different scenes, a unified feature identifier across scenes is obtained. In the specific implementation process, a scene label is assigned to each scene. This label is used to identify different traffic scene types. For example, intersection monitoring scenes are labeled as scene label 1, road segment inspection scenes are labeled as scene label 2, and checkpoint monitoring scenes are labeled as scene label 3. Each scene corresponds to a unique integer label for subsequent model processing.
[0077] Using violation feature vectors and passage feature vectors as input, an analysis network is constructed that includes a scene discriminator and a feature matcher. The scene discriminator is essentially a classification network, and its structure can be a multilayer perceptron (MLP), consisting of an input layer, hidden layers, and an output layer. The input layer receives the feature vectors, the hidden layers perform feature transformations, and the number of nodes in the output layer is the same as the number of scene types, with each node corresponding to a probability value for a scene. The role of the scene discriminator is to identify the scene type to which the input feature vector belongs; that is, by learning from the input feature vector, it determines whether the feature vector comes from a scene such as intersection monitoring, road patrol, or checkpoint monitoring.
[0078] The role of the feature matcher is to adjust the distribution of feature vectors so that feature vectors from different scene types overlap in the feature space. The feature matcher can consist of several fully connected layers, transforming the feature vectors to reduce the differences between feature vectors from different scenes. In constructing the analysis network, the scene discriminator and the feature matcher are interconnected, forming a complete model structure used to process the input feature vectors and achieve cross-scene feature unification.
[0079] During model training, the parameters of the violation trigger judgment model are optimized by minimizing the classification error of the scene discriminator and maximizing the matching error of the feature matcher. Here, the idea of adversarial learning is introduced: the scene discriminator attempts to accurately distinguish the scene source of the feature vector, while the feature matcher attempts to make feature vectors from different scenes difficult to distinguish in the feature space, and the two form an adversarial training process.
[0080] The classification error of the scene discriminator can be measured using the cross-entropy loss function, whose mathematical expression is:
[0081]
[0082] in, Indicates the number of input samples. Indicates the number of scene types. For the sample Belongs to the scene The true label (1 if it belongs to the category, 0 otherwise). For scene discriminator to sample Belongs to the scene The predicted probability. This formula represents the average of the sum of the cross-entropies between the true labels and predicted probabilities of all samples, achieved by minimizing... This can improve the accuracy of scene discriminator classification.
[0083] The matching error of the feature matcher is achieved by maximizing the similarity between feature vectors from different scenes. Maximum Mean Discrepancy (MMD) can be used as a metric, aiming to make the distribution of feature vectors from different scenes as similar as possible in the feature space. Assume there are two sets of feature vectors from different scenes. and The formula for calculating MMD is:
[0084]
[0085] in, and These represent the number of samples in the feature vector sets of the two scenes, respectively. This represents the mapping function that maps eigenvectors to the Reproducing Kernel Hilbert Space (RKHS). This represents the norm in the space. By maximizing the value of MMD, we are actually forcing the feature matcher to adjust the distribution of feature vectors, making feature vectors from different scenes closer in the mapped space, thereby achieving the goal of overlapping distributions.
[0086] During training, the model's total loss function is a combination of the scene discriminator loss and the feature matcher loss, i.e.:
[0087]
[0088] in, To balance the hyperparameters of the two losses, the training weights of the scene discriminator and the feature matcher are adjusted. By optimizing this total loss function, the parameters in the model are continuously adjusted, including the network weights of the scene discriminator and the feature matcher. This allows the scene discriminator to accurately identify scene types while the feature matcher can effectively reduce the distribution differences of feature vectors from different scenes.
[0089] Once the model is trained, for any input scene feature vector, after processing by the feature matcher, its representation in the feature space will no longer strongly depend on the original scene, but will focus more on the violation features themselves. At this point, the feature identifier obtained through model processing becomes a unified cross-scene feature identifier. This identifier can eliminate the influence of scene differences, making feature vectors from different traffic scenarios comparable, providing a unified feature input for subsequent violation probability prediction models, thereby achieving cross-scene violation behavior judgment.
[0090] Throughout the implementation process, the allocation of scene labels must maintain consistency and uniqueness. The structural design of the analysis network must be reasonably configured based on the actual data scale and computing resources, and the hyperparameters in the loss function must be considered. Experimental debugging is required to obtain the best results. During training, it is necessary to ensure that the input order and batch size of the data meet the model training requirements. The performance of the model is gradually improved through iterative optimization, and finally a violation trigger judgment model that can effectively match the differences in feature vectors of different scenarios is obtained, and a unified feature identifier across scenarios is generated.
[0091] Example 4: This example demonstrates training a violation probability prediction model. It uses a unified cross-scenario feature identifier and real-time data of the target scenario as input data, and the violation occurrence probability as output data to predict the current violation probability in the target scenario. Specifically, it first requires collecting historical violation data and normal traffic data for the target scenario. For example, taking a crossroads in a city as the target scenario, historical violation data for the intersection over the past year is collected. This data includes information on violations such as running red lights and not driving in designated lanes. Simultaneously, data on vehicles normally passing through the intersection, i.e., information on vehicles driving normally according to traffic rules, is also collected.
[0092] After collecting this data, it is necessary to extract its cross-scenario unified feature identifier. This unified feature identifier is obtained through processing using the violation trigger judgment model constructed in Example 3. This identifier eliminates the influence of scenario differences and can uniformly represent features under different scenarios. For example, for a historical violation data point at this intersection, which includes information such as the time the vehicle ran a red light, vehicle speed, and vehicle type, this information is input into the violation trigger judgment model, and after model processing, the corresponding cross-scenario unified feature identifier is obtained. Similarly, for normal traffic data, such as information related to vehicles passing through the intersection normally during a green light, the cross-scenario unified feature identifier is also obtained through processing using the violation trigger judgment model.
[0093] Next, the data with violations are labeled as "violation occurred," and the data with normal passage is labeled as "no violation," thus constructing a training sample set. For example, in 1000 historical data entries, there are 200 violations and 800 normal passage entries. The 200 violations are labeled as 1, and the 800 normal passage entries are labeled as 0, forming a training sample set containing 1000 samples. Each sample contains a corresponding cross-scene unified feature identifier and a labeled tag.
[0094] When constructing the input data, the cross-scenario unified feature identifier is concatenated with the time series features of the real-time data of the target scenario as input. The time series features can include information such as the current time and traffic flow over a past period. For example, for a certain traffic data in the target scenario, its cross-scenario unified feature identifier may be a vector containing multiple dimensions, such as [0.2,0.5,0.3,0.8]. At the same time, the time when the traffic occurred is obtained, such as 10:30 on July 2, 2025, and the traffic flow at the intersection in the past 10 minutes, such as 20 vehicles passing through per minute. These time series features are converted into vector form, such as [10,30,20]. Then, the cross-scenario unified feature identifier is concatenated with the time series feature vector to obtain the input data [0.2,0.5,0.3,0.8,10,30,20].
[0095] A violation probability prediction model is trained using a binary cross-entropy loss function, which measures the difference between the model's prediction and the actual label. The goal of training is to enable the model to accurately predict the label where a violation occurs. When the loss function converges, it indicates that the model has learned the patterns in the data, and model training is complete. For example, during training, a set of training samples is input into the model. The model predicts the violation probability for each sample based on the input data, then calculates the binary cross-entropy loss between the predicted probability and the actual label. The model parameters, such as the weights and biases of the neural network, are adjusted using the backpropagation algorithm to gradually reduce the loss. Training stops when the loss no longer decreases significantly or when a preset convergence condition is met.
[0096] For the current traffic situation in the target scenario, its cross-scenario unified feature identifier and real-time time series features are extracted as input data and fed into a trained model. The model then outputs the probability of a traffic violation occurring. For example, if a vehicle is entering the intersection, relevant information about the vehicle, such as its speed, vehicle type, and direction of travel, is obtained. This information is input into the violation trigger judgment model to obtain the cross-scenario unified feature identifier. Simultaneously, time series features such as the current time and the current traffic flow at the intersection are obtained. These features are concatenated and input into a trained violation probability prediction model. The model outputs a probability value, such as 0.85, which indicates that the vehicle's current traffic behavior has an 85% probability of violating traffic rules.
[0097] Throughout the training and prediction process, it is crucial to ensure the integrity and accuracy of data collection. When extracting unified feature identifiers across scenarios, the method described in Example 3 must be strictly followed. The training sample set must be correctly labeled, and the consistency and rationality of features must be guaranteed when concatenating input data. During model training, training parameters such as learning rate and batch size should be set appropriately to ensure the model can effectively learn patterns from the data. During prediction, real-time data of the target scene should be obtained promptly to ensure the timeliness of the input data, thereby ensuring that the violation probability output by the model accurately reflects the current likelihood of a violation. Through this implementation method, an effective violation probability prediction model can be trained, providing a basis for subsequent judgments on whether to trigger violation capture.
[0098] Example 5: This example calculates a scene-level violation identification threshold based on the probability distribution of historical violation data for the target scene. Combining the current violation probability of the target scene with the scene-level violation identification threshold, it determines whether to trigger a violation capture, and periodically updates the violation trigger judgment model parameters. Specifically, historical violation data for the target scene is first input into the violation probability prediction model, which outputs the violation occurrence probability. These probability values are then statistically analyzed to calculate the cumulative distribution function. For example, if the target scene is a highway section, 2000 historical violation data points from the past six months are collected. Each data point is input into the trained violation probability prediction model to obtain the corresponding violation occurrence probability, such as 0.6, 0.75, 0.82, etc. These probability values are then sorted from smallest to largest, and the sum of probabilities at and below each probability value is calculated to form the cumulative distribution function.
[0099] Next, select the probability value corresponding to the 95% quantile in the cumulative distribution function as the scene-level violation recognition threshold. In specific operations, among the 2000 sorted probability values, find the probability value corresponding to the 1900th position (2000×95%). Suppose this value is 0.78, then 0.78 is used as the scene-level violation recognition threshold for this highway section. When determining whether to trigger a violation capture, compare the current violation occurrence probability of the target scene with this threshold. If the current violation occurrence probability is greater than 0.78, trigger a violation capture instruction; otherwise, mark it as normal passage.
[0100] The specific process of triggering a violation capture is as follows: When the current violation occurrence probability of the target scene is greater than the scene-level violation recognition threshold, generate capture information including passage time, vehicle identification, and violation probability. For example, when a vehicle is driving on this highway section, the violation probability prediction model outputs its violation occurrence probability as 0.85, which is greater than the threshold of 0.78. At this time, generate capture information, where the passage time is 14:25 on July 1, 2025, the vehicle identification is the license plate number Beijing A12345, and the violation probability is 0.85. Then send the capture information to the corresponding scene management terminal, such as the monitoring management center of the highway section, and record it in the violation log database at the same time. The log content includes the capture time, violation level, and associated passage data. The violation level can be divided according to the violation probability. For example, 0.78 - 0.85 is a general violation, and above 0.85 is a serious violation. The associated passage data includes vehicle speed, driving trajectory, etc.
[0101] The specific method for regularly updating the parameters of the violation trigger judgment model is as follows: Every fixed time period, such as one month, collect the newly added violation data and normal passage data of each scene, and re-perform format specification and interference filtering processing to generate an updated standardized scene data set. For example, after one month, 300 new violation data and 1000 normal passage data are added to this highway section. Extract the time stamps, vehicle status, behavior records, and other fields of these data from the acquisition system, perform unit unification, missing value filling, filter abnormal fluctuation points using the sliding window method, store them as structured forms and merge them to obtain the updated standardized scene data set.
[0102] Use the updated standardized scene data set to retrain the violation trigger judgment model, and adjust the parameters of the scene discriminator and feature matcher through incremental learning to maintain the matching effect of the feature vector distributions of different scenes. Specifically, input the updated data set into the violation trigger judgment model. Based on the existing parameters, the model learns the new data, adjusts the network weights for identifying scene types in the scene discriminator, and the parameters for adjusting the feature vector distribution in the feature matcher, so that the feature vectors of the new data and the original data are more consistent in the feature space.
[0103] Throughout the implementation process, when calculating the cumulative distribution function, it is necessary to accurately statistically analyze the probability values of historical violation data. When selecting quantiles, the threshold must be determined strictly according to the prescribed proportions to ensure that the threshold reasonably reflects the violation probability distribution characteristics of the target scene. When generating capture information, ensure that the information fields are complete and accurate, and that the sending and recording process is smooth, facilitating timely processing and subsequent query analysis by the management terminal. When updating model parameters, collect data periodically and process it in a standardized manner. During incremental learning, pay attention to the model's adaptability to new data to avoid a decline in the model's processing effectiveness for existing data due to parameter updates. This ensures that the violation trigger judgment model maintains effective matching of feature vector differences across different scenarios, providing reliable support for violation capture judgment.
[0104] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for capturing and controlling traffic violations, characterized in that, include: Historical violation data and normal passage data under various traffic scenarios are obtained. The two types of data are processed for format standardization and interference filtering to obtain a standardized scenario dataset. A feature extraction and transformation module is built to transform the violation features and passable features in the standardized scene dataset to a preset feature space and generate scene feature vectors. A violation trigger judgment model is constructed based on scene feature vectors. By matching the differences in feature vectors of different scenes, a unified feature identifier across scenes is obtained. Train a violation probability prediction model, using cross-scenario unified feature identifiers and real-time data of the target scenario as input data, and the violation occurrence probability as output data, to predict the current violation occurrence probability of the target scenario. Based on the probability distribution of historical violation data in the target scene, calculate the scene-level violation identification threshold. Combine the current probability of violation occurrence in the target scene with the scene-level violation identification threshold to determine whether to trigger violation capture. Update the violation trigger judgment model parameters regularly. The specific method for calculating the scene-level violation identification threshold based on the probability distribution of historical violation data of the target scene, and combining the current probability of violation occurrence in the target scene with the scene-level violation identification threshold to determine whether to trigger violation capture is as follows: After inputting historical violation data of the target scenario into the violation probability prediction model, the probability of violation occurrence is statistically analyzed, and the cumulative distribution function of the probability value is calculated. The probability value corresponding to the 95th percentile in the cumulative distribution function is selected as the scene-level violation identification threshold; If the probability of a violation occurring in the target scene is greater than the scene-level violation identification threshold, a violation capture command is triggered; otherwise, it is marked as normal passage. The specific process for triggering the violation capture is as follows: When the probability of a violation occurring in the target scene is greater than the scene-level violation recognition threshold, capture information including passage time, vehicle identification, and violation probability is generated. The captured information is sent to the corresponding scene management terminal and recorded in the violation log database. The log content includes the capture time, violation level and associated passage data. The specific method for periodically updating the parameters of the violation trigger judgment model is as follows: At fixed time intervals, newly added violation data and normal passage data from each scenario are collected, and the format is standardized and interference is filtered out again to generate an updated standardized scenario dataset. The violation trigger judgment model was retrained using the updated standardized scene dataset. The parameters of the scene discriminator and feature matcher were adjusted through incremental learning to maintain the matching effect of feature vector distributions in different scenes.
2. The traffic violation capture and control method as described in claim 1, characterized in that, The specific method for obtaining historical violation data and normal traffic data under multiple traffic scenarios, and performing format standardization and interference filtering on the two types of data to obtain a standardized scenario dataset is as follows: From the data collection systems of three scenarios—intersection monitoring, road section inspection, and checkpoint monitoring—time stamps, vehicle status, and behavior record fields are extracted from historical violation data, as well as environmental parameters, driving trajectory, and response information fields from normal traffic data. The extracted fields are standardized in terms of units and missing values are filled in. The sliding window method is used to filter out abnormal fluctuations in the time series data. The processed violation data and normal passage data are stored as structured forms respectively and then merged to obtain a standardized scenario dataset.
3. The traffic violation capture and control method as described in claim 2, characterized in that, The specific method for constructing the feature extraction and transformation module to transform the violation features and passable features in the standardized scene dataset to a preset feature space and generate scene feature vectors is as follows: A predefined feature extraction model is selected as the basic processing module. A feature transformation layer is added to the module input layer to convert the structured fields in the standardized scene dataset into vector form. A feature space extractor is set in the middle layer of the module. The output of the middle layer is transformed into a fixed-dimensional feature space through a linear transformation layer. The violation features and the pass features are encoded respectively to obtain the violation feature vector and the pass feature vector in the corresponding scenario. The method for building the feature transformation layer is as follows: For numerical fields in the standardized scenario dataset, a linear transformation is used to map them to the 0-1 interval; For text-based fields, a word frequency statistics algorithm is used to extract keyword vectors. The numerical mapping results are concatenated with the text keyword vectors and used as input data for the feature transformation layer. A linear transformation layer is then used to output a fixed-dimensional feature transformation vector.
4. The traffic violation capture and control method as described in claim 3, characterized in that, The specific method for constructing a violation trigger judgment model based on scene feature vectors and obtaining a unified feature identifier across scenes by matching the differences in feature vectors from different scenes is as follows: Each scene is assigned a scene label, and the violation feature vector and the passable feature vector are used as inputs to construct an analysis network that includes a scene discriminator and a feature matcher. The scene discriminator is used to identify the scene type to which the input feature vector belongs, and the feature matcher is used to adjust the distribution of the feature vector so that the feature vectors of different scene types overlap in the feature space. By minimizing the classification error of the scene discriminator and maximizing the matching error of the feature matcher, the parameters of the violation trigger judgment model are optimized, resulting in a unified feature identifier across scenes.
5. The traffic violation capture and control method as described in claim 4, characterized in that, The training violation probability prediction model uses cross-scenario unified feature identifiers and real-time data of the target scenario as input data, and the violation occurrence probability as output data. The specific method for predicting the current violation occurrence probability in the target scenario is as follows: Collect historical violation data and historical normal passage data of the target scenario, extract their cross-scenario unified feature identifiers, mark the historical violation data with a violation occurrence label, and mark the historical normal passage data with a no violation label, and construct a training sample set; The unified feature identifier across scenarios is concatenated with the time series features of the historical data of the target scenario as input. A violation probability prediction model is trained based on the training sample set, with the training objective being to accurately predict the violation occurrence label. The loss function used to train the violation probability prediction model is the binary classification cross-entropy loss function. The model training is completed when the loss function converges. The historical data of the target scenario includes historical violation data and historical normal passage data. For the current passage data of the target scene, extract the cross-scene unified feature identifier of the target scene and the real-time time series features of the current passage data as input data, and output the probability of violation of the current passage in the target scene.
6. A traffic violation capture and control system, used to implement the traffic violation capture and control method as described in any one of claims 1 to 5, characterized in that, include: The data processing module is used to acquire historical violation data and normal passage data under various traffic scenarios, and to perform format standardization and interference filtering on the two types of data to obtain a standardized scenario dataset. The feature extraction and transformation module is used to transform the violation features and passable features in the standardized scene dataset to a preset feature space to generate a scene feature vector. The violation trigger judgment model module is used to construct a violation trigger judgment model based on the scene feature vector, and obtain a unified feature identifier across scenes by matching the differences in feature vectors of different scenes; The violation probability prediction model module is used to train the violation probability prediction model. It takes the cross-scenario unified feature identifier and the real-time data of the target scenario as input data and the violation occurrence probability as output data to predict the current violation occurrence probability of the target scenario. The threshold calculation and judgment module is used to calculate the scene-level violation identification threshold based on the probability distribution of historical violation data of the target scene, combine the current probability of violation occurrence in the target scene with the scene-level violation identification threshold, determine whether to trigger violation capture, and periodically update the violation trigger judgment model parameters.
7. An electronic device, characterized in that, include: Processing unit; A storage unit for storing the executable program of the processing unit; The processing unit is configured to implement the traffic violation capture and control method according to any one of claims 1 to 5 by executing the executable program.
8. A storage medium, wherein the computer-readable storage medium stores a computer program, characterized in that, When the computer program is executed by the processor, it implements the traffic violation capture and control method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Cross-scene wireless gesture recognition method based on unsupervised learning
CN119202932A
Illegal snapshot method and system based on image recognition
CN120544134A
Multi-scene self-adaptive high-speed obstacle early warning method, device, equipment and medium
CN120564445A