Video anomaly detection method based on weak supervised learning and electronic device

By using methods based on weakly supervised learning, attention mechanisms and autoencoders are used to extract features and calculate anomaly scores for video clips, solving the problem of difficult annotation in video anomaly detection and achieving efficient automatic detection and improved accuracy.

CN118570710AInactive Publication Date: 2024-08-30CETC NEW SMART CITY RES INST CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411056075.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-08-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the automatic detection of video anomalies, there are problems such as difficulty in annotating abnormal videos frame by frame or scarcity of annotation data, resulting in low efficiency of automatic detection.

Method used

Using a method based on weakly supervised learning, the time series model and autoencoder introducing the attention mechanism are used to extract features and calculate anomaly scores from the optical flow map of video clips, and use sparsity constraints and time ordering loss functions for model training. Reduce reliance on a priori information about anomalies.

Benefits of technology

It realizes video anomaly detection without frame-by-frame annotation, improves detection accuracy, reduces reliance on abnormal prior information, and simplifies the training data annotation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570710A
    Figure CN118570710A
Patent Text Reader

Abstract

The invention provides a video anomaly detection method based on weak supervised learning and an electronic device. Based on the method and the device, the abnormal score of the video packet can be scored by introducing the first time sorting model of the attention mechanism, and the video does not need to be marked frame by frame. And the training data set of the first time sorting model only needs to carry out normal or abnormal labeling on the video packets, so that the dependence on abnormal prior information is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to a video anomaly detection method and electronic device based on weakly supervised learning. Background Art

[0002] Abnormal event detection in video has long been a research hotspot in the field of computer vision. With the increasing popularity of high-definition surveillance cameras in cities, the resulting massive amount of surveillance videos has brought a heavy workload to video operators. Therefore, there is an urgent need for automatic video anomaly detection methods. However, in the process of automatic video anomaly detection, there are still problems such as difficulty in annotating abnormal videos frame by frame or scarcity of annotated data. Summary of the invention

[0003] The embodiments of the present application provide a video anomaly detection method and an electronic device based on weakly supervised learning.

[0004] In a first aspect, an embodiment of the present application provides a video anomaly detection method based on weakly supervised learning, the method comprising: Preprocessing the original video data to obtain multiple video packages, each of which includes one or more video clip instances, and the video package is a normal video package or an abnormal video package, wherein the normal video package does not include an abnormal video clip instance, and the abnormal video package includes at least one abnormal video clip instance, and the abnormal video clip instance includes an abnormal event; Calculate the optical flow map of each video clip instance in the video package to obtain a stacking structure of the optical flow map of each video clip instance, where the optical flow map includes motion information of the video clip instance in horizontal and vertical directions; Extracting features from the optical flow map of each video clip instance based on the first time enhancement network to obtain motion perception features of each video clip instance, where the motion perception features include motion information of the video clip instance; Inputting the motion perception feature of each video clip instance into the first time sorting model to obtain an anomaly score for each video clip instance, where the anomaly score is used to indicate the possibility that the video clip instance is anomaly; The first time sorting model is a time series model that introduces an attention mechanism, and the training data set of the first time sorting model includes video packages marked as abnormal and normal respectively; The first time enhancement network is an autoencoder. The first time enhancement network includes three encoder layers, one bottleneck layer and three decoder layers. Each layer consists of a two-dimensional convolutional layer and a linear rectification activation function.

[0005] Optionally, the first time sorting model is trained and optimized based on a first loss function, the first loss function combines the sparsity constraint term and the time sorting loss, and the first loss function is determined based on the following formula:

[0006] in represents the first loss function, represents the temporal sorting loss function, which is used to measure the difference between normal video packets and abnormal video packets, including attention mechanism and temporal context information; represents the sparsity constraint term, which is used to ensure that only a few video clip instances in the abnormal video package have high anomaly scores, thereby avoiding the first-time sorting model predicting that most video clip instances are abnormal video clip instances. is a hyperparameter used to control the weight of the sparsity constraint term. Determined based on the following formula:

[0007] in, and Respectively represent abnormal video packets and normal video packets, Represents a video clip instance The attention weight of is used to measure its importance in the video bag, and Respectively represent abnormal video clip instances and normal video clip instance The anomaly score.

[0008] Optionally, the first time enhancement network is obtained by unsupervised training based on L1 pixel reconstruction loss.

[0009] Optionally, motion-aware features of the video clip instance are determined based on a feature vector extracted from a bottleneck layer by a first temporal enhancement network through a global average pooling operation.

[0010] In a second aspect, an embodiment of the present application provides an electronic device, including: A preprocessing module, used for preprocessing the original video data to obtain multiple video packages, each of which includes one or more video clip instances. The video package is a normal video package or an abnormal video package. The normal video package does not include an abnormal video clip instance, and the abnormal video package includes at least one abnormal video clip instance. The abnormal video clip instance includes an abnormal event. A calculation module, used for calculating an optical flow map of each video clip instance in the video package, and obtaining a stacking structure of the optical flow map of each video clip instance, wherein the optical flow map includes motion information of the video clip instance in horizontal and vertical directions; A feature extraction module, configured to extract features from an optical flow map of each video clip instance based on a first time enhancement network to obtain motion perception features of each video clip instance; A detection module, used for inputting the motion perception feature of each video clip instance into the first time sorting model to obtain an anomaly score for each video clip instance, where the anomaly score is used to indicate the possibility that the video clip instance is abnormal; The first time sorting model is a time series model that introduces an attention mechanism, and the training data set of the first time sorting model includes video packages marked as abnormal and normal respectively; The first time enhancement network is an autoencoder. The first time enhancement network includes three encoder layers, one bottleneck layer and three decoder layers. Each layer consists of a two-dimensional convolutional layer and a linear rectification activation function.

[0011] Optionally, the first time sorting model is trained and optimized based on a first loss function, the first loss function combines the sparsity constraint term and the time sorting loss, and the first loss function is determined based on the following formula:

[0012] in represents the first loss function, represents the temporal sorting loss function, which is used to measure the difference between normal video packets and abnormal video packets, including attention mechanism and temporal context information; represents the sparsity constraint term, which is used to ensure that only a few video clip instances in the abnormal video package have high anomaly scores, thereby avoiding the first-time sorting model predicting that most video clip instances are abnormal video clip instances. is a hyperparameter used to control the weight of the sparsity constraint term. Determined based on the following formula:

[0013] in, and Represent abnormal video packets and normal video packets respectively. Represents a video clip instance The attention weight of is used to measure its importance in the video bag, and Respectively represent abnormal video clip instances and normal video clip instance The anomaly score.

[0014] Optionally, the first time enhancement network is obtained by unsupervised training based on L1 pixel reconstruction loss.

[0015] Optionally, motion-aware features of the video clip instance are determined based on a feature vector extracted from a bottleneck layer by a first temporal enhancement network through a global average pooling operation.

[0016] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, at least one processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a method as described in any one of the above-mentioned first aspects is implemented.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described in any one of the above-mentioned first aspects is implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes any one of the methods described in the first aspect.

[0019] Based on this application, the first time sorting model with attention mechanism can be introduced to score the abnormality score of the video package without labeling the video frame by frame. In addition, the training data set of the first time sorting model only needs to label the video package as normal or abnormal, reducing the dependence on abnormal prior information. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for describing the embodiments are briefly introduced below.

[0021] Figure 1 It is a flowchart of a video anomaly detection method based on weakly supervised learning provided in an embodiment of the present application.

[0022] Figure 2 It is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application.

[0023] Figure 3 It is a structural schematic diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0024] The technical solution of the embodiment of the present invention will be described below in conjunction with the accompanying drawings in the embodiment of the present invention.

[0025] Abnormal event detection in video has long been a research hotspot in the field of computer vision. With the increasing popularity of high-definition surveillance cameras in cities, the resulting massive amount of surveillance videos has brought a heavy workload to video operators. Therefore, there is an urgent need for automatic video anomaly detection methods. However, in the process of automatic video anomaly detection, there are still problems such as difficulty in annotating abnormal videos frame by frame or scarcity of annotated data.

[0026] Based on this, Figure 1As shown, an embodiment of the present application provides a video anomaly detection method based on weakly supervised learning, which includes steps S110-S140.

[0027] In step S110, the original video data is preprocessed to obtain multiple video packages, the video package includes one or more video clip instances, the video package is a normal video package or an abnormal video package, the normal video package does not include an abnormal video clip instance, the abnormal video package includes at least one abnormal video clip instance, and the abnormal video clip instance includes an abnormal event. Among them, the video clip instance is used to indicate a video clip, and the duration of a video clip instance is not limited. For example, the original video data can be a video recorded by a camera in various fields, and the preprocessing of the original video data can refer to operations such as cutting the original video data. Abnormal events can refer to abnormal behaviors in the video or abnormalities in the video itself. For example, abnormal behaviors in the video can be behaviors such as running a red light. For another example, the abnormality of the video itself can be a blurred picture or no picture of the video.

[0028] In step S120, an optical flow map of each video clip instance in the video package is calculated to obtain a stacked structure of optical flow maps of each video clip instance, wherein the optical flow map includes motion information of the video clip instance in the horizontal and vertical directions. In computer vision, an optical flow map can define the movement of an object in an image, which can be caused by camera movement or physical object movement.

[0029] In step S130, feature extraction is performed on the optical flow map of each video clip instance based on the first time enhancement network to obtain motion perception features of each video clip instance, wherein the motion perception features include motion information of the video clip instance. The first time enhancement network may be an autoencoder, and the first time enhancement network may include three encoder layers, a bottleneck layer, and three decoder layers, each layer consisting of a two-dimensional convolutional layer and a rectified linear unit (ReLU) activation function.

[0030] The first time enhancement network inputs the pre-computed motion information (i.e., optical flow map) and outputs the reconstructed motion information. The first time enhancement network can restore the input as much as possible by learning a compact representation. Optionally, the first time enhancement network can be obtained by unsupervised training based on the L1 pixel reconstruction loss. Optionally, the motion-aware features of the video clip instance can be determined based on the feature vector (e.g., a 1024×1 feature vector) extracted from the bottleneck layer by the first time enhancement network through a global average pooling operation. The feature only contains motion information and does not contain the original frame pixel information.

[0031] In step S140, the motion perception features of each video clip instance are input into the first time sorting model to obtain an abnormality score for each video clip instance, and the abnormality score is used to indicate the possibility that the video clip instance is abnormal. The first time sorting model may be a time series model that introduces an attention mechanism, and the training data set of the first time sorting model includes video packages that are respectively marked as abnormal and normal. In other words, the training data set of the first time sorting model may only provide video-level annotations, that is, the video is marked as normal or abnormal, but the specific time point when the abnormal event occurs is not marked. This annotation method is much sparser than frame-level annotation and is a typical weakly supervised learning problem. Exemplarily, the first time sorting model may be a long short-term memory (LSTM) model that introduces an attention mechanism.

[0032] The first time ranking model can process the detection process of video anomalies as a regression problem of anomaly scores. The anomaly score of a video clip can be between 0 and 1, indicating the possibility of whether the clip is normal or abnormal. The higher the score, the more likely it is an abnormal event. Since there is no specific time when the abnormal event occurred, the first time ranking model can only detect anomalies by learning the relative differences between video clips.

[0033] The attention mechanism in the first-time ranking model can learn the importance of each video clip and give higher weights to more important clips. For example, for each video package containing m clips, the attention module will learn a 1×m attention score, which represents the contribution of each clip to the overall abnormality of the video. In this way, the first-time ranking model can better understand the contextual relationship between video clips, thereby improving the accuracy of anomaly detection.

[0034] Optionally, the first time sorting model can be trained and optimized based on a first loss function, and the optimization of the first time sorting model parameters can be achieved by minimizing the first loss function. The first loss function can combine the sparsity constraint term and the time sorting loss to measure the model's ability to distinguish between abnormal and normal videos and avoid the model from over-predicting abnormal events.

[0035] As an example, the first loss function can be determined based on the following formula:

[0036] in represents the first loss function, represents the temporal sorting loss function, which is used to measure the difference between normal video packets and abnormal video packets, including attention mechanism and temporal context information; represents the sparsity constraint term, which is used to ensure that only a few video clip instances in the abnormal video package have high anomaly scores, thereby avoiding the first-time sorting model predicting that most video clip instances are abnormal video clip instances. is a hyperparameter used to control the weight of the sparsity constraint term. Determined based on the following formula:

[0037] in, and Represent abnormal video packets and normal video packets respectively. Represents a video clip instance The attention weight of is used to measure its importance in the video bag, and Respectively represent abnormal video clip instances and normal video clip instance The anomaly score.

[0038] Based on this application, the first time sorting model with attention mechanism can be introduced to score the abnormality score of the video package without labeling the video frame by frame. In addition, the training data set of the first time sorting model only needs to label the video package as normal or abnormal, reducing the dependence on abnormal prior information.

[0039] The method provided in the embodiment of the present application is described in detail above. The device provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0040] See also Figure 2 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 2 The electronic device 200 shown may include: A preprocessing module 210 is used to preprocess the original video data to obtain multiple video packets, each of which includes one or more video clip instances. The video packet is a normal video packet or an abnormal video packet. The normal video packet does not include an abnormal video clip instance, and the abnormal video packet includes at least one abnormal video clip instance. The abnormal video clip instance includes an abnormal event. A calculation module 220, configured to calculate an optical flow map of each video segment instance in the video packet, and obtain a stacked structure of the optical flow map of each video segment instance, wherein the optical flow map includes motion information of the video segment instance in horizontal and vertical directions; A feature extraction module 230, configured to extract features from the optical flow map of each video clip instance based on the first time enhancement network to obtain motion perception features of each video clip instance; A detection module 240, configured to input the motion perception feature of each video clip instance into a first time sorting model to obtain an anomaly score for each video clip instance, wherein the anomaly score is used to indicate the possibility that the video clip instance is anomaly; The first time sorting model may be a time series model that introduces an attention mechanism, and the training data set of the first time sorting model includes video packages that are respectively marked as abnormal and normal; The first time enhancement network may be an autoencoder, and the first time enhancement network may include three encoder layers, one bottleneck layer, and three decoder layers, each layer consisting of a two-dimensional convolutional layer and a linear rectification activation function.

[0041] Optionally, the first time sorting model may be trained and optimized based on a first loss function, the first loss function may combine a sparsity constraint term and a time sorting loss, and the first loss function may be determined based on the following formula:

[0042] in represents the first loss function, represents the temporal sorting loss function, which is used to measure the difference between normal video packets and abnormal video packets, including attention mechanism and temporal context information; represents the sparsity constraint term, which is used to ensure that only a few video clip instances in the abnormal video package have high anomaly scores, thereby avoiding the first-time sorting model predicting that most video clip instances are abnormal video clip instances. is a hyperparameter used to control the weight of the sparsity constraint term. It can be determined based on the following formula:

[0043] in, and Represent abnormal video packets and normal video packets respectively. Represents a video clip instance The attention weight of is used to measure its importance in the video bag, and Respectively represent abnormal video clip instances and normal video clip instance The anomaly score.

[0044] Optionally, the first time enhancement network can be obtained by unsupervised training based on L1 pixel reconstruction loss.

[0045] Optionally, the motion-aware features of the video clip instance may be determined based on a feature vector extracted from the bottleneck layer by a global average pooling operation of the first temporal enhancement network.

[0046] The present application also provides an electronic device. Figure 3 As shown, the electronic device 300 includes: at least one processor 301, a memory 302, and a computer program 303 stored in the memory 302 and executable on the at least one processor 301. When the processor 301 executes the computer program 303, the method provided in the present application is implemented.

[0047] Exemplarily, the computer program 303 may be divided into one or more modules / units, one or more modules / units are stored in the memory 302, and are executed by the processor 301 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 300.

[0048] Those skilled in the art will understand that Figure 3 It is only an example of the electronic device 300 and does not constitute a limitation of the electronic device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 300 may also include input and output devices, network access devices, buses, etc.

[0049] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0050] The memory 302 may be an internal storage unit of the electronic device 300, such as a hard disk or memory of the electronic device 300. The memory 302 may also be an external storage device of the electronic device 300, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 300. Further, the memory 302 may also include both an internal storage unit of the electronic device 300 and an external storage device. The memory 302 is used to store computer programs and other programs and data required by the electronic device 300. The memory 302 may also be used to temporarily store data that has been output or is to be output.

[0051] The electronic device 300 provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0052] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0053] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0054] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, ROM (read-only memory), RAM (random access memory), CD-ROM (compact disc read-only memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, it can be a non-transient storage medium.

[0055] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0056] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0057] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0058] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0059] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0060] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0061] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A video anomaly detection method based on weakly supervised learning, characterized in that: include: Preprocessing the original video data to obtain a plurality of video packets, wherein the video packets include one or more video segment instances, and the video packets are normal video packets or abnormal video packets, wherein the normal video packets do not include abnormal video segment instances, and the abnormal video packets include at least one abnormal video segment instance, and the abnormal video segment instances include abnormal events; Calculating an optical flow map of each of the video clip instances in the video package to obtain a stacking structure of the optical flow maps of each of the video clip instances, wherein the optical flow map includes motion information of the video clip instance in horizontal and vertical directions; Extracting features from the optical flow map of each video clip instance based on the first time enhancement network to obtain motion perception features of each video clip instance, wherein the motion perception features include motion information of the video clip instance; Inputting the motion perception feature of each of the video clip instances into a first time sorting model to obtain an anomaly score for each of the video clip instances, wherein the anomaly score is used to indicate the possibility that the video clip instance is abnormal; The first time sorting model is a time series model that introduces an attention mechanism, and the training data set of the first time sorting model includes video packages marked as abnormal and normal respectively; The first time enhancement network is an autoencoder, and the first time enhancement network includes three encoder layers, one bottleneck layer and three decoder layers, each layer is composed of a two-dimensional convolutional layer and a linear rectification activation function.

2. The method according to claim 1, characterized in that The first time ordering model is trained and optimized based on a first loss function, the first loss function combines a sparsity constraint term and a time ordering loss, and the first loss function is determined based on the following formula: It is stated represents the first loss function, the represents the time sorting loss function, which is used to measure the difference between normal video packets and abnormal video packets, and contains attention mechanism and time context information; represents the sparsity constraint term, which is used to ensure that only a few of the video segment instances in the abnormal video package have high abnormality scores, thereby avoiding the first time sorting model from predicting that most of the video segment instances are abnormal video segment instances, the is a hyperparameter used to control the weight of the sparsity constraint term. Determined based on the following formula: Among them, the and stated Respectively represent the abnormal video packet and the normal video packet, the Represents the video clip instance The attention weight is used to measure its importance in the video package. and stated Respectively represent the abnormal video clip instances and normal video clip instance The anomaly score of 3. The method according to claim 2, characterized in that The first temporal enhancement network is obtained by unsupervised training based on L1 pixel reconstruction loss.

4. The method according to claim 3, characterized in that The motion-aware features of the video clip instance are determined based on a feature vector extracted from a bottleneck layer by a global average pooling operation of the first temporal enhancement network.

5. An electronic device, characterized in that: include: A preprocessing module, configured to preprocess the original video data to obtain a plurality of video packets, wherein the video packets include one or more video segment instances, and the video packets are normal video packets or abnormal video packets, wherein the normal video packets do not include abnormal video segment instances, and the abnormal video packets include at least one abnormal video segment instance, and the abnormal video segment instances include abnormal events; A calculation module, configured to calculate an optical flow map of each of the video clip instances in the video package to obtain a stacking structure of the optical flow maps of each of the video clip instances, wherein the optical flow map includes motion information of the video clip instance in horizontal and vertical directions; A feature extraction module, configured to extract features from the optical flow map of each video clip instance based on the first time enhancement network to obtain motion perception features of each video clip instance; a detection module, configured to input the motion perception feature of each of the video clip instances into a first time sorting model to obtain an anomaly score for each of the video clip instances, wherein the anomaly score is used to indicate the possibility that the video clip instance is abnormal; The first time sorting model is a time series model that introduces an attention mechanism, and the training data set of the first time sorting model includes video packages marked as abnormal and normal respectively; The first time enhancement network is an autoencoder, and the first time enhancement network includes three encoder layers, one bottleneck layer and three decoder layers, each layer is composed of a two-dimensional convolutional layer and a linear rectification activation function.

6. The electronic device according to claim 5, characterized in that: The first time ordering model is trained and optimized based on a first loss function, the first loss function combines a sparsity constraint term and a time ordering loss, and the first loss function is determined based on the following formula: It is stated represents the first loss function, the represents the time sorting loss function, which is used to measure the difference between normal video packets and abnormal video packets, and contains attention mechanism and time context information; represents the sparsity constraint term, which is used to ensure that only a few of the video segment instances in the abnormal video package have high abnormality scores, thereby avoiding the first time sorting model from predicting that most of the video segment instances are abnormal video segment instances, the is a hyperparameter used to control the weight of the sparsity constraint term. Determined based on the following formula: Among them, the and stated Respectively represent the abnormal video packet and the normal video packet, the Represents the video clip instance The attention weight is used to measure its importance in the video package. and stated Respectively represent the abnormal video clip instances and normal video clip instance The anomaly score of 7. The electronic device according to claim 6, characterized in that: The first temporal enhancement network is obtained by unsupervised training based on L1 pixel reconstruction loss.

8. The electronic device according to claim 7, characterized in that: The motion-aware features of the video clip instance are determined based on a feature vector extracted from a bottleneck layer by a global average pooling operation of the first temporal enhancement network.

9. An electronic device comprising a memory, at least one processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • A video anomaly detection system and method based on weak supervised learning

    CN109508671A