Weak supervision video anomaly detection method based on prompt enhanced multi-example learning

By introducing contextual cue features and attention mechanisms into video anomaly detection, the problem of complex anomaly patterns and fuzzy boundary recognition in weakly supervised video anomaly detection is solved, achieving more accurate anomaly recognition and clear boundary generation.

CN118537768AActive Publication Date: 2024-08-23UNIV OF CHINESE ACAD OF SCI

Patent Information

Application Number
CN202410454409.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-16
Publication Date
2024-08-23
Estimated Expiration
2044-04-16

Smart Images

  • Figure CN118537768A
    Figure CN118537768A
Patent Text Reader

Abstract

The invention discloses a weak supervision video anomaly detection method based on prompt enhanced multi-instance learning, which comprises the following steps: extracting video features and audio features, and setting context prompt features; setting a time feature fusion module to perform time feature fusion on the video features, the audio features and the context prompt features to obtain time sequence features; and setting a prediction head to predict the time sequence characteristics, obtaining an abnormal score, and determining whether the video is abnormal or not according to the abnormal score. According to the weak supervision video anomaly detection method based on prompt enhanced multi-example learning, semantic information is integrated into video features by using anomaly perception prompt, and then boundary context features are enriched by introducing normal context prompt, so that different anomaly modes are identified, a clear boundary is generated, and the anomaly identification rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning, and belongs to the field of computer vision. Background Art

[0002] Video anomaly detection is used to identify frame-level anomalies in videos. In order to have good generalization ability in different scenarios, weakly supervised VAD (wVAD) with video-level labels is often used for video anomaly detection. However, there are two key problems when using weak supervision with video-level labels: 1) detecting complex anomaly patterns in various scenarios, where the temporal relationships and visual appearances of anomalies show significant differences; 2) generating clear abnormal event boundaries without fine-grained boundary annotations.

[0003] In order to solve the above problems, a method of processing weakly supervised VAD by generating noisy frame-level anomaly labels and then reducing the noise is proposed in the prior art, but this method limits the generalization ability in unseen scenes;

[0004] There are also methods in the prior art that use multi-instance learning (MIL) to solve weakly supervised VAD. In order to detect abnormal events through frame-level anomaly scores, MIL-based methods usually apply ranking losses to encourage the highest score in abnormal videos to be higher than the highest score in normal videos. In this way, MIL can learn unique patterns in abnormal instances. However, it is well known that MIL has weak ability to determine fuzzy event boundaries and model different abnormal patterns in complex scenes. To this end, some methods modify the objective function or training strategy to facilitate learning clear event boundaries; or introduce auxiliary information, such as a knowledge base, to facilitate modeling of abnormal patterns in complex scenes. Although the above methods have made progress, they still face two major difficulties:

[0005] 1) Binary labels are not sufficient to capture complex abnormal patterns because they only capture a general abnormal pattern. In addition, binary labels ignore the semantic correlation that can represent similar and unique patterns between abnormal events;

[0006] 2) The coupling of anomalies and contextual patterns hinders the learning of clear boundaries.

[0007] Therefore, it is necessary to further study the existing weakly supervised video anomaly detection methods to improve the ability to identify frame-level anomalies in videos. Summary of the invention

[0008] In order to overcome the above problems, the inventors conducted in-depth research and designed a weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning, which is characterized by comprising:

[0009] S101, extracting video features and audio features, and setting contextual prompt features;

[0010] S102, setting a time feature fusion module to perform time feature fusion on video features, audio features, and context prompt features to obtain time series features;

[0011] S103: Setting a prediction head to predict the temporal features, obtaining an anomaly score, and determining whether the video is abnormal according to the anomaly score.

[0012] In a preferred embodiment, in S102, the video features and the audio features are connected along the feature dimension and then spliced ​​with the contextual prompt features along the length to obtain a multimodal feature. Multimodal features are used as input to the temporal feature fusion module.

[0013] In a preferred embodiment, the temporal feature fusion module is an attention mechanism architecture, including a self-attention mechanism of three linear layers, a Norm layer and a fourth linear layer; wherein the multimodal feature After passing through three linear layers, the numerical feature f is generated v 、Query feature f q and key feature f k , query feature f q and key feature f k After point multiplication, we get the similarity matrix, and after normalization, we get the global map A. g , the global map A g With the numerical feature f v After dot multiplication, we get contextual attention features

[0014] In the temporal feature fusion module, dynamic position encoding is also performed in the similarity matrix to obtain a similarity matrix It is expressed as:

[0015]

[0016] ε j,k =exp(-|γ(jk) 2 +β|)

[0017] Where ε=[ε j,k ], j∈[1, N], k∈[1, N], j and k represent the sequence numbers of the video and audio clips, N represents the number of clips, γ represents the learnable weight, β represents the learnable bias, and f q () indicates extracting query features, f k () indicates key features, and the superscript T indicates transposition.

[0018] In a preferred embodiment, the temporal feature fusion module is further provided with a mask similarity matrix. After normalization, we get the area map A l , the area map A l With the numerical feature f v After dot multiplication, we get the event context features The contextual attention feature Event context features Weighted fusion is performed, and the fused features are passed through the Norm layer and the fourth linear layer and then combined with the multimodal features. Splicing, and then pass a normalization layer to obtain time series features

[0019] In a preferred embodiment, in S103, the prediction head includes a perceptron, which can be expressed as:

[0020]

[0021] in, Represents semantic features, Dropout() represents the Dropout layer, GELU() represents the GELU activation function, Conv s1 represents a one-dimensional convolutional layer with a step size of s1, Represents time series characteristics;

[0022] The anomaly score obtained It is expressed as:

[0023]

[0024] Among them, σ() represents the sigmoid activation function, f t () represents the causal convolutional layer, Dropout() represents the Dropout layer, GELU() represents the GELU activation function, Conv s2 () represents a one-dimensional convolutional layer with a step size of s2, Represents semantic features.

[0025] In a preferred embodiment, before performing video anomaly detection, the temporal feature fusion module and the prediction head need to be trained to obtain appropriate network parameters, and the training includes the following steps:

[0026] S201, setting a semantic prompt set according to abnormal scenes in the videos in the video training set;

[0027] S202: extract video features and audio features from the video training set and the corresponding audio training set, do not set contextual prompt features, and only splice the video features and audio features along the feature dimension as multimodal features Then the network parameters are trained through the time feature fusion module and prediction head in turn.

[0028] In a preferred embodiment, in S201, the semantic prompt set is a set of video annotations, and the annotations are used to describe a normal video or an abnormal scene of the video.

[0029] In a preferred embodiment, the contextual prompt feature is obtained by:

[0030] S401, after completing the training of the time feature fusion module and the prediction head, freeze the network parameters of the time feature fusion module and the prediction head;

[0031] S402: randomly set contextual prompt features, extract video features and audio features from the video training set and the corresponding audio training set, connect the video features and audio features along the feature dimension, and then splice them with the contextual prompt features along the length to obtain multimodal features. After passing through the time feature fusion module and the prediction head, the anomaly score is obtained.

[0032] S403, setting the label of the video to 0, setting the loss function, and repeating step S402 for training using the video training set and the audio training set to obtain contextual prompt features.

[0033] The present invention also provides an electronic device, comprising:

[0034] at least one processor; and

[0035] A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the methods described above.

[0036] The present invention also provides a computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute any of the above methods.

[0037] The beneficial effects of the present invention include:

[0038] (1) Anomaly perception cues are used to integrate semantic information into video features, and then normal context cues are introduced to enrich boundary context features, thereby identifying different anomaly patterns and generating clear boundaries, thereby improving the anomaly recognition rate;

[0039] (2) Introducing normal contextual cues as the sum of normal patterns. Such cues enrich the contextual features of the boundary to reveal a more discriminative feature, which can be used to decouple context and anomalies, thereby producing clear event boundaries and improving anomaly recognition rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A flowchart of a weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to a preferred embodiment of the present invention is shown. DETAILED DESCRIPTION

[0041] The present invention will be further described in detail below through the accompanying drawings and embodiments. Through these descriptions, the characteristics and advantages of the present invention will become more clear and distinct.

[0042] The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise noted.

[0043] The present invention provides a weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning, such as Figure 1 As shown, including:

[0044] S101, extracting video features and audio features, and setting contextual prompt features;

[0045] S102, setting a time feature fusion module to perform time feature fusion on video features, audio features, and context prompt features to obtain time series features;

[0046] S103: Setting a prediction head to predict the temporal features, obtaining an anomaly score, and determining whether the video is abnormal according to the anomaly score.

[0047] In S101, for the input video and its corresponding audio Use a pre-trained video encoder from video Extract video features Use a pre-trained audio encoder to extract audio Extract audio features from

[0048] Preferably, before extracting features, the input video and audio Divide into non-overlapping segments of multiple frames, extract features from each segment, and form segment-level video features and segment-level audio features Where N is the number of fragments, D v is the feature dimension of the video, D a is the characteristic dimension of the audio.

[0049] Preferably, the multiple frames are 16 frames.

[0050] By dividing the image into non-overlapping segments of multiple frames, computational overhead can be saved and recognition efficiency can be improved.

[0051] In the present invention, the specific network structures of the video encoder and the audio encoder are not limited, and those skilled in the art may adopt commonly used encoders, for example, the video encoder adopts I3D and the audio encoder adopts VG Gish.

[0052] The contextual prompt feature is used to assist in generating clear abnormal event boundaries, and the specific feature value thereof can be set by those skilled in the art based on experience.

[0053] By setting contextual hint features, the potential normal event distribution of the training model is summarized, and clear abnormal event boundaries can be generated by enriching fuzzy contextual features.

[0054] In S102, a temporal feature fusion module Temporal Feature Fusion (TFF) is set to process and fuse video features and audio features to obtain temporal features.

[0055] Specifically, the video features and audio features are connected along the feature dimension and then concatenated with the contextual cue features along the length to obtain multimodal features. Multimodal features are used as input to the temporal feature fusion module.

[0056] The temporal feature fusion module is an attention mechanism architecture for interpretable multi-time step prediction, including a self-attention mechanism of three linear layers, a Norm layer and a fourth linear layer.

[0057] Among them, multimodal features After passing through three linear layers, the numerical feature f is generated v 、Query feature f q and key feature f k , query feature f q and key feature f k After point multiplication, we get the similarity matrix, and after normalization, we get the global map A. g , the global map A g With the numerical feature f v After dot multiplication, we get contextual attention features The process is the same as that of a traditional Transformer module (such as a TFT module).

[0058] Different from the traditional Transformer module, in the temporal feature fusion module, dynamic position encoding is also performed in the similarity matrix, and the obtained similarity matrix It is expressed as:

[0059]

[0060] ε j,k =exp(-|γ(jk) 2 +β|)

[0061] Where ε=[ε j,k ], j∈[1, N], k∈[1, N], j and k represent the sequence numbers of the video and audio clips, N represents the number of clips, γ represents the learnable weight, β represents the learnable bias, and f q (·) represents the extraction of query features, f k (·) indicates key features, and the superscript T indicates transposition.

[0062] Furthermore, unlike the traditional Transformer module, the temporal feature fusion module is also provided with a mask similarity matrix. By similarity matrix The mask is obtained, which is expressed as:

[0063]

[0064]

[0065] in, Represents the mask similarity matrix The elements of , i represents the index of the video segment, and w represents the window size.

[0066] Furthermore, the mask similarity matrix After normalization, we get the area map A l .

[0067] Map of area A l With the numerical feature f v After dot multiplication, we get the event context features It is expressed as:

[0068]

[0069] Among them, D h Represents the hidden layer dimension in the attention mechanism architecture.

[0070] Furthermore, the contextual attention features Event context features Weighted fusion is performed, and the fused features are passed through the Norm layer and the fourth linear layer and then combined with the multimodal features. Splicing, and then pass a normalization layer to obtain time series features It is expressed as:

[0071]

[0072]

[0073] in, represents the weighted fusion feature, α is the learnable weight, and f o Represents the output features, Norm() represents the Norm layer, and LayerNorm represents the normalization layer.

[0074] In the present invention, by setting a mask similarity matrix and weighted fusion, local attention is improved, the problem of long-term noise is solved, and anomaly recognition is made more accurate.

[0075] Furthermore, after adding contextual cue features, the temporal feature fusion module can capture the unique features of anomalies and contexts through the attention mechanism, which dynamically integrates the abnormal context with the rich content of the normal domain by utilizing the high feature correlation, thereby amplifying the feature differences so that the subsequent prediction head can use this difference to accurately determine the event boundary.

[0076] In S103, the prediction head includes a perceptron, which can be expressed as:

[0077]

[0078] in, Represents semantic features, Dropout() represents the Dropout layer, GELU() represents the GELU activation function, Conv s1 represents a one-dimensional convolutional layer with a step size of s1, Represents the timing characteristics.

[0079] The anomaly score obtained It is expressed as:

[0080]

[0081] Among them, σ() represents the sigmoid activation function, f t () represents the causal convolutional layer, Dropout() represents the Dropout layer, GELU() represents the GELU activation function, Conv s2 () represents a one-dimensional convolutional layer with a step size of s2, Represents semantic features.

[0082] According to the present invention, the causal convolution layer, the Dropout layer, and the convolution layer are all commonly used neural network structures, and their specific structures are not described in detail in the present invention.

[0083] According to the present invention, when the anomaly score is lower than a preset value, it is considered that there is no anomaly in the video, otherwise, it is considered that there is anomaly in the video.

[0084] According to the present invention, before performing video anomaly detection, the temporal feature fusion module and the prediction head need to be trained to obtain appropriate network parameters.

[0085] In the present invention, unlike traditional neural network training, the training includes the following steps:

[0086] S201, setting a semantic prompt set according to abnormal scenes in the videos in the video training set;

[0087] S202: extract video features and audio features from the video training set and the corresponding audio training set, do not set contextual prompt features, and only splice the video features and audio features along the feature dimension as multimodal features Then the network parameters are trained through the time feature fusion module and prediction head in turn.

[0088] In S201, the semantic hint set is a collection of video annotations, and the annotations are used to describe a normal video or an abnormal video scene. For example, a traffic video with a car accident is annotated as "car accident"; a traffic video without abnormalities is annotated as "normal".

[0089] For any video, the annotations in the semantic cue set can be divided into three categories: positive annotations, negative annotations, and related annotations;

[0090] The positive annotation is used to describe the abnormal scene in the video. For example, in a traffic video with a car accident, "car accident" is a positive annotation.

[0091] The negative class is annotated as “normal”, which is used to describe normal videos, i.e., videos where no abnormal situations occur;

[0092] Related class annotations are scenes that do not appear in this video but appear in other videos in the video set.

[0093] In S202, during training, for abnormal videos, the first q abnormal scores are selected to enhance abnormal features, and the maximum score of normal videos is sampled to reduce the abnormal score of normal videos.

[0094] Preferably, q is set to:

[0095]

[0096] Here, y=1 represents an abnormal video, y=0 represents a normal video, and a represents the number of frames when the video is divided into multiple non-overlapping segments.

[0097] Preferably, the mean of the first k anomaly scores is used as the anomaly prediction of the abnormal video

[0098] Preferably, the loss function during training is Set to:

[0099]

[0100] Preferably, the objective function in the training is obtained by the following method:

[0101] S301, scaling the anomaly score as an activation value, separating video-level events and context features, expressed as:

[0102]

[0103]

[0104]

[0105] in, Indicates the characteristics of the event. represents the context feature, μ represents the configurable scale factor, Represents the visual features obtained by concatenating event features and context features.

[0106] Since a video may contain events and context examples, aligning all segments with the same cue will confuse the model with unclear semantics. Step S303 can solve the above problem.

[0107] S302, converting annotations in the semantic hint set into text features;

[0108] Preferably, the annotations in the semantic cue set are first converted into an embedding tensor, and then the learnable cue is connected with the embedding tensor to obtain the text features through a text encoder.

[0109] Since the original category annotations are too concise, unable to summarize complex events, and lack rich semantics, in this invention, learnable hints are introduced into the original text embedding, which can improve the generalization ability and derive semantically rich text features;

[0110] Preferably, the embedding tensor of the positive annotation is represented as:

[0111]

[0112] The process of connecting the learnable hint and the embedding tensor is expressed as:

[0113]

[0114] The positive annotation text feature is obtained by the text encoder and represented as T p ,

[0115] In the same way, we obtain the related class annotation text features T r , negative annotation text features T n , connect the text features of positive class annotations, related class annotations, and negative class annotations to form the text feature T of each label:

[0116] T={T p , T r , T n}

[0117] S303, obtaining visual text correlation distribution P, expressed as:

[0118]

[0119]

[0120] Among them, C represents the ordinal number of the abnormal category, τ represents the temperature factor, and k represents the fragment index.

[0121] S304, dynamically calculate semantic relevance to form an alignment target, expressed as:

[0122]

[0123] Among them, c is the scaling factor, if it is a normal video, the scaling factor is equal to 1, the superscript e and c correspond to the features of the event and context, and the subscript p, r, and n refer to the positive class annotations, related class annotations, and negative class annotations of the text features.

[0124] S305. Obtain instant learning loss It is expressed as:

[0125]

[0126]

[0127] in, represents the target distribution, Express expectations, Indicates the target.

[0128] Preferably, the method further includes: S306, setting a prompt constraint loss

[0129]

[0130] Among them, T l represents a learnable hint, T init Indicates an initial prompt.

[0131] The setting of the hint constraint loss ensures consistency between learnable hints and class annotations.

[0132] More preferably, in the training phase, the overall objective function is set to:

[0133]

[0134] Among them, the hyperparameters λ and β are used to balance the loss.

[0135] By optimizing the objective function, the method of the present invention can generate more discriminative features using semantically rich features, thereby accurately detecting various abnormal patterns.

[0136] Preferably, the contextual prompt feature is obtained by:

[0137] S401, after completing the training of the time feature fusion module and the prediction head, freeze the network parameters of the time feature fusion module and the prediction head;

[0138] S402: randomly set contextual prompt features, extract video features and audio features from the video training set and the corresponding audio training set, connect the video features and audio features along the feature dimension, and then splice them with the contextual prompt features along the length to obtain multimodal features. After passing through the time feature fusion module and the prediction head, the anomaly score is obtained.

[0139] S403, setting the label of the video to 0, setting the loss function, and repeating step S402 for training using the video training set and the audio training set to obtain contextual prompt features.

[0140] Preferably, during training, the loss function Set to:

[0141]

[0142] in, represents the anomaly score of segment i, and N represents the total number of segments.

[0143] Various embodiments of the method described above in the present invention can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs, which may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general programmable processor, which may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0144] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0145] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0146] To provide interaction with a user, the methods and apparatus described herein may be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0147] The methods and apparatus described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communications network). Examples of communications networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0148] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0149] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in the present disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document is not limited here.

[0150] Example

[0151] Example 1

[0152] Experiments were conducted on the XD Violence dataset. The ShanghaiTech dataset includes 13 fixed-view campus scenes from surveillance systems. It contains 238 videos in the training set and 199 videos in the test set. XD Violence is the most extensive dataset currently available for wVAD. It includes videos collected from various sources, including movies, games, and car cameras. The dataset includes 3,954 training videos with video-level annotations and 800 test videos with frame-level labels, including six different anomaly categories.

[0153] We use a weakly supervised video anomaly detection method based on cue-enhanced multi-instance learning to conduct experiments, including:

[0154] S101, extracting video features and audio features, and setting contextual prompt features;

[0155] S102, setting a time feature fusion module to perform time feature fusion on video features, audio features, and context prompt features to obtain time series features;

[0156] S103: Setting a prediction head to predict the temporal features, obtaining an anomaly score, and determining whether the video is abnormal according to the anomaly score.

[0157] In S101, the video is encoded into 1024-dimensional video features through the RGB stream I3D video encoder, which is pre-trained on the Kinetics dataset. For audio features, VGGish pre-trained on the YouTube dataset is used. Before extracting features, the input video and audio are divided into non-overlapping segments of 16 frames.

[0158] In S102, the video features and the audio features are connected along the feature dimension and then concatenated with the contextual prompt features along the length to obtain a multimodal feature. Use multimodal features as input to the temporal feature fusion module;

[0159] In the temporal feature fusion module, dynamic position encoding is also performed in the similarity matrix to obtain a similarity matrix It is expressed as:

[0160]

[0161] ε j,k= exp(-|γ(jk) 2 +β|)

[0162] The temporal feature fusion module is also provided with a mask similarity matrix. After normalization, we get the area map A l , the area map Al With the numerical feature f v After dot multiplication, we get the event context features The contextual attention feature Event context features Weighted fusion is performed, and the fused features are passed through the Norm layer and the fourth linear layer and then combined with the multimodal features. Splicing, and then pass a normalization layer to obtain time series features

[0163] In the XD-Violence dataset, the contextual cue feature length is set to 35. In the network parameter training phase, the method of steps S201-S202 and S401-S403 is adopted, where λ and β are 1 and 8 respectively, and the ratios of s1 and s2 are 2 and 3 respectively.

[0164] Comparative Example 1

[0165] Using the same data set as Example 1, the same experiments as Example 1 were performed using the OCSVM method, Conv-AE method, MIL-Rank method, CA-VAD method, RTFM method, CRFD method, DDL method, MSL method, S3R method, MGFN method, UR-DMU method, Zhang et al. method, CMA-LA method, MACIL-SD method, CoMo method, PEL4VAD method, and HyperVD method.

[0166] Among them, the OCSVM method can be found in the literature Xiaogang Peng, Hao Wen, Yikai Luo, Xiao Zhou, KeyangYu, Yigang Wang, and ZizhaoWu. Learning weakly supervised audio-visualviolence detection in hyperbolic space. arXiv preprint arXiv:2305.18797, 2023.

[0167] For the Conv-AE method, see Tianyu Gao, Adam Fisch, and Danqi Chen. Making pretrained language models better few-shot learners. arXiv preprint arXiv:2012.15723, 2020.

[0168] MIL-Rank Configuration SystemYujiang Pu and Xiaoyu Wu.Audio-guided attentionnetwork for weakly supervised violence detection.In 2022 2nd InternationalConference on Consumer Electronics and Computer Engineering(ICCECE),pages219–223.IEEE,2022.

[0169] CA-VAD was developed by Joao Carreira and Andrew Zisserman.Quo vadis, action recognition?

[0170] Proceedings of the RTFM Method Yujiang Pu and Xiaoyu Wu.Locality-aware attentionnetwork with discriminative dynamics learning for weakly supervised anomaly detection.In 2022IEEE International Conference on Multimedia and Expo(ICME),pages 1–6.IEEE,2022.

[0171] CRFD features include Yunbin Tu, Liang Li, Li Su, Zheng-Jun Zha, and QingmingHuang.Smart:Syntax-calibrated multi-aspect relation transformer for changecaptioning.IEEE Transactions on Pattern Analysis and Machine Intelligence,2024.

[0172] The DDL method can be found in the literature: Hui Lv, Zhongqi Yue, Qianru Sun, Bin Luo, Zhen Cui, and Hanwang Zhang. Unbiased multiple instance learning for weakly supervised video anomaly detection. In Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, pages 8022–8031, 2023.

[0173] The MSL method can be found in the literature: Chen Ju, Tengda Han, Kunhao Zheng, Ya Zhang, and Weidi Xie. Prompting visual-language models for effcient video understanding. In European Conference on Computer Vision, pages 105–124. Springer, 2022.

[0174] The S3R method can be found in the literature: Yunbin Tu, Liang Li, Li Su, Shengxiang Gao, Chenggang Yan, Zheng-Jun Zha, Zhengtao Yu, and Qingming Huang. I2 transformer: Intra-and inter-relation embedding transformer for tv show captioning. IEEE Transactions on Image Processing, 31:3565–3577, 2022.

[0175] The MGFN method can be found in the literature: Shuning Chang, Yanchao Li, Shengmei Shen, Jiashi Feng, and Zhiying Zhou. Contrastive attention for video anomaly detection. IEEE Transactions on Multimedia, 24:4067–4076, 2021.

[0176] The UR-DMU method can be found in the literature: Lewei Yao, Jianhua Han, Youpeng Wen, Xiaodan Liang, Dan Xu, Wei Zhang, Zhenguo Li, Chunjing Xu, and Hang Xu. "Detclip: Dictionary-enriched visual-concept paralleled pretraining for open-world detection." Advances in Neural Information Processing Systems, 35: 9125–9138, 2022.

[0177] The method of Zhang et al. can be found in the literature: Peng Wu, Jing Liu, Yujia Shi, Yujia Sun, Fangtao Shao, Zhaoyang Wu, and Zhiwei Yang. "Not only Look, but also Listen: Learning Multimodal Violence Detection under Weak Supervision", pages 322–339, 2020.

[0178] The CMA-LA method can be found in the literature: Hui Lv, Chuanwei Zhou, Zhen Cui, Chunyan Xu, Yong Li, and Jian Yang. "Localizing anomalies from weakly labeled videos." IEEE Transactions on Image Processing, pages 4505–4515, 2021.

[0179] The MACIL-SD method can be found in the literature: Mengmeng Wang, Jiazheng Xing, and Yong Liu. "Actionclip: A new paradigm for video action recognition." arXiv preprint arXiv:2109.08472, 2021.

[0180] For the CoMo method, please refer to the literature Yingxian Chen, Zhengzhe Liu, Baoheng Zhang, Wilton Fok, Xiaojuan Qi, and Yik-ChungWu. Mgfn: Magnitude contrastive glance-and-focus network for weakly-supervised video anomaly detection. In Proceedings of the AAAI Conference on Artifcial Intelligence, pages 387–395, 2023.

[0181] For the PEL4VAD method, see Seongheon Park, Hanjae Kim, Minsu Kim, Dahye Kim, and Kwanghoon Sohn. Normality guided multiple instance learning for weaklysupervised video anomaly detection. In Proceedings of the IEEE / CVF WinterConference on Applications of Computer Vision, pages 2665–2674, 2023.

[0182] The HyperVD method can be found in Cewu Lu, Jianping Shi, and Jiaya Jia. Abnormal event detection at 150fps in matlab. In Proceedings of the IEEE international conference on computer vision, pages 2720–2727, 2013.

[0183] The experimental results of Example 1 and Comparative Example 1 are compared, and the results are shown in Table 1, where the average precision (AP) is used as the metric.

[0184] Table 1

[0185]

[0186] In Comparative Example 1, the OCSVM method and the Conv-AE method are semi-supervised methods, and the remaining methods are weakly supervised methods.

[0187] As can be seen from Table 1, the method in Example 1 surpasses all previous semi-supervised methods and weakly supervised methods (i.e., the method in Comparative Example 1). It is worth noting that when using the same I3D-RGB video features and VGGish audio features, the method in Example 1 achieves an absolute gain of 2.54% in AP compared to the best method in Comparative Example 1. This better result stems from the accurate modeling of divergent anomaly patterns by the method in Example 1, as well as helping to produce more accurate anomaly detection results by generating clear event anomaly scores and eliminating false positives.

[0188] The present invention has been described above in conjunction with preferred embodiments, but these embodiments are only exemplary and serve only as an illustration. On this basis, the present invention may be subjected to a variety of substitutions and improvements, all of which fall within the scope of protection of the present invention.

Claims

1. A weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning, characterized in that: include: S101, extracting video features and audio features, and setting contextual prompt features; S102, setting a time feature fusion module to perform time feature fusion on video features, audio features, and context prompt features to obtain time series features; S103: Setting a prediction head to predict the temporal features, obtaining an anomaly score, and determining whether the video is abnormal according to the anomaly score.

2. The weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to claim 1 is characterized in that: In S102, the video features and the audio features are connected along the feature dimension and then concatenated with the contextual prompt features along the length to obtain a multimodal feature. Multimodal features are used as input to the temporal feature fusion module.

3. The weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to claim 1 is characterized in that: The temporal feature fusion module is an attention mechanism architecture, including three linear layers of self-attention mechanism, Norm layer and fourth linear layer; among them, the multimodal feature After passing through three linear layers, the numerical feature f is generated v 、Query feature f q and key feature f k , query feature f q and key feature f k After point multiplication, we get the similarity matrix, and after normalization, we get the global map A. g , the global map A g With the numerical feature f v After dot multiplication, we get contextual attention features In the temporal feature fusion module, dynamic position encoding is also performed in the similarity matrix to obtain a similarity matrix It is expressed as: e j,k =exp(-|γ(jk) 2 +b|) Where ε=[ε j,k ], j∈[1, N], k∈[1, N], j and k represent the sequence numbers of the video and audio clips, N represents the number of clips, γ represents the learnable weight, β represents the learnable bias, and f q () indicates extracting query features, f k () indicates key features, and the superscript T indicates transposition.

4. The weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to claim 3 is characterized in that: The temporal feature fusion module is also provided with a mask similarity matrix. After normalization, we get the area map A l , the area map A l With the numerical feature f v After dot multiplication, we get the event context features The contextual attention feature Event context features Weighted fusion is performed, and the fused features are passed through the Norm layer and the fourth linear layer and then combined with the multimodal features. Splicing, and then pass a normalization layer to obtain time series features 5. The weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to claim 1, characterized in that: In S103, the prediction head includes a perceptron, which can be expressed as: in, Represents semantic features, Dropout() represents the Dropout layer, GELU() represents the GELU activation function, Conv s1 represents a one-dimensional convolutional layer with a step size of s1, Represents time series characteristics; The anomaly score obtained It is expressed as: Among them, σ() represents the sigmoid activation function, f t () represents the causal convolutional layer, Dropout() represents the Dropout layer, GELU() represents the GELU activation function, Conw s2 () represents a one-dimensional convolutional layer with a step size of s2, Represents semantic features.

6. The weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to claim 1, characterized in that: Before performing video anomaly detection, the temporal feature fusion module and the prediction head need to be trained to obtain appropriate network parameters. The training includes the following steps: S201, setting a semantic prompt set according to abnormal scenes in the videos in the video training set; S202: extract video features and audio features from the video training set and the corresponding audio training set, do not set contextual prompt features, and only splice the video features and audio features along the feature dimension as multimodal features Then the network parameters are trained through the time feature fusion module and prediction head in turn.

7. The weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to claim 6 is characterized in that: In S201, the semantic prompt set is a collection of video annotations, and the annotations are used to describe a normal video or an abnormal scene of the video.

8. The weakly supervised video anomaly detection method based on prompt-enhanced multi-instance learning according to claim 1, characterized in that: The contextual prompt feature is obtained in the following way: S401, after completing the training of the time feature fusion module and the prediction head, freeze the network parameters of the time feature fusion module and the prediction head; S402: randomly set contextual prompt features, extract video features and audio features from the video training set and the corresponding audio training set, connect the video features and audio features along the feature dimension, and then splice them with the contextual prompt features along the length to obtain multimodal features. After passing through the time feature fusion module and the prediction head, the anomaly score is obtained. S403, setting the label of the video to 0, setting the loss function, and repeating step S402 for training using the video training set and the audio training set to obtain contextual prompt features.

9. An electronic device, comprising: at least one processor; as well as A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the method of any one of claims 1-7.

10. A computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Abnormal behavior detection method based on multi-example learning modeling

    CN111160117A

  • Weak supervision monitoring video abnormal behavior detection method based on time domain attention

    CN113516032A

  • Weak supervision video anomaly detection method, system and device and medium

    CN116434112A

  • Time sequence behavior detection method based on context aggregation and boundary generation

    CN117115906A

  • Cross-modal relation perception violent behavior detection method and system

    CN117765442A

Cited By

  • Weak supervision video anomaly detection method based on prompt learning knowledge enhancement

    CN121095832A

  • A weakly supervised video anomaly detection method based on prompt learning knowledge enhancement

    CN121095832B