Video anomaly detection method and device, electronic equipment and computer program product
Through the parallel dual-branch anomaly detection module of the video anomaly detection model, combined with appearance and motion information, the problem of detection accuracy under the influence of scene environment in the existing technology is solved, and more efficient video anomaly detection is achieved.
Patent Information
- Application Number
- CN202410631532.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-05-21
AI Technical Summary
Existing video anomaly detection methods fail to effectively consider the scene environment, resulting in low accuracy of detection results.
The video anomaly detection model is adopted, including a video analysis module and a parallel dual-branch anomaly detection module. Through the appearance anomaly detection network and the motion anomaly detection network, the foreground video frame image, scene image and optical flow image of the target object are extracted, and future video frame images and Optical flow images are reconstructed and appearance information, motion information and scene information are comprehensively considered to improve detection accuracy.
It improves the accuracy of target object anomaly detection in videos, can more effectively identify appearance anomalies, motion anomalies and scene mismatch anomalies, and improves the accuracy and robustness of detection results.
Smart Images

Figure CN118552874A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a video anomaly detection method, device, electronic device, and computer program product. Background Art
[0002] The video anomaly detection method refers to the use of smart devices deployed in industrial parks, residential communities and other areas to detect abnormal events in surveillance videos, providing strong guarantees for the orderly progress of production and life.
[0003] In the related art, when performing abnormality detection on a target object in a surveillance video, the impact of the scene environment on the detection result is not considered, resulting in low accuracy of the detection result. Summary of the invention
[0004] In view of this, exemplary embodiments of the present disclosure provide a video anomaly detection method, apparatus, electronic device, and computer program product to solve the problems existing in the related art.
[0005] According to a first aspect of the exemplary embodiments of the present disclosure, a method for detecting anomalies in a video is provided, comprising:
[0006] Acquire a video to be tested of the target object, and extract multiple frames of video frame images to be tested from the video to be tested;
[0007] Obtain a pre-built video anomaly detection model, the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network;
[0008] Input multiple frames of video frames to be tested into the video anomaly detection model, extract the foreground video frame image, scene image and optical flow image of the target object from the multiple frames of video frames to be tested through the video parsing module, obtain the future video frame image of the target object based on the foreground video frame image and the scene image through the appearance anomaly detection network, and obtain the reconstructed optical flow image of the target object based on the optical flow image and the scene image through the motion anomaly detection network;
[0009] The detection result of the target object is determined by using the future video frame image and the reconstructed optical flow image.
[0010] According to a second aspect of the exemplary embodiments of the present disclosure, there is provided a video anomaly detection device, comprising:
[0011] An acquisition module is used to acquire the video to be tested of the target object;
[0012] A processing module, used for extracting multiple frames of video frame images to be tested from the video to be tested;
[0013] The acquisition module is also used to acquire a pre-built video anomaly detection model, the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network;
[0014] A prediction module is used to input multiple frames of video frame images to be tested into a video anomaly detection model, extract the foreground video frame image, scene image and optical flow image of the target object from the multiple frames of video frame images to be tested through the video parsing module, obtain the future video frame image of the target object based on the foreground video frame image and the scene image through the appearance anomaly detection network, and obtain the reconstructed optical flow image of the target object based on the optical flow image and the scene image through the motion anomaly detection network;
[0015] The processing module is also used to determine the detection result of the target object by using the future video frame image and the reconstructed optical flow image.
[0016] According to a third aspect of the exemplary embodiments of the present disclosure, there is provided an electronic device, including:
[0017] at least one processor;
[0018] a memory for storing at least one processor executable instruction;
[0019] Wherein, at least one processor is used to execute instructions to implement the steps of the above method.
[0020] According to a fourth aspect of the exemplary embodiments of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program implements the steps of the above-described method when executed by a processor.
[0021] At least one of the above-mentioned technical solutions adopted in the exemplary embodiments of the present disclosure can achieve the following beneficial effects: by obtaining a video to be tested of the target object, and extracting multiple frames of video frame images to be tested from the video to be tested; obtaining a pre-built video anomaly detection model, the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network; inputting multiple frames of video frame images to be tested into the video anomaly detection model, respectively extracting the foreground video frame image, scene image and optical flow image of the target object from the multiple frames of video frame images to be tested through the video parsing module, obtaining the future video frame image of the target object based on the foreground video frame image and the scene image through the appearance anomaly detection network, and obtaining the reconstructed optical flow image of the target object based on the optical flow image and the scene image through the motion anomaly detection network; using the future video frame image and the reconstructed optical flow image to determine the detection result of the target object, it is possible to comprehensively consider the appearance information, motion information and scene information of the target object when performing abnormality detection on the target object in the video to be tested, thereby improving the accuracy of the detection result. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the exemplary embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 A schematic diagram showing a network architecture of a video anomaly detection model provided by an exemplary embodiment of the present disclosure;
[0024] Figure 2A The schematic diagram of the structure of the traditional U-Net network in the related art is shown;
[0025] Figure 2B A schematic diagram of the structure of a multi-layer residual U-Net network provided by an exemplary embodiment of the present disclosure is shown;
[0026] Figure 3 A schematic structural diagram of a first memory storage unit provided by an exemplary embodiment of the present disclosure is shown;
[0027] Figure 4 A schematic diagram showing the detection results of the video anomaly detection model provided by an exemplary embodiment of the present disclosure in the test phase;
[0028] Figure 5 A schematic diagram of a process of a video anomaly detection method provided by an exemplary embodiment of the present disclosure is shown;
[0029] Figure 6 A schematic diagram of the structure of a video anomaly detection device provided by an exemplary embodiment of the present disclosure is shown;
[0030] Figure 7 A schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present disclosure is shown;
[0031] Figure 8 A schematic diagram of the structure of a computer system provided by an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0032] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0033] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0034] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0035] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0036] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0037] Artificial intelligence is a technology that enables computers and machine languages to demonstrate intelligence and human-like thinking abilities. It includes learning and reasoning, speech recognition, autonomous driving, and target detection. With the continuous development and innovation of technology, artificial intelligence is increasingly integrated into the national economy, injecting new growth momentum into all walks of life. At a time when unstructured data such as images, voice, and video are growing rapidly, computer vision has gradually become one of the hottest areas of artificial intelligence, focusing on creating algorithmic models that can process, analyze, and understand visual data (images or videos) in the same way as humans.
[0038] Video anomaly detection refers to the ability of an algorithm model to analyze and understand abnormal events in massive image or video data samples, and output quantitative indicators that are easy for people to understand. In a sense, a high-performance video anomaly detection algorithm can ensure the safety and normal operation of production and life to the greatest extent, and effectively improve people's work efficiency and happiness in life. However, how to meet the operation of such a large-scale algorithm has posed unprecedented challenges to the scale, performance, reliability and stability of the network.
[0039] Video anomaly detection algorithms are intelligent devices deployed in industrial parks, residential areas and other areas to accurately detect abnormal events in surveillance videos, providing a strong guarantee for the orderly production and life. Deploying video anomaly detection algorithms to edge intelligent computing nodes, with the powerful intelligent computing power of intelligent computing servers, can more quickly detect behaviors that do not comply with regulations in industrial parks, residential areas and other areas, and issue warning information in a timely and effective manner to avoid unsafe accidents.
[0040] In related technologies, abnormal events in videos can be detected from global and local perspectives, focusing on targets in areas where abnormalities may occur, effectively alleviating the differences caused by the field of view; or abnormal frames in the video can be determined first, and then abnormal events in the abnormal frames can be detected. However, these video anomaly detection methods do not consider the impact of the scene environment on the detection results, resulting in low accuracy of the detection results.
[0041] Therefore, in order to solve the above problems, an exemplary embodiment of the present disclosure provides a video anomaly detection method, which detects abnormal events in a video through a pre-built video anomaly detection model. The video anomaly detection model can analyze the appearance characteristics and behavioral characteristics of the target object in combination with the scene environment in the video, so as to determine whether the behavior of the target object is abnormal, thereby improving the accuracy of the detection results.
[0042] The video anomaly detection method provided by the exemplary embodiments of the present disclosure may be executed by a terminal or by a chip applied to the terminal.
[0043] Exemplarily, the above-mentioned terminal may include one or more of a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), and a wearable device based on augmented reality (AR) and / or virtual reality (VR) technology, etc., and the exemplary embodiments of the present disclosure do not impose specific limitations on this.
[0044] With the continuous development of artificial intelligence technology, deep learning methods have gradually replaced traditional machine learning and become the mainstream method in the field of video anomaly detection. Relying on the powerful neural network constructed, deep learning algorithms can understand massive and complex video data samples and make correct decisions. Depending on whether data labels are required during the training process, deep learning methods can be divided into supervised video anomaly detection methods, semi-supervised video anomaly detection methods, and unsupervised video anomaly detection methods. Since abnormal data samples have the characteristics of low frequency of occurrence, small amount of data, many types and difficult to collect, the exemplary embodiment of the present disclosure adopts a semi-supervised anomaly detection method that only uses normal data samples during the training process.
[0045] Based on different theoretical premises, video anomaly detection methods are divided into reconstruction-based methods, prediction-based methods and hybrid model-based methods. The reconstruction-based method can learn the inherent laws of the input data (here is the normal data sample) and ultimately output an output result that is as similar as possible to the input data in the same time period. However, the reconstruction-based method may also reconstruct the abnormal data samples very well, resulting in a high false alarm rate of the detection results. The prediction-based method can learn normal data samples in continuous time and ultimately output the predicted data for the next moment. The hybrid method integrates the above two methods into the same algorithm. Although the number of parameters and the amount of calculation of the algorithm have been improved to a certain extent, its robustness and accuracy have been greatly improved. Therefore, based on the above analysis, the exemplary embodiment of the present disclosure uses a semi-supervised video anomaly detection method based on a hybrid model.
[0046] Figure 1 FIG. 1 is a schematic diagram showing a network architecture of a video anomaly detection model provided by an exemplary embodiment of the present disclosure. Figure 1 As shown, the network architecture of the video anomaly detection model 100 may include a video parsing module 110 and a parallel dual-branch anomaly detection module 120. The video parsing module 110 may include a target detection network 111, a scene extraction network 112, and an optical flow estimation network 113; the parallel dual-branch anomaly detection module 120 may include an appearance anomaly detection network 121 and a motion anomaly detection network 122, the appearance anomaly detection network 121 may include an appearance and scene perception encoder 1211, a first memory storage unit 1212, a first scene conditional variational autoencoder 1213, and an appearance and scene perception decoder 1214, and the motion anomaly detection network 122 includes a motion and scene perception encoder 1221, a second memory storage unit 1222, a second scene conditional variational autoencoder 1223, and a motion and scene perception decoder 1224.
[0047] Among them, the exemplary embodiment of the present disclosure can merge the appearance and scene perception encoder 1211 and the appearance and scene perception decoder 1214 together, which is called the appearance and scene perception autoencoder, and merge the motion and scene perception encoder 1221 and the motion and scene perception decoder 1224 together, which is called the motion and scene perception autoencoder.
[0048] It should be noted that the appearance and scene perception encoder 1211 and the motion and scene perception encoder 1221 have the same structure, the first memory storage unit 1212 and the second memory storage unit 1222 have the same structure, the first scene conditional variational autoencoder 1213 and the second scene conditional variational autoencoder 1223 have the same structure, and the appearance and scene perception decoder 1214 and the motion and scene perception decoder 1224 have the same structure. In other words, the appearance anomaly detection network 121 and the motion anomaly detection network 122 have the same structure, which can ensure the consistency of the overall structure of the parallel dual-branch anomaly detection module.
[0049] In practical applications, the exemplary embodiments of the present disclosure can input multiple frames of original video frame images in a preset time period (such as from time 1 to time t) into the video parsing module 110. Among them, the target detection network 111 can be used to extract the appearance information of the target object in the multiple frames of original video frame images to obtain the foreground video frame images; the scene extraction network 112 can be used to extract the scene image operation on the multiple frames of original video frame images to obtain the scene image; the optical flow estimation network 113 can be used to extract the motion information of the target object in the multiple frames of original video frame images to obtain the optical flow image.
[0050] (1) Target detection network.
[0051] Since the vast majority of abnormal events in surveillance videos mainly come from moving subjects, that is, target objects in the foreground, the series of actions involved largely determine whether there are abnormal events in the original video frame image, and this abnormal event comes from the abnormal appearance of the target object. Therefore, compared with the practice of directly inputting the original video frame image to the neural network model in the related art, the exemplary embodiment of the present disclosure can use the target detection network 111 to extract the foreground video frame image in the original video frame image, and directly focus on the target object in the foreground video frame image, so that the input data of the subsequent appearance abnormality detection network 121 is more in line with the video abnormality detection task.
[0052] The target detection network 111 of the exemplary embodiment of the present disclosure can use a multi-target tracking algorithm (Byte Track algorithm) implemented by a target tracking tool (such as MMTracking) based on the Pytorch framework. The biggest difference between the Byte Track algorithm and other tracking algorithms is that the Byte Track algorithm does not simply remove the low-score detection results, but uses the similarity between the detection frame and the tracking trajectory to remove the background from the low-score detection results while retaining the high-score detection results, and dig out the real objects (including difficult samples such as occlusion and blur), thereby reducing missed detections and improving the coherence of the target object's motion trajectory.
[0053] (2) Targeting the scene extraction network.
[0054] In addition to the abnormality of the moving subject itself, the incompatibility between the target object and the scene of the video is another reason for abnormal events in the surveillance video. This abnormal event comes from the incompatibility of the scene of the target object. The so-called incompatibility refers to the behavior of the target object in an inappropriate scene that does not meet people's expectations, such as students running fast in the classroom, pedestrians walking on the motor vehicle lane, etc. Since this type of abnormal event has a great relationship with the scene, it means that the behavior of the target object is normal in one scene and abnormal in another scene. Therefore, it is difficult to accurately detect such abnormal events caused by the incompatibility between the target object and the scene. In view of the characteristics of this type of abnormal event, the exemplary embodiment of the present disclosure uses the scene extraction network 112 to extract the scene of the surveillance video for subsequent guidance of the generation of future video frame images and reconstructed optical flow images.
[0055] The image semantic segmentation model (DeeplabV3+ model) that can be used by the scene extraction network 112 of the exemplary embodiment of the present disclosure. The Deeplab V3+ model mainly includes three parts, namely: a backbone deep convolutional neural network for extracting image features, a dilated spatial convolutional pooling pyramid network, and a scene extraction decoder. Among them, the dilated spatial convolutional pooling pyramid network may include a convolution layer with a convolution kernel size of 1×1, three dilated convolution layers with a convolution kernel size of 3×3 with different numerical dilation coefficients, and a global pooling layer, which are used to process the output of the backbone deep convolutional neural network; then, the scene extraction decoder connects the output results of the dilated spatial convolutional pooling pyramid network according to the image channel level, and connects and convolves the output results of the dilated spatial convolutional pooling pyramid network through the scene extraction decoder network (such as using a convolution operation with a convolution kernel size of 1×1 to reduce the number of channels of the feature vector), and finally forms a scene image of the original video frame image.
[0056] (3) For optical flow estimation network.
[0057] In addition to the abnormal appearance of the target object and the abnormal scene mismatch of the target object, the abnormal motion is also an abnormal event of the monitoring video and may also come from the abnormal motion of the target object, such as the wrong driving direction of a motor vehicle, etc. The optical flow estimation network of the exemplary embodiment of the present disclosure can use an enhanced optical flow prediction algorithm (FlowNet2.0) to extract the optical flow information of the original video frame image by stacking multiple networks to obtain an optical flow image for subsequent generation of a reconstructed optical flow image.
[0058] At this time, the foreground video frame image, scene image and optical flow image processed by the video analysis module 110 can be input into the parallel dual-branch anomaly detection module 120 to obtain the future video frame image at the t+1th moment and the reconstructed optical flow image from the 1st moment to the tth moment; wherein, the future video frame image is generated by the appearance anomaly detection network 121 based on the foreground video frame image and the scene image, and the reconstructed optical flow image is generated by the motion anomaly detection network 122 based on the optical flow image and the scene image.
[0059] Specifically, for the appearance anomaly detection network 121, the foreground video frame image is input into the appearance anomaly detection network 121, and the appearance and scene perception encoder 1211 is used to perform feature encoding on the foreground video frame image, learn the appearance features of the target object in the foreground video frame image, obtain the appearance feature vector of the target object, and input the appearance feature vector of the target object into the first memory storage unit 1212. The first memory storage unit 1212 is used to retrieve the memory memory through the memory addressing vector, use multiple memory items for linear combination, obtain the appearance query feature vector corresponding to the appearance feature vector, and input the appearance query feature vector into the first scene conditional variational autoencoder 1213. The first scene conditional variational autoencoder 1213 is used to perform feature splicing operations and feature extraction operations on the appearance query feature vector and the scene image, obtain the target appearance and scene splicing feature vector of the fused scene image, and input the target appearance and scene splicing feature vector into the appearance and scene perception decoder 1214. The appearance and scene perception decoder 1214 is used to perform a decompression operation on the target appearance and scene splicing feature vector to obtain the future video frame image.
[0060] (1) For appearance and scene perception encoders.
[0061] Figure 2A The schematic diagram of the structure of the traditional U-Net network in the related art is shown. Figure 2B FIG. 4 shows a schematic diagram of the structure of a multi-layer residual U-Net network provided by an exemplary embodiment of the present disclosure. Figure 2AThe figure shows the structure of the traditional U-Net network in the related art. The characteristic of the traditional U-Net network is that multiple jump connections are set between the high-level network and the low-level network to reduce the information loss problem caused by the convolution operation. The U-Net network is a classic full convolution network with a contraction phase and an expansion phase. The left side of the network is a downsampling operation composed of convolution and pooling, the purpose of which is to reduce the size dimension of the input data and compress the feature representation of the input data; the right side of the network is an upsampling operation composed of deconvolution, the purpose of which is to decompress the compressed feature representation and restore the previous size dimension of the feature vector. From Figure 2A It can be seen that the traditional U-Net network uses multiple 3×3 convolution kernels of the same small size. As the network depth increases, its nonlinear expression ability is also enhanced. In addition, the small size of the convolution kernel also reduces the number of parameters involved in the operation, further improving the computational efficiency of the model.
[0062] As mentioned above, the deeper the network, the stronger its nonlinear expression ability, but the gradient value of each network layer becomes smaller and smaller or even disappears, which eventually causes the network update to become very slow or even stagnant. Based on this, the exemplary embodiment of the present disclosure can transform the traditional U-Net network and propose a new multi-layer residual U-Net network for video anomaly detection.
[0063] like Figure 2B As shown in the figure, for a normal neural network, if the input data is x, then the output data can be expressed as F(x), where F(·) represents the fitting function of the neural network. In the multi-layer residual U-Net network, in addition to F(x), the output also adds the original input data, that is, the residual block is a module of the neural network, and its output is F(x)+x.
[0064] like Figure 2A As shown in the figure, in each convolution layer of the traditional U-Net network, the size of the convolution kernel is 3×3, and then the Relu activation function is used for activation. Figure 2B In the multi-layer residual U-Net network shown in the figure, each residual block can include multiple convolutional layers with different convolutional kernel sizes, such as a convolutional layer with a convolutional kernel size of 1×1, a convolutional layer with a convolutional kernel size of 3×3, and a convolutional layer with a convolutional kernel size of 1×1, for a total of three convolutional layers. In the new multi-layer residual U-Net network, before and after the 3×3 convolution operation, a 1×1 convolutional kernel is used to perform feature dimensionality reduction and dimensionality increase operations respectively. By introducing the residual block, the detection accuracy can be maintained while reducing the amount of computation of the model while ensuring that the output feature size remains unchanged.
[0065] It can be seen that the exemplary embodiment of the present disclosure can replace the convolution operation performed by the traditional U-Net network using multiple convolution kernels of the same size with a residual convolution operation performed using multiple convolution kernels of different sizes, further improving the computational efficiency and accuracy of the model.
[0066] It should be noted that, in the appearance and scene perception encoder, its input data is the foreground video frame image, and its output data is the appearance feature vector of the target object.
[0067] (2) For the first memory storage unit.
[0068] Since abnormal data samples have the characteristics of low occurrence rate, being difficult to collect, numerous categories and small number, the method of the exemplary embodiment of the present invention is an anomaly detection method based on a semi-supervised hybrid model. During the training phase, only normal data samples are used as training samples, which prompts the model to learn the inherent regularity of video events and enable it to have the ability to distinguish between normal events and abnormal events.
[0069] Since the multi-layer residual U-Net network has a strong generalization ability, the abnormal data samples may be well reconstructed by the multi-layer residual U-Net network during the test phase, resulting in a small loss error, making it difficult for the model to distinguish between normal events and abnormal events, and greatly increasing the false alarm rate of the video anomaly detection results. Therefore, the exemplary embodiment of the present disclosure sets a first memory storage unit 1212 in the appearance anomaly detection network 121, which effectively reduces the loss error of normal data samples and increases the loss error of abnormal data samples, which is conducive to the model to better detect abnormal events in the video.
[0070] Figure 3 FIG. 2 shows a schematic diagram of the structure of a first memory storage unit provided by an exemplary embodiment of the present disclosure. Figure 3 As shown, the first memory storage unit mainly includes two parts, namely, the first memory addressing vector and the first memory memory. The first memory addressing vector is obtained by calculating the Softmax similarity (cosine similarity) between the input data (also referred to as the input feature vector here) and the first memory storage items in the first memory memory. Here, the input feature vector f IN It can be the appearance feature vector of the target object mentioned above. The calculation process of the first memory addressing vector can be expressed as:
[0071]
[0072] Among them, r i represents the i-th first memory addressing vector, whose element values sum to 1; f IN represents the input feature vector; m i represents the first memory storage item in the memory; d(f IN ,mi ) represents the cosine similarity between the input feature vector and the i-th first memory storage item in the first memory; N represents the total number of first memory storage items in the first memory.
[0073]
[0074] Among them, ||·|| represents the length of the module, that is, the vector.
[0075] like Figure 3 As shown, the first memory is a real-valued matrix that takes the input eigenvector f IN The first memory storage unit can independently select the most typical first memory storage item in the memory (the memory storage item corresponding to the maximum cosine similarity) to input the feature vector f IN Re-represent the target object and obtain the appearance query feature vector f OUT Among them, for the input feature vector f IN The process of re-expression can be expressed as:
[0076]
[0077] Among them, f OUT represents the appearance query feature vector of the target object; r represents the first memory addressing vector; M represents the first memory memory; other parameters can be found in the previous text and will not be repeated here.
[0078] According to the input feature vector f IN , the first memory storage unit can obtain multiple first memory addressing vectors through the above formula (1), further search the first memory storage unit, and linearly combine the multiple first memory addressing vectors in the first memory storage unit with the corresponding multiple first memory items, and finally obtain the appearance query feature vector of the target object through the above formula (3). Then, the appearance query feature vector of the target object is input into the first scene conditional variational autoencoder to perform the next step.
[0079] Based on this, the exemplary embodiment of the present disclosure sets a first memory storage unit between the appearance and scene perception encoder and the appearance and scene perception decoder, which can effectively increase the loss error of abnormal data samples and reduce the loss error of normal data samples, thereby widening the loss difference between the two types of data, which is conducive to the model to accurately detect anomalies. In addition, in order to better improve the learning performance of the first memory storage unit for abnormal data samples, the exemplary embodiment of the present disclosure applies cross entropy loss to it and updates its parameters through back propagation.
[0080] It should be noted that, in the first memory storage unit, its input data is the appearance feature vector of the target object, and its output data is the appearance query feature vector of the target object.
[0081] (3) Conditional variational autoencoder for the first scenario.
[0082] Deep learning models can be mainly divided into discriminative models and generative models. In recent years, with the popularity of generative tasks represented by image generation and dialogue response generation, generative models have received more and more attention. In the method of the exemplary embodiment of the present disclosure, the generative model used by the appearance anomaly detection network is a first scene conditional variational autoencoder, which is essentially a generative model with a deep latent space.
[0083] The first scene conditional variational autoencoder may include a first encoder, a first latent space sampling layer and a first decoder, wherein the appearance query feature vector of the target object and the scene image are spliced to obtain a first appearance and scene splicing feature vector; the first encoder can be used to perform feature extraction and compression operations on the first appearance and scene splicing feature vector to obtain an appearance compression feature vector; the first latent space sampling layer is a representation of compressed data, and its function is to learn data features and simplify data representation in order to find a certain pattern, and it can be used to extract an appearance and scene latent space feature vector from the appearance compression feature vector; the appearance and scene latent space feature vector and the scene image are spliced to obtain a second appearance and scene splicing feature vector; the first decoder is used to perform a decompression operation on the second appearance and scene splicing feature vector to obtain a target appearance and scene splicing feature vector of the target object, and the target appearance and scene splicing feature vector may be a data sample similar to the appearance query feature vector of the target object.
[0084] The first scene conditional variational autoencoder not only inputs label data in the encoding stage, but also inputs a vector representing the label data in the decoding stage. Based on this, the exemplary embodiment of the present disclosure can use the scene image as a guiding condition to flexibly control the generation process of future video frame images by setting the first scene conditional variational autoencoder, so that the generation results of future video frame images are diverse and controllable, and a full range of appearance anomalies and scene mismatch anomalies can be detected.
[0085] It should be noted that, in the first scene conditional variational autoencoder, its input data is the appearance query feature vector of the target object, and its output data is the target appearance and scene splicing feature vector of the target object.
[0086] (4) For appearance and scene-aware decoders.
[0087] In the appearance and scene perception decoder, the input data is the target appearance and scene splicing feature vector of the target object. The appearance and scene perception decoder is used to perform a decompression operation on the target appearance and scene splicing feature vector of the target object to obtain the final future video frame image.
[0088] For the motion anomaly detection network 122, the optical flow image can be input into the motion anomaly detection network 122, and the motion and scene perception encoder 1221 is used to perform feature encoding on the optical flow image, learn the motion features of the target object in the optical flow image, obtain the motion feature vector of the target object, and input the motion feature vector of the target object into the second memory storage unit 1222. The second memory storage unit 1222 is used to retrieve the memory memory through the memory addressing vector, use multiple memory items for linear combination, obtain the motion query feature vector corresponding to the motion feature vector, and input the motion query feature vector into the second scene conditional variational autoencoder 1223. The second scene conditional variational autoencoder 1223 is used to perform feature splicing operations and feature extraction operations on the motion query feature vector and the scene image, obtain the target motion and scene splicing feature vector of the fused scene image, and input the target motion and scene splicing feature vector into the motion and scene perception decoder 1224. The motion and scene perception decoder 1224 is used to perform a decompression operation on the target motion and scene splicing feature vector to obtain a reconstructed optical flow image.
[0089] As can be seen from the foregoing, the appearance anomaly detection network 121 and the motion anomaly detection network 122 have the same structure. The structure and function of each module included in the motion anomaly detection network 122 can be specifically referred to in the foregoing. Here, only the differences between the two in the textual description are briefly explained.
[0090] (1) For motion and scene perception encoders.
[0091] The motion and scene perception encoder can be the multi-layer residual U-Net network mentioned above, which will not be described here. The input data of the motion and scene perception encoder is the optical flow image, and the output data is the motion feature vector of the target object.
[0092] (2) Regarding the second memory storage unit.
[0093] The structure of the second memory storage unit is the same as that of the first memory storage unit in the previous text, and will not be repeated here. The input feature vector of the second memory storage unit can be the motion feature vector of the target object in the previous text, and the output data is the motion query feature vector of the target object. Referring to the structure of the first memory storage unit, the second memory storage unit mainly includes two parts, namely the second memory addressing vector and the second memory memory. The calculation formula involved in the second memory storage unit refers to the relevant technical formula of the first memory storage unit, and will not be repeated here.
[0094] The exemplary embodiment of the present disclosure sets a second memory storage unit between the motion and scene perception encoder and the motion and scene perception decoder, which can effectively increase the loss error of abnormal data samples and reduce the loss error of normal data samples, thereby widening the loss difference between the two types of data, which is conducive to the model to accurately detect anomalies. In addition, in order to better improve the learning performance of the second memory storage unit for abnormal data samples, the exemplary embodiment of the present disclosure applies a cross entropy loss to it and updates its parameters through back propagation.
[0095] (3) Conditional variational autoencoder for the second scenario.
[0096] The structure of the second scene conditional variational autoencoder is the same as the structure of the first scene conditional variational autoencoder in the previous text. The second scene conditional variational autoencoder may include a second encoder, a second latent space sampling layer, and a second decoder; wherein the motion query feature vector of the target object and the scene image are spliced to obtain a first motion and scene splicing feature vector; the second encoder may be used to perform feature extraction and compression operations on the first motion and scene splicing feature vector to obtain a motion compression feature vector; the second latent space sampling layer is a representation of compressed data, and its function is to learn data features and simplify data representation in order to find a certain pattern, which may be used to extract motion and scene latent space feature vectors from motion compression feature vectors; the motion and scene latent space feature vectors and the scene image are spliced to obtain a second motion and scene splicing feature vector; the second decoder is used to perform a decompression operation on the second motion and scene splicing feature vector to obtain a target motion and scene splicing feature vector of the target object, and the target motion and scene splicing feature vector may be a data sample similar to the motion query feature vector of the target object.
[0097] The second scene conditional variational autoencoder not only inputs label data in the encoding stage, but also inputs a vector representing the label data in the decoding stage. Based on this, the exemplary embodiment of the present disclosure can use the scene image as a guiding condition to flexibly control the generation process of the reconstructed optical flow image by setting the second scene conditional variational autoencoder, so that the generation result of the reconstructed optical flow image has diversity and controllability, and realizes the full range detection of motion anomalies and scene mismatch anomalies.
[0098] It should be noted that, in the second scene conditional variational autoencoder, its input data is the motion query feature vector of the target object, and its output data is the target motion and scene splicing feature vector of the target object.
[0099] (4) For motion and scene perception decoders.
[0100] In the motion and scene perception decoder, the input data is the target motion and scene splicing feature vector of the target object. The motion and scene perception decoder is used to decompress the target motion and scene splicing feature vector of the target object to obtain the final reconstructed optical flow image.
[0101] Based on this, the exemplary embodiment of the present disclosure can set two first scene conditional variational autoencoders and second scene conditional variational autoencoders with the same structure in a parallel dual-branch anomaly detection module, and use the scene image as a guiding condition to guide the generation of future video frame images and reconstructed optical flow images respectively.
[0102] In practical applications, during the training process of the video anomaly detection model, the exemplary embodiments of the present disclosure can determine whether the video anomaly detection model has converged by calculating the loss of the video anomaly detection model to be constructed.
[0103] The input data of the video anomaly detection model of the exemplary embodiment of the present disclosure is multiple frames of original video frame images from time 1 to time t, and the final output data is the future video frame image at time t+1 and the reconstructed optical flow image from time 1 to time t. Based on this, the loss of the video anomaly detection model in the exemplary embodiment of the present disclosure may include prediction loss and reconstruction loss, and the video anomaly detection model is constrained by using the L2 distance (i.e., mean square error) between the input data and the output data, which is defined as follows:
[0104]
[0105]
[0106] Among them, L pred represents the prediction loss; x t+1 Represents the real future video frame image at time t+1; represents the predicted future video frame image at time t+1; L recon represents the reconstruction loss; y 1:t Represents the real reconstructed optical flow image from the 1st moment to the tth moment; Represents the predicted reconstructed optical flow image from time 1 to time t; the subscript 2 represents the L2 distance; the superscript 2 represents the square.
[0107] Since the first memory storage unit and the second memory storage unit are set in the parallel dual-branch anomaly detection module of the video anomaly detection model of the exemplary embodiment of the present disclosure, the memory items in the memory are retrieved by the memory addressing vector to realize the recombination of the feature vector, and finally the difference in the loss function between normal data and abnormal data is increased. The quality of the memory addressing vector directly determines the quality of the feature vector finally output by the memory storage unit. Therefore, in order to better obtain the sparse memory addressing vector, the exemplary embodiment of the present disclosure imposes a cross entropy loss constraint on the first memory storage unit and the second memory storage unit, which is referred to as memory loss (including the first memory loss of the first memory storage unit and the second memory loss of the second memory storage unit). The memory loss in the exemplary embodiment of the present disclosure can be calculated by the following formula:
[0108] L memory =λ 1memory ·L 1memory +λ 2memory ·L 2memory (7)
[0109]
[0110]
[0111] Among them, L memory Indicates memory loss, r j represents the jth second memory addressing vector, whose element values sum to 1, N' represents the total number of second memory storage items in the second memory, L 1memory represents the first memory loss of the first memory storage unit, L 2memory represents the second memory loss of the second memory storage unit, λ 1memory represents the weight of the first memory loss of the first memory storage unit, λ 2memory Represents the weight of the second memory loss of the second memory storage unit. For other parameters, see the previous text and will not be repeated here.
[0112] Here, the cross entropy loss describes the distance relationship between the true value and the output value, that is, the similarity between the probability distributions of the two. In other words, the more similar the two probability distributions are, the smaller the cross entropy value will be.
[0113] In addition, in order to avoid the loss of scene feature information in the video during the generation of future video frame images and reconstructed optical flow images, a first scene conditional variational autoencoder and a second scene conditional variational autoencoder are set in the parallel dual-branch anomaly detection module of the video anomaly detection model of the exemplary embodiment of the present disclosure. And, as can be seen from the foregoing, when performing deep feature information extraction, the first scene conditional variational autoencoder and the second scene conditional variational autoencoder both include two splicing processes of the scene image, so that the first scene conditional variational autoencoder can be used to obtain the target appearance and scene splicing feature vector of the fused scene image, and the second scene conditional variational autoencoder can be used to obtain the target motion and scene splicing feature vector of the fused scene image, thereby avoiding the loss of scene feature information during the deep feature information extraction process and improving the accuracy of video anomaly detection.
[0114] Based on this, the loss of the video anomaly detection model in the exemplary embodiment of the present disclosure also includes a splicing loss, which may include the appearance and scene splicing loss of the first scene conditional variational autoencoder and the motion and scene splicing loss of the second scene conditional variational autoencoder. The calculation method of the appearance and scene splicing loss and the motion and scene splicing loss is the same, and the calculation of the appearance and scene splicing loss is taken as an example for explanation below.
[0115] Since the time interval between the multiple frames of original video frames from time 1 to time t and the future video frame images at time t+1 in the complete video clip is very short, and the two are very similar in content, the exemplary embodiment of the present disclosure considers that the two are determined by the same latent space vector. Therefore, the exemplary embodiment of the present disclosure can represent the first scene conditional variational autoencoder as p(x t+1 |x 1:t ,s 1:t ), where x 1:t Represents multiple frames of original video frame images from time 1 to time t, s 1:t represents the scene image, x t+1 The future video frame image at time t+1 is also applicable to the generation of reconstructed optical flow images.
[0116] Given the video frame image x from time 1 to time t 1:t Under the condition of , the appearance query feature vector of the original video frame image is obtained through the first memory storage unit, from which the prior distribution p(z|x 1:t ). Then, the video frame images x from time 1 to time t are 1:t and scene image s 1:t The concatenation is performed and input into the first scene conditional variational autoencoder to output a new feature representation, thereby obtaining the posterior distribution q(z|x 1:t ,s 1:t). Next, z is sampled from the posterior distribution and concatenated with the condition, i.e., the appearance query feature vector, and finally input into the appearance and scene-aware decoder to generate the future video frame image x t+1 The above process is for the optical flow image y 1:t The same applies.
[0117] Assume that p(z|x 1:t ), q(z|x 1:t ,s 1:t ) and p(x t+1 |x 1:t ,s 1:t ) all conform to the Gaussian distribution. The appearance and scene splicing loss of the first scene conditional variational autoencoder can be calculated by the following formula:
[0118] L 1SC-VAE =KL[q(z|x 1:t ,s 1:t )||p(z|x 1:t )] (10)
[0119] Among them, L 1SC-VAE represents the appearance and scene splicing loss, KL represents the divergence, q(z|x 1:t ,s 1:t ) represents the posterior distribution, p(z|x 1:t ) represents the prior distribution. Similarly, the motion and scene splicing loss L of the second scene conditional variational autoencoder can be calculated 2SC-VAE .
[0120] At this point, the splicing loss of the video anomaly detection model can be calculated by the following formula:
[0121] L SC-VAE =λ 1SC-VAE ·L 1SC-VAE +λ 2SC-VAE ·L 2SC-VAE (11)
[0122] Among them, L SC-VAE represents the splicing loss, L 1memory represents the appearance and scene stitching loss, L 2SC-VAE represents the motion and scene stitching loss, λ 1SC-VAE represents the weight of appearance and scene splicing loss, λ 2SC-VAE Represents the weight of motion and scene stitching loss.
[0123] Based on this, the total loss of the video anomaly detection model provided by the exemplary embodiment of the present disclosure can be calculated by the following formula:
[0124] L=λ pred ·Lpred +λ recon ·L recon +λ memory ·L memory +λ SC-VAE ·L SC-VAE (12)
[0125] Where L represents the total loss of the video anomaly detection model, λ pred represents the weight of the prediction loss, λ recon represents the weight of the reconstruction loss, λ memory represents the weight of memory loss, λ SC-VAE Represents the weight of the splicing loss. For other parameters, please refer to the previous article and will not be repeated here.
[0126] In the inference stage, the target object of the video to be tested is detected for abnormality through the video anomaly detection model, and the output data of the video anomaly detection model are: the future video frame image at the t+1th moment representing the appearance features of the target object and the reconstructed optical flow image from the 1st moment to the tth moment representing the motion information of the target object. Based on this, the exemplary embodiment of the present disclosure can calculate the abnormality score of the target object through the abnormality scores of the future video frame image and the reconstructed optical flow image, and determine whether the video to be tested is abnormal.
[0127] Exemplarily, the anomaly score of the target object can be calculated by the following formula:
[0128] S=w fram-pred ·S fram-pred +w fram-recon ·S fram-recon (13)
[0129]
[0130]
[0131] Among them, S represents the abnormal score of the target object, S fram-pred represents the appearance anomaly score of the future video frame image, S fram-recon represents the motion anomaly score of the reconstructed optical flow image, w fram-pred Represents the fusion weight coefficient of the appearance anomaly score, wf ram-recon Indicates the fusion weight coefficient of the motion abnormality score. For other parameters, please refer to the previous text and will not be repeated here.
[0132] Figure 4 FIG. 1 is a schematic diagram showing the detection results of the video anomaly detection model provided by the exemplary embodiment of the present disclosure during the test phase. Figure 4As shown in the figure, the video anomaly detection model is tested using the test data set. It can be seen that when a bicycle breaks into the pedestrian area in the video, the anomaly score of the bicycle will increase accordingly, forming a huge gap with the anomaly score generated by the normal data sample. The gray shaded part in the figure can be the real anomaly label of the test data set. Finally, the accuracy of the video anomaly detection method proposed by the exemplary embodiment of the present disclosure in the field of video anomaly detection is proved.
[0133] In the video anomaly detection model proposed in the exemplary embodiment of the present disclosure, the appearance anomaly detection network is essentially a prediction network, and the motion anomaly detection network is essentially a reconstruction network. The appearance anomaly detection network and the motion anomaly detection network are integrated to form a parallel dual-branch anomaly detection module with a hybrid structure. The parallel dual-branch anomaly detection module is used to establish the connection between the foreground video frame image, the optical flow image and the scene image, learn multi-modal feature information, and realize the comprehensive detection of abnormal human behavior in video surveillance. Through the uniquely set network model, the accuracy and robustness of anomaly detection are further improved.
[0134] Based on this, the exemplary embodiment of the present disclosure provides a video anomaly detection method, which can be executed by a terminal or by a chip applied to the terminal. The terminal here can be referred to above and will not be described in detail here.
[0135] Figure 5 FIG. 2 shows a flow chart of a video anomaly detection method provided by an exemplary embodiment of the present disclosure. Figure 5 As shown, the video anomaly detection method includes:
[0136] S501, obtaining a video to be tested of a target object, and extracting a plurality of video frame images to be tested from the video to be tested;
[0137] S502, obtaining a pre-built video anomaly detection model, the video anomaly detection model comprising a video parsing module and a parallel dual-branch anomaly detection module, the parallel dual-branch anomaly detection module comprising an appearance anomaly detection network and a motion anomaly detection network;
[0138] S503, inputting multiple frames of video frame images to be tested into the video anomaly detection model, respectively extracting the foreground video frame image, scene image and optical flow image of the target object from the multiple frames of video frame images to be tested through the video parsing module, obtaining the future video frame image of the target object based on the foreground video frame image and the scene image through the appearance anomaly detection network, and obtaining the reconstructed optical flow image of the target object based on the optical flow image and the scene image through the motion anomaly detection network;
[0139] S504: Determine the detection result of the target object by using the future video frame image and the reconstructed optical flow image.
[0140] Specifically, the video to be tested may include a target object. The exemplary embodiment of the present disclosure may first extract multiple frames of video to be tested from the video to be tested, and then perform abnormality detection on the target object using the multiple frames of video to be tested.
[0141] As can be seen from the foregoing, the abnormality of the target object may include appearance abnormality, motion abnormality and scene mismatch abnormality, and the scene mismatch abnormality may include appearance and scene mismatch abnormality and motion and scene mismatch abnormality. When performing abnormality detection on the target object in the video to be tested, the related art only detects appearance abnormality and motion abnormality, and does not consider the case of scene mismatch abnormality. Based on this, the exemplary embodiment of the present disclosure pre-constructs a video anomaly detection model, which may include a video parsing module and a parallel dual-branch anomaly detection module, and the parallel dual-branch anomaly detection module may include an appearance anomaly detection network and a motion anomaly detection network.
[0142] Multiple frames of video frame images to be tested are input into the video anomaly detection model. First, the foreground video frame image, scene image and optical flow image of the target object can be extracted from the multiple frames of video frame images to be tested through the video parsing module; then, the future video frame image of the target object is obtained based on the foreground video frame image and the scene image through the appearance anomaly detection network, and the reconstructed optical flow image of the target object is obtained based on the optical flow image and the scene image through the motion anomaly detection network; finally, the detection result of the target object is determined using the future video frame image and the reconstructed optical flow image.
[0143] It can be seen that the future video frame image integrates the appearance information in the foreground video frame image and the scene information in the scene image, and the connection between the appearance information and the scene information is established through the future video frame image; the reconstructed optical flow image integrates the motion information in the optical flow image and the scene information in the scene image, and the connection between the motion information and the scene information is established through the reconstructed optical flow image. Therefore, the detection result of the target object is determined by using the future video frame image and the reconstructed optical flow image, and the detection result can comprehensively consider the appearance information, motion information and scene information of the target object, thereby improving the accuracy of the detection result.
[0144] The exemplary embodiment of the present disclosure is composed of a parallel dual-branch anomaly detection module consisting of an appearance anomaly detection network and a motion anomaly detection network, which can simultaneously learn the multimodal features of the target object and improve the detection efficiency of the video anomaly detection model.
[0145] According to the technical solution of the exemplary embodiment of the present disclosure, a video to be tested of a target object is obtained, and multiple frames of video frame images to be tested are extracted from the video to be tested; a pre-built video anomaly detection model is obtained, the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network; the multiple frames of video frame images to be tested are input into the video anomaly detection model, the foreground video frame images, scene images and optical flow images of the target object are respectively extracted from the multiple frames of video frame images to be tested through the video parsing module, the future video frame images of the target object are obtained based on the foreground video frame images and the scene images through the appearance anomaly detection network, and the reconstructed optical flow images of the target object are obtained based on the optical flow images and the scene images through the motion anomaly detection network; the detection result of the target object is determined by using the future video frame images and the reconstructed optical flow images, so that when performing abnormality detection on the target object in the video to be tested, the appearance information, motion information and scene information of the target object can be comprehensively considered, thereby improving the accuracy of the detection result.
[0146] In some embodiments, the appearance anomaly detection network includes an appearance and scene-aware encoder, a first memory storage unit, a first scene-conditional variational autoencoder, and an appearance and scene-aware decoder;
[0147] The motion anomaly detection network includes a motion and scene-aware encoder, a second memory storage unit, a second scene-conditional variational autoencoder, and a motion and scene-aware decoder;
[0148] The structure of the appearance and scene perception encoder and the motion anomaly detection network is the same, the structure of the first memory storage unit and the second memory storage unit is the same, the structure of the first scene conditional variational autoencoder and the first scene conditional variational autoencoder is the same, and the structure of the appearance and scene perception decoder and the motion and scene perception decoder is the same.
[0149] Specifically, as can be seen from the foregoing, the appearance anomaly detection network may include an appearance and scene perception encoder, a first memory storage unit, a first scene conditional variational autoencoder and an appearance and scene perception decoder; the motion anomaly detection network may include a motion and scene perception encoder, a second memory storage unit, a second scene conditional variational autoencoder and a motion and scene perception decoder.
[0150] The exemplary embodiment of the present disclosure can set the structure of the appearance and scene perception encoder and the motion anomaly detection network to be the same, the structure of the first memory storage unit and the second memory storage unit to be the same, the structure of the first scene conditional variational autoencoder and the first scene conditional variational autoencoder to be the same, and the structure of the appearance and scene perception decoder and the motion and scene perception decoder to be the same, thereby ensuring the consistency of the overall structure of the parallel dual-branch anomaly detection module composed of the appearance anomaly detection network and the motion anomaly detection network, and improving the stability of the video anomaly detection model finally constructed.
[0151] In some embodiments, obtaining a future video frame image of a target object based on a foreground video frame image and a scene image through an appearance anomaly detection network may include:
[0152] The foreground video frame image is feature encoded by the appearance and scene perception encoder to obtain the appearance feature vector of the target object; the appearance query feature vector corresponding to the appearance feature vector is obtained by the first memory storage unit; the appearance query feature vector and the scene image are feature splicing and feature extraction operations are performed by the first scene conditional variational autoencoder to obtain the target appearance and scene splicing feature vectors of the fused scene image; the target appearance and scene splicing feature vectors are decompressed by the appearance and scene perception decoder to obtain the future video frame image of the target object.
[0153] Specifically, the foreground video frame image is input into the appearance anomaly detection network, and the appearance and scene perception encoder can be used to perform feature encoding on the foreground video frame image, learn the appearance features of the target object in the foreground video frame image, obtain the appearance feature vector of the target object, and input the appearance feature vector of the target object into the first memory storage unit.
[0154] The first memory storage unit can be used to retrieve the memory memory through the memory addressing vector, use multiple memory items for linear combination, obtain the appearance query feature vector corresponding to the appearance feature vector, and input the appearance query feature vector into the first scene conditional variational autoencoder.
[0155] The first scene conditional variational autoencoder can be used to perform feature splicing operations and feature extraction operations on the appearance query feature vector and the scene image to obtain the target appearance and scene splicing feature vector of the fused scene image, and the target appearance and scene splicing feature vector are input into the appearance and scene perception decoder.
[0156] The appearance and scene-aware decoder can be used to decompress the target appearance and scene splicing feature vectors to obtain the future video frame image of the target object.
[0157] Based on this, an exemplary embodiment of the present disclosure can set a first scene-conditional variational autoencoder in the appearance anomaly detection network, use the scene image as a guiding condition, and flexibly control the generation process of future video frame images, so that the generation results of future video frame images are diverse and controllable, thereby achieving full-range detection of appearance anomalies and appearance anomalies and scene incompatibility anomalies.
[0158] In some embodiments, the first scene-conditional variational autoencoder includes a first encoder, a first latent space sampling layer, and a first decoder;
[0159] Performing a feature splicing operation and a feature extraction operation on the appearance query feature vector and the scene image through the first scene conditional variational autoencoder to obtain a target appearance of the fused scene image and a scene splicing feature vector may include:
[0160] The first encoder performs feature extraction and compression operations on the appearance query feature vector and the first appearance and scene splicing feature vector of the scene image to obtain an appearance compression feature vector; the first latent space sampling layer extracts the appearance and scene latent space feature vector from the appearance compression feature vector; the first decoder performs a decompression operation on the appearance and scene latent space feature vector and the second appearance and scene splicing feature vector of the scene image to obtain a target appearance and scene splicing feature vector of the target object.
[0161] Specifically, as can be seen from the foregoing, the first scene conditional variational autoencoder is essentially a generative model with a deep latent space, which may include a first encoder, a first latent space sampling layer and a first decoder.
[0162] First, an exemplary embodiment of the present disclosure may first concatenate the appearance query feature vector and the scene image of the target object to obtain a first appearance and scene concatenation feature vector; then, the first encoder may perform feature extraction and compression operations on the first appearance and scene concatenation feature vector to obtain an appearance compression feature vector; the first latent space sampling layer is a representation of compressed data, and its function is to learn data features and simplify data representation in order to find a certain pattern, and it may be used to extract an appearance and scene latent space feature vector from the appearance compression feature vector; the appearance and scene latent space feature vector and the scene image are concatenated to obtain a second appearance and scene concatenation feature vector; the first decoder may decompress the second appearance and scene concatenation feature vector to obtain a target appearance and scene concatenation feature vector of the target object, and the target appearance and scene concatenation feature vector may be a data sample similar to the appearance query feature vector of the target object.
[0163] It can be seen that the first scene conditional variational autoencoder includes two splicing processes of scene images when performing deep feature information extraction, so that the first scene conditional variational autoencoder can be used to obtain the target appearance and scene splicing feature vector of the fused scene image, thereby avoiding the loss of scene feature information in the process of deep feature information extraction and improving the accuracy of video anomaly detection.
[0164] In some embodiments, obtaining a reconstructed optical flow image of a target object based on an optical flow image and a scene image through a motion anomaly detection network includes:
[0165] The optical flow image is feature encoded by a motion and scene perception encoder to obtain a motion feature vector of the target object; a motion query feature vector corresponding to the motion feature vector is obtained by a second memory storage unit; feature splicing and feature extraction operations are performed on the motion query feature vector and the scene image by a second scene conditional variational autoencoder to obtain a target motion and scene splicing feature vector of a fused scene image; and a motion and scene perception decoder is used to decompress the target motion and scene splicing feature vector to obtain a reconstructed optical flow image of the target object.
[0166] Specifically, the optical flow image is input into the motion anomaly detection network, the optical flow image is feature encoded by the motion and scene perception encoder, the motion features of the target object in the optical flow image are learned, the motion feature vector of the target object is obtained, and the motion feature vector of the target object is input into the second memory storage unit.
[0167] The memory memory is retrieved through the memory addressing vector through the second memory storage unit, and a plurality of memory items are used for linear combination to obtain a motion query feature vector corresponding to the motion feature vector, and the motion query feature vector is input into the second scene conditional variational autoencoder.
[0168] The motion query feature vector and the scene image are subjected to feature splicing and feature extraction operations through the second scene conditional variational autoencoder to obtain target motion and scene splicing feature vectors of the fused scene image, and the target motion and scene splicing feature vectors are input into the motion and scene perception decoder.
[0169] The target motion and scene splicing feature vectors are decompressed by the motion and scene-aware decoder to obtain the reconstructed optical flow image.
[0170] Based on this, an exemplary embodiment of the present disclosure can set a second scene conditional variational autoencoder in the motion anomaly detection network, use the scene image as a guiding condition, and flexibly control the generation process of the reconstructed optical flow image, so that the generation result of the reconstructed optical flow image is diverse and controllable, thereby achieving full-range detection of motion anomalies, as well as motion anomalies and scene incompatibility anomalies.
[0171] In some embodiments, the second scene-conditional variational autoencoder includes a second encoder, a second latent space sampling layer, and a second decoder;
[0172] The second scene conditional variational autoencoder performs feature splicing and feature extraction operations on the motion query feature vector and the scene image to obtain the target motion and scene splicing feature vectors of the fused scene image, including:
[0173] The second encoder performs feature extraction and compression operations on the motion query feature vector and the first motion and scene splicing feature vector of the scene image to obtain a motion compression feature vector; the second latent space sampling layer extracts the motion and scene latent space feature vector from the motion compression feature vector; the second decoder performs a decompression operation on the motion and scene latent space feature vector and the second motion and scene splicing feature vector of the scene image to obtain a target motion and scene splicing feature vector of the target object.
[0174] Specifically, as can be seen from the foregoing, the second scene conditional variational autoencoder is essentially a generative model with a deep latent space, which may include a second encoder, a second latent space sampling layer and a second decoder.
[0175] First, an exemplary embodiment of the present disclosure can first splice the motion query feature vector of the target object and the scene image to obtain a first motion and scene splicing feature vector; then, a second encoder is used to perform feature extraction and compression operations on the first motion and scene splicing feature vector to obtain a motion compression feature vector; the second latent space sampling layer is a representation of compressed data, and its function is to learn data features and simplify data representation in order to find a certain pattern, and it can be used to extract motion and scene latent space feature vectors from motion compression feature vectors; the motion and scene latent space feature vectors and the scene image are spliced to obtain a second motion and scene splicing feature vector; the second decoder is used to decompress the second motion and scene splicing feature vector to obtain a target motion and scene splicing feature vector of the target object, and the target motion and scene splicing feature vector can be a data sample similar to the motion query feature vector of the target object.
[0176] It can be seen that the second scene conditional variational autoencoder includes two splicing processes of scene images when performing deep feature information extraction, so that the second scene conditional variational autoencoder can be used to obtain the target motion and scene splicing feature vectors of the fused scene image, thereby avoiding the loss of scene feature information in the process of deep feature information extraction and improving the accuracy of video anomaly detection.
[0177] In some embodiments, the structures of the appearance and scene perception encoder and the motion anomaly detection network are both multi-layer residual U-Net networks, and the multi-layer residual U-Net network includes multiple residual blocks, and each residual block includes multiple convolution layers with convolution kernels of different sizes for residual convolution operations.
[0178] Specifically, the appearance and scene perception encoder and the motion anomaly detection network both use the multi-layer residual U-Net network proposed in the exemplary embodiment of the present disclosure. The relevant content of the multi-layer residual U-Net network can be found in the previous text and will not be repeated here.
[0179] The multi-layer residual U-Net network in the exemplary embodiment of the present disclosure may include multiple residual blocks, and each residual block may include multiple convolution layers with convolution kernels of different sizes for performing residual convolution operations.
[0180] Compared with the traditional U-Net network, the exemplary embodiment of the present disclosure can replace the convolution operation performed by the traditional U-Net network using multiple convolution kernels of the same size with a residual convolution operation performed using multiple convolution kernels of different sizes, which can further improve the computational efficiency and accuracy of the video anomaly detection model.
[0181] In some embodiments, using the future video frame image and the reconstructed optical flow image to determine the detection result of the target object may include:
[0182] Determine the appearance anomaly score corresponding to the future video frame image and the motion anomaly score corresponding to the reconstructed optical flow image respectively;
[0183] Calculate an anomaly score of the target object based on the appearance anomaly score and the motion anomaly score;
[0184] The anomaly score of the target object is used to determine the detection result of the target object.
[0185] Specifically, after obtaining the future video frame image and the reconstructed optical flow image, the appearance anomaly score corresponding to the future video frame image and the motion anomaly score corresponding to the reconstructed optical flow image can be determined respectively. The calculation formula for the appearance anomaly score corresponding to the future video frame image can be the formula (14) in the above text, and the calculation formula for the motion anomaly score corresponding to the reconstructed optical flow image can be the formula (15) in the above text.
[0186] Then, the anomaly score of the target object is calculated based on the appearance anomaly score and the motion anomaly score using the formula (13) in the previous text, and the detection result of the target object is determined using the anomaly score of the target object.
[0187] For example, a preset abnormality score may be set to determine whether the target object is abnormal. If the abnormality score of the target object is greater than or equal to the preset abnormality score, the detection result of the target object is determined to be abnormal; if the abnormality score of the target object is less than the preset abnormality score, the detection result of the target object is determined to be normal.
[0188] Here, the preset anomaly score may be determined according to actual application scenarios, and the exemplary embodiments of the present disclosure do not specifically limit this.
[0189] Based on this, the exemplary embodiments of the present disclosure can score the abnormality of the future video frame images and the reconstructed optical flow images of the fused scene images, and determine the detection results of the target objects according to the scoring results.
[0190] In some embodiments, the video parsing module includes an object detection network, a scene extraction network, and an optical flow estimation network;
[0191] The foreground video frame image, scene image and optical flow image of the target object are respectively extracted from multiple frames of the video frame image to be tested through the video parsing module, including:
[0192] The target detection network is used to extract the appearance information of the target object in multiple frames of video frame images to be tested, and the foreground video frame image is obtained; the scene extraction network is used to extract the scene information of the target object in multiple frames of video frame images to be tested, and the scene image is obtained; the optical flow estimation network is used to extract the motion information of the target object in multiple frames of video frame images to be tested, and the optical flow image is obtained.
[0193] Specifically, the video parsing module may include a target detection network, a scene extraction network, and an optical flow estimation network. The exemplary embodiment of the present disclosure may extract the appearance information of the target object in multiple frames of video frame images to be tested through the target detection network to obtain a foreground video frame image; extract the scene information of the target object in multiple frames of video frame images to be tested through the scene extraction network to obtain a scene image; and extract the motion information of the target object in multiple frames of video frame images to be tested through the optical flow estimation network to obtain an optical flow image.
[0194] Here, the relevant contents of the target detection network, scene extraction network and optical flow estimation network can be found in the previous article and will not be repeated here.
[0195] Based on this, the exemplary embodiment of the present disclosure can pre-process multiple frames of video frame images to be tested by the video parsing module of the target detection network, scene extraction network and optical flow estimation network, and extract foreground video frame images, scene images and optical flow images respectively, so that the parallel dual-branch anomaly detection module composed of the appearance anomaly detection network and the motion anomaly detection network can perform abnormality detection of the target object, thereby improving the detection efficiency.
[0196] In some embodiments, during the training phase, the total loss of the video anomaly detection model includes prediction loss, reconstruction loss, memory loss and splicing loss, and the total loss of the video anomaly detection model is calculated based on the weighted average of the prediction loss, reconstruction loss, memory loss and splicing loss.
[0197] Specifically, in the training stage of the video anomaly detection model, the total loss of the video anomaly detection model may include prediction loss, reconstruction loss, memory loss and splicing loss, and the total loss of the video anomaly detection model is calculated based on the weighted average of prediction loss, reconstruction loss, memory loss and splicing loss.
[0198] Among them, the total loss of the video anomaly detection model can be calculated by formula (12) in the previous article, the prediction loss can be calculated by formula (5) in the previous article, the reconstruction loss can be calculated by formula (6) in the previous article, the memory loss can be calculated by formula (7) to formula (9) in the previous article, and the splicing loss can be calculated by formula (10) to formula (11) in the previous article.
[0199] At least one of the above-mentioned technical solutions adopted in the exemplary embodiments of the present disclosure can achieve the following beneficial effects: by obtaining a video to be tested of the target object, and extracting multiple frames of video frame images to be tested from the video to be tested; obtaining a pre-built video anomaly detection model, the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network; inputting multiple frames of video frame images to be tested into the video anomaly detection model, respectively extracting the foreground video frame image, scene image and optical flow image of the target object from the multiple frames of video frame images to be tested through the video parsing module, obtaining the future video frame image of the target object based on the foreground video frame image and the scene image through the appearance anomaly detection network, and obtaining the reconstructed optical flow image of the target object based on the optical flow image and the scene image through the motion anomaly detection network; using the future video frame image and the reconstructed optical flow image to determine the detection result of the target object, it is possible to comprehensively consider the appearance information, motion information and scene information of the target object when performing abnormality detection on the target object in the video to be tested, thereby improving the accuracy of the detection result.
[0200] The above mainly introduces the solutions provided by the exemplary embodiments of the present disclosure. It is understandable that in order to implement the above functions, the electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware 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 exceed the scope of the present disclosure.
[0201] The exemplary embodiments of the present disclosure can divide the functional units of the electronic device according to the above method examples. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the exemplary embodiments of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0202] In the case of dividing each functional module according to each function, an exemplary embodiment of the present disclosure provides a video anomaly detection device, which may be an electronic device or a chip applied to an electronic device. Figure 6 FIG. 2 shows a schematic diagram of the structure of a video anomaly detection device provided by an exemplary embodiment of the present disclosure. Figure 6 As shown, the device 600 includes:
[0203] An acquisition module 601 is used to acquire a video to be tested of a target object;
[0204] The processing module 602 is used to extract multiple frames of video frames to be tested from the video to be tested;
[0205] The acquisition module 601 is also used to acquire a pre-built video anomaly detection model, the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network;
[0206] The prediction module 603 is used to input multiple frames of video frame images to be tested into the video anomaly detection model, respectively extract the foreground video frame image, scene image and optical flow image of the target object from the multiple frames of video frame images to be tested through the video parsing module, obtain the future video frame image of the target object based on the foreground video frame image and the scene image through the appearance anomaly detection network, and obtain the reconstructed optical flow image of the target object based on the optical flow image and the scene image through the motion anomaly detection network;
[0207] The processing module 602 is further configured to determine a detection result of the target object by using the future video frame image and the reconstructed optical flow image.
[0208] In some embodiments, the appearance anomaly detection network includes an appearance and scene-aware encoder, a first memory storage unit, a first scene-conditional variational autoencoder, and an appearance and scene-aware decoder;
[0209] The motion anomaly detection network includes a motion and scene-aware encoder, a second memory storage unit, a second scene-conditional variational autoencoder, and a motion and scene-aware decoder;
[0210] The structure of the appearance and scene perception encoder and the motion anomaly detection network is the same, the structure of the first memory storage unit and the second memory storage unit is the same, the structure of the first scene conditional variational autoencoder and the first scene conditional variational autoencoder is the same, and the structure of the appearance and scene perception decoder and the motion and scene perception decoder is the same.
[0211] In some embodiments, the prediction module 603 is also used to perform feature encoding on the foreground video frame image through the appearance and scene perception encoder to obtain the appearance feature vector of the target object; obtain the appearance query feature vector corresponding to the appearance feature vector through the first memory storage unit; perform feature splicing and feature extraction operations on the appearance query feature vector and the scene image through the first scene conditional variational autoencoder to obtain the target appearance and scene splicing feature vector of the fused scene image; perform decompression operations on the target appearance and scene splicing feature vector through the appearance and scene perception decoder to obtain the future video frame image of the target object.
[0212] In some embodiments, the first scene-conditional variational autoencoder includes a first encoder, a first latent space sampling layer, and a first decoder;
[0213] The prediction module 603 is also used to perform feature extraction and compression operations on the appearance query feature vector and the first appearance and scene splicing feature vector of the scene image through the first encoder to obtain an appearance compression feature vector; extract the appearance and scene latent space feature vector from the appearance compression feature vector through the first latent space sampling layer; and perform decompression operations on the appearance and scene latent space feature vector and the second appearance and scene splicing feature vector of the scene image through the first decoder to obtain a target appearance and scene splicing feature vector of the target object.
[0214] In some embodiments, the prediction module 603 is also used to perform feature encoding on the optical flow image through a motion and scene perception encoder to obtain a motion feature vector of the target object; obtain a motion query feature vector corresponding to the motion feature vector through a second memory storage unit; perform feature splicing operations and feature extraction operations on the motion query feature vector and the scene image through a second scene conditional variational autoencoder to obtain a target motion and scene splicing feature vector of a fused scene image; perform decompression operations on the target motion and scene splicing feature vector through a motion and scene perception decoder to obtain a reconstructed optical flow image of the target object.
[0215] In some embodiments, the second scene-conditional variational autoencoder includes a second encoder, a second latent space sampling layer, and a second decoder;
[0216] The prediction module 603 is also used to perform feature extraction and compression operations on the motion query feature vector and the first motion and scene splicing feature vector of the scene image through a second encoder to obtain a motion compression feature vector; extract the motion and scene latent space feature vector from the motion compression feature vector through a second latent space sampling layer; and perform decompression operations on the motion and scene latent space feature vector and the second motion and scene splicing feature vector of the scene image through a second decoder to obtain a target motion and scene splicing feature vector of the target object.
[0217] In some embodiments, the structures of the appearance and scene perception encoder and the motion anomaly detection network are both multi-layer residual U-Net networks, and the multi-layer residual U-Net network includes multiple residual blocks, and each residual block includes multiple convolution layers with convolution kernels of different sizes for residual convolution operations.
[0218] In some embodiments, the processing module 602 is further used to respectively determine the appearance anomaly score corresponding to the future video frame image and the motion anomaly score corresponding to the reconstructed optical flow image; calculate the anomaly score of the target object based on the appearance anomaly score and the motion anomaly score; and determine the detection result of the target object using the anomaly score of the target object.
[0219] In some embodiments, the video parsing module includes an object detection network, a scene extraction network, and an optical flow estimation network;
[0220] The prediction module 603 is also used to extract the appearance information of the target object in multiple frames of video frame images to be tested through the target detection network to obtain a foreground video frame image; to extract the scene information of the target object in multiple frames of video frame images to be tested through the scene extraction network to obtain a scene image; and to extract the motion information of the target object in multiple frames of video frame images to be tested through the optical flow estimation network to obtain an optical flow image.
[0221] In some embodiments, during the training phase, the total loss of the video anomaly detection model includes prediction loss, reconstruction loss, memory loss and splicing loss, and the total loss of the video anomaly detection model is calculated based on the weighted average of the prediction loss, reconstruction loss, memory loss and splicing loss.
[0222] The exemplary embodiments of the present disclosure also provide an electronic device, comprising: at least one processor; a memory for storing at least one processor-executable instruction; wherein the at least one processor is used to execute the instruction to implement the steps of the above method disclosed in the exemplary embodiments of the present disclosure.
[0223] Figure 7 FIG. 1 shows a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present disclosure. Figure 7 As shown, the electronic device 700 includes at least one processor 701 and a memory 702 coupled to the processor 701 . The processor 701 can execute corresponding steps in the above method disclosed in the exemplary embodiment of the present disclosure.
[0224] The processor 701 may also be referred to as a central processing unit (CPU), which may be an integrated circuit chip having signal processing capabilities. Each step in the method disclosed in the exemplary embodiment of the present disclosure may be completed by an integrated logic circuit of hardware in the processor 701 or by instructions in the form of software. The processor 701 may be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the exemplary embodiment of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a memory 702, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, or other mature storage media in the art. The processor 701 reads the information in the memory 702 and completes the steps of the method in conjunction with its hardware.
[0225] In addition, when various operations / processes according to the present disclosure are implemented by software and / or firmware, they can be transmitted from a storage medium or a network to a computer system having a dedicated hardware structure, for example, Figure 8The computer system 800 shown is installed with the programs constituting the software. When the various programs are installed, the computer system can perform various functions, including the functions described above. Figure 8 A schematic diagram of the structure of a computer system provided by an exemplary embodiment of the present disclosure is shown.
[0226] Computer system 800 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0227] like Figure 8 As shown, the computer system 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the computer system 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0228] A plurality of components in the computer system 800 are connected to the I / O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 can be any type of device capable of inputting information to the computer system 800, and the input unit 806 can receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 807 can be any type of device capable of presenting information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 808 can include but is not limited to a disk, an optical disk. The communication unit 809 allows the computer system 800 to exchange information / data with other devices over a network such as the Internet, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, for example, a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0229] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above. For example, in some embodiments, the above methods disclosed in the exemplary embodiments of the present disclosure may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on an electronic device via ROM 802 and / or a communication unit 809. In some embodiments, the computing unit 801 may be configured to perform the above methods disclosed in the exemplary embodiments of the present disclosure in any other appropriate manner (e.g., by means of firmware).
[0230] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the above method disclosed in the exemplary embodiments of the present disclosure.
[0231] The computer-readable storage medium in the exemplary embodiment of the present disclosure 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. The above-mentioned computer-readable storage 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 above. More specifically, the above-mentioned computer-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 above.
[0232] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0233] The exemplary embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor, the above method disclosed in the exemplary embodiments of the present disclosure is implemented.
[0234] In embodiments of the present disclosure, computer program codes for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer.
[0235] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0236] The modules, components or units involved in the exemplary embodiments described in the present disclosure may be implemented by software or hardware, wherein the names of the modules, components or units do not, in some cases, limit the modules, components or units themselves.
[0237] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0238] The above descriptions are only some embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0239] Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present disclosure. It should be understood by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.
Claims
1. A video anomaly detection method, characterized in that: include: Acquire a video to be tested of the target object, and extract multiple frames of video frame images to be tested from the video to be tested; Obtaining a pre-built video anomaly detection model, wherein the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, wherein the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network; The multiple frames of video frame images to be tested are input into the video anomaly detection model, and the foreground video frame image, scene image and optical flow image of the target object are respectively extracted from the multiple frames of video frame images to be tested by the video parsing module, and the future video frame image of the target object is obtained based on the foreground video frame image and the scene image by the appearance anomaly detection network, and the reconstructed optical flow image of the target object is obtained based on the optical flow image and the scene image by the motion anomaly detection network; The detection result of the target object is determined by using the future video frame image and the reconstructed optical flow image.
2. The method according to claim 1, characterized in that: The appearance anomaly detection network includes an appearance and scene perception encoder, a first memory storage unit, a first scene conditional variational autoencoder and an appearance and scene perception decoder; The motion anomaly detection network includes a motion and scene perception encoder, a second memory storage unit, a second scene conditional variational autoencoder and a motion and scene perception decoder; The structure of the appearance and scene perception encoder is the same as that of the motion anomaly detection network, the structure of the first memory storage unit is the same as that of the second memory storage unit, the structure of the first scene conditional variational autoencoder is the same as that of the first scene conditional variational autoencoder, and the structure of the appearance and scene perception decoder is the same as that of the motion and scene perception decoder.
3. The method according to claim 2, characterized in that The obtaining of the future video frame image of the target object based on the foreground video frame image and the scene image by the appearance anomaly detection network includes: The foreground video frame image is feature encoded by the appearance and scene perception encoder to obtain the appearance feature vector of the target object; the appearance query feature vector corresponding to the appearance feature vector is obtained by the first memory storage unit; the appearance query feature vector and the scene image are subjected to feature splicing and feature extraction operations by the first scene conditional variational autoencoder to obtain the target appearance and scene splicing feature vector fused with the scene image; the target appearance and scene splicing feature vector is decompressed by the appearance and scene perception decoder to obtain the future video frame image of the target object.
4. The method according to claim 3, characterized in that The first scene conditional variational autoencoder comprises a first encoder, a first latent space sampling layer and a first decoder; The step of performing a feature splicing operation and a feature extraction operation on the appearance query feature vector and the scene image by the first scene conditional variational autoencoder to obtain a target appearance and a scene splicing feature vector fused with the scene image includes: The first encoder performs feature extraction and compression operations on the appearance query feature vector and the first appearance and scene splicing feature vector of the scene image to obtain an appearance compression feature vector; the first latent space sampling layer extracts an appearance and scene latent space feature vector from the appearance compression feature vector; the first decoder performs a decompression operation on the appearance and scene latent space feature vector and the second appearance and scene splicing feature vector of the scene image to obtain a target appearance and scene splicing feature vector of the target object.
5. The method according to claim 2, characterized in that: The step of obtaining the reconstructed optical flow image of the target object based on the optical flow image and the scene image through a motion anomaly detection network includes: The optical flow image is feature encoded by the motion and scene perception encoder to obtain the motion feature vector of the target object; the motion query feature vector corresponding to the motion feature vector is obtained by the second memory storage unit; the motion query feature vector and the scene image are feature stitched and extracted by the second scene conditional variational autoencoder to obtain the target motion and scene stitching feature vector fused with the scene image; the target motion and scene stitching feature vector is decompressed by the motion and scene perception decoder to obtain the reconstructed optical flow image of the target object.
6. The method according to claim 5, characterized in that The second scene conditional variational autoencoder includes a second encoder, a second latent space sampling layer, and a second decoder; The step of performing a feature splicing operation and a feature extraction operation on the motion query feature vector and the scene image by the second scene conditional variational autoencoder to obtain a target motion and scene splicing feature vector fused with the scene image includes: The second encoder performs feature extraction and compression operations on the motion query feature vector and the first motion and scene splicing feature vector of the scene image to obtain a motion compression feature vector; the second latent space sampling layer extracts a motion and scene latent space feature vector from the motion compression feature vector; the second decoder performs a decompression operation on the motion and scene latent space feature vector and the second motion and scene splicing feature vector of the scene image to obtain a target motion and scene splicing feature vector of the target object.
7. The method according to claim 2, characterized in that The structures of the appearance and scene perception encoder and the motion anomaly detection network are both multi-layer residual U-Net networks, and the multi-layer residual U-Net network includes multiple residual blocks, and each of the residual blocks includes multiple convolution layers with convolution kernels of different sizes for residual convolution operations.
8. The method according to claim 1, characterized in that The using the future video frame image and the reconstructed optical flow image to determine the detection result of the target object includes: respectively determining an appearance anomaly score corresponding to the future video frame image and a motion anomaly score corresponding to the reconstructed optical flow image; Calculating an anomaly score of the target object based on the appearance anomaly score and the motion anomaly score; The abnormality score of the target object is used to determine a detection result of the target object.
9. The method according to claim 1, characterized in that: The video parsing module includes a target detection network, a scene extraction network and an optical flow estimation network; The extracting of the foreground video frame image, the scene image and the optical flow image of the target object from the multiple frames of the video frame images to be tested by the video parsing module includes: The target detection network is used to extract the appearance information of the target object in the multiple frames of video frame images to be tested, so as to obtain the foreground video frame image; the scene extraction network is used to extract the scene information of the target object in the multiple frames of video frame images to be tested, so as to obtain the scene image; the optical flow estimation network is used to extract the motion information of the target object in the multiple frames of video frame images to be tested, so as to obtain the optical flow image.
10. The method according to any one of claims 1 to 9, characterized in that: During the training phase, the total loss of the video anomaly detection model includes prediction loss, reconstruction loss, memory loss and splicing loss, and the total loss of the video anomaly detection model is calculated based on a weighted average of the prediction loss, the reconstruction loss, the memory loss and the splicing loss.
11. A video anomaly detection device, characterized in that: include: An acquisition module is used to acquire the video to be tested of the target object; A processing module, used for extracting a plurality of frames of video frame images to be tested from the video to be tested; The acquisition module is also used to acquire a pre-built video anomaly detection model, wherein the video anomaly detection model includes a video parsing module and a parallel dual-branch anomaly detection module, wherein the parallel dual-branch anomaly detection module includes an appearance anomaly detection network and a motion anomaly detection network; A prediction module, used for inputting the multiple frames of video frame images to be tested into the video anomaly detection model, respectively extracting the foreground video frame image, scene image and optical flow image of the target object from the multiple frames of video frame images to be tested through the video parsing module, obtaining the future video frame image of the target object based on the foreground video frame image and the scene image through the appearance anomaly detection network, and obtaining the reconstructed optical flow image of the target object based on the optical flow image and the scene image through the motion anomaly detection network; The processing module is further used to determine the detection result of the target object by using the future video frame image and the reconstructed optical flow image.
12. An electronic device, characterized in that: include: at least one processor; a memory for storing the at least one processor-executable instruction; The at least one processor is configured to execute the instructions to implement the steps of the method according to any one of claims 1 to 11.
13. A computer program product, characterized in that The method comprises a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Gaussian mixture model-based method for detecting abnormal behavior in crowd
CN106778595A
Video restoration method based on optical flow method and multi-view scene
CN114119424A
Video anomaly detection method, system and equipment based on scene target
CN115578691A
Video anomaly detection system and method based on abnormal region positioning
CN117376569A
Video anomaly detection method and device, chip and storage medium
CN117523453A
Cited By
Traffic anomaly detection method and device, and storage medium
CN118823698A
Video anomaly detection method and device, equipment, storage medium and product
CN119380237A
Abnormal behavior real-time detection and early warning system based on video analysis
CN122248170A
