Unsupervised video abnormal behavior detection method and device, equipment and medium
By estimating optical flow and predicting intermediate frames of monitoring video frames, and calculating similarity to determine abnormal behavior, the problem of low accuracy of unsupervised video abnormal behavior detection in financial scenarios is solved, and a higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202411660941.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-14
AI Technical Summary
Unsupervised video abnormal behavior detection has low accuracy in financial scenarios, especially since abnormal situations may move in space and time, resulting in increased detection difficulty.
By performing frame extraction, optical flow estimation, predicted intermediate frames and feature extraction on the monitoring video frame, the similarity between the predicted intermediate frame and the real intermediate frame is calculated, and when the similarity is less than the threshold, it is determined to be abnormal behavior.
It improves the accuracy of unsupervised video abnormal behavior detection, can detect abnormal situations in both spatial and temporal dimensions, and enhances the difference between normal and abnormal video frames.
Smart Images

Figure CN119625600A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence and finance, and in particular to an unsupervised video abnormal behavior detection method, device, electronic device and readable storage medium. Background Art
[0002] Video abnormal behavior detection refers to the detection and feedback processing of abnormal behavior in surveillance videos. When performing abnormal behavior detection on video surveillance of financial scenarios, it is difficult to obtain abnormal labels, making video abnormal behavior detection difficult. Therefore, unsupervised artificial intelligence has been proposed and applied in financial abnormal behavior detection. Through unsupervised artificial intelligence technology, abnormal behavior detection can be made relatively simple. Unsupervised abnormal behavior detection technology can help the financial industry protect related scenarios and improve security levels and user trust.
[0003] However, since anomalies in videos can occur in both spatial and temporal motion, the accuracy of unsupervised video anomaly detection is reduced. Summary of the invention
[0004] The present invention provides a method, a device, an electronic device and a readable storage medium for detecting abnormal behavior of a video based on unsupervision, aiming to improve the accuracy of detecting abnormal behavior of a video based on unsupervision.
[0005] To achieve the above object, the present invention provides a method for detecting abnormal behavior in videos based on unsupervised video, the method comprising:
[0006] Obtaining a surveillance video to be detected, and decomposing the surveillance video to be detected into surveillance video frames;
[0007] Extracting frames from the surveillance video frames at preset intervals to obtain interval frames, and performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames;
[0008] Predicting the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain predicted intermediate frames;
[0009] Extracting features from the predicted intermediate frame and the real intermediate frame between the interval frames respectively to obtain predicted frame features and real frame features;
[0010] Calculating the similarity between the predicted intermediate frame and the real intermediate frame using a preset function according to the predicted frame feature and the real frame feature;
[0011] When the similarity is less than a preset threshold, it is determined that the surveillance video to be detected has abnormal behavior.
[0012] Optionally, performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames includes:
[0013] Constructing an optical flow estimation model, and scaling the interval frames to obtain scaled interval frames;
[0014] Inputting the scaled interval frames into the first convolution layer and the pooling layer in the optical flow estimation model in sequence to obtain a feature vector of the scaled interval frames;
[0015] Performing feature matching on the feature vectors in the zoom interval frames using the second convolutional layer in the optical flow estimation model to obtain a feature vector similarity image;
[0016] Inputting the feature vector similarity image into the third convolutional layer in the optical flow estimation model to obtain an optical flow vector of each pixel in the feature vector similarity image;
[0017] The optical flow vector is visualized to obtain an optical flow estimation frame.
[0018] Optionally, performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames includes:
[0019] Performing image denoising processing on the interval frames to obtain denoised interval frames;
[0020] Extracting feature points from the denoised interval frames to obtain optical flow feature points;
[0021] Performing feature tracking on the optical flow feature points to obtain an optical flow vector;
[0022] The optical flow vector is visualized to obtain an optical flow estimation frame.
[0023] Optionally, predicting the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain the predicted intermediate frames includes:
[0024] Calculating the intermediate value of each optical flow vector in the optical flow estimation frame of the interval frame to obtain an intermediate value optical flow estimation frame;
[0025] Subtracting the pixel value of the previous frame image in the interval frame from the pixel value of the next frame image in the interval frame to obtain a difference image of the interval frame;
[0026] Using a downsampling layer in a preset interpolation network to extract features from the difference image, a low-dimensional feature matrix;
[0027] According to the intermediate value optical flow estimation frame, a deconvolution calculation is performed on the low-dimensional feature matrix to obtain a predicted intermediate frame.
[0028] Optionally, in the step of respectively extracting features from the predicted intermediate frame and the real intermediate frame between the interval frames to obtain predicted frame features and real frame features, extracting features from the predicted intermediate frame to obtain predicted frame features includes:
[0029] Normalizing pixels of the predicted intermediate frame to obtain a standard predicted intermediate frame;
[0030] Calculate the intermediate frame feature map matrix using the preset convolution kernel matrix and the standard prediction intermediate frame according to the preset step size;
[0031] Performing average region division on the intermediate frame feature map matrix to obtain a plurality of sub-regions of the same size;
[0032] A maximum pixel value among the pixel values in each of the sub-regions is selected, and the maximum pixel value is used as the pixel value of the corresponding sub-region to obtain the predicted frame feature.
[0033] Optionally, the calculating the similarity between the predicted intermediate frame and the real intermediate frame by using a preset function according to the predicted frame feature and the real frame feature includes:
[0034] The similarity between the predicted intermediate frame and the real intermediate frame is calculated using the following function:
[0035]
[0036] Wherein, the l2 refers to the similarity between the predicted intermediate frame and the real intermediate frame; Refers to the predicted frame features of the predicted intermediate frame; the f t refers to the real frame feature of the real intermediate frame; Refers to the L2 norm of the predicted frame feature; the ‖f t ‖2 refers to the L2 norm of the real frame feature.
[0037] Optionally, decomposing the surveillance video to be detected into surveillance video frames includes:
[0038] Utilize the video frame reading function to cyclically read the image pixel matrix of each frame in the monitoring video to be detected;
[0039] Perform pixel matching on the image pixel matrix to obtain an image file of each frame of the surveillance video to be detected;
[0040] The image files are integrated according to the frame sequence of the surveillance video to be detected to obtain surveillance video frames.
[0041] In order to solve the above problems, the present invention also provides a device for detecting abnormal behavior of a video based on unsupervised operation, the device comprising:
[0042] A video frame optical flow estimation module is used to obtain a surveillance video to be detected, decompose the surveillance video to be detected into surveillance video frames, perform frame extraction on the surveillance video frames at preset intervals to obtain interval frames, perform optical flow estimation on the interval frames, and obtain optical flow estimation frames of the interval frames;
[0043] A video frame feature extraction module is used to predict the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain predicted intermediate frames, and to extract features from the predicted intermediate frames and the real intermediate frames between the interval frames to obtain predicted frame features and real frame features;
[0044] The video frame abnormal behavior judgment module is used to calculate the similarity between the predicted intermediate frame and the real intermediate frame according to the predicted frame features and the real frame features using a preset function, and when the similarity is less than a preset threshold, it is determined that the monitoring video to be detected has abnormal behavior.
[0045] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0046] a memory storing at least one computer program; and
[0047] The processor executes the computer program stored in the memory to implement the above-mentioned unsupervised video abnormal behavior detection method.
[0048] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned unsupervised video abnormal behavior detection method.
[0049] The embodiment of the present invention obtains the predicted intermediate frame by performing optical flow estimation and video frame prediction on the interval frame, thereby realizing the detection of the surveillance video in two dimensions of space and time, solving the problem that the abnormal situation in the surveillance video occurs in the spatial and temporal motion. Furthermore, the predicted intermediate frame and the real intermediate frame are subjected to feature extraction, and the difference between the normal surveillance video and the abnormal surveillance video is enhanced from the feature space, thereby improving the accuracy of the unsupervised video abnormal behavior detection. Therefore, the unsupervised video abnormal behavior detection method, device, equipment and storage medium provided by the present invention can improve the accuracy of the unsupervised video abnormal behavior detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of a process of detecting abnormal behavior in video based on unsupervised video according to an embodiment of the present invention;
[0051] Figure 2 and Figure 3 A detailed implementation flow chart of one of the steps in the unsupervised video abnormal behavior detection method provided by one embodiment of the present invention;
[0052] Figure 4 A schematic diagram of a module of an unsupervised video abnormal behavior detection device provided by an embodiment of the present invention;
[0053] Figure 5 A schematic diagram of the internal structure of an electronic device for implementing an unsupervised video abnormal behavior detection method provided by an embodiment of the present invention;
[0054] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0056] The embodiment of the present invention provides a method for detecting abnormal behavior of video based on unsupervision. The execution subject of the method for detecting abnormal behavior of video based on unsupervision includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the method for detecting abnormal behavior of video based on unsupervision can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server may include an independent server, or may include a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0057] Reference Figure 1 The flowchart of the method for detecting abnormal behavior of a video based on unsupervised video according to an embodiment of the present invention is shown in FIG. 1 . In the embodiment of the present invention, the method for detecting abnormal behavior of a video based on unsupervised video includes:
[0058] S1. Obtain a surveillance video to be detected, and decompose the surveillance video to be detected into surveillance video frames.
[0059] In the embodiment of the present invention, the surveillance video to be detected may be a video captured by a surveillance video recording device, for example, a video captured by a surveillance camera in a financial service hall.
[0060] In an optional embodiment of the present invention, first, the time range of the surveillance video to be detected needs to be determined, and secondly, the storage location of the surveillance video to be detected needs to be determined. Finally, the surveillance video to be detected is retrieved according to the time range and the storage location. In addition, in order to ensure the data security of the surveillance video to be detected, the surveillance video to be detected needs to be backed up before retrieving the surveillance video to be detected.
[0061] Furthermore, the embodiment of the present invention decomposes the surveillance video to be detected into surveillance video frames, so as to facilitate the detection of abnormal behavior in time of the surveillance video to be detected, thereby making the abnormal behavior detection result more accurate.
[0062] In detail, as an optional embodiment of the present invention, refer to Figure 2 As shown, decomposing the surveillance video to be detected into surveillance video frames includes:
[0063] S11, using a video frame reading function to cyclically read the image pixel matrix of each frame in the monitoring video to be detected;
[0064] S12, performing pixel matching on the image pixel matrix to obtain an image file of each frame of the surveillance video to be detected;
[0065] S13, integrating the image files according to the frame sequence of the surveillance video to be detected to obtain surveillance video frames.
[0066] In the embodiment of the present invention, the video frame reading function may be cap.read().
[0067] In an optional embodiment of the present invention, the video frame reading function will return two values during the process of reading the surveillance video to be detected: one is a Boolean value indicating whether the frame is read successfully; and the other is an image pixel matrix of each frame of the surveillance video to be detected.
[0068] S2. Perform frame extraction on the monitoring video frames at preset intervals to obtain interval frames, perform optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames.
[0069] In the embodiment of the present invention, the preset interval may be that one frame is extracted every other frame in the monitoring video frame. Therefore, the interval frame refers to the difference of one frame between two video frames.
[0070] The embodiment of the present invention extracts frames from the surveillance video frames at preset intervals to ensure that the extracted video frames can be used for the interpolation network to predict intermediate frames, thereby realizing abnormal behavior detection of the detection surveillance video.
[0071] The embodiment of the present invention performs optical flow estimation on the interval frames to obtain the motion trajectory of the feature points in the interval frames, and then predicts the intermediate frames of the interval frames through the motion trajectory, thereby performing abnormal behavior detection in the spatial and temporal dimensions of the detection monitoring video, thereby improving the accuracy of abnormal behavior detection in the video.
[0072] In detail, as an optional embodiment of the present invention, refer to Figure 3 As shown, the performing optical flow estimation on the interval frames to obtain the optical flow estimation frames of the interval frames includes:
[0073] S21, performing image denoising processing on the interval frames to obtain denoised interval frames;
[0074] S22, extracting feature points from the denoised interval frames to obtain optical flow feature points;
[0075] S23, performing feature tracking on the optical flow feature points to obtain an optical flow vector;
[0076] S24. Visualize the optical flow vector to obtain an optical flow estimation frame.
[0077] The optional embodiment of the present invention ensures the clarity of the interval frames and improves the accuracy of abnormal behavior detection in the video by performing pre-processing operations such as grayscale and denoising on the interval frames.
[0078] Furthermore, in an optional embodiment of the present invention, algorithms such as Harris corner detection and Shi-Tomasi corner detection may be used to extract feature points from the denoised interval frames to obtain optical flow feature points.
[0079] In another optional embodiment of the present invention, the KLT tracking algorithm or the Lucas-Kanade optical flow algorithm can be used to track the optical flow feature points from the previous frame of the interval frame to the next frame of the interval frame. Furthermore, the position changes of the optical flow feature points between different frames are calculated by the Lucas-Kanade optical flow algorithm, the Horn-Schunck optical flow algorithm, the Farneback optical flow algorithm, etc., to obtain the optical flow vector of each optical flow feature point.
[0080] In addition, as another optional embodiment of the present invention, performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames includes:
[0081] Constructing an optical flow estimation model, and scaling the interval frames to obtain scaled interval frames;
[0082] Inputting the scaled interval frames into the first convolution layer and the pooling layer in the optical flow estimation model in sequence to obtain a feature vector of the scaled interval frames;
[0083] Performing feature matching on the feature vectors in the zoom interval frames using the second convolutional layer in the optical flow estimation model to obtain a feature vector similarity image;
[0084] Inputting the feature vector similarity image into the third convolutional layer in the optical flow estimation model to obtain an optical flow vector of each pixel in the feature vector similarity image;
[0085] The optical flow vector is visualized to obtain an optical flow estimation frame.
[0086] In an embodiment of the present invention, the optical flow estimation model may be a convolutional neural network including three convolutional layers and one pooling layer.
[0087] In an optional embodiment of the present invention, since an optical flow estimation model is used to perform optical flow estimation on the interval frames, it is necessary to calculate the displacement vector of each pixel point of the interval frames. In order to improve the efficiency and speed of optical flow estimation, when the interval frames are sparse point optical flow, the optical flow estimation model is used to perform optical flow estimation on the interval frames. When the interval frames are dense optical flow, the Harris corner detection algorithm and the Lucas-Kanade optical flow algorithm are used to perform optical flow estimation on the interval frames.
[0088] S3. According to the interval frames and the optical flow estimation frames, the monitoring video frames between the interval frames are predicted to obtain predicted intermediate frames.
[0089] The embodiment of the present invention predicts the surveillance video frames between the interval frames based on the interval frames and the optical flow estimation frames, thereby realizing detection of the surveillance video to be detected in two dimensions, namely, space and time, and solves the problem of low accuracy of video abnormal behavior detection by conventional unsupervised methods when the abnormal situation in the surveillance video to be detected occurs in spatial and temporal motion.
[0090] Further, as an optional embodiment of the present invention, predicting the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain the predicted intermediate frames includes:
[0091] Calculating the intermediate value of each optical flow vector in the optical flow estimation frame of the interval frame to obtain an intermediate value optical flow estimation frame;
[0092] Subtracting the pixel value of the previous frame image in the interval frame from the pixel value of the next frame image in the interval frame to obtain a difference image of the interval frame;
[0093] Using a downsampling layer in a preset interpolation network to extract features from the difference image, a low-dimensional feature matrix;
[0094] According to the intermediate value optical flow estimation frame, a deconvolution calculation is performed on the low-dimensional feature matrix to obtain a predicted intermediate frame.
[0095] In an embodiment of the present invention, the preset interpolation network may be a U-Net model including a convolutional layer and a deconvolutional layer.
[0096] An optional embodiment of the present invention calculates the intermediate value of the optical flow vector for the optical flow estimation frame and calculates the difference image for the interval frame, thereby ensuring the accuracy of image restoration of the feature matrix of the difference image using the interpolation network, thereby improving the accuracy of predicting the intermediate frame and improving the accuracy of detecting abnormal video behavior.
[0097] S4. Extract features from the predicted intermediate frame and the real intermediate frame between the interval frames respectively to obtain predicted frame features and real frame features.
[0098] In the embodiment of the present invention, the real intermediate frame may be a frame image that actually exists between the interval frames in the monitoring video frame.
[0099] The embodiment of the present invention extracts features from the predicted intermediate frame and the real intermediate frame between the interval frames respectively, and enhances the difference between the normal monitoring video and the abnormal monitoring video from the feature space, thereby improving the accuracy of unsupervised video abnormal behavior detection.
[0100] In detail, as an optional embodiment of the present invention, in the step of respectively extracting features from the predicted intermediate frame and the real intermediate frame between the interval frames to obtain predicted frame features and real frame features, extracting features from the predicted intermediate frame to obtain predicted frame features includes:
[0101] Normalizing pixels of the predicted intermediate frame to obtain a standard predicted intermediate frame;
[0102] Calculate the intermediate frame feature map matrix using the preset convolution kernel matrix and the standard prediction intermediate frame according to the preset step size;
[0103] Performing average region division on the intermediate frame feature map matrix to obtain a plurality of sub-regions of the same size;
[0104] A maximum pixel value among the pixel values in each of the sub-regions is selected, and the maximum pixel value is used as the pixel value of the corresponding sub-region to obtain the predicted frame feature.
[0105] In the embodiment of the present invention, the preset convolution kernel matrix may be a function of weighted average of pixels in a small area of the input image. The preset step size may be set by a technician according to the number of convolutions.
[0106] In an optional embodiment of the present invention, by performing convolution pooling on the predicted intermediate frame, the predicted frame features of the predicted intermediate frame are obtained, thereby ensuring the accuracy of the predicted frame features.
[0107] Furthermore, in the embodiment of the present invention, the step of extracting features from the real intermediate frames between the interval frames to obtain real frame features is similar to the step of extracting features from the predicted intermediate frames to obtain predicted frame features, and therefore is not described in detail.
[0108] S5. Calculate the similarity between the predicted intermediate frame and the real intermediate frame using a preset function according to the predicted frame features and the real frame features.
[0109] In the embodiment of the present invention, the preset function may be an L2 regularized similarity calculation function.
[0110] The embodiment of the present invention calculates the similarity between the predicted intermediate frame and the real intermediate frame according to the predicted frame features and the real frame features using a preset function, and determines the degree of difference between the predicted intermediate frame and the real intermediate frame according to the similarity, thereby realizing abnormal behavior detection of the surveillance video to be detected.
[0111] In detail, as an optional embodiment of the present invention, the calculating the similarity between the predicted intermediate frame and the real intermediate frame by using a preset function according to the predicted frame feature and the real frame feature includes:
[0112] The similarity between the predicted intermediate frame and the real intermediate frame is calculated using the following function:
[0113]
[0114] Wherein, the l2 refers to the similarity between the predicted intermediate frame and the real intermediate frame; Refers to the predicted frame features of the predicted intermediate frame; the f t refers to the real frame feature of the real intermediate frame; Refers to the L2 norm of the predicted frame feature; the ‖f t ‖2 refers to the L2 norm of the real frame feature.
[0115] An optional embodiment of the present invention obtains the similarity between the predicted intermediate frame and the real intermediate frame by calculating the inner product of the predicted frame feature and the real frame feature and dividing it by the product of the L2 norm of the predicted frame feature and the real frame feature, wherein the range of the similarity is a real number in a closed interval from 1 to -1, and when the value of the similarity is closer to 1, it means that the predicted frame feature is more similar to the real frame feature; when the value of the similarity is closer to -1, it means that the predicted frame feature is less similar to the real frame feature; when the value of the similarity is equal to 0, it means that there is no similarity between the predicted frame feature and the real frame feature.
[0116] S6. When the similarity is less than a preset threshold, it is determined that abnormal behavior exists in the surveillance video to be detected.
[0117] In the embodiment of the present invention, the preset threshold is usually 0.3, and can be adjusted according to the accuracy of abnormal behavior detection.
[0118] In an optional embodiment of the present invention, when the similarity is less than a minimum similarity value set in advance, it proves that the predicted frame features of the predicted intermediate frame are very different from the real frame features of the real intermediate frame, which is insufficient to determine that the predicted intermediate frame is similar to the real intermediate frame. Therefore, when the similarity is less than the preset threshold, it is determined that the surveillance video to be detected has abnormal behavior.
[0119] The embodiment of the present invention obtains the predicted intermediate frame by performing optical flow estimation and video frame prediction on the interval frame, thereby realizing the detection of the surveillance video in two dimensions of space and time, solving the situation that the abnormal situation in the surveillance video occurs in the spatial and temporal motion. Furthermore, the predicted intermediate frame and the real intermediate frame are subjected to feature extraction, and the difference between the normal surveillance video and the abnormal surveillance video is enhanced from the feature space, thereby improving the accuracy of the unsupervised video abnormal behavior detection. Therefore, the unsupervised video abnormal behavior detection method provided by the present invention can improve the accuracy of the unsupervised video abnormal behavior detection.
[0120] like Figure 4 , which is a functional module diagram of the unsupervised video abnormal behavior detection device of the present invention.
[0121] The unsupervised video abnormal behavior detection device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the unsupervised video abnormal behavior detection device 100 can include a video frame optical flow estimation module 101, a video frame feature extraction module 102 and a video frame abnormal behavior judgment module 103. The module of the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0122] In this embodiment, the functions of each module / unit are as follows:
[0123] The video frame optical flow estimation module 101 is used to obtain a surveillance video to be detected, decompose the surveillance video to be detected into surveillance video frames, perform frame extraction on the surveillance video frames at preset intervals to obtain interval frames, perform optical flow estimation on the interval frames, and obtain optical flow estimation frames of the interval frames.
[0124] The video frame feature extraction module 102 is used to predict the monitoring video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain predicted intermediate frames, and to extract features from the predicted intermediate frames and the real intermediate frames between the interval frames to obtain predicted frame features and real frame features.
[0125] The video frame abnormal behavior judgment module 103 is used to calculate the similarity between the predicted intermediate frame and the real intermediate frame according to the predicted frame features and the real frame features using a preset function, and when the similarity is less than a preset threshold, it is determined that the surveillance video to be detected has abnormal behavior.
[0126] The embodiment of the present invention obtains the predicted intermediate frame by performing optical flow estimation and video frame prediction on the interval frame, thereby realizing the detection of the surveillance video in two dimensions of space and time, solving the problem that the abnormal situation in the surveillance video occurs in the spatial and temporal motion. Furthermore, the predicted intermediate frame and the real intermediate frame are subjected to feature extraction, and the difference between the normal surveillance video and the abnormal surveillance video is enhanced from the feature space, thereby improving the accuracy of the unsupervised video abnormal behavior detection. Therefore, the unsupervised video abnormal behavior detection device provided by the present invention can improve the accuracy of the unsupervised video abnormal behavior detection.
[0127] like Figure 5 , which is a schematic diagram of the structure of an electronic device for implementing the unsupervised video abnormal behavior detection method according to the present invention.
[0128] The electronic device may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as an unsupervised video abnormal behavior detection program.
[0129] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. The memory 11 may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory 11 may also be an external storage device of an electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as code based on an unsupervised video abnormal behavior detection program, but also can be used to temporarily store data that has been output or is to be output.
[0130] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, unsupervised video abnormal behavior detection programs, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0131] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is configured to realize connection and communication between the memory 11 and at least one processor 10, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0132] Figure 5 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0133] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0134] Optionally, the communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
[0135] Optionally, the communication interface 13 may also include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0136] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0137] The unsupervised video abnormal behavior detection program stored in the memory 11 in the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:
[0138] Obtaining a surveillance video to be detected, and decomposing the surveillance video to be detected into surveillance video frames;
[0139] Extracting frames from the surveillance video frames at preset intervals to obtain interval frames, and performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames;
[0140] Predicting the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain predicted intermediate frames;
[0141] Extracting features from the predicted intermediate frame and the real intermediate frame between the interval frames respectively to obtain predicted frame features and real frame features;
[0142] Calculating the similarity between the predicted intermediate frame and the real intermediate frame using a preset function according to the predicted frame feature and the real frame feature;
[0143] When the similarity is less than a preset threshold, it is determined that the surveillance video to be detected has abnormal behavior.
[0144] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0145] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable medium can be non-volatile or volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM).
[0146] An embodiment of the present invention may further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:
[0147] Obtaining a surveillance video to be detected, and decomposing the surveillance video to be detected into surveillance video frames;
[0148] Extracting frames from the surveillance video frames at preset intervals to obtain interval frames, and performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames;
[0149] Predicting the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain predicted intermediate frames;
[0150] Extracting features from the predicted intermediate frame and the real intermediate frame between the interval frames respectively to obtain predicted frame features and real frame features;
[0151] Calculating the similarity between the predicted intermediate frame and the real intermediate frame using a preset function according to the predicted frame feature and the real frame feature;
[0152] When the similarity is less than a preset threshold, it is determined that the surveillance video to be detected has abnormal behavior.
[0153] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0154] In the several embodiments provided by the present invention, it should be understood that the disclosed electronic device, apparatus and method can be implemented in other ways. For example, the apparatus embodiment described above is only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0155] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0156] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0157] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0158] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0159] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0160] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for detecting abnormal behavior in videos based on unsupervised learning, characterized in that: The method comprises: Obtaining a surveillance video to be detected, and decomposing the surveillance video to be detected into surveillance video frames; Extracting frames from the surveillance video frames at preset intervals to obtain interval frames, and performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames; Predicting the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain predicted intermediate frames; Extracting features from the predicted intermediate frame and the real intermediate frame between the interval frames respectively to obtain predicted frame features and real frame features; Calculating the similarity between the predicted intermediate frame and the real intermediate frame using a preset function according to the predicted frame feature and the real frame feature; When the similarity is less than a preset threshold, it is determined that the surveillance video to be detected has abnormal behavior.
2. The unsupervised video abnormal behavior detection method according to claim 1, characterized in that: The performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames includes: Constructing an optical flow estimation model, and scaling the interval frames to obtain scaled interval frames; Inputting the scaled interval frames into the first convolution layer and the pooling layer in the optical flow estimation model in sequence to obtain a feature vector of the scaled interval frames; Performing feature matching on the feature vectors in the zoom interval frames using the second convolutional layer in the optical flow estimation model to obtain a feature vector similarity image; Inputting the feature vector similarity image into the third convolutional layer in the optical flow estimation model to obtain an optical flow vector of each pixel in the feature vector similarity image; The optical flow vector is visualized to obtain an optical flow estimation frame.
3. The unsupervised video abnormal behavior detection method according to claim 1, characterized in that: The performing optical flow estimation on the interval frames to obtain optical flow estimation frames of the interval frames includes: Performing image denoising processing on the interval frames to obtain denoised interval frames; Extracting feature points from the denoised interval frames to obtain optical flow feature points; Performing feature tracking on the optical flow feature points to obtain an optical flow vector; The optical flow vector is visualized to obtain an optical flow estimation frame.
4. The unsupervised video abnormal behavior detection method according to claim 1, characterized in that: The step of predicting the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain the predicted intermediate frames includes: Calculating the intermediate value of each optical flow vector in the optical flow estimation frame of the interval frame to obtain an intermediate value optical flow estimation frame; Subtracting the pixel value of the previous frame image in the interval frame from the pixel value of the next frame image in the interval frame to obtain a difference image of the interval frame; Using a downsampling layer in a preset interpolation network to extract features from the difference image, a low-dimensional feature matrix; According to the intermediate value optical flow estimation frame, a deconvolution calculation is performed on the low-dimensional feature matrix to obtain a predicted intermediate frame.
5. The unsupervised video abnormal behavior detection method according to claim 1, characterized in that: In the step of respectively extracting features from the predicted intermediate frame and the real intermediate frame between the interval frames to obtain predicted frame features and real frame features, extracting features from the predicted intermediate frame to obtain predicted frame features includes: Normalizing pixels of the predicted intermediate frame to obtain a standard predicted intermediate frame; Calculate the intermediate frame feature map matrix using the preset convolution kernel matrix and the standard prediction intermediate frame according to the preset step size; Performing average region division on the intermediate frame feature map matrix to obtain a plurality of sub-regions of the same size; A maximum pixel value among the pixel values in each sub-region is selected, and the maximum pixel value is used as the pixel value of the corresponding sub-region to obtain the predicted frame feature.
6. The unsupervised video abnormal behavior detection method according to claim 1, characterized in that: The calculating the similarity between the predicted intermediate frame and the real intermediate frame by using a preset function according to the predicted frame feature and the real frame feature includes: The similarity between the predicted intermediate frame and the real intermediate frame is calculated using the following function: Wherein, the l2 refers to the similarity between the predicted intermediate frame and the real intermediate frame; Refers to the predicted frame features of the predicted intermediate frame; the f t refers to the real frame feature of the real intermediate frame; Refers to the L2 norm of the predicted frame feature; the ‖f t ‖2 refers to the L2 norm of the real frame feature.
7. The unsupervised video abnormal behavior detection method according to claim 1, characterized in that: Decomposing the surveillance video to be detected into surveillance video frames includes: Utilize the video frame reading function to cyclically read the image pixel matrix of each frame in the surveillance video to be detected; Perform pixel matching on the image pixel matrix to obtain an image file of each frame of the surveillance video to be detected; The image files are integrated according to the frame sequence of the surveillance video to be detected to obtain surveillance video frames.
8. A device for detecting abnormal behavior in video based on unsupervised operation, characterized in that: The device comprises: A video frame optical flow estimation module is used to obtain a surveillance video to be detected, decompose the surveillance video to be detected into surveillance video frames, perform frame extraction on the surveillance video frames at preset intervals to obtain interval frames, perform optical flow estimation on the interval frames, and obtain optical flow estimation frames of the interval frames; A video frame feature extraction module is used to predict the surveillance video frames between the interval frames according to the interval frames and the optical flow estimation frames to obtain predicted intermediate frames, and to extract features from the predicted intermediate frames and the real intermediate frames between the interval frames to obtain predicted frame features and real frame features; The video frame abnormal behavior judgment module is used to calculate the similarity between the predicted intermediate frame and the real intermediate frame according to the predicted frame features and the real frame features using a preset function, and when the similarity is less than a preset threshold, it is determined that the monitoring video to be detected has abnormal behavior.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the unsupervised video abnormal behavior detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for detecting abnormal behavior in video based on unsupervision is implemented as described in any one of claims 1 to 7.
Citation Information
Cited By
Video anomaly detection method based on Mask grid stability
CN121259736A
Real-time detection and recovery method and system for laser attack on vehicle-mounted vision system
CN122550442A