A traffic behavior anomaly detection method, system, computer device and medium
By constructing a dual-memory library and iteratively updating the hypersphere, the problem of decreased accuracy in existing traffic behavior anomaly detection methods under diverse scenarios is solved, achieving efficient and accurate anomaly detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU INST OF URBAN & RURAL CONSTR & DEV
- Filing Date
- 2026-04-29
- Publication Date
- 2026-05-29
AI Technical Summary
Existing methods for detecting abnormal traffic behavior rely on prior knowledge of the feature space, which leads to a decrease in detection accuracy in diverse traffic scenarios, making it difficult to effectively identify abnormal behavior and prone to missed detections and false detections.
We construct a dual memory (normal and abnormal memory), optimize high-dimensional image feature vectors through a contrastive loss function, establish an initial hypersphere space, and enhance feature differences and clustering by iteratively updating the memory and hypersphere space to achieve efficient anomaly detection.
It improves the accuracy and efficiency of traffic behavior anomaly detection, eliminates missed and false detections, adapts to the characteristics of different traffic scenarios, and achieves efficient anomaly identification.
Smart Images

Figure CN122116013A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of traffic behavior anomaly detection algorithm technology, specifically relating to a traffic behavior anomaly detection method, system, computer equipment, and medium. Background Technology
[0002] Traffic behavior anomaly detection faces the challenge of a vague and diverse definition of "anomaly," lacking a fixed and unified model. Traditional traffic behavior anomaly detection methods introduce the concept of a hypersphere to learn the distribution of the sample dataset in order to identify "anomalies," but this relies excessively on prior knowledge constraints established by the feature space.
[0003] Current research attempts to address the problem of traditional detection methods over-relying on prior knowledge constraints established by feature spaces by introducing memory modules into models to store information from normal memory samples, thereby increasing inter-class distance. However, existing memory modules cannot effectively capture the differential patterns of abnormal features, resulting in weak model recognition of abnormal behavior and a high likelihood of missed or false detections. When sample features in traffic scenarios exhibit diverse variations (such as differences in vehicle behavior and pedestrian actions under different weather and lighting conditions), pre-defined prior rules struggle to adapt to the actual data distribution, leading to a disconnect between feature representation and real-world behavior patterns. This results in decreased detection accuracy, an inability to accurately and clearly reflect the essence of traffic samples, and poor recognition capabilities for different categories of samples. Summary of the Invention
[0004] To address the aforementioned problems, this invention provides a method, system, computer device, and medium for detecting abnormal traffic behavior.
[0005] To achieve the above objectives, the present invention provides a method for detecting abnormal traffic behavior, comprising: Collect a sample set of original traffic monitoring videos, and divide the sample set into a basic construction sample set and an iterative update sample set.
[0006] Extract the first high-dimensional image feature vector from the basic construction sample set, optimize the constraints of the first high-dimensional image feature vector using the contrastive loss function, construct a traffic behavior basic memory bank based on the optimized high-dimensional image feature vector, and construct an initial hypersphere space based on the basic memory bank.
[0007] Extract the second high-dimensional image feature vector from one original traffic monitoring video in the iterative update sample set; calculate the matching probability value between the second high-dimensional image feature vector and each element in the basic memory, and update each element in the basic memory using the matching probability value to obtain the updated memory; weight and sum all matching probability values with the elements in the basic memory corresponding to each matching probability value to obtain the memory-enhanced feature; map the memory-enhanced feature to the initial hypersphere space, and iteratively update the parameters of the initial hypersphere space using the mapped hypersphere space to obtain the updated hypersphere space; continue to perform the update step on the updated memory and the updated hypersphere space using the second high-dimensional image feature vector.
[0008] When the preset update cycle is reached, the update step is stopped, and the final memory and optimal hypersphere space are obtained; the final memory and optimal hypersphere space are used for traffic behavior anomaly detection.
[0009] Preferably, constructing the initial hypersphere space based on the basic memory bank specifically includes: The average value of each element in the basic memory is calculated according to its dimension; the average values of all dimensions form the initial sphere center coordinates. Calculate the Euclidean distance from each element in the basic memory bank to the initial sphere center, and take the average of all Euclidean distances as the initial radius; The initial hypersphere space is determined by the initial center coordinates and the initial radius.
[0010] Preferably, the step of calculating the matching probability value between the second high-dimensional image feature vector and each element in the basic memory, and updating each element in the basic memory using the matching probability value to obtain the updated memory, specifically includes: Calculate the cosine similarity between the feature vector of the second high-dimensional image and each element in the basic memory bank; Normalize all cosine similarities to obtain matching probability values; multiply the matching probability values by the corresponding elements to obtain element change values; The original element is added to the element's changed value to obtain the updated element; the updated memory is composed of all the updated elements.
[0011] Preferably, the traffic behavior basic memory bank is divided into a normal traffic behavior memory bank and a traffic behavior abnormality memory bank; high-dimensional image feature vectors of the original traffic monitoring video are extracted using a pre-trained ResNet18 model.
[0012] Preferably, the contrastive loss function The formula is as follows: ; in, i For sample index number, This includes the set of pairs between normal memory bank samples and the set of pairs between abnormal memory bank samples. This represents the set of pairs between normal memory bank samples and abnormal memory bank samples. This is the first high-dimensional image feature vector. for Characteristics of samples of the same category for Different categories of sample characteristics, This represents a scalar temperature parameter.
[0013] Preferably, mapping the memory-enhanced features to the initial hypersphere space further includes defining a distance loss function to optimize the memory-enhanced features, and then using the optimized features to iteratively update the parameters of the initial hypersphere space. The distance loss function is specifically as follows: ; in, This represents the total number of normal memory bank samples and abnormal memory bank samples. This represents the normal number of samples in the memory bank. These are weighting coefficients. Represents the feature center, These represent memory enhancement features obtained from the normal memory bank and the abnormal memory bank, respectively.
[0014] Preferably, the final memory and the optimal hypersphere are used for traffic behavior anomaly detection, specifically including: Extract high-dimensional image feature vectors from target traffic surveillance videos; Through memory bank read operations, a memory-enhanced feature is generated from the high-dimensional image feature vector and the normal memory bank of the final memory bank; another memory-enhanced feature is generated from the high-dimensional image feature vector and the abnormal memory bank of the final memory bank. The memory-enhanced features generated from two different memory banks are mapped to the hypersphere space, and the distances from the two different memory-enhanced features to the center of the optimal hypersphere space are calculated to obtain the normal memory distance and the abnormal memory distance. If the weighted difference between the normal memory distance and the abnormal memory distance is less than a set threshold, it is considered a normal memory bank sample; otherwise, it is considered an abnormal memory bank sample.
[0015] The present invention also provides a traffic behavior anomaly detection system, comprising: The data acquisition module is used to collect a sample set of original traffic monitoring videos, and divides the sample set into a basic construction sample set and an iterative update sample set.
[0016] The network training module is used to extract the first high-dimensional image feature vector from the basic construction sample set, optimize the constraints of the first high-dimensional image feature vector using the contrastive loss function, construct a traffic behavior basic memory bank based on the optimized high-dimensional image feature vector, and construct an initial hypersphere space based on the basic memory bank. Extract the second high-dimensional image feature vector from one original traffic monitoring video in the iterative update sample set; calculate the matching probability value between the second high-dimensional image feature vector and each element in the basic memory, and update each element in the basic memory using the matching probability value to obtain the updated memory; weight and sum all matching probability values with the elements in the basic memory corresponding to each matching probability value to obtain the memory-enhanced feature; map the memory-enhanced feature to the initial hypersphere space, and iteratively update the parameters of the initial hypersphere space using the mapped hypersphere space to obtain the updated hypersphere space; continue to perform the update step on the updated memory and the updated hypersphere space using the second high-dimensional image feature vector.
[0017] The model determination module is used to stop the update step when a preset update cycle is reached, and obtain the final memory and the optimal hypersphere space; the final memory and the optimal hypersphere space are used for traffic behavior anomaly detection.
[0018] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any one of the traffic behavior anomaly detection methods.
[0019] The present invention also provides a computer-readable storage medium storing a computer program that, when loaded by a processor, can execute any of the steps in the traffic behavior anomaly detection method.
[0020] The traffic behavior anomaly detection method provided by this invention has the following beneficial effects: This invention constructs a basic memory bank based on the high-dimensional image feature vectors of samples. The basic memory bank is divided into a normal memory bank and an anomaly memory bank. The dual memory banks can clearly distinguish between normal and abnormal behavior features, eliminating missed detections and false detections during the identification process. The dual memory banks classify and dynamically update representative features, avoiding interference from invalid features and allowing features to more accurately reflect the essence of the behavior. The contrast loss function enhances the similarity of similar features and expands the difference between dissimilar features. An initial hypersphere space is constructed based on the basic memory bank. The hypersphere space, through feature mapping and distance loss constraints, further strengthens the feature distribution of normal features clustering and abnormal features dispersion, ultimately achieving high-accuracy detection through features with strong representational power. The invention employs memory bank reading and updating operations, continuously updating the memory bank and the initial hypersphere space with new samples, ensuring that the memory bank stores representative sample features, improving the efficiency and accuracy of retrieval and subsequent processing. Finally, a traffic behavior anomaly detection model including a final memory bank and an optimal hypersphere space is obtained, improving the efficiency and accuracy of traffic behavior anomaly detection. Attached Figure Description
[0021] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of a traffic behavior anomaly detection method according to an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the construction of the memory bank according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the hypersphere space according to an embodiment of the present invention. Detailed Implementation
[0023] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.
[0024] This invention provides a method for detecting abnormal traffic behavior, specifically as follows: Figure 1 As shown, it includes: S1. Collect a sample set of original traffic monitoring videos, and divide the sample set into a basic construction sample set and an iterative update sample set.
[0025] A traffic behavior dataset is collected by acquiring road traffic monitoring videos of the area to be detected. The videos are then segmented into eight-frame segments to obtain the training set. It includes both normal and abnormal behavior data. A total of... One sample, each sample , i For sample index, For the first i Input data for one sample The corresponding labels are 0 for normal and 1 for abnormal. C This represents the number of channels in an image sample. W and H This indicates the width and height of the image sample.
[0026] The acquired data is preprocessed, and the traffic behavior data is scaled to a uniform resolution of 224. 224, and then normalized.
[0027] The acquired data is input into the model for training. A memory bank and a hypersphere are introduced into the model, such as... Figure 2 and Figure 3 As shown, to enhance the performance of traffic behavior anomaly detection, a feature extraction network is constructed. The preprocessed data is passed through a ResNet18 network to extract features, resulting in high-dimensional image feature vectors. These high-dimensional image feature vectors are then labeled as normal or abnormal.
[0028] in, Figure 2 This invention demonstrates the classification and construction logic of the normal and abnormal dual memory databases, as well as the bidirectional interaction process between the new high-dimensional traffic video features (queries) and the dual memory databases. This not only enables the independent storage of normal and abnormal traffic behavior features, but also allows new features to be fused with representative features in the database through read operations to generate memory-enhanced features. Furthermore, through update operations, the elements in the dual memory databases can be dynamically optimized using the matching probability of new features, so that the memory databases continuously store more representative features and adapt to feature changes in different traffic scenarios. Figure 3 Using the feature center as the hypersphere center, the memory-enhanced features generated from the dual memory bank are optimized and constrained by the distance loss function. This allows normal features to cluster in the region close to the feature center, while abnormal features are dispersed in the region far from the feature center, forming a feature distribution effect where normal features cluster and abnormal features disperse. This provides a core spatial basis for subsequent determination of whether traffic behavior is abnormal by calculating the weighted difference of distance from the feature to the feature center.
[0029] S2. Extract the first high-dimensional image feature vector from the basic construction sample set, optimize the constraints of the first high-dimensional image feature vector using the contrastive loss function, construct a basic traffic behavior memory bank based on the optimized high-dimensional image feature vector, and construct an initial hypersphere space based on the basic memory bank; extract the second high-dimensional image feature vector from an original traffic monitoring video in the iterative update sample set; calculate the matching probability value between the second high-dimensional image feature vector and each element in the basic memory bank, update each element in the basic memory bank using the matching probability value, and obtain the updated memory bank; weight and sum all matching probability values with the elements in the basic memory bank corresponding to each matching probability value to obtain the memory enhancement feature; map the memory enhancement feature to the initial hypersphere space, iteratively update the parameters of the initial hypersphere space using the mapped hypersphere space, and obtain the updated hypersphere space; continue to perform update steps on the updated memory bank and the updated hypersphere space using the second high-dimensional image feature vector.
[0030] A contrastive loss function is defined to enhance the similarity between similar feature points while amplifying the differences between dissimilar feature points. This ensures that feature points representing abnormal behavior maintain a significant distance from those representing normal behavior, thereby improving the model's ability to identify abnormal behavior. The specific formula for the contrastive loss function is as follows: ; in, This represents the positive example set (i.e., the pairings between normal memory bank samples and the pairings between abnormal memory bank samples). p for The elements; This represents the negative set (i.e., the pairing between normal memory bank samples and abnormal memory bank samples). for The elements; The feature vector output by the ResNet18 network. for Characteristics of samples of the same category for Different categories of sample characteristics, This represents a scalar temperature parameter. In the contrastive loss function, the scalar temperature parameter's role is to bring positive sample pairs (similar samples) closer together and push negative sample pairs (dissimilar samples) further apart. i Sample index, I This represents the total sample.
[0031] Construct a normal memory and an abnormal memory to store sample data from the normal memory and the abnormal memory, respectively: design the memory as a matrix. ,vector represent The OK, Indicates 1 to Integers. Each This represents an element, corresponding to the prototype feature of the sample. The memory bank contains sample elements from normal memory bank samples and sample elements from abnormal memory bank samples, represented as follows: ; in, These represent the normal and abnormal memory banks, respectively, with subscripts... These represent the number of normal and abnormal elements in the memory bank, respectively.
[0032] To read the memory and obtain new features, firstly, calculate each new memory feature. and all elements Cosine similarity between The specific formula is as follows: ; in, It is the first in the memory bank One element, , T For vector transpose, It is the L2 norm, i.e., the Euclidean length.
[0033] Then, the calculated cosine similarity is normalized to obtain the matching probability weights. The specific formula is as follows: ; in, M This indicates the total number of reference features stored in the memory. This means iterating through all reference features from the 1st to the Mth feature, and calculating their differences with each other. The similarity index is used as the denominator for normalization.
[0034] Finally, the matching probability is multiplied by the corresponding element, and the sum is calculated; that is, elements are read from the memory and used from the memory. Combinations to represent queries The specific formula for obtaining the final estimated value of the memory-enhanced feature vector is as follows: ; in, Indicates the weighting coefficient, superscript k Corresponding target object, m′ Corresponding to the m′ Basic data, Indicates the first m′ Original basic data, M This represents the total number of basic data points used in the calculation.
[0035] To update the memory and make the stored samples more representative, the first step is to calculate each new memory feature. and all elements The cosine similarity between the elements is then used to calculate the matching probability. Normalization is performed using a normalized exponential function: ; in, K This represents the total number of query features involved in the calculation. k ′ represents the index variable for summation.
[0036] Next, the normalized similarity is multiplied by the corresponding query and summed to obtain the change. : ; in, The first in the representation and memory module The set of indexes for the query corresponding to the item.
[0037] Finally, add the changed amount to the original element to obtain the updated element: ; Construct a hypersphere space based on the data in the memory bank, and use the mean of the sample features stored in the memory bank as the center of the hypersphere. The Euclidean distance from the feature to the center of the sphere is used as the radius. The specific formula is as follows: ; ; in, Represents the features of each sample. It refers to the number of samples.
[0038] Define a distance loss function to optimize the memory-enhanced features read from the memory bank. Map these features to a hypersphere, ensuring that normal memory bank samples are mapped to positions closer to the feature center, while abnormal memory bank samples are mapped to positions farther from the center. The distance loss function... The specific formula is as follows: ; in, The total number of samples, This represents the normal number of samples in the memory bank. These are weighting coefficients. Represents the feature center, These represent memory enhancement features obtained from normal and abnormal memory banks, respectively.
[0039] Iterate through the hypersphere parameters to reach their optimal state: Preset the model training epochs, iterate through the hypersphere parameters, and stop iterating when the model reaches the preset number of epochs. Store the hypersphere parameters for subsequent detection. ; ; in, Indicates the first The hypersphere radius after the next iteration. Indicates the first The supersphere center after the next iteration; , Represents the initial radius and center of the sphere, where the radius... This indicates that the initial radius is 1 and the center of the sphere is... This indicates that the initial center of the spheres is a B-row zero matrix, where B represents the batch size; Indicates the first The hypersphere radius output by the model in the next iteration. Indicates the first The hypersphere center output by the model in the next iteration; and Each represents the weight at each iteration.
[0040] S3. When the preset update cycle is reached, the update step is stopped, and the final memory and optimal hypersphere space are obtained; the final memory and optimal hypersphere space are used for traffic behavior anomaly detection.
[0041] The system performs anomaly detection by inputting traffic data into the model and then using a memory-based reading operation to generate memory-enhanced features from elements in both the normal and anomaly memory databases. Calculate its distance from the feature center, using To define the distance between sample features and feature centers, D 1 represents the normal memory bank sample distance. D 2 represents the distance between samples in the abnormal memory, expressed as follows: ; Calculate the weighted difference between the distance between a feature generated from a normal memory and the center of the hypersphere and the distance between a feature generated from an abnormal memory and the center of the hypersphere. If the difference is less than a set threshold, the feature is considered a normal memory sample; otherwise, it is considered an abnormal memory sample.
[0042] ; in, This indicates the set threshold. and This represents the weighting coefficient.
[0043] Based on the same inventive concept, the present invention also provides a traffic behavior anomaly detection system, comprising: The data acquisition module is used to collect a sample set of original traffic monitoring videos, and divides the sample set into a basic construction sample set and an iterative update sample set.
[0044] The network training module is used to extract the first high-dimensional image feature vector from the basic construction sample set, optimize the constraints of the first high-dimensional image feature vector using the contrastive loss function, construct a traffic behavior basic memory bank based on the optimized high-dimensional image feature vector, and construct an initial hypersphere space based on the basic memory bank. Extract the second high-dimensional image feature vector from one original traffic monitoring video in the iterative update sample set; calculate the matching probability value between the second high-dimensional image feature vector and each element in the basic memory, and update each element in the basic memory using the matching probability value to obtain the updated memory; weight and sum all matching probability values with the elements in the basic memory corresponding to each matching probability value to obtain the memory-enhanced feature; map the memory-enhanced feature to the initial hypersphere space, and iteratively update the parameters of the initial hypersphere space using the mapped hypersphere space to obtain the updated hypersphere space; continue to perform the update step on the updated memory and the updated hypersphere space using the second high-dimensional image feature vector.
[0045] The model determination module is used to stop the update step when a preset update cycle is reached, and obtain the final memory and the optimal hypersphere space; the final memory and the optimal hypersphere space are used for traffic behavior anomaly detection.
[0046] This invention also provides a computer device. At the hardware level, the computer device includes a processor, an internal bus, a network interface, memory, and non-volatile storage, and may also include other hardware required for business operations. The processor reads the corresponding computer program from the non-volatile storage into the memory and then runs it to implement the traffic behavior anomaly detection method provided above.
[0047] The present invention also provides a computer-readable storage medium storing a computer program that can be used to execute the traffic behavior anomaly detection method provided above.
[0048] Specific limitations regarding the computational system for traffic behavior anomaly detection methods can be found in the limitations of the traffic behavior anomaly detection method described above, and will not be repeated here. Each module in the aforementioned traffic behavior anomaly detection system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0049] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. Furthermore, the above embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for detecting abnormal traffic behavior, characterized in that, include: Collect a sample set of original traffic monitoring videos, and divide the sample set into a basic construction sample set and an iterative update sample set; Extract the first high-dimensional image feature vector from the basic construction sample set, optimize the constraint of the first high-dimensional image feature vector using the contrastive loss function, construct a traffic behavior basic memory bank based on the optimized high-dimensional image feature vector, and construct an initial hypersphere space based on the basic memory bank. Extract the second high-dimensional image feature vector from one original traffic monitoring video in the iterative update sample set; calculate the matching probability value between the second high-dimensional image feature vector and each element in the basic memory bank; update each element in the basic memory bank using the matching probability value to obtain the updated memory bank; and sum all the matching probability values with the elements in the basic memory bank corresponding to each matching probability value to obtain the memory enhancement feature. The memory-enhanced features are mapped onto the initial hypersphere space, and the parameters of the initial hypersphere space are iteratively updated using the mapped hypersphere space to obtain the updated hypersphere space. The update steps are then performed on the updated memory and the updated hypersphere space using the second high-dimensional image feature vector. When the preset update cycle is reached, the update step is stopped, and the final memory and optimal hypersphere space are obtained; the final memory and optimal hypersphere space are used for traffic behavior anomaly detection.
2. The method for detecting abnormal traffic behavior according to claim 1, characterized in that, The initial hypersphere space is constructed based on the aforementioned basic memory bank, specifically including: The average value of each element in the basic memory is calculated according to its dimension; the average values of all dimensions form the initial sphere center coordinates. Calculate the Euclidean distance from each element in the basic memory bank to the initial sphere center, and take the average of all Euclidean distances as the initial radius; The initial hypersphere space is determined by the initial center coordinates and the initial radius.
3. The method for detecting abnormal traffic behavior according to claim 1, characterized in that, The process of calculating the matching probability value between the second high-dimensional image feature vector and each element in the basic memory, and updating each element in the basic memory using the matching probability value to obtain the updated memory, specifically includes: Calculate the cosine similarity between the feature vector of the second high-dimensional image and each element in the basic memory bank; Normalize all cosine similarities to obtain matching probability values; multiply the matching probability values by the corresponding elements to obtain element change values; The original element is added to the element's changed value to obtain the updated element; the updated memory is composed of all the updated elements.
4. The method for detecting abnormal traffic behavior according to claim 1, characterized in that, The traffic behavior basic memory bank is divided into a normal traffic behavior memory bank and a traffic behavior abnormality memory bank; high-dimensional image feature vectors of the original traffic monitoring videos are extracted using a pre-trained ResNet18 model.
5. The method for detecting abnormal traffic behavior according to claim 4, characterized in that, The contrast loss function The formula is as follows: ; in, i For sample index number, This includes the set of pairs between normal memory bank samples and the set of pairs between abnormal memory bank samples. This represents the set of pairs of normal memory bank samples and abnormal memory bank samples. This is the first high-dimensional image feature vector. for Characteristics of samples of the same category for Different categories of sample characteristics, This represents a scalar temperature parameter.
6. The method for detecting abnormal traffic behavior according to claim 4, characterized in that, The step of mapping the memory-enhanced features to the initial hypersphere space further includes defining a distance loss function to optimize the memory-enhanced features, and then using the optimized features to iteratively update the parameters of the initial hypersphere space. The specific distance loss function is as follows: ; in, This represents the total number of normal memory bank samples and abnormal memory bank samples. This represents the normal number of samples in the memory bank. These are weighting coefficients. Represents the feature center, These represent memory enhancement features obtained from the normal memory bank and the abnormal memory bank, respectively.
7. The method for detecting abnormal traffic behavior according to claim 4, characterized in that, The final memory and optimal hypersphere are used for traffic behavior anomaly detection, specifically including: Extract high-dimensional image feature vectors from target traffic surveillance videos; Through memory bank read operations, a memory-enhanced feature is generated from the high-dimensional image feature vector and the normal memory bank of the final memory bank; another memory-enhanced feature is generated from the high-dimensional image feature vector and the abnormal memory bank of the final memory bank. The memory-enhanced features generated from two different memory banks are mapped to the hypersphere space, and the distances from the two different memory-enhanced features to the center of the optimal hypersphere space are calculated to obtain the normal memory distance and the abnormal memory distance. If the weighted difference between the normal memory distance and the abnormal memory distance is less than a set threshold, it is considered a normal memory bank sample; otherwise, it is considered an abnormal memory bank sample.
8. A traffic behavior anomaly detection system, characterized in that, include: The data acquisition module is used to collect raw traffic monitoring video sample sets, and divides the sample sets into a basic construction sample set and an iterative update sample set; The network training module is used to extract the first high-dimensional image feature vector from the basic construction sample set, optimize the constraints of the first high-dimensional image feature vector using the contrastive loss function, construct a traffic behavior basic memory bank based on the optimized high-dimensional image feature vector, and construct an initial hypersphere space based on the basic memory bank. Extract the second high-dimensional image feature vector from one original traffic monitoring video in the iterative update sample set; calculate the matching probability value between the second high-dimensional image feature vector and each element in the basic memory bank; update each element in the basic memory bank using the matching probability value to obtain the updated memory bank; and sum all the matching probability values with the elements in the basic memory bank corresponding to each matching probability value to obtain the memory enhancement feature. The memory-enhanced features are mapped onto the initial hypersphere space, and the parameters of the initial hypersphere space are iteratively updated using the mapped hypersphere space to obtain the updated hypersphere space. The update steps are then performed on the updated memory and the updated hypersphere space using the second high-dimensional image feature vector. The model determination module is used to stop the update step when a preset update cycle is reached, and obtain the final memory and the optimal hypersphere space; the final memory and the optimal hypersphere space are used for traffic behavior anomaly detection.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor, it is able to perform the steps of the method according to any one of claims 1 to 7.