An abnormal behavior recognition method and system based on deep learning
By employing multimodal feature fusion and dynamic threshold calibration mechanisms, the robustness and adaptability issues of existing abnormal behavior recognition methods in complex scenarios are addressed. This achieves high-accuracy anomaly recognition and continuous learning, while reducing false positive and false negative rates and computational costs.
Patent Information
- Application Number
- CN202611574177.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-12
- Publication Date
- 2026-11-20
AI Technical Summary
Existing abnormal behavior identification methods lack robustness in complex scenarios, have high false positive and false negative rates, cannot adapt to changes in behavior distribution across scenarios and time periods, and are difficult to adapt to new abnormal types and avoid catastrophic forgetting.
Employing multimodal feature fusion, a dual-branch architecture, and a dynamic threshold calibration mechanism, this approach extracts multi-scale appearance and motion features through a cross-modal attention fusion module. Combined with normal behavior reconstruction and abnormal behavior classification, it dynamically adjusts the judgment threshold to construct a closed-loop incremental learning mechanism.
It improves the accuracy of abnormal behavior identification, reduces false alarm and false negative rates, adapts to scene changes, supports continuous learning, avoids catastrophic forgetting, and reduces computation and data annotation costs.
Smart Images

Figure CN123142174A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and intelligent video surveillance technology, and more specifically to an abnormal behavior recognition method and system based on deep learning. Background Technology
[0002] With the rapid advancement of safe city, intelligent transportation, industrial security, and smart community construction, the number of video surveillance cameras deployed has increased dramatically, leading to an explosive increase in the amount of surveillance video data. Traditional methods relying on security personnel manually monitoring surveillance footage suffer from problems such as fatigue, high missed detection rates, and slow response times, and can no longer meet the real-time and accuracy requirements of large-scale video surveillance. Deep learning-based abnormal behavior recognition technology can automatically detect and identify abnormal behaviors from surveillance videos, such as fights, falls, illegal intrusions, leaving suspicious items, and loitering, which is of great significance for improving public safety governance capabilities and the level of security intelligence.
[0003] Existing methods for identifying abnormal behavior mainly fall into the following categories: The first category is reconstruction-based methods, which use autoencoders or generative adversarial networks to learn the feature distribution of normal behavior and classify samples with large reconstruction errors as anomalous. However, these methods rely solely on the single path of reconstruction error for judgment. When normal behavior itself has strong diversity, some normal samples may also produce large reconstruction errors, leading to a high false positive rate. At the same time, these methods can only determine whether something is anomalous or not, but cannot further distinguish the specific categories of anomalous behavior, making it difficult to support hierarchical responses.
[0004] The second type is classification-based methods, which directly construct an abnormal behavior classifier to perform end-to-end classification of video clips. However, in actual monitoring scenarios, abnormal samples are relatively scarce and the abnormal categories are open-ended. The classifier struggles to cover all possible abnormal types and has poor generalization ability for novel abnormalities not seen during the training phase, easily leading to missed detections.
[0005] The third category is based on single-modal feature-based methods, which use only RGB image sequences or optical flow sequences as network input. RGB appearance features are sensitive to changes in lighting, weather conditions, and camera shake, while optical flow motion features are inaccurate in estimating target occlusion and low-texture areas. Single-modal features lack robustness in complex surveillance scenarios, thus limiting recognition performance.
[0006] The fourth type is based on fixed thresholds, which sets a global fixed threshold for binary judgment after the model outputs an anomaly score. However, the normal behavior patterns of different monitoring scenarios (such as shopping malls, subway stations, campuses, and industrial parks) vary significantly, and the behavior distribution of the same scenario also fluctuates significantly at different times (day and night, peak and off-peak hours). Fixed thresholds cannot adapt to such cross-scenario and cross-time period distribution changes, resulting in a high false alarm rate in some scenarios and a high false negative rate in others.
[0007] The fifth category is based on offline training. After the model is trained on the initial dataset, it is deployed in a fixed location. When the monitoring scenario changes or new anomaly types appear, it is necessary to collect a new dataset and retrain the model entirely. Full retraining is not only computationally expensive and time-consuming, but it is also prone to destroying previously learned knowledge during the process of learning new knowledge, resulting in catastrophic forgetting problems.
[0008] Therefore, there is an urgent need in the existing technology for an abnormal behavior recognition method and system that can integrate multimodal features to improve robustness in complex scenarios, synergistically utilize reconstructed information and discriminative information to reduce false positives and false negatives, adaptively adjust the judgment threshold to adapt to scene changes, and support continuous incremental learning to avoid catastrophic forgetting. Summary of the Invention
[0009] In view of this, the present invention provides an abnormal behavior recognition method and system based on deep learning, aiming to solve the technical problems of existing abnormal behavior recognition methods, such as insufficient robustness in complex scenarios due to the use of single-modal features, high false positive and false negative rates due to the separation of reconstruction and classification paths, inability of fixed thresholds to adapt to changes in behavior distribution across scenarios and time periods, and difficulty of offline training models to adapt to new abnormal types and catastrophic forgetting due to full retraining.
[0010] To achieve the above objectives, the present invention adopts the following technical solution: A deep learning-based method for identifying abnormal behavior includes the following steps: S1. Acquire the monitoring video stream, preprocess the video frame sequence, detect and track the target object in the video, and extract the appearance image block, continuous inter-frame optical flow map and skeleton key point sequence of the target object. S2. Input the appearance image block into a spatial feature extraction network to obtain multi-scale spatial appearance features, and input the optical flow map and skeleton key point sequence into a temporal feature extraction network to obtain multi-scale temporal motion features; S3. Adaptive weighted fusion of the multi-scale spatial appearance features and multi-scale temporal motion features is performed through the cross-modal attention fusion module to obtain spatiotemporal fusion features; S4. Input the spatiotemporal fusion features into the normal behavior reconstruction branch and the abnormal behavior classification branch respectively. The normal behavior reconstruction branch outputs the reconstruction error based on the memory-enhanced autoencoder, and the abnormal behavior classification branch outputs the probability distribution of abnormal categories. S5. Calculate the comprehensive anomaly score based on the reconstruction error and anomaly category probability distribution. Input the context information of the current scene and the sliding window statistics of the historical anomaly scores into the threshold prediction network, output the anomaly judgment threshold, determine the anomaly judgment threshold through the dynamic threshold calibration mechanism, and judge the behavior that exceeds the anomaly judgment threshold as an abnormal behavior. S6. Video segments identified as abnormal behavior are classified and alarmed according to the abnormality category and comprehensive abnormality score, and the alarm results and corresponding video segments are pushed to the manual review terminal. S7. Receive the annotation results fed back by the manual review terminal, mine difficult sample based on the annotation results, and update the parameters of the spatial feature extraction network, temporal feature extraction network, cross-modal attention fusion module, normal behavior reconstruction branch, abnormal behavior classification branch and threshold prediction network through incremental learning.
[0011] Furthermore, S1 includes: S11. Use an object detection network to perform object detection on each frame of video image to obtain the object bounding box; S12. Use a multi-target tracking algorithm to associate the same target in adjacent frames and assign a continuous tracking identifier; S13. Cropping and scaling the target bounding box to obtain a fixed-size appearance image block; S14. Calculate the dense optical flow graph between consecutive frames using an optical flow network; S15. Use a pose estimation network to extract the skeleton key points of the target object, and arrange the skeleton key points of the same target in consecutive frames into a skeleton key point sequence according to the tracking identifier.
[0012] Furthermore, the cross-modal attention fusion module in S3 includes a channel attention unit and a spatial attention unit; The channel attention unit performs global average pooling and global max pooling on multi-scale spatial appearance features and multi-scale temporal motion features, respectively. The pooling results are concatenated and passed through a fully connected layer to generate channel attention weights. The channel attention weights are multiplied by the features of the corresponding modal to obtain channel weighted features. The spatial attention unit performs average pooling and max pooling on the channel weighted features of the two modalities in the channel dimension and concatenates them. After passing through a convolutional layer and activation function, a spatial attention weight map is generated. The spatial attention weight map is multiplied by the channel weighted features of the corresponding modalities to obtain the spatial weighted features. The spatiotemporal fusion feature is obtained by adding the spatial weighted features of the two modalities element by element and then performing convolution fusion.
[0013] Furthermore, the normal behavior reconstruction branch includes an encoder, a memory module, and a decoder; The encoder downsamples and encodes the spatiotemporal fusion features to obtain encoded features; The memory module contains a learnable memory item matrix. An attention mechanism is used to retrieve the memory items most relevant to the encoded features from the memory item matrix, and the retrieved memory items are weighted and aggregated with the encoded features to obtain memory-enhanced features. The decoder upsamples and reconstructs the memory-enhanced features to obtain reconstructed features; The mean of the element-by-element differences between the encoded features and the reconstructed features is calculated as the reconstruction error.
[0014] Furthermore, the dynamic threshold calibration mechanism in S5 includes: S51. After normalizing the reconstruction error, sum it with the maximum probability in the probability distribution of the anomaly category to obtain the comprehensive anomaly score. S52. Encode the scene type, time period information and congestion level of the current scene to obtain the scene context vector; S53. Maintain a fixed-length historical outlier score sliding window, and calculate the mean and standard deviation of the outlier scores within the sliding window as statistics. S54. Input the scene context vector and statistics into the threshold prediction network and output the anomaly judgment threshold at the current moment. S55. When the comprehensive anomaly score exceeds the anomaly determination threshold, it is determined to be an abnormal behavior.
[0015] A deep learning-based abnormal behavior recognition system includes: The video preprocessing module is used to acquire the surveillance video stream, preprocess the video frame sequence, detect and track target objects in the video, and extract the appearance image blocks, continuous inter-frame optical flow maps, and skeleton key point sequences of the target objects. The feature extraction module is used to input the appearance image block into the spatial feature extraction network to obtain multi-scale spatial appearance features, and to input the optical flow map and skeleton key point sequence into the temporal feature extraction network to obtain multi-scale temporal motion features; The cross-modal fusion module is used to adaptively weight and fuse the multi-scale spatial appearance features and multi-scale temporal motion features through the cross-modal attention fusion module to obtain spatiotemporal fusion features; The dual-branch decision module is used to input the spatiotemporal fusion features into the normal behavior reconstruction branch and the abnormal behavior classification branch respectively. The normal behavior reconstruction branch outputs the reconstruction error based on the memory-enhanced autoencoder, and the abnormal behavior classification branch outputs the probability distribution of abnormal categories. The dynamic threshold module is used to calculate a comprehensive anomaly score based on the reconstruction error and the probability distribution of anomaly categories. Combining the context information of the current scene and the sliding window statistics of historical anomaly scores, it determines the anomaly judgment threshold through a dynamic threshold calibration mechanism, and judges behaviors with a comprehensive anomaly score exceeding the anomaly judgment threshold as abnormal behaviors. The alarm push module is used to classify and alarm video segments that are judged to be abnormal behavior according to the abnormality category and comprehensive abnormality score, and push the alarm results and corresponding video segments to the manual review terminal. The incremental update module is used to receive the annotation results fed back by the manual review terminal, mine difficult example samples based on the annotation results, and update the parameters of each network and module through incremental learning.
[0016] Furthermore, the video preprocessing module includes: The target detection unit is used to perform target detection on each frame of video image using a target detection network to obtain the target bounding box; The target tracking unit is used to associate the same target in adjacent frames with a multi-target tracking algorithm and assign a continuous tracking identifier; The appearance cropping unit is used to crop and scale the appearance image block to a fixed size according to the target bounding box; Optical flow computing unit, used to compute dense optical flow graphs between consecutive frames using an optical flow network; The skeleton extraction unit is used to extract the skeleton key points of the target object using a pose estimation network, and arranges the skeleton key points of the same target in consecutive frames into a skeleton key point sequence according to the tracking identifier.
[0017] Furthermore, the cross-modal fusion module includes a channel attention unit and a spatial attention unit; The channel attention unit is used to perform global average pooling and global max pooling on multi-scale spatial appearance features and multi-scale temporal motion features, respectively. The pooling results are concatenated and passed through a fully connected layer to generate channel attention weights. The channel attention weights are multiplied by the features of the corresponding modal to obtain channel weighted features. The spatial attention unit is used to perform average pooling and max pooling on the channel weighted features of the two modalities respectively and concatenate them. After passing through convolutional layers and activation functions, a spatial attention weight map is generated. The spatial attention weight map is multiplied by the channel weighted features of the corresponding modalities to obtain the spatial weighted features. The cross-modal fusion module is also used to add the spatial weighted features of the two modalities element by element and then perform convolutional fusion to obtain the spatiotemporal fusion features.
[0018] Furthermore, the normal behavior reconstruction branch includes an encoder, a memory module, and a decoder; The encoder is used to downsample and encode spatiotemporal fusion features to obtain encoded features; The memory module contains a learnable memory item matrix, which is used to retrieve the most relevant memory items to the encoded features from the memory item matrix through an attention mechanism, and to weight and aggregate the retrieved memory items with the encoded features to obtain memory-enhanced features. The decoder is used to upsample and reconstruct the memory-enhanced features to obtain reconstructed features; The dual-branch decision module is also used to calculate the mean of the element-by-element differences between the encoded features and the reconstructed features as the reconstruction error.
[0019] Furthermore, the incremental update module includes: The difficult example mining unit is used to filter samples whose judgment results are inconsistent with the annotation results and samples whose comprehensive anomaly scores are within the neighborhood of the anomaly judgment threshold, based on the annotation results fed back by the manual review terminal, as difficult example samples. The loss calculation unit is used to calculate the classification loss and reconstruction loss on the difficult sample, and calculate the elastic regularization term according to the parameter importance weights obtained in the previous training stage. The classification loss, reconstruction loss and elastic regularization term are weighted and summed to obtain the incremental loss. The parameter update unit is used to update the parameters of each network and module through backpropagation based on the incremental loss, and to recalculate the parameter importance weights based on the updated parameters for the next incremental update.
[0020] Compared with the prior art, the present invention has the following beneficial effects: First, this invention simultaneously extracts three modal information: appearance image blocks, optical flow maps, and skeleton key point sequences. It extracts multi-scale appearance features and motion features through a spatial flow and temporal flow dual-stream network, and performs adaptive weighted fusion of channel and spatial dimensions through a cross-modal attention fusion module. This enables more comprehensive and robust behavior representations in complex monitoring scenarios such as target occlusion, lighting changes, and camera shake, significantly improving the accuracy of abnormal behavior recognition compared to single-modal methods.
[0021] Second, this invention adopts a dual-branch architecture with a normal behavior reconstruction branch and an abnormal behavior classification branch running in parallel. The memory-enhanced autoencoder enhances the modeling ability of diverse normal behavior patterns through a learnable memory term matrix. The reconstruction error can reflect the degree to which the sample deviates from the normal pattern, thereby providing the ability to detect unknown anomalies. The classification branch provides the ability to finely distinguish known anomaly categories. The information from the two paths is synergistically fused at the comprehensive anomaly scoring level, effectively reducing the false alarm rate and false negative rate, and supporting the identification of anomaly categories.
[0022] Third, this invention proposes a dynamic threshold calibration mechanism, which inputs contextual information such as scene type, time period, and congestion level, along with the sliding window statistics of historical anomaly scores, into the threshold prediction network. This adaptively outputs anomaly judgment thresholds that are adapted to the current scene and time period, overcoming the poor adaptability of fixed thresholds when deployed across scenes and time periods, and significantly reducing the false alarm rate in actual deployment.
[0023] Fourth, this invention constructs a closed-loop mechanism from automatic identification to manual review and then to model update. It automatically filters weak samples in the model by mining difficult examples and uses elastic regularization to constrain the parameter update direction. While incrementally learning new anomaly types, it retains the memory of existing knowledge, effectively avoiding catastrophic forgetting, reducing the computational cost of full retraining and data labeling cost, and enabling the model to continuously evolve in long-term operation. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, 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 embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0025] Figure 1 This is a flowchart illustrating the abnormal behavior recognition method based on deep learning provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the cross-modal attention fusion module provided in an embodiment of the present invention; Figure 3 This is a structural block diagram of an abnormal behavior recognition system based on deep learning provided in an embodiment of the present invention.
[0026] Among them, 1 is the video preprocessing module, 2 is the feature extraction module, 3 is the cross-modal fusion module, 4 is the dual-branch decision module, 5 is the dynamic threshold module, 6 is the alarm push module, and 7 is the incremental update module. Detailed Implementation
[0027] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0029] Example 1 This embodiment provides a deep learning-based method for identifying abnormal behavior, such as... Figure 1 As shown, the method includes steps S1 to S7, and each step will be described in detail below with reference to the accompanying drawings.
[0030] Step S1: Acquire the surveillance video stream and perform preprocessing.
[0031] Real-time video streams or historical video files are acquired from surveillance cameras or video storage devices, and the videos are decoded according to a preset sampling frame rate to obtain a video frame sequence. The video frame sequence is then processed sequentially with operations including target detection, multi-target tracking, appearance image patch cropping, optical flow calculation, and skeleton keypoint extraction.
[0032] Specifically, a deep learning-based target detection network (such as the YOLO series detection networks) is used to detect pedestrians and other surveillance targets in each frame of video image, outputting the bounding box coordinates and target confidence score for each target, and filtering out detection results below the confidence threshold. A multi-target tracking algorithm (such as the DeepSORT algorithm) is used to correlate the detection results in adjacent frames, assigning a unique tracking identifier to each target in the video sequence and recording the motion trajectory of each target. The target region is cropped from the original frame based on the target bounding box, and the cropped region is scaled to a fixed size (such as 224×224 pixels) to obtain the appearance image patch. A lightweight optical flow estimation network (such as the RAFT network) is used to calculate the dense optical flow map between two consecutive frames, which contains displacement components in both horizontal and vertical directions. Human pose estimation networks (such as OpenPose or HRNet) are used to extract the skeleton key points of each target. The key points include human joints such as head, neck, shoulder, elbow, wrist, hip, knee, and ankle. Each key point contains coordinates and confidence. The skeleton key point coordinates of the same target in consecutive T frames (T is between 16 and 32) are arranged in chronological order according to the tracking identifier to form a skeleton key point sequence.
[0033] Through the above preprocessing, a set of multimodal input data containing appearance image patch sequences, optical flow map sequences, and skeleton key point sequences is constructed for each tracking target within each time window.
[0034] Step S2: Multi-scale feature extraction.
[0035] The sequence of appearance image patches is input into the spatial feature extraction network, and the sequence of optical flow maps and the sequence of skeleton key points are input into the temporal feature extraction network to extract multi-scale spatial appearance features and multi-scale temporal motion features, respectively.
[0036] The spatial feature extraction network uses a convolutional neural network (such as ResNet-50) pre-trained on a large-scale image dataset as its backbone. Appearance image patches from T consecutive frames are input into the backbone network, and multi-level feature maps output from different depth stages of the network are extracted as multi-scale spatial appearance features. Shallow features retain details such as edges and textures, while deep features contain semantic information. The multi-scale features of each frame are stacked and temporally convolved along the time dimension to obtain multi-scale spatial appearance features that incorporate short-term temporal information.
[0037] The temporal feature extraction network comprises an optical flow coding branch and a skeleton coding branch. The optical flow coding branch employs a 3D convolutional neural network (such as a 3D ResNet-based structure) to perform 3D convolution and 3D pooling operations on a continuous T-frame optical flow map sequence to extract multi-scale optical flow motion features. The skeleton coding branch first normalizes the coordinates of the skeleton keypoints relative to the center of the target bounding box, then concatenates the keypoint coordinates at each time step into a feature vector, which is input into the skeleton coding network composed of multiple layers of temporal convolutions and gated recurrent units to extract skeleton motion features. The optical flow motion features and skeleton motion features are concatenated along the channel dimension and then subjected to convolutional dimensionality reduction to obtain the multi-scale temporal motion features.
[0038] Step S3: Cross-modal attention fusion.
[0039] like Figure 2 As shown, the cross-modal attention fusion module includes a channel attention unit and a spatial attention unit, which performs two-dimensional adaptive weighted fusion of spatial appearance features and temporal motion features.
[0040] The channel attention unit performs global average pooling and global max pooling on the features of the two modalities respectively. The results of the two pooling operations are concatenated along the channel dimension and passed through two fully connected layers (the intermediate layer uses the ReLU activation function, and the output layer uses the Sigmoid activation function) to generate a channel attention weight vector. Each value in the weight vector corresponds to the importance of each channel of the corresponding modality. The channel attention weight vector is then multiplied by the original features of the corresponding modality by channel to obtain the channel-weighted features of the two modalities.
[0041] The spatial attention unit performs average pooling and max pooling on the channel-weighted features of the two modalities along the channel dimension, respectively. The pooling results are concatenated along the channel dimension to form a dual-channel feature map. This map is then passed through a 7×7 convolutional layer and a sigmoid activation function to generate a spatial attention weight map. The value at each position in the weight map corresponds to the importance of that spatial location. The spatial attention weight map is then multiplied by the corresponding channel-weighted features of the modality according to their spatial locations to obtain the spatial weighted features for each of the two modalities.
[0042] The spatially weighted features of the two modalities are added element-wise, and then passed through a 3×3 convolutional layer for channel dimensionality reduction and feature integration, ultimately yielding a spatiotemporal fusion feature that integrates appearance and motion information. Through a dual-dimensional attention mechanism of channels and space, the network can adaptively focus on the channels and spatial regions that are most informative for identifying abnormal behavior.
[0043] Step S4: Determine the dual-branch anomaly.
[0044] The spatiotemporal fusion features are input into the normal behavior reconstruction branch and the abnormal behavior classification branch respectively to obtain the reconstruction error and the probability distribution of abnormal categories.
[0045] The normal behavior reconstruction branch employs a memory-enhanced autoencoder structure, comprising an encoder, a memory module, and a decoder. The encoder consists of several convolutional layers and downsampling layers, progressively downsampling and encoding the spatiotemporal fusion features to obtain dimensionality-compressed encoded features. The memory module contains a learnable memory term matrix, composed of M memory term vectors of length D (M ranging from 100 to 512). For the input encoded features, attention weights are obtained by calculating the cosine similarity between the encoded features and each memory term. The K most similar memory terms (K ranging from 5 to 20) are selected, and a weighted sum is calculated using the attention weights as coefficients. This sum is then concatenated with the encoded features and passed through a fully connected layer for dimensionality reduction, yielding the memory-enhanced features. The introduction of the memory module enables the autoencoder to memorize multiple normal behavior prototypes, enhancing its ability to model the diversity of normal behavior. The decoder consists of several transposed convolutional layers and upsampling layers, progressively upsampling and reconstructing the memory-enhanced features, outputting reconstructed features with the same dimensionality as the encoded features. The average of the absolute differences between the encoded features and the reconstructed features is calculated as the reconstruction error. When the input behavior conforms to the normal pattern, there are matching memory items in the memory module, and the reconstruction error is small. When the input behavior is abnormal, there are no matching items in the memory module, and the reconstruction error increases significantly.
[0046] The abnormal behavior classification branch consists of a global average pooling layer, several fully connected layers, and a Softmax output layer. It classifies spatiotemporal fusion features and outputs a probability distribution over a predefined set of abnormal categories. These predefined abnormal categories include, but are not limited to, fighting, falling down, trespassing, leaving items behind, loitering, and climbing fences. The maximum probability value in the probability distribution reflects the model's confidence that the behavior belongs to a certain known abnormal category.
[0047] Step S5: Dynamic threshold calibration and anomaly detection.
[0048] First, the comprehensive anomaly score is calculated: the reconstruction error is mapped to the 0-1 interval using min-max normalization. The normalized reconstruction error is then weighted and summed with the maximum probability value in the anomaly category probability distribution according to preset weights to obtain the comprehensive anomaly score. The weights are adjusted based on the performance on the validation set, with a default value of 0.5 for each.
[0049] The dynamic threshold calibration mechanism comprises three stages: scene context encoding, sliding window statistics, and threshold prediction. The scene context encoding stage encodes the current monitored scene type (e.g., indoor / outdoor, shopping mall / subway station / campus), the current time period (divided by hour and combined with weekday / holiday indicators), and the number of targets in the current frame (as a congestion indicator). The scene type and time period are mapped from discrete identifiers to low-dimensional dense vectors using an embedding layer. The congestion indicator, after normalization, is used as a scalar input. The above encodings are concatenated to obtain the scene context vector. The sliding window statistics stage maintains a historical anomaly score sliding window of length W (W ranges from 300 to 1000, in seconds or frame windows). Each time a new comprehensive anomaly score is generated, it is added to the window, and the oldest score is removed. The mean and standard deviation of the scores within the window are calculated in real time as statistics. The threshold prediction network employs a multi-layer fully connected network. The scene context vector, the sliding window mean, and the standard deviation are concatenated and input, passing through two hidden layers (using the ReLU activation function) and one output layer (using the Sigmoid activation function), outputting an anomaly judgment threshold between 0 and 1.
[0050] The threshold prediction network is jointly trained with the main network during the model training phase, using the interval hinge loss as the loss function. The training objective is to ensure that the overall anomaly score of normal samples is lower than the predicted threshold while maintaining a certain interval, and that the overall anomaly score of abnormal samples is higher than the predicted threshold while maintaining a certain interval. For the nth sample in the batch training, the threshold prediction loss... The calculation method is as follows: (1), Where N is the batch size. The comprehensive anomaly score for the nth sample. This is the anomaly detection threshold output by the threshold prediction network for the scene and time of this sample. For sample labels (normal samples are taken) Abnormal sample taking ), The interval parameter ranges from 0.1 to 0.3, with a default value of 0.2. The first term in formula (1) imposes a constraint on normal samples: when the normal sample scores... This results in a penalty, pushing the scores of normal samples down to at least below a threshold. The interval; the second term imposes a constraint on outlier samples: when outlier sample scores A penalty is imposed at any time, pushing the score of abnormal samples to at least above a threshold. The interval.
[0051] During the inference phase, the threshold prediction network outputs a threshold in real time based on the current scene context and recent rating distribution. When the overall abnormal rating exceeds this threshold, it is determined to be abnormal behavior. Because the threshold adaptively adjusts with the scene and time of day, it can automatically increase the threshold during peak hours when there are many people to reduce false alarms caused by crowding, and automatically decrease the threshold during sparsely populated nighttime hours to increase sensitivity to suspicious behavior.
[0052] Step S6: Tiered Alarms and Push Notifications.
[0053] For video clips identified as exhibiting abnormal behavior, they are categorized based on the type of abnormality and a comprehensive anomaly score. Specifically, high-risk categories such as fighting and illegal intrusion are assigned higher basic alarm levels, while medium- to low-risk categories such as loitering and leaving items behind are assigned lower basic alarm levels. The basic alarm level is adjusted based on how much the comprehensive anomaly score exceeds a threshold; the greater the score exceeds the threshold, the higher the alarm level. Ultimately, alarms are classified into three levels: urgent, important, and general. Alarm information (including the type of abnormality, alarm level, time of occurrence, camera location, and comprehensive anomaly score) and corresponding video clips (a few seconds of video buffering before and after the alarm time) are pushed to the security personnel's manual review terminal, while simultaneously displaying the alarm screen on the monitoring display.
[0054] Step S7: Manual feedback and incremental updates.
[0055] After reviewing the alarm video clips on the manual verification terminal, security personnel provide a labeling result for each alarm: confirmed as abnormal (correctly labeled) or false alarm (labeled as normal). The system triggers an incremental update after collecting a certain number of feedback labels.
[0056] Incremental updates consist of three stages: hard example discovery, loss calculation, and parameter update. The hard example discovery stage selects samples from two categories as hard examples: first, samples where the model's judgment differs from the manually labeled data (including false positives and false negatives); and second, boundary samples whose overall anomaly score falls within the neighborhood of the anomaly detection threshold (e.g., within 0.1 above and below the threshold). In addition, a certain proportion of old samples are randomly selected from historical training data as replay samples, which, together with the hard example samples, form the incremental training set.
[0057] The loss calculation step calculates the following losses on the incremental training set and then sums them using weighted averages.
[0058] (1) Classification loss Cross-entropy loss is used to measure the difference between the output probability distribution of the abnormal behavior classification branch and the manually labeled category, and is calculated on all incremental training samples.
[0059] (2) Reconstruction loss : Calculated only on samples labeled as normal, using the mean squared error between encoded features and reconstructed features to constrain the autoencoder to maintain its ability to reconstruct normal behavior patterns.
[0060] (3) Elastic regularization term Based on the parameter importance weights calculated and saved at the end of the previous training phase, a secondary penalty is applied to the difference between the current parameters and the parameters of the previous phase. The higher the parameter importance, the greater the penalty, thus protecting parameters important to the old task from being significantly modified. The elastic regularization term is calculated as follows: (2), in, This represents the summation over all trainable parameters in the model. Let be the current value of the i-th trainable parameter. The value of the i-th parameter at the end of the previous training phase. is the i-th diagonal element of the Fisher information matrix, used to measure the importance of the i-th parameter to the old task.
[0061] The diagonal elements of the Fisher information matrix are calculated using the empirical Fisher approximation. Specifically, after the previous training phase (initial training or the last incremental update), the model parameters are fixed. In this stage, a complete forward and backward propagation is performed on the training set used. The gradient of the loss function with respect to each parameter is calculated for each training sample. Then, the mean of the squared gradients over all samples is taken as the estimate of the diagonal elements of the Fisher information. (3), Where N is the total number of samples in this training phase. old model parameters The loss for the nth sample (the sum of classification loss and reconstruction loss). This represents the gradient of the loss function with respect to the i-th parameter on the n-th sample of the old model. After calculation, it will be... and Saved to the model checkpoint for use in the next incremental update. This approximation method requires only one additional backpropagation traversal and does not require calculating the Hessian matrix, resulting in low computational overhead.
[0062] (4) Threshold prediction loss Using the interval hinge loss described in formula (1), the threshold prediction network is jointly optimized on the incremental training set to adapt it to the rating distribution in the new scenario.
[0063] The total loss L_total for the incremental training phase is obtained by summing the above losses according to preset weights. (4), in, The reconstructed loss weights range from 0.5 to 1.0, with a default value of 1.0. These are the elastic regularization coefficients; during the initial training phase, since there are no old parameters, Setting it to 0 means no elastic constraint is applied during each incremental training phase. The value range is from 100 to 1000, with a default value of 500. The larger the value, the stronger the protection of old knowledge, but the slower the learning of new knowledge. It can be adjusted according to the degree of difference between the new anomaly type and the old type. The threshold is used to predict the loss weight, with a value ranging from 0.1 to 0.5, and a default value of 0.2.
[0064] The total loss during the initial training phase is .
[0065] In the parameter update stage, the Adam optimizer is used to backpropagate according to the total loss L_total in formula (4) to update the parameters of the spatial feature extraction network, temporal feature extraction network, cross-modal attention fusion module, normal behavior reconstruction branch, abnormal behavior classification branch, and threshold prediction network. After the update is completed, the Fisher information diagonal elements of each parameter are recalculated on the joint training set composed of the incremental training set and the old sample replay set according to formula (3). and the current parameters Save as new This information is used for the next incremental update. Through a dual mechanism of elastic regularization and old sample replay, the model effectively maintains its ability to identify existing anomaly types and normal behaviors while learning new anomaly types, thus avoiding catastrophic forgetting.
[0066] In the initial training phase of the model, end-to-end training was performed using publicly available surveillance video datasets (such as UCF-Crime and ShanghaiTech Campus datasets) containing both normal behavior and labeled abnormal behavior, as well as self-collected and labeled surveillance video data. During training, the normal behavior reconstruction branch only computed the reconstruction loss on normal samples. The abnormal behavior classification branch calculates the classification loss on all labeled samples. The threshold prediction network calculates the threshold prediction loss according to formula (1). According to formula (4) The total loss is obtained by weighted summation. The Adam optimizer is used for training, with an initial learning rate of 0.001, a batch size of 8 to 32 based on GPU memory, and 50 to 100 training epochs. A learning rate cosine annealing strategy and an early stopping strategy are employed to prevent overfitting. After the initial training, the diagonal elements of the Fisher information are calculated on the complete training set according to formula (3). And save it as the basis for the importance of the parameters in the first incremental update.
[0067] Example 2 This embodiment provides an abnormal behavior recognition system based on deep learning, such as... Figure 3 As shown, the system includes a video preprocessing module 1, a feature extraction module 2, a cross-modal fusion module 3, a dual-branch decision module 4, a dynamic threshold module 5, an alarm push module 6, and an incremental update module 7.
[0068] The video preprocessing module 1 performs the function of step S1 in Embodiment 1, and includes a target detection unit, a target tracking unit, an appearance cropping unit, an optical flow calculation unit, and a skeleton extraction unit. The target detection unit uses a target detection network to perform target detection on each frame of video image to obtain target bounding boxes; the target tracking unit uses a multi-target tracking algorithm to associate the same target in adjacent frames and assign tracking labels; the appearance cropping unit crops and scales the appearance image blocks according to the target bounding boxes to obtain fixed-size appearance image blocks; the optical flow calculation unit uses an optical flow network to calculate dense optical flow maps between consecutive frames; and the skeleton extraction unit uses a pose estimation network to extract skeleton key points and arranges them into a skeleton key point sequence according to the tracking labels.
[0069] Feature extraction module 2 is used to perform the function of step S2 in embodiment one, including a spatial feature extraction network and a temporal feature extraction network. The spatial feature extraction network uses a convolutional neural network backbone to extract multi-scale spatial appearance features, and the temporal feature extraction network uses a three-dimensional convolutional network and a skeleton coding network to extract multi-scale temporal motion features.
[0070] The cross-modal fusion module 3 is used to perform the function of step S3 in embodiment one. It includes a channel attention unit and a spatial attention unit, which adaptively weight the two modal features in the channel dimension and the spatial dimension, respectively, and then add the weighted features element by element and fused them by convolution to obtain the spatiotemporal fusion features.
[0071] The dual-branch decision module 4 is used to perform the function of step S4 in Embodiment 1, including a normal behavior reconstruction branch and an abnormal behavior classification branch. The normal behavior reconstruction branch includes an encoder, a memory module, and a decoder. The memory module contains a learnable memory item matrix, retrieves memory items through an attention mechanism, and aggregates them with encoded features. The decoder outputs reconstructed features and calculates the reconstruction error. The abnormal behavior classification branch outputs the probability distribution of abnormal categories.
[0072] The dynamic threshold module 5 performs the function of step S5 in Embodiment 1, and includes a scene context encoding unit, a sliding window statistics unit, and a threshold prediction network. The scene context encoding unit encodes the scene type, time period, and congestion level into a scene context vector; the sliding window statistics unit maintains a historical anomaly score sliding window and calculates the mean and standard deviation; the threshold prediction network outputs anomaly judgment threshold based on the scene context vector and statistics; the dynamic threshold module also calculates a comprehensive anomaly score and compares it with the threshold to determine abnormal behavior.
[0073] The alarm push module 6 is used to perform the function of step S6 in embodiment one, determine the alarm level according to the anomaly category and comprehensive anomaly score, and push the alarm information and video clips to the manual review terminal.
[0074] The incremental update module 7 is used to perform the function of step S7 in Embodiment 1, including a hard example mining unit, a loss calculation unit, and a parameter update unit. The hard example mining unit filters false positives, false negatives, and boundary samples as hard example samples based on manual feedback annotations; the loss calculation unit calculates the classification loss, reconstruction loss, and elasticity regularization term and performs a weighted summation; the parameter update unit updates the parameters of each network and module through backpropagation and recalculates the parameter importance weights.
[0075] The specific implementation methods and technical effects of each module in the system of this embodiment are the same as those in Embodiment 1, and will not be repeated here. Those skilled in the art will understand that all of the above modules can be implemented in hardware, or they can be implemented by software program instructions related to hardware, and the software program can be stored in a computer-readable storage medium.
[0076] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0077] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A deep learning-based method for identifying abnormal behavior, characterized in that, Includes the following steps: S1. Acquire the monitoring video stream, preprocess the video frame sequence, detect and track the target object in the video, and extract the appearance image block, continuous inter-frame optical flow map and skeleton key point sequence of the target object. S2. Input the appearance image block into a spatial feature extraction network to obtain multi-scale spatial appearance features, and input the optical flow map and skeleton key point sequence into a temporal feature extraction network to obtain multi-scale temporal motion features; S3. Adaptive weighted fusion of the multi-scale spatial appearance features and multi-scale temporal motion features is performed through the cross-modal attention fusion module to obtain spatiotemporal fusion features; S4. Input the spatiotemporal fusion features into the normal behavior reconstruction branch and the abnormal behavior classification branch respectively. The normal behavior reconstruction branch outputs the reconstruction error based on the memory-enhanced autoencoder, and the abnormal behavior classification branch outputs the probability distribution of abnormal categories. S5. Calculate the comprehensive anomaly score based on the reconstruction error and anomaly category probability distribution. Input the context information of the current scene and the sliding window statistics of the historical anomaly scores into the threshold prediction network, output the anomaly judgment threshold, determine the anomaly judgment threshold through the dynamic threshold calibration mechanism, and judge the behavior that exceeds the anomaly judgment threshold as an abnormal behavior. S6. Video segments identified as abnormal behavior are classified and alarmed according to the abnormality category and comprehensive abnormality score, and the alarm results and corresponding video segments are pushed to the manual review terminal. S7. Receive the annotation results fed back by the manual review terminal, mine difficult sample based on the annotation results, and update the parameters of the spatial feature extraction network, temporal feature extraction network, cross-modal attention fusion module, normal behavior reconstruction branch, abnormal behavior classification branch and threshold prediction network through incremental learning.
2. The method for identifying abnormal behavior based on deep learning according to claim 1, characterized in that, S1 includes: S11. Use an object detection network to perform object detection on each frame of video image to obtain the object bounding box; S12. Use a multi-target tracking algorithm to associate the same target in adjacent frames and assign a continuous tracking identifier; S13. Cropping and scaling the target bounding box to obtain a fixed-size appearance image block; S14. Calculate the dense optical flow graph between consecutive frames using an optical flow network; S15. Use a pose estimation network to extract the skeleton key points of the target object, and arrange the skeleton key points of the same target in consecutive frames into a skeleton key point sequence according to the tracking identifier.
3. The method for identifying abnormal behavior based on deep learning according to claim 1, characterized in that, The cross-modal attention fusion module in S3 includes a channel attention unit and a spatial attention unit; The channel attention unit performs global average pooling and global max pooling on multi-scale spatial appearance features and multi-scale temporal motion features, respectively. The pooling results are concatenated and passed through a fully connected layer to generate channel attention weights. The channel attention weights are multiplied by the features of the corresponding modal to obtain channel weighted features. The spatial attention unit performs average pooling and max pooling on the channel weighted features of the two modalities in the channel dimension and concatenates them. After passing through a convolutional layer and activation function, a spatial attention weight map is generated. The spatial attention weight map is multiplied by the channel weighted features of the corresponding modalities to obtain the spatial weighted features. The spatiotemporal fusion feature is obtained by adding the spatial weighted features of the two modalities element by element and then performing convolution fusion.
4. The method for identifying abnormal behavior based on deep learning according to claim 1, characterized in that, The normal behavior reconstruction branch includes an encoder, a memory module, and a decoder; The encoder downsamples and encodes the spatiotemporal fusion features to obtain encoded features; The memory module contains a learnable memory item matrix. An attention mechanism is used to retrieve the memory items most relevant to the encoded features from the memory item matrix, and the retrieved memory items are weighted and aggregated with the encoded features to obtain memory-enhanced features. The decoder upsamples and reconstructs the memory-enhanced features to obtain reconstructed features; The mean of the element-by-element differences between the encoded features and the reconstructed features is calculated as the reconstruction error.
5. The method for identifying abnormal behavior based on deep learning according to claim 1, characterized in that, The dynamic threshold calibration mechanism in S5 includes: S51. After normalizing the reconstruction error, sum it with the maximum probability in the probability distribution of the anomaly category to obtain the comprehensive anomaly score. S52. Encode the scene type, time period information and congestion level of the current scene to obtain the scene context vector; S53. Maintain a fixed-length historical outlier score sliding window, and calculate the mean and standard deviation of the outlier scores within the sliding window as statistics. S54. Input the scene context vector and statistics into the threshold prediction network and output the anomaly judgment threshold at the current moment. S55. When the comprehensive anomaly score exceeds the anomaly determination threshold, it is determined to be an abnormal behavior.
6. An abnormal behavior recognition system based on deep learning, characterized in that, include: The video preprocessing module is used to acquire the surveillance video stream, preprocess the video frame sequence, detect and track target objects in the video, and extract the appearance image blocks, continuous inter-frame optical flow maps, and skeleton key point sequences of the target objects. The feature extraction module is used to input the appearance image block into the spatial feature extraction network to obtain multi-scale spatial appearance features, and to input the optical flow map and skeleton key point sequence into the temporal feature extraction network to obtain multi-scale temporal motion features; The cross-modal fusion module is used to adaptively weight and fuse the multi-scale spatial appearance features and multi-scale temporal motion features through the cross-modal attention fusion module to obtain spatiotemporal fusion features; The dual-branch decision module is used to input the spatiotemporal fusion features into the normal behavior reconstruction branch and the abnormal behavior classification branch respectively. The normal behavior reconstruction branch outputs the reconstruction error based on the memory-enhanced autoencoder, and the abnormal behavior classification branch outputs the probability distribution of abnormal categories. The dynamic threshold module is used to calculate a comprehensive anomaly score based on the reconstruction error and the probability distribution of anomaly categories. Combining the context information of the current scene and the sliding window statistics of historical anomaly scores, it determines the anomaly judgment threshold through a dynamic threshold calibration mechanism, and judges behaviors with a comprehensive anomaly score exceeding the anomaly judgment threshold as abnormal behaviors. The alarm push module is used to classify and alarm video segments that are judged to be abnormal behavior according to the abnormality category and comprehensive abnormality score, and push the alarm results and corresponding video segments to the manual review terminal. The incremental update module is used to receive the annotation results fed back by the manual review terminal, mine difficult example samples based on the annotation results, and update the parameters of each network and module through incremental learning.
7. The abnormal behavior recognition system based on deep learning according to claim 6, characterized in that, The video preprocessing module includes: The target detection unit is used to perform target detection on each frame of video image using a target detection network to obtain the target bounding box; The target tracking unit is used to associate the same target in adjacent frames with a multi-target tracking algorithm and assign a continuous tracking identifier; The appearance cropping unit is used to crop and scale the appearance image block to a fixed size according to the target bounding box; Optical flow computing unit, used to compute dense optical flow graphs between consecutive frames using an optical flow network; The skeleton extraction unit is used to extract the skeleton key points of the target object using a pose estimation network, and arranges the skeleton key points of the same target in consecutive frames into a skeleton key point sequence according to the tracking identifier.
8. The abnormal behavior recognition system based on deep learning according to claim 6, characterized in that, The cross-modal fusion module includes a channel attention unit and a spatial attention unit; The channel attention unit is used to perform global average pooling and global max pooling on multi-scale spatial appearance features and multi-scale temporal motion features, respectively. The pooling results are concatenated and passed through a fully connected layer to generate channel attention weights. The channel attention weights are multiplied by the features of the corresponding modal to obtain channel weighted features. The spatial attention unit is used to perform average pooling and max pooling on the channel weighted features of the two modalities respectively and concatenate them. After passing through convolutional layers and activation functions, a spatial attention weight map is generated. The spatial attention weight map is multiplied by the channel weighted features of the corresponding modalities to obtain the spatial weighted features. The cross-modal fusion module is also used to add the spatial weighted features of the two modalities element by element and then perform convolutional fusion to obtain the spatiotemporal fusion features.
9. The abnormal behavior recognition system based on deep learning according to claim 6, characterized in that, The normal behavior reconstruction branch includes an encoder, a memory module, and a decoder; The encoder is used to downsample and encode spatiotemporal fusion features to obtain encoded features; The memory module contains a learnable memory item matrix, which is used to retrieve the most relevant memory items to the encoded features from the memory item matrix through an attention mechanism, and to weight and aggregate the retrieved memory items with the encoded features to obtain memory-enhanced features. The decoder is used to upsample and reconstruct the memory-enhanced features to obtain reconstructed features; The dual-branch decision module is also used to calculate the mean of the element-by-element differences between the encoded features and the reconstructed features as the reconstruction error.
10. The abnormal behavior recognition system based on deep learning according to claim 6, characterized in that, The incremental update module includes: The difficult example mining unit is used to filter samples whose judgment results are inconsistent with the annotation results and samples whose comprehensive anomaly scores are within the neighborhood of the anomaly judgment threshold, based on the annotation results fed back by the manual review terminal, as difficult example samples. The loss calculation unit is used to calculate the classification loss and reconstruction loss on the difficult sample, and calculate the elastic regularization term according to the parameter importance weights obtained in the previous training stage. The classification loss, reconstruction loss and elastic regularization term are weighted and summed to obtain the incremental loss. The parameter update unit is used to update the parameters of each network and module through backpropagation based on the incremental loss, and to recalculate the parameter importance weights based on the updated parameters for the next incremental update.
