Weakly supervised video anomaly detection method and system based on feature enhancement and fusion

Through the temporal feature enhancement network and visual-language knowledge association mechanism, the problem of insufficient utilization of temporal information and cross-modal relationships in video anomaly detection is solved, and the detection accuracy and the model's ability to identify abnormal behaviors are improved.

CN118470608BActive Publication Date: 2024-10-22SHANDONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410909729.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-09
Publication Date
2024-10-22
Estimated Expiration
2044-07-09

AI Technical Summary

Technical Problem

Existing video anomaly detection methods have deficiencies in utilizing temporal information, cross-modal relationships, and data balance, resulting in low detection accuracy and failure to fully mine anomaly information.

Method used

A weakly supervised video anomaly detection method based on feature enhancement and fusion is used to enhance the network learning of temporal dependencies through temporal features, and a visual-linguistic knowledge association mechanism is introduced to integrate the spatiotemporal structure information and semantic labels of video data to improve the accuracy of anomaly detection. .

Benefits of technology

It achieves a deep understanding and fusion of video data, improves the accuracy of anomaly detection and the model's ability to identify abnormal events, alleviates the gap in the number of positive and negative samples, and enhances the capture of the diversity and complexity of abnormal behaviors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118470608B_ABST
    Figure CN118470608B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of video anomaly detection, and specifically discloses a weakly supervised video anomaly detection method and system based on feature enhancement and fusion. The method comprises: dividing an input video into a plurality of video clips, extracting features of each video clip through a visual feature encoder to obtain a generalized visual feature representation of the video clip, and obtaining a text class embedding of a label through a text feature encoder; learning the temporal dependency relationship of the visual feature representation from local and global perspectives through a temporal feature enhancement network to obtain a temporal enhanced visual feature representation; performing feature fusion on the temporal enhanced visual feature representation and the text class embedding to obtain a visual language alignment map; and inputting the visual language alignment map into a trained video anomaly classifier to obtain a video anomaly detection result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video anomaly detection, and in particular to a weakly supervised video anomaly detection method and system based on feature enhancement and fusion. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] An important function of surveillance cameras is to detect and record any abnormal situations that may occur in a timely manner through real-time monitoring. Video anomaly detection is a computer vision task used to solve this problem. The purpose of video anomaly detection is to use algorithms and models to replace manual analysis of video sequences, and automatically detect and identify abnormal events that are significantly different from normal behavior. These anomalies may include emergencies, abnormal behaviors, unusual objects, or drastic changes in the environment. Video anomaly detection plays an important role in improving efficiency and accuracy in many fields such as public safety, examination room monitoring, and traffic management.

[0004] According to the training data category and label of video anomaly detection, it can be divided into two categories: semi-supervised learning-based methods and weakly supervised learning-based methods. Algorithms based on semi-supervised learning use the "either normal or abnormal" assumption, only use unlabeled normal videos as training input, and detect data that significantly deviates from the learned normal features as abnormal. Although the lack of manual labeling reduces the workload in the early stages, the inherent defects in the "either normal or abnormal" assumption doom semi-supervised algorithms to be unable to be put into practical application. In reality, there is no sample space that can encompass all the features of normal events, so new, unlearned normal events are very likely to be misdetected. Only learning the feature representation of normal events cannot optimize for missed or misdetected abnormal events, resulting in relatively low anomaly detection accuracy of such methods in practical applications.

[0005] In the video anomaly detection framework based on weakly supervised learning, the training set contains normal and abnormal video samples, but only provides video-level label information, and it is impossible to know the specific start and end time of the abnormal event. The weakly supervised method can effectively ensure the accuracy of anomaly detection while reducing the reliance on manual fine labeling.

[0006] Although there are some weakly supervised video anomaly detection methods, they have the following shortcomings:

[0007] (1) Not making full use of temporal information. Feature recognition is a key issue in video anomaly detection. In practical applications, the boundary between normal and abnormal is fuzzy, which requires the model to have highly discriminative representation learning capabilities. Some previous methods only extracted features from the current isolated video clips to judge anomalies, ignoring the importance of temporal dynamic modeling.

[0008] (2) Failure to fully utilize cross-modal relationships. In terms of feature extraction, most existing methods rely solely on processing a single modality, namely visual information, while ignoring the role of other information sources such as language information.

[0009] (3) Ignoring the problem of data imbalance. Imbalanced data distribution is a prominent feature of anomaly detection. The number of normal examples usually far exceeds that of abnormal examples, which causes the model to overfit to normal examples during training and lack the ability to identify abnormal events.

[0010] Many existing methods fail to fully explore and utilize all samples that may carry abnormal information, and there are omissions in the identification of abnormal patterns due to the lack of targeted design. Summary of the invention

[0011] In order to solve the above problems, the present invention proposes a weakly supervised video anomaly detection method and system based on feature enhancement and fusion. The temporal dependency is learned locally and globally through the temporal feature enhancement network, and the visual-language knowledge association mechanism is introduced. The deep understanding and fusion of the spatiotemporal structure information of video data and the language information of semantic labels are achieved, thereby improving the accuracy of anomaly detection.

[0012] In some embodiments, the following technical solutions are adopted:

[0013] A weakly supervised video anomaly detection method based on feature enhancement and fusion, comprising:

[0014] The input video is divided into several video clips, and features are extracted from each video clip through a visual feature encoder to obtain a generalized visual feature representation of the video clip, and the text class embedding of the label is obtained through a text feature encoder;

[0015] The temporal feature enhancement network learns the temporal dependency of the visual feature representation locally and globally to obtain the temporal enhanced visual feature representation;

[0016] The temporal enhanced visual feature representation is fused with the text class embedding to obtain a visual-language alignment map; the visual-language alignment map is input into the trained video anomaly classifier to obtain the video anomaly detection result.

[0017] As an optional solution, a CLIP model is used as a feature extractor, wherein the CLIP model includes a visual feature encoder and a text feature encoder;

[0018] The video category label is passed through the CLIP tokenizer to get the original word unit, and then the m The learnable hints of the context words are added to the front and back of the original word to form a complete word; the assembled complete word and position vector are added and sent to the text feature encoder to obtain the text class embedding.

[0019] As an optional solution, the temporal feature enhancement network is used to learn the temporal dependencies of visual feature representation locally and globally, specifically:

[0020] The visual feature representation is divided into equal-length and overlapping windows in the time dimension, and local self-attention calculation is performed in each window to obtain the local time feature expression;

[0021] The graph convolutional network is used to model and learn the global temporal dependency from the perspective of feature similarity and relative distance, and a temporally enhanced visual feature representation is obtained; the similarity between the visual feature representations of two video clips is calculated to generate a video feature similarity matrix of the graph convolutional network. ; Calculate the distance between two video frames and generate the video frame position distance matrix of the graph convolution network .

[0022] As an optional solution, the temporally enhanced visual feature representation is fused with the text class embedding to obtain a visual language alignment map, specifically:

[0023] The temporally enhanced visual feature representation is input into a fully connected neural network to obtain anomaly scores of the visual features. Visual cues are obtained based on the anomaly scores and the temporally enhanced visual feature representation. The visual cues are added to the text class embedding and input into a feedforward neural network to obtain a visual-language alignment graph.

[0024] The fully connected neural network consists of a feed-forward neural network FFN with residual connections, a fully connected layer FC and a Sigmoid activation function.

[0025] A visual cue is obtained based on the anomaly score and the temporal enhanced visual feature representation. Specifically, the visual cue is obtained by a dot product of the anomaly score and the temporal enhanced visual feature representation, and then the dot product is normalized.

[0026] As an optional solution, calculate the anomaly score of each video clip in the video sample, sort all the anomaly scores from large to small, and select the top k The video anomaly classifier is trained based on the video clips corresponding to the anomaly scores.

[0027] As an optional solution, the loss function of the video anomaly classifier is specifically: a weighted sum of classification loss, contrast loss, temporal smoothing loss and sparse loss.

[0028] In other embodiments, the following technical solutions are adopted:

[0029] A weakly supervised video anomaly detection system based on feature enhancement and fusion, comprising:

[0030] The feature extraction module is used to divide the input video into several video segments, extract features from each video segment through a visual feature encoder to obtain a generalized visual feature representation of the video segment, and obtain a text class embedding of the label through a text feature encoder;

[0031] A feature enhancement module is used to learn the temporal dependency of visual feature representation from local and global perspectives through a temporal feature enhancement network to obtain temporally enhanced visual feature representation;

[0032] The anomaly detection module is used to fuse the temporal enhanced visual feature representation with the text class embedding to obtain a visual language alignment map; the visual language alignment map is input into the trained video anomaly classifier to obtain the video anomaly detection result.

[0033] In other embodiments, the following technical solutions are adopted:

[0034] A terminal device includes a processor and a memory, wherein the processor is used to implement instructions; the memory is used to store multiple instructions, and the instructions are suitable for being loaded by the processor and executing the above-mentioned weakly supervised video anomaly detection method based on feature enhancement and fusion.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] (1) This paper innovatively proposes a local-global temporal relationship enhancement module, which enables the features of each video segment to be deeply associated with the features of adjacent and remote segments, and can capture the temporal continuity changes of local actions in a short period of time, and learn the temporal correlation patterns of global behaviors in a long period of time;

[0037] (2) The present invention innovatively proposes a visual-language fusion module to align visual and linguistic features and introduces a visual-language knowledge association mechanism, so that the two modalities of vision and language can be better integrated to promote the model to achieve accurate and consistent understanding and representation of anomalies at the visual and linguistic levels; thereby achieving a deep understanding and fusion of the spatiotemporal structure information of video data and the language information of semantic labels, thereby improving the accuracy of abnormal event detection.

[0038] (3) The present invention improves the traditional multi-instance learning by allowing video clips with larger anomaly scores in each video sample to participate in the training of the video anomaly classifier, and allowing more abnormal examples in the abnormal video package to participate in the model training process. This alleviates the gap between the number of positive and negative samples to a certain extent, improves the sensitivity and accuracy of the model for anomaly detection, and enables the classifier to more comprehensively capture the diversity and complexity of abnormal behaviors in different video packages.

[0039] (4) This invention innovatively proposes a new multi-pair contrast loss, which not only emphasizes that normal samples should be significantly separated from various abnormal samples in the feature space, but also takes into account that different types of abnormal events should also maintain sufficient distinction. This can not only strengthen the model's representation of normal behavior, but also ensure that the model can effectively distinguish various abnormal behaviors, thereby improving the performance of video anomaly detection based on weakly supervised learning.

[0040] Other features and advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a flow chart of a weakly supervised video anomaly detection method based on feature enhancement and fusion in an embodiment of the present invention;

[0042] Figure 2 Schematic diagram of the network structure of weakly supervised video anomaly detection based on feature enhancement and fusion in an embodiment of the present invention;

[0043] Figure 3 A schematic diagram of a timing feature enhancement network structure in an embodiment of the present invention;

[0044] Figure 4 Schematic diagram of the visual language feature fusion process in an embodiment of the present invention. DETAILED DESCRIPTION

[0045] It should be noted that the following detailed descriptions are illustrative and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.

[0046] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0047] Embodiment 1

[0048] In one or more embodiments, a weakly supervised video anomaly detection method based on feature enhancement and fusion is disclosed, combined with Figure 1 and Figure 2 , specifically including the following process:

[0049] S101: Divide the input video into several video segments, extract features from each video segment through a visual feature encoder to obtain a generalized visual feature representation of the video segment, and obtain a text class embedding of the label through a text feature encoder.

[0050] Specifically, this embodiment models weakly supervised video anomaly detection into a multi-instance learning framework. In this framework, the model regards the video as a package, each package has a label, and the video containing anomalies is called a positive package, and the normal video is called a negative package. A video is divided into video clips, and these video clips are examples in the package. Similarly, the abnormal clips are called positive examples and the normal clips are called negative examples. A video is represented as X , its corresponding video category label is Y ,in Y = 1 means that the video contains at least one abnormal example, Y = 0 means the video contains only normal examples. Indicates that the video is split into n Video clips This example uses the Contrastive Language-Image Pre-Training (CLIP) model as a feature extractor. The CLIP model has been pre-trained on a large-scale open vocabulary image-text pair dataset. The CLIP model consists of two encoders, one is a visual feature encoder and the other is a text feature encoder.

[0051] Will n After the video clip is input into the CLIP visual feature encoder, we will get n The corresponding visual feature representation is In weakly supervised video anomaly detection, text labels are some words, such as fighting, which are too concise and cannot well summarize abnormal events. Therefore, this embodiment innovatively proposes an automatic hint learning strategy to add a learnable hint vector to the original class embedding. Specifically, the label is first passed through the CLIP tokenizer to obtain the original word unit, and then the word unit containing mThe learnable hints of the context word-units are added to the front and back of the original word-unit to form a complete word-unit. Finally, the assembled complete word-unit and position vector are added and sent to the CLIP text feature encoder to obtain the class embedding c .

[0052] S102: The temporal dependency of the visual feature representation is learned locally and globally through the temporal feature enhancement network to obtain a temporally enhanced visual feature representation.

[0053] Combination Figure 3 ,This embodiment innovatively designs a set of structured timing feature ,enhancement network architecture, which is divided into two key parts, namely the local ,timing enhancement module and the global timing enhancement module.

[0054] The local Transformer mechanism is applied to feature enhancement on the local time scale. Through the self-attention mechanism, the local Transformer is able to capture the slight changes between adjacent frames and the correlation of local continuous segments in the action sequence, thereby refining a detailed and rich local temporal feature expression. In order to capture local temporal dependencies, a Transformer encoder layer is introduced after the CLIP visual encoder extracts the frame-level visual features. This layer is different from the ordinary Transformer encoder layer in that it limits the self-attention calculation to a local window instead of a global scope. Specifically, the frame-level visual features are first divided into equal-length and overlapping windows in the temporal dimension, and the self-attention calculation is limited to each window, and there is no information exchange between windows. This operation has a local receptive field like convolution and reduces the computational complexity. The corresponding formula for the self-attention mechanism within the window is expressed as follows:

[0055] ;

[0056] in, is the activation function used for normalization, Q, K, V They are query, key, and value matrices. d is the dimension of the word vector. The main difference from the original Transformer’s self-attention calculation is the addition of relative position encoding B , limiting the attention calculation to each window.

[0057] In terms of processing long-distance temporal dependencies, this embodiment innovatively introduces a lightweight graph convolutional network (GCN) as the core component of the global temporal enhancement module after the local temporal enhancement module. GCN models global temporal dependencies from the perspective of feature similarity and relative distance.

[0058] The feature similarity branch calculates the features of two video clips X The similarity between them generates the GCN video feature similarity matrix , the corresponding formula is as follows:

[0059] ;

[0060] in, and Is indexed by i and j characteristics of the video clip.

[0061] The position distance branch captures long-range dependencies through the distance between two frames and generates a GCN video frame position distance matrix. , the corresponding formula is as follows:

[0062] ;

[0063] in, i and j is the position index of the two video frames, i Frame and j The proximity between frames is determined only by their relative temporal positions.

[0064] GCN video feature similarity matrix Directly capture long-range dependencies by calculating the similarity between frames at any two positions; GCN video frame position distance matrix Only the position distance between the two frames is considered. Through these two matrices, global information (long-range dependency) can be obtained, so that new feature representations can be calculated.

[0065] like Figure 3 As shown, this embodiment connects the local timing enhancement module and the global timing enhancement module in series to form a new timing feature enhancement module, which takes the generalized visual features of the video clips output by the CLIP visual feature encoder as input, and obtains enhanced visual features after the timing feature enhancement network learns the timing dependencies locally and globally.

[0066] S103: Fusing the temporally enhanced visual feature representation with the text class embedding to obtain a visual-language alignment map; inputting the visual-language alignment map into a trained video anomaly classifier to obtain a video anomaly detection result.

[0067] This embodiment uses a language-vision fusion module to fuse the temporal enhanced visual feature representation with the text class embedding; specifically, Figure 4By inputting the temporally enhanced visual features into a classifier consisting of a feed-forward neural network FFN with residual connections, a fully connected layer FC, and a Sigmoid activation function, the visual features modeled by temporal relationships can be obtained. X aug Frame-level anomaly score S , the corresponding formula is as follows:

[0068] ;

[0069] In order to further improve the ability of text labels to represent abnormal events, this embodiment innovatively proposes to use visual context information to refine text class embedding. This embodiment proposes a visual prompt mechanism that focuses on abnormalities, which focuses on the visual features in abnormal fragments and aggregates these features into visual prompts for class embedding.

[0070] First, we use the frame-level anomaly scores of visual features modeled with temporal relationships. S As abnormal attention, through abnormal attention S and timing enhanced video features X aug The dot product of is used to obtain visual cues, and then normalizes them. The corresponding formula is expressed as follows:

[0071] ;

[0072] in, N For normalization operation, P It is a visual cue that the focus is abnormal.

[0073] By adding the visual cues of the focused anomaly and the text class embedding, the final example-level class embedding of the language branch is obtained after passing through a feedforward neural network and residual connection. The class embedding obtained in this way incorporates the visual information and completes the multimodal fusion of vision and language.

[0074] After the learnable textual hint mechanism and the focused abnormal visual hint mechanism, the final class embedding is calculated C aug and visual features X aug The cosine similarity of can get the visual language alignment map.

[0075] Some video anomaly detection methods based on the multi-instance learning framework only select the segment features with the highest anomaly value in the positive package and the segment features with the highest anomaly value in the negative package for model training. This approach has obvious limitations. It ignores other abnormal example segments that may exist in the positive package, because in actual video data, abnormal events may often span multiple continuous segments, or contain multiple independent abnormal examples in a video package. To address this defect, this embodiment innovatively proposes a multi-abnormal example sorting strategy to make full use of more abnormal samples in each positive package to participate in the training process.

[0076] The visual language alignment graph expresses the similarity between frame-level visual features and all class embeddings. The anomaly score after feature fusion can be obtained by subtracting the cosine similarity between the video and the normal class (i.e. the probability that a video is in the normal class) from 1.

[0077] Each video will get an anomaly score after the feature fusion of n video clips:

[0078] ;

[0079] The anomaly score of the video, where each element r is the anomaly score of the video segment in the video.

[0080] Different from the previous method, which only takes one package n The largest anomaly score is selected to participate in the training. This method proposes a top- k The sample selection strategy is to select the sample with the highest anomaly score from each bag. k This big k The examples participate in the constraint process of training, and the corresponding formula is expressed as follows:

[0081] ;

[0082] ;

[0083] in, Refers to the descending sort operation, After sorting , Depend on Top- k Examples are included.

[0084] The classification loss of the video anomaly classifier uses the selected top- k The cross entropy between the score and the video label, the corresponding formula is expressed as follows:

[0085] ;

[0086] in, Yes Video i After sorting in descending order j Anomaly scores for large video clips, It is a video-level tag. k is a hyperparameter.

[0087] Through the multi-abnormal example sorting strategy proposed in this embodiment, the classifier can more comprehensively capture the diversity and complexity of abnormal behaviors in different video packets.

[0088] In addition to the classification loss, this embodiment also proposes a new multi-pair contrast loss. In the process of updating parameters, it not only considers the relationship between normal samples and many other different abnormal samples, but also keeps a relatively reasonable distance between abnormal samples. The training samples of this loss are z +1 tuple, that is ( ),in is a feature of a normal sample, and the others are features of abnormal samples. The corresponding formulas are as follows:

[0089] ;

[0090] The first part is used to increase the feature distance between positive and negative samples, and the second part is used to control the distance between abnormal samples. D is the distance function, N is the normalization function, μ and q is a hyperparameter used to control the weights.

[0091] In addition, it is necessary to add time smoothing loss L ts and sparse loss L sp To further constrain the model training. The purpose of the temporal smoothness constraint is to make adjacent clips in the abnormal video have similar abnormal scores, while the purpose of the sparse constraint is to add a priori information that abnormal events are rare to each abnormal video. The corresponding formulas of these two losses are expressed as follows:

[0092] ;

[0093] ;

[0094] in, Indicates abnormal video i Middle segment j The anomaly score.

[0095] The total loss function of this embodiment is the weighted sum of classification loss, contrast loss, temporal smoothing loss, and sparse loss. The corresponding formula is as follows:

[0096] ;

[0097] in, , , is the weight of the balance loss term.

[0098] The method of this embodiment proposes a new local-global temporal relationship enhancement module so that the features of each video clip can be deeply associated with the features of adjacent and remote clips, so that the temporal continuity changes of local actions can be captured in a short period, and the temporal correlation patterns of global behaviors can be learned in a long period; an innovative visual language fusion module is proposed to align visual and language features so that the two modalities can be better integrated to promote the model to achieve accurate and consistent understanding and representation of anomalies at the visual and language levels; traditional multi-instance learning is improved so that more abnormal examples in the abnormal video package can participate in the training process of the model; a new loss function is proposed, which not only allows normal samples to be clearly distinguished from more abnormal samples in the feature space, but also takes into account that there should be enough distance between different types of abnormal events.

[0099] Embodiment 2

[0100] In one or more embodiments, a weakly supervised video anomaly detection system based on feature enhancement and fusion is disclosed, comprising:

[0101] The feature extraction module is used to divide the input video into several video segments, extract features from each video segment through a visual feature encoder to obtain a generalized visual feature representation of the video segment, and obtain a text class embedding of the label through a text feature encoder;

[0102] A feature enhancement module is used to learn the temporal dependency of visual feature representation from local and global perspectives through a temporal feature enhancement network to obtain temporally enhanced visual feature representation;

[0103] The anomaly detection module is used to fuse the temporal enhanced visual feature representation with the text class embedding to obtain a visual language alignment map; the visual language alignment map is input into the trained video anomaly classifier to obtain the video anomaly detection result.

[0104] The specific implementation of the above modules is the same as that in Example 1 and will not be described in detail.

[0105] Embodiment 3

[0106] In one or more embodiments, a terminal device is disclosed, including a server, the server including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the weakly supervised video anomaly detection method based on feature enhancement and fusion in Embodiment 1 when executing the program. For the sake of brevity, it will not be described in detail here.

[0107] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0108] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.

[0109] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.

[0110] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A weakly supervised video anomaly detection method based on feature enhancement and fusion, characterized in that: include: The input video is divided into several video clips, and features are extracted from each video clip through a visual feature encoder to obtain a generalized visual feature representation of the video clip, and the text class embedding of the label is obtained through a text feature encoder; The temporal feature enhancement network learns the temporal dependency of the visual feature representation locally and globally to obtain the temporal enhanced visual feature representation; The temporal enhanced visual feature representation is fused with the text class embedding to obtain a visual language alignment map; the visual language alignment map is input into the trained video anomaly classifier to obtain the video anomaly detection result; The temporal feature enhancement network learns temporal dependencies from local and global perspectives on visual feature representation, specifically: The visual feature representation is divided into equal-length and overlapping windows in the time dimension, and local self-attention calculation is performed in each window to obtain the local time feature expression; The graph convolutional network is used to model and learn the global temporal dependency from the perspective of feature similarity and relative distance, and a temporally enhanced visual feature representation is obtained; the similarity between the visual feature representations of two video clips is calculated to generate a video feature similarity matrix of the graph convolutional network. ; Calculate the distance between two video frames and generate the video frame position distance matrix of the graph convolution network ; The feature similarity branch calculates the features of two video clips X The similarity between them generates the GCN video feature similarity matrix , the corresponding formula is as follows: ; in, and Is indexed by i and j Features of the video clips; The position distance branch captures long-range dependencies through the distance between two frames and generates a GCN video frame position distance matrix. , the corresponding formula is as follows: ; in, i and j is the position index of the two video frames, i Frame and j The proximity between frames is determined only by their relative temporal positions; The loss function of the video anomaly classifier is specifically: a weighted sum of classification loss, contrast loss, temporal smoothing loss, and sparse loss; The temporally enhanced visual feature representation is fused with the text class embedding to obtain the visual language alignment map, which is as follows: The temporally enhanced visual feature representation is input into a fully connected neural network to obtain anomaly scores of the visual features. Visual cues are obtained based on the anomaly scores and the temporally enhanced visual feature representation. The visual cues are added to the text class embedding and input into a feedforward neural network to obtain a visual-language alignment graph.

2. A weakly supervised video anomaly detection method based on feature enhancement and fusion as claimed in claim 1, characterized in that: Using a CLIP model as a feature extractor, the CLIP model includes a visual feature encoder and a text feature encoder; The video category label is passed through the CLIP tokenizer to get the original word unit, and then the m The learnable hints of the context words are added to the front and back of the original word to form a complete word; the assembled complete word and position vector are added and sent to the text feature encoder to obtain the text class embedding.

3. A weakly supervised video anomaly detection method based on feature enhancement and fusion as claimed in claim 1, characterized in that: The fully connected neural network consists of a feed-forward neural network FFN with residual connections, a fully connected layer FC and a Sigmoid activation function.

4. A weakly supervised video anomaly detection method based on feature enhancement and fusion as claimed in claim 1, characterized in that: A visual cue is obtained based on the anomaly score and the temporal enhanced visual feature representation. Specifically, the visual cue is obtained by a dot product of the anomaly score and the temporal enhanced visual feature representation, and then the dot product is normalized.

5. A weakly supervised video anomaly detection method based on feature enhancement and fusion as claimed in claim 1, characterized in that: Calculate the anomaly score of each video clip in the video sample, sort all anomaly scores from large to small, and select the top k The video anomaly classifier is trained based on the video clips corresponding to the anomaly scores.

6. A weakly supervised video anomaly detection system based on feature enhancement and fusion, characterized in that: include: The feature extraction module is used to divide the input video into several video segments, extract features from each video segment through a visual feature encoder to obtain a generalized visual feature representation of the video segment, and obtain a text class embedding of the label through a text feature encoder; The feature enhancement module is used to learn the temporal dependency relationship of the visual feature representation from local and global perspectives through the temporal feature enhancement network to obtain a temporally enhanced visual feature representation; the temporal dependency relationship of the visual feature representation is learned from local and global perspectives through the temporal feature enhancement network, specifically: The visual feature representation is divided into equal-length and overlapping windows in the time dimension, and local self-attention calculation is performed in each window to obtain the local time feature expression; The graph convolutional network is used to model and learn the global temporal dependency from the perspective of feature similarity and relative distance, and a temporally enhanced visual feature representation is obtained; the similarity between the visual feature representations of two video clips is calculated to generate a video feature similarity matrix of the graph convolutional network. ; Calculate the distance between two video frames and generate the video frame position distance matrix of the graph convolution network ; The feature similarity branch calculates the features of two video clips X The similarity between them generates the GCN video feature similarity matrix , the corresponding formula is as follows: ; in, and Is indexed by i and j Features of the video clips; The position distance branch captures long-range dependencies through the distance between two frames and generates a GCN video frame position distance matrix. , the corresponding formula is as follows: ; in, i and j is the position index of the two video frames, i Frame and j The proximity between frames is determined only by their relative temporal positions; The temporally enhanced visual feature representation is fused with the text class embedding to obtain the visual language alignment map, which is as follows: Inputting the temporally enhanced visual feature representation into a fully connected neural network to obtain anomaly scores of the visual features, obtaining visual cues based on the anomaly scores and the temporally enhanced visual feature representation, adding the visual cues to the text class embedding and inputting them into a feedforward neural network to obtain a visual-language alignment graph; The anomaly detection module is used to fuse the temporally enhanced visual feature representation with the text class embedding to obtain a visual language alignment map; the visual language alignment map is input into a trained video anomaly classifier to obtain a video anomaly detection result; the loss function of the video anomaly classifier is specifically: a weighted sum of classification loss, contrast loss, temporal smoothing loss and sparse loss.

7. A terminal device, comprising a processor and a memory, wherein the processor is used to implement instructions; and the memory is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing the weakly supervised video anomaly detection method based on feature enhancement and fusion as described in any one of claims 1-5.