A vehicle abnormal behavior recognition method considering inter-class similarity

By introducing TCN and AM into vehicle abnormal behavior recognition and combining them with the CISP loss function, the problem of low recognition accuracy caused by data imbalance is solved, and higher recognition accuracy and robustness are achieved, especially for the accurate recognition of minority abnormal behaviors when there is a large similarity between categories.

CN118797521BActive Publication Date: 2026-05-19CHONGQING UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING UNIV
Filing Date
2024-07-05
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing methods for identifying abnormal vehicle behavior do not consider the impact of data imbalance on the identification of abnormal categories, resulting in low accuracy, especially when there is a high degree of similarity between categories, it is difficult to distinguish between a few categories of abnormal behavior.

Method used

By combining Temporal Convolutional Network (TCN) and Attention Mechanism (AM), a loss function of cross-entropy loss and inter-class similarity penalty (CISP) is designed. Trajectory features are extracted through TCN and important features are weighted by AM. The model is then optimized by combining the CISP loss function to improve the accuracy of identifying minority class abnormal behaviors.

Benefits of technology

It effectively improves the recognition accuracy and robustness in data imbalance and complex traffic scenarios, enhances the focus on key trajectories, and improves the accuracy of abnormal behavior recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118797521B_ABST
    Figure CN118797521B_ABST
Patent Text Reader

Abstract

The application belongs to the field of intelligent transportation, and discloses a vehicle abnormal behavior recognition method considering inter-class similarity, comprising the following steps: S1. collecting vehicle trajectory data of a research road section and extracting trajectory features; S2. according to behavior labels, counting trajectory feature performances of various vehicle behaviors and performing inter-class similarity measurement of various vehicle behaviors; S3. designing a CISP loss function so that the model pays attention to data that are misclassified due to inter-class similarity; S4. introducing an attention mechanism AM on the basis of a time convolution network TCN to establish a vehicle abnormal behavior recognition model, and using the CISP loss function designed in step S3 to perform model training and optimization, thereby completing vehicle abnormal behavior recognition. The application can effectively overcome the limitations of traditional methods in processing data imbalance and complex traffic scenes, and achieve higher recognition accuracy and robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent transportation, and specifically relates to a method for identifying abnormal vehicle behavior that considers inter-class similarity. Background Technology

[0002] Effective management and monitoring of vehicles on traffic routes are crucial for ensuring the safety of people's lives and property and maintaining smooth traffic flow. Vehicle abnormal behavior recognition technology analyzes vehicle trajectories to identify behaviors that deviate from normal driving patterns, such as abnormal acceleration or deceleration, prolonged low-speed driving, and speeding. These abnormal behaviors may indicate traffic accidents, congestion, or vehicle malfunctions, significantly threatening road safety and traffic efficiency. Therefore, by comprehensively acquiring vehicle trajectory data and identifying these abnormal behaviors, timely preventative measures can be taken to reduce traffic accident rates, alleviate traffic congestion, improve road efficiency, and enhance the safety and reliability of public transportation.

[0003] Despite the existence of various methods for identifying abnormal vehicle behavior, many shortcomings remain in practical applications. Traditional monitoring methods rely on manual observation or basic automated rules, which are not only time-consuming and labor-intensive but also struggle to cope with complex and ever-changing traffic scenarios. In recent years, with the rapid development of machine learning and deep learning technologies, utilizing these technologies for vehicle behavior identification and anomaly detection has become a research hotspot. These methods can learn normal and abnormal behavioral feature representations from large amounts of vehicle trajectory data, thereby improving vehicle monitoring. However, since anomalies are only a minority, the large difference in the number of normal trajectories and abnormal trajectories often leads to insufficient training for the few abnormal behavior categories during data training. Furthermore, when the similarity between different categories is high, the fewer categories become even more difficult to distinguish, resulting in a decrease in the accuracy of identifying that category of abnormal behavior.

[0004] Patent document CN111310583A discloses a vehicle abnormal behavior recognition method based on an improved Long Short-Term Memory (LSTM) network. This method uses a vehicle detection model to obtain the target vehicle's trajectory, then preprocesses and manually labels the trajectory, and finally classifies and identifies the trajectory using an improved LSTM network. However, this method does not consider the impact of data imbalance on the recognition effect of abnormal categories. In practical applications, a large amount of abnormal behavior data needs to be collected to maintain data balance. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide a method for identifying abnormal vehicle behavior that considers inter-class similarity. This invention aims to solve the problem that existing methods do not consider the impact of data imbalance on the effectiveness of abnormal category identification, resulting in low identification accuracy.

[0006] This invention provides a method for identifying abnormal vehicle behavior that considers inter-class similarity, comprising the following steps:

[0007] S1. Collect vehicle trajectory data for the study section and extract trajectory features;

[0008] S2. Based on the behavioral labels, statistically analyze the trajectory characteristics of various vehicle behaviors and measure the inter-class similarity of various vehicle behaviors;

[0009] S3. Design the CISP loss function so that the model focuses on data that is misclassified due to inter-class similarity;

[0010] S4. Based on the Temporal Convolutional Network (TCN), an attention mechanism (AM) is introduced to establish a vehicle abnormal behavior recognition model. The CISP loss function designed in step S3 is used for model training and optimization to complete the vehicle abnormal behavior recognition.

[0011] Furthermore, step S1 includes the following sub-steps:

[0012] S1.1 Calculate the average speed:

[0013] S1.2 Calculate the maximum speed: v max =max{v1,v2…v i-1 ,v i}

[0014] S1.3 Calculate the minimum speed: v min =min{v1,v2…v i-1 ,v i}

[0015] S1.4 Calculation speed range: v dif =v max -v min

[0016] S1.5 Calculation speed standard deviation:

[0017] Furthermore, step S2 includes the following sub-steps:

[0018] S2.1 divides the data into training and testing sets, and uses the mean value of the corresponding features of each class in the training set to evaluate the similarity between classes in terms of vehicle speed level and driving stability.

[0019] S2.2 uses Euclidean distance to measure the distance between class centers;

[0020] d ij =||μ i -μ j||2

[0021] In the formula, μ i and μ j represent the mean of categories i and j respectively; ||·|| denotes the L2 norm;

[0022] S2.3 uses the reciprocal of the Euclidean distance as a similarity measure, where the similarity measure s between categories is... ij The calculation method is as follows:

[0023]

[0024] S2.4 Construct the similarity matrix S;

[0025]

[0026] In this case, the similarity of the same category is set to 0.

[0027] Furthermore, step S3 includes the following sub-steps:

[0028] S3.1 uses cross-entropy loss as the basic loss function of the model for multi-class classification problems involving vehicle abnormal behavior recognition. The cross-entropy loss L... ce The mathematical calculation method is as follows:

[0029]

[0030] In the formula, N is the number of categories; C is the number of samples; y ij Let the value of the true label of the i-th sample in the j-th category be denoted as . Let be the predicted probability of the i-th sample in the j-th category by the model;

[0031] S3.2 Design an inter-class similarity penalty term to reduce the occurrence of samples being misclassified into similar categories. The penalty term L isp It can be formalized as:

[0032]

[0033] In the formula, p ij It is the probability that a given sample actually belongs to class j when the model predicts that it belongs to class i.

[0034] S3.3 introduces an inter-class similarity penalty term based on the cross-entropy loss function to complete the design of the CISP loss function. The final CISP loss function is calculated as follows:

[0035] L cisp =L ce +λL isp

[0036] In the formula, λ is a hyperparameter, which is a weighting factor for the inter-class similarity penalty term, used to balance the contributions between the cross-entropy loss and the similarity penalty term.

[0037] Furthermore, step S4 includes the following sub-steps:

[0038] In the feature extraction layer, S4.1 uses padding techniques to fill the end of the trajectory sequence with "0" values, pads all sequences to the same length, and performs one-hot encoding on the category labels to convert them into binary vectors.

[0039] S4.2 In the feature extraction layer, TCN is used to extract the features of the input trajectory, given the input sequence x = [x1, x2, ..., x...]. T ] and convolution kernel w = [w0, w1, ..., w k-1 The main mathematical model of the TCN model is expressed as follows:

[0040]

[0041] In the formula, y t y represents the output value at time step t in a causal convolution; t ' represents the output value at time step t in dilated convolution; This represents the output of the l-th layer; d is the dilation factor, representing the interval at which the convolution kernel is applied. This represents the i-th parameter of the l-th convolutional kernel; This represents the (l-1)th layer at time step t-id (l) The output value of b; (l) σ is the bias term; σ is the activation function ReLU.

[0042] S4.3 introduces an attention mechanism to weight the input trajectory sequence. For each time step t, the input x... t Calculate its attention score e t :

[0043] e t =tanh(W·x) t )

[0044] In the formula, tanh is the nonlinear activation function; W is the weight matrix;

[0045] e is obtained through the softmax function t After normalization, the attention weight 'a' is obtained. t :

[0046]

[0047] After obtaining the attention weights, the model calculates a weighted sequence representation by weightedly combining the features from all time steps:

[0048]

[0049] In the formula, c is the final attention representation, which focuses on the part of the sequence that is most important to the current task;

[0050] In the category output layer, S4.4 uses the Adam optimization algorithm to adjust the model parameters so that the loss function reaches its minimum value.

[0051] Beneficial effects:

[0052] This invention proposes a vehicle abnormal behavior recognition method that considers inter-class similarity. This method uses a Temporal Convolutional Network (TCN) and an Attention Mechanism (AM) to extract and process vehicle trajectory data. In the feature extraction stage, the TCN captures the temporal features of the trajectory data, while the Attention Mechanism further weights important features, enhancing attention to key trajectories. To address the issue of high inter-class similarity, this invention designs a loss function combining cross-entropy loss and an inter-class similarity penalty term (CISP), causing the model to focus more on data easily misclassified during training, thus improving the accuracy of identifying minority class abnormal behaviors. This invention effectively overcomes the limitations of traditional methods in handling imbalanced data and complex traffic scenarios, achieving higher recognition accuracy and robustness.

[0053] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description

[0054] Figure 1 This is a flowchart of a vehicle abnormal behavior recognition method that considers inter-class similarity according to the present invention;

[0055] Figure 2 This is a structural diagram of a vehicle abnormal behavior recognition model. Detailed Implementation

[0056] To make the technical solutions, advantages, and objectives of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the protection scope of this application.

[0057] like Figure 1As shown, the present invention provides a method for identifying abnormal vehicle behavior that considers inter-class similarity, comprising the following steps:

[0058] S1. Collect vehicle trajectory data of the research road section, extract trajectory features, and comprehensively evaluate vehicle trajectories from the perspective of speed and its changes to reflect the characteristics of vehicle driving behavior;

[0059] S1.1 calculates the average speed;

[0060] By calculating the average speed of each vehicle, the average speed v of the vehicle trajectory can be extracted. avg This value is used to assess the vehicle's general driving speed:

[0061]

[0062] S1.2 Calculate the maximum speed;

[0063] By identifying the maximum speed reached by the vehicle during the observation period, the maximum speed of the vehicle's trajectory can be extracted. This value is used to measure its maximum driving capability.

[0064] v max =max{v1,v2…v i-1 ,v i}

[0065] S1.3 Calculate the minimum speed;

[0066] By recording the vehicle's lowest speed during the observation period, the minimum speed of the vehicle's trajectory can be extracted. This value may reflect behaviors such as traffic congestion or parking.

[0067] v min =min{v1,v2…v i-1 ,v i}

[0068] S1.4 has extremely poor calculation speed;

[0069] The speed range reflects the breadth of vehicle speed variation; a larger speed range indicates that the vehicle experienced a significant speed change from slower to faster during the observation period, while a smaller speed range may mean that the vehicle's movement was more consistent.

[0070] v dif =v max -v min

[0071] S1.5 calculates the standard deviation of the speed;

[0072] The speed standard deviation is used to quantify how much a vehicle's speed disperses around its mean. A larger speed standard deviation means that the vehicle's speed varies significantly at different points in time, reflecting the instability of the vehicle's operation.

[0073]

[0074] S2. Based on the five vehicle trajectory feature extraction methods in step S1, combine the behavior labels to statistically analyze the trajectory feature performance of various vehicle behaviors, and measure the inter-class similarity of various vehicle behaviors.

[0075] S2.1 divides the data into training and testing sets, and uses the mean value of the corresponding features of each class in the training set to evaluate the similarity between classes in terms of vehicle speed level and driving stability.

[0076] S2.2 uses Euclidean distance to measure the distance between class centers;

[0077] d ij =||μ i -μ j ||2

[0078] In the formula, μ i and μ j represent the mean of categories i and j respectively; ||·|| denotes the L2 norm;

[0079] S2.3 uses the reciprocal of the Euclidean distance as a similarity measure, where the similarity measure s between categories is... ij The calculation method is as follows:

[0080]

[0081] S2.4 Construct the similarity matrix S;

[0082]

[0083] In this case, the similarity of the same category is set to 0.

[0084] S3. Design the CISP (Cross-Entropy Loss with Inter-class Similarity Penalty) loss function to make the model pay more attention to the data that is misclassified due to the large similarity between classes during training, thus solving the problem of low class recognition accuracy due to the small number of data due to imbalance.

[0085] S3.1 uses cross-entropy loss as the basic loss function of the model for multi-class classification problems involving vehicle abnormal behavior recognition. The cross-entropy loss L... ce The mathematical calculation method is as follows:

[0086]

[0087] In the formula, N is the number of categories; C is the number of samples; y ijThe true label value of the i-th sample in the j-th category (one-hot encoded, value is 0 or 1); Let be the predicted probability of the i-th sample in the j-th category by the model;

[0088] S3.2 Design an inter-class similarity penalty term to reduce the occurrence of samples being misclassified into similar categories. The penalty term L isp It can be formalized as:

[0089]

[0090] In the formula, p ij It is the probability that a given sample actually belongs to class j when the model predicts that it belongs to class i.

[0091] S3.3 introduces an inter-class similarity penalty term based on the cross-entropy loss function to complete the design of the CISP loss function. The final CISP loss function is calculated as follows:

[0092] L cisp =L ce +λL isp

[0093] In the formula, λ is a hyperparameter, which is a weighting factor for the inter-class similarity penalty term, used to balance the contributions between the cross-entropy loss and the similarity penalty term.

[0094] S4. Based on the Temporal Convolutional Network (TCN), an attention mechanism (AM) is introduced to establish a vehicle abnormal behavior recognition model. The CISP loss function designed in step S3 is used for model training and optimization to complete the vehicle abnormal behavior recognition.

[0095] The TCN-AM-CISP model consists of three parts: a trajectory input layer, a category output layer, and a feature extraction layer.

[0096] In the feature extraction layer, S4.1 uses padding techniques to fill the end of the trajectory sequence with "0" values, pads all sequences to the same length, and performs one-hot encoding on the category labels to convert them into binary vectors.

[0097] S4.2 In the feature extraction layer, TCN is used to extract the features of the input trajectory, given the input sequence x = [x1, x2, ..., x...]. T ] and convolution kernel w = [w0, w1, ..., w k-1 The main mathematical model of the TCN model is expressed as follows:

[0098]

[0099] In the formula, y t y represents the output value at time step t in a causal convolution; t' represents the output value at time step t in dilated convolution; This represents the output of the l-th layer; d is the dilation factor, representing the interval at which the convolution kernel is applied. This represents the i-th parameter of the l-th convolutional kernel; This represents the (l-1)th layer at time step t-id (l) The output value of b; (l) σ is the bias term; σ is the activation function ReLU.

[0100] S4.3 introduces an attention mechanism to weight the input trajectory sequence. For each time step t, the input x... t Calculate its attention score e t :

[0101] e t =tanh(W·x) t )

[0102] In the formula, tanh is the nonlinear activation function; W is the weight matrix;

[0103] e is obtained through the softmax function t After normalization, the attention weight 'a' is obtained. t :

[0104]

[0105] After obtaining the attention weights, the model calculates a weighted sequence representation by weightedly combining the features from all time steps:

[0106]

[0107] In the formula, c is the final attention representation, which focuses on the part of the sequence that is most important to the current task;

[0108] In the category output layer, S4.4 uses the Adam optimization algorithm to adjust the model parameters to minimize the loss function. For each vehicle trajectory, the model has a corresponding output representing the category of vehicle behavior.

[0109] In this embodiment, the overall structure of the vehicle abnormal behavior recognition model can be found in [reference needed]. Figure 2 .

[0110] It is hereby declared that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for identifying abnormal vehicle behavior considering inter-class similarity, characterized in that, Includes the following steps: S1. Collect vehicle trajectory data for the study section and extract trajectory features; S2. Based on the behavioral labels, statistically analyze the trajectory characteristics of various vehicle behaviors and measure the inter-class similarity of various vehicle behaviors; S3. Design the CISP loss function so that the model focuses on data that is misclassified due to inter-class similarity; S3.1 uses cross-entropy loss as the basic loss function of the model for multi-class classification problems involving vehicle abnormal behavior recognition. The mathematical calculation method is as follows: In the formula, Number of categories; The number of samples; For the first The true label of the sample in the first... Values ​​in each category; For the model to the first The sample at the th The predicted probabilities of each category; S3.2 Design an inter-class similarity penalty term to reduce the occurrence of samples being misclassified into similar categories. It can be formalized as: In the formula, The model predicts which category a given sample belongs to. Class actually belongs to The probability of a class; It is a measure of similarity between categories; S3.3 introduces an inter-class similarity penalty term based on the cross-entropy loss function to complete the design of the CISP loss function. The final CISP loss function is calculated as follows: In the formula, It is a hyperparameter, a weighting factor for the inter-class similarity penalty term, used to balance the contributions between the cross-entropy loss and the similarity penalty term; S4. Based on the Temporal Convolutional Network (TCN), an attention mechanism (AM) is introduced to establish a vehicle abnormal behavior recognition model. The CISP loss function designed in step S3 is used for model training and optimization to complete the vehicle abnormal behavior recognition. In the feature extraction layer, S4.1 uses padding techniques to fill the end of the trajectory sequence with "0" values, pads all sequences to the same length, and performs one-hot encoding on the category labels to convert them into binary vectors. S4.2 In the feature extraction layer, TCN is used to extract the features of the input trajectory, given the input sequence. and convolution kernel The main mathematical model of the TCN model is represented as follows: In the formula, Represents the time step in causal convolution The output value; Represents the time step in dilated convolution. The output value; Indicates the first Layer output; Indicates the first The first layer of convolution kernel One parameter; Representing the Layer in time step The output value; It is a bias term; It is the activation function ReLU; S4.3 introduces an attention mechanism to weight the input trajectory sequence for each time step. Input Calculate their attention score : In the formula, tanh is a nonlinear activation function; This is the weight matrix; Using the softmax function Normalization is performed to obtain attention weights. : After obtaining the attention weights, the model calculates a weighted sequence representation by weightedly combining the features from all time steps: In the formula, It is the final attention representation, which focuses on the part of the sequence that is most important to the current task; In the category output layer, S4.4 uses the Adam optimization algorithm to adjust the model parameters so that the loss function reaches its minimum value.

2. The vehicle abnormal behavior recognition method considering inter-class similarity according to claim 1, characterized in that: Step S1 includes the following sub-steps: S1.1 Calculate the average speed: S1.2 Calculate the maximum speed: S1.3 Calculate the minimum speed: S1.4 Calculation speed range: S1.5 Calculation speed standard deviation: .

3. The vehicle abnormal behavior recognition method considering inter-class similarity according to claim 2, characterized in that: Step S2 includes the following sub-steps: S2.1 divides the data into training and testing sets, and uses the mean value of the corresponding features of each class in the training set to evaluate the similarity between classes in terms of vehicle speed level and driving stability. S2.2 uses Euclidean distance to measure the distance between class centers; In the formula, and Representing categories and The mean; Represents the L2 norm; S2.3 uses the reciprocal of the Euclidean distance as a similarity measure, and the similarity measure between categories is... The calculation method is as follows: S2.4 Constructing a similarity matrix ; In this case, the similarity of the same category is set to 0.