Weak supervision video anomaly detection method and system based on prototype orthogonality
By adopting a weakly supervised video anomaly detection method based on prototype orthogonality, the problems of high computational complexity, high power consumption, and high hardware cost in video anomaly detection in the field of robot monitoring are solved, achieving efficient and robust video anomaly detection that is suitable for deployment on edge devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-05
- Publication Date
- 2026-03-10
AI Technical Summary
Existing video anomaly detection technologies in the field of robot monitoring suffer from problems such as high computational complexity, high power consumption, high hardware cost, high latency, low detection accuracy, and poor robustness. In particular, they have characterization bottlenecks and boundary ambiguities in long video processing and multimodal anomaly detection.
We employ a weakly supervised video anomaly detection method based on prototype orthogonality. This method extracts features through a pre-trained visual encoder, combines a selective state space model and a learnable prototype codebook, applies prototype orthogonality constraints, and performs end-to-end training to achieve the extraction of high-value temporal features and anomaly detection.
It achieves efficient and robust video anomaly detection. The model has achieved excellent detection accuracy and robustness on complex datasets such as UCF-Crime. It is suitable for deployment on edge devices, reducing computational and memory overhead and improving detection accuracy and robustness.
Smart Images

Figure CN121640198A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and computer vision, and in particular to a weakly supervised video anomaly detection method and system based on prototype orthogonality. Background Technology
[0002] Currently, the technical methods used for video anomaly detection can be mainly divided into the following three categories: (1) Reconstruction-based method: learn only the normal video pattern and identify anomalies through high reconstruction error. Its advantage is that no abnormal samples are required.
[0003] (2) Classification-based methods: Directly classify normal and abnormal, with high detection accuracy, but heavily rely on costly frame-by-frame annotation (full supervision).
[0004] (3) Weakly supervised methods: To reduce annotation costs, training is performed using only video-level labels, which is the current mainstream research approach. This method typically combines techniques such as multiple instance learning (MIL) and attention mechanisms.
[0005] The two options are as follows: (1) Cloud-based large-scale model solution: After the monitoring robot collects video, it transmits the data to a cloud server for analysis by a large-scale visual model. Although this solution has high accuracy, it has the following drawbacks: ① High latency: The back-and-forth data transmission leads to untimely response, which cannot meet the real-time alarm requirements of emergency situations; ② High cost: Continuous cloud services and API calls are expensive, especially for large-scale robot clusters; ③ Privacy and security risks: Uploading monitoring data to the cloud increases the risk of privacy leaks.
[0006] (2) Traditional localization solutions: To address cloud-based issues, some solutions attempt to deploy the robot locally. However, traditional video analysis models (such as those based on 3D CNN or Transformer) require massive computation and have numerous model parameters, placing extremely high demands on the robot's onboard computing units (such as GPU / NPU), resulting in: ① soaring hardware costs; ② enormous power consumption, severely shortening the robot's battery life; ③ severe overheating, affecting the stability and lifespan of the robot's hardware.
[0007] Despite the progress made in existing technologies, the following profound technical shortcomings and bottlenecks still exist: (1) Inefficient temporal modeling: When processing long videos containing a lot of redundant information, existing models face a dilemma: traditional models (such as RNN) are difficult to capture long-range dependencies, while new models (such as Transformer) have good performance but high computational complexity and are not suitable for real-time detection.
[0008] (2) The serious “representation bottleneck” problem: “Anomalies” themselves contain a variety of visually distinct patterns (such as fires and fights). Existing methods usually force these multimodal anomalies to be mapped to a single feature region, which leads to serious confusion between different anomalies and between normal and abnormal features, fundamentally limiting the detection accuracy.
[0009] (3) Limitations of reasoning logic: Existing methods rely too much on "semantic recognition" (such as identifying objects), while their ability to detect many anomalies that only manifest as dynamic pattern changes (such as stealth and abnormal equipment vibration) is very weak.
[0010] (4) Existing technologies are caught in a dilemma in the field of robot monitoring: cloud solutions are costly and have high latency; traditional local solutions have high power consumption and demanding computing power requirements, making it difficult to achieve lightweight edge deployment. Summary of the Invention
[0011] In view of the above, the main objective of this invention is to propose a weakly supervised video anomaly detection method and system based on prototype orthogonality to solve the aforementioned technical problems.
[0012] This invention proposes a weakly supervised video anomaly detection method based on prototype orthogonality, the method comprising the following steps: Step 1: Given a video stream as the training set, use a pre-trained visual encoder to extract features and obtain a visual feature sequence. Step 2: Input the visual feature sequence into the selective state space model to filter redundant information in the time series and capture key dynamics, and output high-value time series features. Step 3: Given a learnable prototype codebook containing prototype codebooks of normal categories and anomaly categories, the pre-trained visual encoder, the selective state space model, and the learnable prototype codebook constitute a video anomaly detection model. Step 4: Based on high-value temporal features and learnable prototype codebooks, the video anomaly detection model is trained end-to-end using a video-level labeled multi-instance learning framework. Prototype orthogonality constraints are applied during training to force the feature subspaces formed by the normal category prototype codebook and the anomaly category prototype codebook to be mutually orthogonal, thus obtaining the trained video anomaly detection model. Step 5: Input the video to be detected into the trained video anomaly detection model, obtain the high-value temporal features of the video to be detected, calculate the distance between the high-value temporal features of the video to be detected and the nearest prototype in the anomaly category prototype codebook, and obtain the video anomaly score based on the distance to achieve video anomaly detection.
[0013] This invention also proposes a weakly supervised video anomaly detection system based on prototype orthogonality, wherein the system applies the weakly supervised video anomaly detection method based on prototype orthogonality as described above, and the system includes: The feature extraction module is used for: Given a video stream as the training set, a visual feature sequence is obtained by using a pre-trained visual encoder for feature extraction. The timing processing module is used for: Visual feature sequences are input into a selective state-space model to filter redundant information in the time series and capture key dynamics, outputting high-value time series features. The multimodal representation module is used for: Given a learnable prototype codebook containing prototype codebooks of normal categories and anomaly categories, a pre-trained visual encoder, a selective state-space model, and the learnable prototype codebook constitute a video anomaly detection model. The constraint optimization module is used for: Based on high-value temporal features and learnable prototype codebooks, a video-level labeled multi-instance learning framework is used to train the video anomaly detection model end-to-end. During the training process, prototype orthogonality constraints are applied to force the feature subspaces formed by the normal category prototype codebook and the anomaly category prototype codebook to be mutually orthogonal, thus obtaining a well-trained video anomaly detection model. The anomaly scoring module is used for: The required video is input into the trained video anomaly detection model to obtain the high-value temporal features of the required video, and the distance between the high-value temporal features of the required video and the nearest prototype in the anomaly category prototype codebook is calculated. Based on the distance, the video anomaly score is obtained to achieve video anomaly detection.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) Superior performance: By introducing a fundamental global geometric constraint—prototype orthogonality constraint—a representation space with a clear structure and global separation of normal and abnormal features is constructed. Combined with optimal transmission codebook learning for accurate capture of anomaly multimodality, the model achieves state-of-the-art (SOTA) performance on complex datasets such as UCF-Crime, demonstrating extremely high detection accuracy and robustness. This invention has achieved SOTA detection accuracy on multiple authoritative public datasets such as UCF-Crime and ShanghaiTech.
[0015] (2) Traditional methods treat all visually distinct "anomalies" as a single concept, forcibly mapping them to the same feature region, resulting in a severe "representation bottleneck" where the model cannot learn a pure anomaly representation. This invention introduces a dynamic codebook learning paradigm based on Optimal Transport (OT) into the field of video anomaly detection for the first time, explicitly modeling the multimodality of anomalies. It allows the model to learn specific, decoupled prototype representations for multiple different anomaly patterns, greatly enhancing the model's expressive power and generalization ability. At the same time, through a distribution-level matching method, it provides a solid foundation for applying the higher-level structural constraint of "prototype orthogonality".
[0016] (3) Computationally efficient: The S3M module used in the front end has linear time complexity, which fundamentally solves the "computing power explosion" problem of architectures such as Transformer when processing long videos. The entire framework has few parameters and the model size is only at the megabyte (MB) level, which is much smaller than the mainstream models that are often tens or hundreds of MB. Compared with the Transformer-based method, it greatly reduces the computation and memory overhead when processing long videos of thousands of frames, making it suitable for real-time application deployment.
[0017] (4) Strong robustness: Traditional methods passively learn a fuzzy normal-abnormal decision boundary, resulting in a chaotic feature space structure, severe overlap between normal and abnormal feature distributions, and poor model robustness. This invention no longer passively "searches" for boundaries, but actively "builds" the structure. This invention proposes and introduces a powerful global geometric constraint—prototype orthogonality—for the first time. The prototype orthogonality design makes the feature representations learned by the model have better structure and separability, fundamentally solving the "fuzzy boundary" problem. It ensures that the normal and abnormal features learned by the model occupy structurally separated and unrelated regions in the global representation space. This makes the decision boundary between the two types of features naturally clear and stable, greatly improving the model's discriminative ability and robustness to complex scenarios, effectively solving the problem of abnormal multimodality, and improving the model's robustness to complex and diverse real-world abnormal scenarios.
[0018] (5) Weak supervision capability: The training process is based on a multi-instance learning framework with video-level labels. Training can be completed with only video-level labels, which greatly reduces the cost of data labeling and has strong practical value.
[0019] (6) Ideal for edge deployment: Existing high-precision models (especially those based on Transformer) have high computational complexity and large model size, making them difficult to deploy on edge devices (such as monitoring robots) that are limited in computing power and sensitive to power consumption.
[0020] This invention is the first to introduce the emerging and computationally efficient Selective State-Space Model (S3M) into the field of video anomaly detection as a front-end temporal processor, combined with a lightweight codebook learning module in the back-end. S3M processes long video sequences with linear time complexity, efficiently filtering temporal redundancy. The back-end codebook learning is also far more lightweight than complex classification heads or Transformer decoders.
[0021] The innovative architecture of this invention enables the entire framework to maintain state-of-the-art detection accuracy while possessing extremely low computational cost and a very small model size. It perfectly resolves the contradiction between "high accuracy" and "low power consumption," making it possible to lightweight high-performance video anomaly detection models and deploy them on edge devices such as local surveillance robots, greatly expanding the application scenarios and commercial value of the technology.
[0022] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by means of embodiments of the invention. Attached Figure Description
[0023] Figure 1 This is an architecture diagram of a weakly supervised video anomaly detection method based on prototype orthogonality proposed in this invention; Figure 2 This is a schematic diagram illustrating the working principle of the Selective State Space Module (S3M). Figure 3 A schematic diagram illustrating the principle of Optimal Transmission (OT) codebook learning; Figure 4 This is a schematic diagram of the structure of a weakly supervised video anomaly detection system based on prototype orthogonality proposed in this invention. Detailed Implementation
[0024] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0025] These and other aspects of the embodiments of the present invention will become clear from the following description and accompanying drawings. In these descriptions and drawings, some specific embodiments of the present invention are specifically disclosed to illustrate some ways of implementing the principles of the embodiments of the present invention; however, it should be understood that the scope of the embodiments of the present invention is not limited thereto.
[0026] Please see Figure 1 This embodiment provides a weakly supervised video anomaly detection method based on prototype orthogonality, the method comprising the following steps: Step 1: Given a video stream as the training set, use a pre-trained visual encoder to extract features and obtain a visual feature sequence. This step is the core starting point of the entire framework, and its task is to transform human-readable visual fragments into machine-understandable, structured mathematical language. This process can be broken down into two levels: vectorizing individual fragments and combining all vectors into a sequence.
[0027] First, vectorization of individual segments: A video stream is received. The video stream is uniformly divided into T non-overlapping segments. For the segment at time point t, it is fed into a powerful pre-trained visual encoder (such as CLIP ViT-B / 16). This encoder acts like a "visual translator," condensing the complex pixel information of the segment into an information-dense mathematical object—a feature vector. This process can be precisely described by the following formula: ; in, This represents the visual feature vector generated at the t-th time step (i.e., the t-th video segment); Represents a D-dimensional real vector space; Next, the sequence is constructed: the above vectorization operation is performed on each video segment (from the 1st to the Tth), resulting in a series of... The system then combines these independent feature vectors into a complete feature sequence, strictly following their temporal order in the original video. The final construction process is defined by the following core formula: ; in, This indicates the final video feature sequence that is constructed and used to represent the entire video. It is no longer a single vector, but a set of vectors. This represents the temporal feature vector of each segment arranged in chronological order (t from 1 to T), where T is the total number of segments into which the video is divided.
[0028] Through the process described by the formula for video feature sequences, the originally unstructured video data is successfully transformed into a structured mathematical object containing rich spatiotemporal information—the video feature sequence F. The video feature sequence F is the direct and sole input for subsequent time-series dynamic analysis by the S3M module.
[0029] Step 2: Input the visual feature sequence into the selective state space model to filter redundant information in the time series and capture key dynamics, and output high-value time series features. Please see Figure 2This step aims to clarify the theoretical basis of the Selective State-Space Model (S3M module) and relate it to the specific application scenario (video feature processing) of this embodiment.
[0030] The revolutionary aspect of S3M lies in its parameterization of the A, B, and C matrices, as well as the discretized step size Δ, making them dependent on the input at each time step. This endows the model with powerful selectivity: when faced with redundant normal segments, the model learns to generate a smaller B value to "ignore" the input; when a crucial anomalous clue is detected, it generates a larger B value to "lock in" and update its internal state. In this way, S3M can efficiently filter out temporal redundancy in linear time complexity, outputting a high-value feature sequence that has undergone deep context encoding and selective filtering. .
[0031] The core workflow of the S3M module is to apply a selective mechanism and iteratively solve the problem. It processes each feature in the input sequence one by one through an iterative loop from t=1 to T, generating the final high-value output sequence. At each time step t of the loop, the system precisely executes the following series of interconnected internal operations: (1) Dynamic parameter generation: The visual feature vector currently being processed Three parallel miniature neural networks were fed in. The goal is to use the core functions of these three networks to "examine" the current segment. The content is dynamically calculated, and a set of state transition parameters tailored to this specific moment is determined: discretization step size. Input matrix and output matrix The formula is as follows: ; in, This represents the dynamic step size parameter obtained by projecting the current segment content through the neural network at each time step; This represents the dynamic input matrix obtained at each time step by projecting the content of the current segment through the neural network; This represents the dynamic output matrix obtained at each time step by projecting the content of the current segment through the neural network; This represents three parallel micro-neural networks; This indicates the Softplus activation function.
[0032] The system uses a discretized version of the state update equation. To calculate the new hidden state This calculation incorporates three pieces of information: ① the hidden state from the previous time step. ② Input of the current time step ③ The input matrix, dynamically generated at the current moment, determines the importance of the input. .in, Represents the discretized state matrix. Represents the discretized input matrix. , , This represents the learnable continuous-time parameter matrix.
[0033] (2) Generate output features: The system then applies the output equation It uses the recently updated "memory". and the customized output matrix at the current moment To calculate the high-value features of a video segment at time step t. After the loop has traversed all T time steps, all generated... They will be combined to form the final high-value feature sequence. And pass it to subsequent modules.
[0034] Step 3: Given a learnable prototype codebook containing prototype codebooks of normal categories and anomaly categories, the pre-trained visual encoder, the selective state space model, and the learnable prototype codebook constitute a video anomaly detection model. like Figure 3 As shown, the initialization of the multimodal representation (defining a learnable codebook) is as follows: First, high-quality time-series feature sequences are obtained from the S3M module, and then the system classifies them into "normal" categories. and "abnormal" category Each entity creates and initializes a set of learnable prototypes. This set is academically known as a codebook; the core formula is as follows: ; in, The entire codebook representing category c (normal or abnormal); codebook The k-th prototype vector in the codeword is also called the codeword. This represents a predefined hyperparameter that represents the category. The codebook size, i.e., the number of prototypes contained in the category.
[0035] Step 4: Based on high-value temporal features and learnable prototype codebooks, the video anomaly detection model is trained end-to-end using a video-level labeled multi-instance learning framework. Prototype orthogonality constraints are applied during training to force the feature subspaces formed by the normal category prototype codebook and the anomaly category prototype codebook to be mutually orthogonal, thus obtaining the trained video anomaly detection model. To better train the video anomaly detection model, a weighted joint optimization was performed using optimal transmission distance, prototype orthogonality loss, and standard multi-instance learning loss. The construction process of each loss is as follows: like Figure 3 As shown, the optimal transmission distance is: First, the problem is formalized (treating features and codebooks as probability distributions). Within a training batch, the system performs a formal transformation on the data: 1. Feature distribution: This involves creating a set of all high-value feature vectors belonging to category c. The whole can be regarded as an empirical probability distribution.
[0036] 2. Codebook Distribution: Distribute the codebook of category c. The whole can be regarded as a uniform discrete probability distribution.
[0037] Next, we solve and drive the process (calculating the optimal transmission loss): The entropy-regularized optimal transmission distance (i.e., Sinkhorn distance) between the empirical probability distribution and the uniform discrete probability distribution is calculated as the matching loss. This loss function drives the prototype vector in the codebook to move to a position that can "receive" all data features at the lowest cost, thereby adaptively learning the multimodal structure of the data; the calculation formula is as follows: ; in, The cost matrix is represented as follows: , , This represents the cost of transferring features to the prototype vector. Represents the transmission scheme matrix. This represents the entropy regularization term. This represents the optimal transmission loss for category c; Represents the prototype codebook of category c (normal or abnormal), that is, the entire codebook of that category; This represents the set of all feature vectors belonging to category c among high-value time-series features. express Specific samples in Represents the Frobenius inner product. This represents the empirical probability distribution of feature vectors belonging to category c among high-value time-series features. This represents the uniform discrete probability distribution of the prototype codebook for category c.
[0038] Ultimately, after multiple rounds of training, the prototypes in the codebook will adaptively move to the areas with the densest data distribution, thereby accurately capturing the multimodal structure of normal behavior and various abnormal behaviors.
[0039] To globally separate the representation spaces of normal and abnormal categories, this embodiment proposes a stronger codebook-level orthogonality constraint. The normal category prototype codebook... and exception category prototype codebook Represented as matrices and , These represent the prototype codebook sizes for the normal and abnormal categories, respectively. Prototype orthogonality loss. Defined as the square of the Frobenius norm of their normalized cross-correlation matrices: ; in, This represents the prototype orthogonality loss. Indicates to The matrix obtained by L2 normalizing the row vectors. These are represented as matrices obtained by performing row vector L2 normalization on the normal codebook matrix and the abnormal codebook matrix, respectively. Indicates matrix transpose; The symbol represents the square of the Frobenius norm; the subscript n indicates normality; the subscript a indicates anomality; and F is an abbreviation for the Frobenius norm.
[0040] Standard Multiple Instance Learning (MIL) loss: First, this embodiment calculates the anomaly score for each video segment. For the high-value feature vector of a video segment at time step t... Its abnormal scores Defined as its prototype codebook for exception categories The function of nearest prototype vector distance: ; in, Hyperparameters that indicate the steepness of the control function; This represents the distance value at time step t, which indicates how close the current video segment's features are to the overall "anomaly" concept. This represents the minimization operator, where k represents the range of values for the variable. k is an index that iterates from 1 to... ; Represents the L2 norm; This represents the high-value feature vector of a video segment at time step t; This represents the k-th prototype vector in the anomaly category prototype codebook; This represents the final anomaly score at time step t. The score is usually between 0 and 1, with a higher value indicating a greater likelihood of an anomaly. This represents an exponential function.
[0041] Then, based on video-level weak tags (1 indicates an anomaly, 0 indicates normal). This embodiment uses the standard Multiple Instance Learning (MIL) loss for processing: ; in, This represents standard multi-instance learning. Indicates batch size; Let i represent the score sequence of the i-th video; The true label indicates whether the i-th video is normal or abnormal; It is a variant of Multiple Instance Learning (MIL), which means selecting the scores of the K highest-scoring segments to calculate the loss.
[0042] Weighted joint optimization: Finally, the ultimate optimization objective is a weighted sum of the above loss terms. The standard Multiple Instance Learning (MIL) loss, the optimal transport matching loss, and the novel prototype orthogonality loss are weighted and summed to form the final joint optimization objective function. The total loss formula is as follows: ; in, This represents the total loss of the joint optimization objective function. It is a single final value used to measure how well the model performs on a batch of training data. The goal of model training is to minimize this single final value. The weights represent the standard multi-instance learning loss; it is a hyperparameter used to control the weights. The significance or influence of this factor in the total loss is indicated by the subscript mil, which represents multi-instance learning. The weighting coefficient represents the optimal transmission loss and is used to control the importance of the optimal transmission matching part in the total loss.
[0043] The subscript ot represents optimal transmission. Representing the normal category (n) and the abnormal category (n) respectively. The optimal transmission (OT) loss; The weight coefficients representing the prototype orthogonality loss control the strength with which the model enforces the separation of normal and anomalous prototypes. The subscript "ortho" indicates orthogonality. If any normal prototype is oriented close to (i.e., similar to) any anomalous prototype, their dot product will be large, leading to... The value increases. This is achieved by minimizing the total loss function. The model is forced to adjust the orientation of all prototypes so that the dot product between any normal prototype and any abnormal prototype approaches 0, which is the mathematical definition of orthogonality.
[0044] Step 5: Input the video to be detected into the trained video anomaly detection model, obtain the high-value temporal features of the video to be detected, calculate the distance between the high-value temporal features of the video to be detected and the nearest prototype in the anomaly category prototype codebook, and obtain the video anomaly score based on the distance to achieve video anomaly detection.
[0045] Please refer to Figure 4 This embodiment also provides a weakly supervised video anomaly detection system based on prototype orthogonality, wherein the system applies the weakly supervised video anomaly detection method based on prototype orthogonality as described above, and the system includes: The feature extraction module is used for: Given a video stream as the training set, a visual feature sequence is obtained by using a pre-trained visual encoder for feature extraction. The timing processing module is used for: Visual feature sequences are input into a selective state-space model to filter redundant information in the time series and capture key dynamics, outputting high-value time series features. The multimodal representation module is used for: Given a learnable prototype codebook containing prototype codebooks of normal categories and anomaly categories, a pre-trained visual encoder, a selective state-space model, and the learnable prototype codebook constitute a video anomaly detection model. The constraint optimization module is used for: Based on high-value temporal features and learnable prototype codebooks, a video-level labeled multi-instance learning framework is used to train the video anomaly detection model end-to-end. During the training process, prototype orthogonality constraints are applied to force the feature subspaces formed by the normal category prototype codebook and the anomaly category prototype codebook to be mutually orthogonal, thus obtaining a well-trained video anomaly detection model. The anomaly scoring module is used for: The required video is input into the trained video anomaly detection model to obtain the high-value temporal features of the required video, and the distance between the high-value temporal features of the required video and the nearest prototype in the anomaly category prototype codebook is calculated. Based on the distance, the video anomaly score is obtained to achieve video anomaly detection.
[0046] To verify the effectiveness and advancement of this invention, this embodiment was comprehensively tested on two industry-recognized mainstream weakly supervised video anomaly detection datasets (ShanghaiTech, UCF-Crime), and its performance was rigorously compared with existing state-of-the-art (SOTA) methods.
[0047] 1. Comparison with the State of the Omnibus (SOTA) method: Under weak supervision, this embodiment uses frame-level AUC (Area Under the ROC Curve) as the core evaluation metric and compares it with current mainstream and latest methods. Experimental results are shown in Table 1: Table 1 Performance comparison with existing technologies (AUC / %)
[0048] As shown in Table 1, this invention demonstrates superior and highly competitive performance. On the ShanghaiTech dataset, the method achieved an AUC of 98.13%, performing comparably to current state-of-the-art methods with a slight advantage. On the more complex UCF-Crime dataset, the method achieved an AUC of 88.44%, surpassing all existing comparative methods, including all the latest published results, setting a new state-of-the-art (SOTA) record for this dataset.
[0049] 2. Model benefit comparison: The experimental results are shown in Table 2: Table 2 Comparison of Model Efficiency;
[0050] As shown in Table 2, this invention has an overwhelming advantage in model lightweighting. Its parameter count and computational cost are far lower than mainstream methods based on Transformer or large CNNs. This order-of-magnitude reduction means that this invention can run smoothly on robot onboard chips with power consumption and computing power only a fraction of traditional solutions, greatly reducing hardware barriers and operating costs, and truly solving the deployment challenge of real-time local video analysis for robots.
[0051] 3. Computational efficiency analysis: In addition to its superior detection accuracy, this invention also has significant advantages in computational efficiency, mainly due to its innovative framework design.
[0052] (1) Source of core advantages: The front end of this invention adopts the Selective State Space Model (S3M) as the time processor. Unlike the Transformer architecture, which is widely used in the video field but has huge computational overhead (its self-attention mechanism has a computational complexity of the square of the sequence length), S3M can process video feature sequences with linear time complexity.
[0053] (2) Beneficial Effects: This feature enables the present invention to significantly reduce the consumption of computing resources and memory when processing long videos of thousands of frames, demonstrating superior operating efficiency. This makes it more suitable for practical application scenarios with high real-time requirements, such as urban security monitoring and resource-constrained edge computing deployments.
[0054] The theoretical motivation for this invention stems from a profound understanding and resolution of two fundamental theoretical contradictions in the traditional weakly supervised video anomaly detection (WS-VAD) paradigm. Traditional methods generally employ "semantic-associative" reasoning, attempting to learn an "anomaly" as a holistic concept, mapping it to a single region in the feature space. However, this paradigm has serious theoretical limitations.
[0055] (1) First, the neglect of “anomaly multimodality” leads to a “representation bottleneck”. Therefore, the first motivation of this invention is to abandon the single-region assumption and explicitly model the multimodality of anomalies. This invention proposes to establish a “codebook” for “anomalies” consisting of multiple learnable “prototypes”, allowing each prototype to capture a specific anomaly pattern, thereby fundamentally breaking the representation bottleneck.
[0056] (2) Second, passive learning of "separability" leads to "boundary ambiguity". Therefore, the second core motivation of this invention is to shift from "passively finding boundaries" to "actively constructing structures". This invention proposes to impose a strong constraint at the global geometric level - "prototype orthogonality". By forcing the subspaces formed by normal and abnormal prototype codebooks to be mutually orthogonal, this invention actively constructs a feature space with a clear structure and natural separability globally, theoretically ensuring the robustness of decision-making.
[0057] In summary, the motivation of this invention is to fundamentally challenge and reconstruct traditional theoretical assumptions, and to establish a new theoretical framework with higher accuracy and stronger robustness through explicit multimodal modeling and active geometric structure construction.
[0058] It should be understood that although the steps in the flowcharts of the various embodiments of the present invention are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the various embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0059] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0060] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0061] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A weakly supervised video anomaly detection method based on prototype orthogonality, characterized in that, The method comprises the following steps: Step 1, given a video stream as a training set, and using a pre-trained visual encoder to extract features to obtain a visual feature sequence; Step 2, input the visual feature sequence into a selective state space model to filter redundant information in the time sequence and capture key dynamics, and output high-value time sequence features; Step 3, given a learnable prototype codebook containing a normal category prototype codebook and an abnormal category prototype codebook, the pre-trained visual encoder, the selective state space model and the learnable prototype codebook constitute a video anomaly detection model; Step 4, according to the high-value time sequence features and the learnable prototype codebook, using a video-level label multiple instance learning framework to train the video anomaly detection model end-to-end, and applying a prototype orthogonality constraint during the training process to force the feature subspaces constituted by the normal category prototype codebook and the abnormal category prototype codebook to be mutually orthogonal during the training process, to obtain a trained video anomaly detection model; Step 5, input the video to be detected into the trained video anomaly detection model, obtain the high-value time sequence features of the video to be detected, and calculate the distance between the high-value time sequence features of the video to be detected and the nearest prototype in the abnormal category prototype codebook, and according to the distance, obtain the video anomaly score to realize video anomaly detection.
2. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 1, characterized in that, In the step 1, the method for extracting features by using a pre-trained visual encoder to obtain a visual feature sequence comprises the following steps: Divide the video stream into T non-overlapping segments; Use a pre-trained visual encoder to encode each non-overlapping segment to obtain a plurality of visual feature vectors; Combine the visual feature vectors according to the time sequence in the video stream to obtain a visual feature sequence.
3. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 2, characterized in that, In the step 2, the method for inputting the visual feature sequence into a selective state space model to filter redundant information in the time sequence and capture key dynamics to output high-value time sequence features comprises the following steps: Send the feature vector of the current time step in the visual feature sequence into three parallel micro neural networks to obtain state transition parameters, the state transition parameters including a discretization step, an input matrix and an output matrix; According to the discretization step and the input matrix, construct a discretized version of the state update equation, and use the discretized version of the state update equation to calculate the new hidden state from the hidden state of the previous time step and the feature vector of the current time step; According to the discretization step and the output matrix, construct an output equation, and apply the new hidden state to the output equation to obtain the final output of the current step; After all T time steps are looped through, the final outputs generated by all time steps are combined to obtain high-value time sequence features.
4. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 3, characterized in that, In the step 4, the method for using a video-level label multiple instance learning framework to train the video anomaly detection model end-to-end and applying a prototype orthogonality constraint during the training process comprises the following steps: Express the normal category prototype codebook and the abnormal category prototype codebook as a matrix form to obtain a normal codebook matrix and an abnormal codebook matrix; The Frobenius norm square of the normalized cross-correlation matrix of the normal codebook matrix and the abnormal codebook matrix as a prototype orthogonality loss; The prototype orthogonality loss and the standard multiple instance learning loss are combined as a joint optimization objective function of the video anomaly detection model, and the joint optimization objective function is used for end-to-end training.
5. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 4, characterized in that, In the process of combining the prototype orthogonality loss and the standard multiple instance learning loss as a joint optimization objective function of the video anomaly detection model, an optimal transport loss is also introduced, and the optimal transport loss is combined with the orthogonality loss and the standard multiple instance learning loss in a weighted manner, and the corresponding process has the following relationship: ; wherein, denotes the total loss of the jointly optimized objective function, denotes the weight coefficient of the standard multi-instance learning loss, denotes the standard multi-instance learning loss, denotes the optimal transport loss for the normal class and the abnormal class, respectively, denotes the weight coefficient of the optimal transport loss, denotes the weight coefficient of the prototype orthogonality loss, denotes the prototype orthogonality loss.
6. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 5, characterized in that, The construction process of the optimal transport loss is as follows: The set of all feature vectors belonging to the category c in the high-value time sequence feature is regarded as an empirical probability distribution as a whole; The prototype codebook of the category c is regarded as a uniform discrete probability distribution as a whole; The entropy regularization optimal transport distance between the empirical probability distribution and the uniform discrete probability distribution is taken as the optimal transport loss of the category c.
7. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 6, characterized in that, The optimal transport loss of the category c has the following relationship: ; wherein, denotes a cost matrix, the elements of which are denoted by ; , denotes a codebook , denotes the cost of transporting a feature to a prototype vector, denotes a transmission scheme matrix, denotes an entropy regularization term, denotes the optimal transmission loss for class c, denotes the prototype codebook for class c, denotes the set of all feature vectors belonging to class c in the high-value temporal feature, denotes a specific sample in denotes the Frobenius inner product, denotes the empirical probability distribution of feature vectors belonging to class c in the high-value temporal feature, denotes the uniform discrete probability distribution over the prototype codebook for class c.
8. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 7, characterized in that, The prototype orthogonality loss has the following relationship: ; wherein, denote the matrix obtained by performing row vector L2 normalization on the normal codebook matrix and the abnormal codebook matrix, respectively, denotes the square of the Frobenius norm, denotes the matrix transpose.
9. The weakly supervised video anomaly detection method based on prototype orthogonality according to claim 8, characterized in that, The standard multiple instance learning loss has the following relationship: ; wherein, denotes the batch size, denotes the score sequence of the i denotes the true label of the i denotes that the scores of the K segments with the highest scores are selected to compute the loss. The calculation process of the anomaly score of the video segment at time step t in the score sequence of the i-th video has the following relationship: ; wherein, denotes a hyperparameter that controls the steepness of the control function, denotes the distance value at time step t, denotes a minimization operator, k denotes the range of values of the variable, denotes the size of the anomaly class prototype codebook, denotes the L2 norm, denotes the high-value feature vector of the video segment at time step t, denotes the k-th prototype vector in the anomaly class prototype codebook, denotes the exponential function, denotes the final anomaly score at time step t.
10. A weakly supervised video anomaly detection system based on prototype orthogonality, characterized in that, The system applies the weakly supervised video anomaly detection method based on prototype orthogonality according to any one of claims 1 to 9, and the system comprises: The feature extraction module is configured to: Given a video stream as a training set, and a pre-trained visual encoder is used for feature extraction to obtain a visual feature sequence; The time sequence processing module is configured to: The visual feature sequence is input into a selective state space model to filter redundant information in the time sequence and capture key dynamics, and high-value time sequence features are output; The multi-modal representation module is configured to: Given the learnable prototype codebook containing the normal category prototype codebook and the abnormal category prototype codebook, the pre-trained visual encoder, the selective state space model and the learnable prototype codebook constitute a video anomaly detection model; The constrained optimization module is configured to: According to the high-value time sequence features and the learnable prototype codebook, the video anomaly detection model is trained end-to-end by using the multiple instance learning framework of the video-level label, and the prototype orthogonality constraint is applied in the training process to force the feature subspaces constituted by the normal category prototype codebook and the abnormal category prototype codebook to be mutually orthogonal during the training process, thereby obtaining a trained video anomaly detection model; The anomaly scoring module is configured to: The required detection video is input into the trained video anomaly detection model, the high-value time sequence features of the required detection video are obtained, the distance between the high-value time sequence features of the required detection video and the nearest prototype in the abnormal category prototype codebook is calculated, and the video anomaly score is obtained according to the distance size, thereby realizing video anomaly detection.
Citation Information
Patent Citations
Video-monitoring-oriented end-to-end geological disaster automatic identification method, system and application
CN111582017A
Telecommunication troubleshooting system based on big data technology
CN116760691A
Video anomaly detection method based on causal normality learning
CN119206567A
Prototype pseudo instance enhanced video anomaly detection method and system
CN120088712A
Film thickness prediction method and system based on self-supervision and characterization learning
CN120124013A
Cited By
Weak supervision video anomaly detection method and system based on Wolder decomposition
CN121921711A
A Weakly Supervised Video Anomaly Detection Method and System Based on Wolde Decomposition
CN121921711B