A method for video anomaly detection
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]本发明实施例提供了一种视频异常检测的方法,以至少解决现有人工智能技术实现不同场景中的异常事件检测时,使用单一训练场景下训练模型可能在其他场景中检测效果下降的技术问题
本发明提出了一种视频异常检测的方法,将源场景视频的视频帧输入轻量化视频特征提取器中进行特征提取,得到视频帧的多图像特征,并将多个图像特征进行上采样处理,得到每一图像特征对应的每一图像信息;计算每一图像信息和视频帧之间的多个损失函数,将多个损失函数中的最小值对应的图像信息的层数,确定为轻量化视频特征提取器的目标层数。
Smart Images

Figure CN118781513B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer software, and more specifically, to a method for video anomaly detection. Background Technology
[0002] With the widespread application of digital technology and the rapid development of information technology, modern industrial production, such as steel, petrochemicals, and manufacturing, is moving towards higher efficiency, larger scale, greater complexity, and greater integration. If any abnormality occurs in any process or subsystem and is not detected and effectively handled in a timely manner, these abnormalities will propagate, evolve, and develop in a chain reaction, severely impacting the safe operation of industrial production and product quality. Industrial production environments are permeated with surveillance cameras, so the detection of industrial production anomalies typically relies on video surveillance data. Traditional industrial video surveillance systems mainly rely on manual review of video footage after the fact. However, with the massive increase in video surveillance data, manual detection methods are inefficient and lack the ability to prevent abnormal events. Therefore, it is necessary to utilize artificial intelligence technology to achieve automatic detection of abnormal events in industrial production.
[0003] Existing video anomaly detection methods have limitations when applied to industrial production videos: First, existing methods primarily focus on detecting anomalies within a single scene. However, in industrial production videos, the same anomalous behavior may occur in different industrial settings. For example, the unusual behavior of a worker removing their safety helmet in a coal mine production scene could occur in a coal preparation workshop or a coking workshop. Limited by the different video backgrounds, the data distribution of anomalies will also vary, and a model trained in a single scene may perform worse in other scenes. Second, deploying video anomaly detection methods in industrial production on edge computing devices incurs high computational loads and long detection latency, making it difficult to respond quickly to anomalies. Summary of the Invention
[0004] This invention provides a method for video anomaly detection, which at least addresses the technical problem that when existing artificial intelligence technologies are used to detect anomalies in different scenarios, the detection performance of a model trained in a single training scenario may decrease in other scenarios.
[0005] According to one aspect of the present invention, a method for video anomaly detection is provided. The method may include: acquiring a first video frame of a source scene video; inputting the first video frame into a lightweight video feature extractor for feature extraction to obtain multiple first image features of the first video frame, and inputting the multiple first image features into a sample reconstructor to obtain each first image information corresponding to each first image feature, wherein the lightweight video feature extractor is a multi-level structured feature extractor; determining the target layer number of the lightweight video feature extractor based on each first image information and the first video frame; acquiring a second video frame of the target scene video; inputting the second video frame into the lightweight video feature extractor with the determined target layer number for feature extraction to obtain second image features of the second video frame, and inputting the second image features into a scene classifier to obtain target loss data corresponding to the second video frame; determining adversarial loss data corresponding to the target loss data based on the target loss data; adjusting the parameters of the lightweight video feature extractor with the determined layer number based on the adversarial loss data to maximize the adversarial loss data, wherein the adversarial loss data is used to characterize the probability value of considering the target scene video as the source scene video; and determining adaptive anomaly detection in the target scene video by the lightweight video feature extractor and the scene classifier when the adversarial loss data is maximized.
[0006] Optionally, based on each first image information and the first video frame, the target number of the lightweight video feature extractor is determined, including: calculating multiple reconstruction loss data between each first image information and the first video frame; and determining the target number of the lightweight video feature extractor based on the multiple reconstruction loss data.
[0007] Optionally, multiple reconstruction loss data are calculated between each first image information and the first video frame, including: calculating each first image information and the first video frame using the mean squared error loss function to obtain multiple reconstruction loss data.
[0008] Optionally, the target number of the lightweight video feature extractor is determined based on multiple reconstruction loss data, including: determining the number of layers of the lightweight video feature extractor corresponding to the first image information of the minimum value of multiple reconstruction loss data as the target number of the lightweight video feature extractor.
[0009] Optionally, after determining the target number of lightweight video feature extractors based on multiple reconstruction loss data, the method further includes: inputting the first image features into a scene classifier, and adjusting the parameters of the scene classifier so that the category label corresponding to the first image features is the source scene video.
[0010] Optionally, based on the target loss data, the adversarial loss data corresponding to the target loss data is determined, including: taking the negative of the target loss data to obtain the adversarial loss data.
[0011] The beneficial effects of this invention are: This invention proposes a method for video anomaly detection. The method involves inputting video frames of the source scene video into a lightweight video feature extractor for feature extraction, obtaining multiple image features of the video frames, and upsampling multiple image features to obtain each image information corresponding to each image feature. Multiple loss functions between each image information and the video frame are calculated, and the number of layers of the image information corresponding to the minimum value among the multiple loss functions is determined as the target number of layers of the lightweight video feature extractor.
[0012] Video frames from the target scene video are input into a lightweight video feature extractor with a defined target layer for feature extraction, yielding image features of the target scene video frames. These image features are then input into a scene classifier to obtain target loss data corresponding to the target scene video frame image features. The target loss data is then negatively taken to obtain the corresponding adversarial loss data. Based on the adversarial loss data, the parameters of the lightweight video feature extractor with a defined layer are adjusted to maximize the adversarial loss data. Under the condition of maximizing the adversarial loss data, the adaptive anomaly detection of the lightweight video feature extractor and scene classifier in the target scene video is determined. This solves the technical problem that existing artificial intelligence technologies may experience a decline in detection performance in other scenes when using a model trained in a single training scenario to detect anomalies in different scenarios. It achieves the technical effect of shortening the distance between different scenarios when performing anomaly detection in different scenarios and improving the detection performance of a model trained in a single training scenario applicable to different scenarios. Attached Figure Description
[0013] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 This is a flowchart of a video anomaly detection method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a lightweight video feature extractor according to an embodiment of the present invention; Figure 3 This is a schematic diagram of a sample reconstruction device according to an embodiment of the present invention; Figure 4 This is a schematic diagram of a multi-level video feature extractor according to an embodiment of the present invention; Figure 5 This is a schematic diagram illustrating the correspondence between video frames and reconstruction loss data in a coal mine production video according to an embodiment of the present invention. Figure 6 This is a schematic diagram of a video anomaly detection system according to an embodiment of the present invention. Detailed Implementation
[0014] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0015] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0016] Example 1 According to an embodiment of the present invention, a method for video anomaly detection is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system containing at least one set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0017] Figure 1 This is a flowchart of a video anomaly detection method according to an embodiment of the present invention, such as... Figure 1 As shown, the method may include the following steps: Step S101: Obtain the first video frame of the source scene video.
[0018] In the technical solution provided by step S101 of the present invention, a video of the source scene is captured, and a first video frame of the source scene video is obtained. The first video frame can be an image of a worker casually removing his safety helmet in a coal mine production scene. The source scene video can be represented by a first formula: (1) in, Indicates source domain video, Represents the source domain. Indicates the number of samples in the source domain. Indicates the video frame number in the source domain. This represents a video frame in the source domain.
[0019] Step S102: Input the first video frame into the lightweight video feature extractor for feature extraction to obtain multiple first image features of the first video frame, and input the multiple first image features into the sample reconstructor to obtain each first image information corresponding to each first image feature. The lightweight video feature extractor is a multi-level structure feature extractor.
[0020] In the technical solution provided in step S102 of the present invention, the lightweight video feature extractor performs multi-level extraction of features in the first video frame through multiple layers to obtain multiple first image features. An embodiment of the present invention provides a schematic diagram of a lightweight video feature extractor. Figure 2 This is a schematic diagram of a lightweight video feature extractor according to an embodiment of the present invention, as shown below. Figure 2 As shown.
[0021] exist Figure 2 In the middle, for the first Layer feature extraction unit, assuming its input features are The compressed features are obtained after passing through two 3×3 convolutional layers. The interdependence of the calculation channels is calculated, and each two-dimensional feature channel is considered. The input channel attention module performs weight calculations, as shown in the second formula: (2) in, Represents the weight of a particular channel; This represents the input characteristics of the channel. These represent the width and height of the input image, respectively; after assigning weights to each channel, they are weighted and summed. The data is then fused with the input features of the unit: the fusion process is shown in the third formula. , (3) in and Represents the Sigmoid and ReLU functions; , The parameters represent the upsampling layer and the convolutional layer; after passing through the extraction unit, the features of the video image are obtained. The present invention provides a schematic diagram of a sample reconstruction device, which inputs multiple first image features into the sample reconstruction device to obtain each first image information corresponding to each first image feature. Figure 3 This is a schematic diagram of a sample reconstruction device according to an embodiment of the present invention, as shown below. Figure 3 As shown. In Figure 3 In this process, each first image feature is upsampled (sample reconstruction) to obtain the first image information corresponding to each first image feature. Each feature extractor corresponds to one feature upsampling.
[0022] Step S103: Determine the target layer number of the lightweight video feature extractor based on each first image information and the first video frame.
[0023] In the technical solution provided by step S103 of the present invention, the first image information and the first video frame are processed to determine the target number of the lightweight video feature extractor. The present invention provides a schematic diagram of a multi-level video feature extractor. Figure 4 This is a schematic diagram of a multi-level video feature extractor according to an embodiment of the present invention, as shown below. Figure 4 As shown, in Figure 4 As can be seen from this, the feature extraction level can be as follows: the first level is X. 0,0 X 1,0 X 0,1 The second level is X 0,0 X 1,0 X 2,0 X 1,1 X 0,2 The same applies to other levels.
[0024] Step S104: Obtain the second video frame of the target scene video.
[0025] In the technical solution provided by step S104 of the present invention, a video of the target scene is captured, and a second video frame of the target scene video is obtained. The second video frame can be an image of a worker casually removing his safety helmet in a coal mine production scene. The target scene video can be represented by the fourth formula: (4) in, Indicates the target domain video. Indicates the target domain. Indicates the number of samples in the target domain. Indicates the video frame number in the target domain. This represents a video frame in the target domain.
[0026] Step S105: Input the second video frame into a lightweight video feature extractor with a determined target layer number for feature extraction to obtain the second image features of the second video frame, and input the second image features into a scene classifier to obtain the target loss data corresponding to the second video frame.
[0027] In the technical solution provided in step S105 of the present invention, a lightweight video feature extractor with a determined target layer number extracts features from the second video frame to obtain the second image features of the second video frame. These second image features are then input into a scene classifier to obtain the target loss data corresponding to the second video frame. Figure 3 Loss function in a scene classifier.
[0028] Step S106: Based on the target loss data, determine the adversarial loss data corresponding to the target loss data. Based on the adversarial loss data, adjust the parameters of the lightweight video feature extractor with a determined number of layers to maximize the adversarial loss data. The adversarial loss data is used to characterize the probability value of considering the target scene video as the source scene video.
[0029] In the technical solution provided in step S106 of the present invention, the target loss function is transformed to obtain the adversarial loss function corresponding to the target loss function. Based on the adversarial loss data, the parameters of the lightweight video feature extractor with a determined number of layers are adjusted to maximize the adversarial loss data.
[0030] Step S107: Under the condition of maximum adversarial loss data, determine the adaptive anomaly detection of the lightweight video feature extractor and scene classifier in the target scene video.
[0031] In the technical solution provided by step S107 of the present invention, the distance between the source scene features and the target scene features is minimized, thereby capturing video features under different scenes and reconstructing video frames. The difference between the reconstructed frame and the actual frame is used to determine whether the frame is abnormal, requiring optimized model design. To achieve the lowest possible latency and energy consumption while maintaining high accuracy, as shown in the following formula (5): (5) in, The optimization function of the model. This represents the number of parameters in the model. The value represents the detection time of the video frame, Energy represents the energy consumption of the model, AUC represents the accuracy of the model detection, auc represents the minimum accuracy, and Emax represents the maximum energy consumption that can be consumed.
[0032] The method described in this embodiment will be further described below.
[0033] As an optional embodiment, step S103, determining the target number of the lightweight video feature extractor based on each first image information and the first video frame, includes: calculating multiple reconstruction loss data between each first image information and the first video frame; and determining the target number of the lightweight video feature extractor based on the multiple reconstruction loss data.
[0034] In this embodiment, multiple reconstruction loss data are calculated for each first image information and the first video frame. Based on the multiple reconstruction loss data, the target layer of the lightweight video feature extractor is obtained, such as one layer, two layers, etc. This is only an example and is not a specific limitation.
[0035] As an optional embodiment, calculating multiple reconstruction loss data between each first image information and the first video frame includes: calculating each first image information and the first video frame using a mean squared error loss function to obtain multiple reconstruction loss data.
[0036] In this embodiment, each first image information and the first video frame are calculated using the mean square error loss function to obtain multiple reconstruction loss data, as shown in formula (6): (6) in, This indicates the reconstruction of the loss data. This represents the mean squared error loss function. This represents the i-th frame of the source domain video. Represents the feature extraction function. This represents the upsampling function.
[0037] The multi-level structure enables the feature extractor and sample reconstructor to extract and utilize video frame feature information from multiple levels. Each feature extraction unit is trained with dense connections to supervise the video frame reconstruction output at each level. The reconstruction loss of the image output at each level can also be expressed by formula (7): (7) in, Let represent the reconstruction result of the b-th video frame and the image reconstruction loss of the input image of the b-th video frame. This represents the reconstruction result of the b-th video frame; represents the actual input video frame b; N represents the batch size.
[0038] As an optional implementation method, the target number of lightweight video feature extractors is determined based on multiple reconstruction loss data, including: determining the number of lightweight video feature extractors of the first image information corresponding to the minimum value of multiple reconstruction loss data as the target number of lightweight video feature extractors.
[0039] In this embodiment, the number of layers in the lightweight video feature extractor corresponding to the minimum value of multiple reconstruction loss data is determined as the target number of the lightweight video feature extractor. The embodiment of the present invention provides a schematic diagram illustrating the correspondence between video frames and reconstruction loss data in a coal mine production video. Figure 5This is a schematic diagram illustrating the correspondence between video frames and reconstruction loss data in a coal mine production video according to an embodiment of the present invention, as shown below. Figure 5 As shown.
[0040] As an optional implementation, after determining the target number of layers of the lightweight video feature extractor based on multiple reconstruction loss data, the method further includes: inputting the first image features into the scene classifier, and adjusting the parameters of the scene classifier so that the category label corresponding to the first image features is the source scene video.
[0041] In this embodiment, during the processing of the first image features by the scene classifier, the parameters of the scene classifier are adjusted so that the category label corresponding to the first image features is the source scene video.
[0042] As an optional embodiment, step S106, based on the target loss data, determines the adversarial loss data corresponding to the target loss data, including: taking the negative of the target loss data to obtain the adversarial loss data.
[0043] In this embodiment, the relationship between adversarial loss data and target loss data is shown in formula (8): (8) in, Let C represent the adversarial loss data for the target scene video frames, and let C denote the scene classifier.
[0044] In this embodiment of the invention, video frames of the source scene video are input into a lightweight video feature extractor for feature extraction, resulting in multi-image features of the video frames. These multiple image features are then upsampled to obtain image information corresponding to each image feature. Multiple loss functions are calculated between each image information and the video frame. The layer number of the image information corresponding to the minimum value among these loss functions is determined as the target layer number of the lightweight video feature extractor. Video frames of the target scene video are then input into the lightweight video feature extractor with the determined target layer number for feature extraction, resulting in image features of the target scene video frames. These image features are then input into a scene classifier to obtain the target image information corresponding to the image features of the target scene video frames. The target loss data is negativeed to obtain the corresponding adversarial loss data. Based on the adversarial loss data, the parameters of the lightweight video feature extractor with a determined number of layers are adjusted to maximize the adversarial loss data. When the adversarial loss data is maximized, the adaptive anomaly detection of the lightweight video feature extractor and scene classifier in the target scene video is determined. This solves the technical problem that when existing artificial intelligence technologies detect anomalies in different scenes, the detection performance of the model trained in a single training scene may decrease in other scenes. This achieves the technical effect of shortening the distance between different scenes when performing anomaly detection in different scenes and improving the detection performance of the model trained in a single training scene for different scenes.
[0045] Example 2 According to embodiments of the present invention, a system for video anomaly detection is also provided. It should be noted that this system for determining the distance between videos of different scenes can be used to perform a video anomaly detection method as described in Embodiment 1.
[0046] Figure 6 This is a schematic diagram of a video anomaly detection system according to an embodiment of the present invention. Figure 6 As shown, a video anomaly detection system may include: a first acquisition unit, a first processing unit, a first determination unit, a second acquisition unit, a second processing unit, a third processing unit, and a second determination unit.
[0047] The first acquisition unit is used to acquire the first video frame of the source scene video.
[0048] The first processing unit is used to input the first video frame into a lightweight video feature extractor for feature extraction, obtain multiple first image features of the first video frame, and input the multiple first image features into a sample reconstructor to obtain each first image information corresponding to each first image feature. The lightweight video feature extractor is a multi-level structure feature extractor.
[0049] The first determining unit is used to determine the target layer number of the lightweight video feature extractor based on each first image information and the first video frame.
[0050] The second acquisition unit is used to acquire the second video frame of the target scene video.
[0051] The second processing unit is used to input the second video frame into a lightweight video feature extractor with a determined target layer number for feature extraction, to obtain the second image features of the second video frame, and to input the second image features into a scene classifier to obtain the target loss data corresponding to the second video frame.
[0052] The third processing unit is used to determine the adversarial loss data corresponding to the target loss data based on the target loss data, and to adjust the parameters of the lightweight video feature extractor with a determined number of layers based on the adversarial loss data to maximize the adversarial loss data. The adversarial loss data is used to characterize the probability value of considering the target scene video as the source scene video.
[0053] The second determining unit is used to determine the adaptive anomaly detection of the lightweight video feature extractor and scene classifier in the target scene video when the adversarial loss data is maximized.
[0054] Optionally, the first determining unit further includes: a calculation module for calculating multiple reconstruction loss data between each first image information and the first video frame; and a determining module for determining the target number of the lightweight video feature extractor based on the multiple reconstruction loss data.
[0055] Optionally, the calculation module may further include a processing submodule for calculating each first image information and the first video frame using the mean square error loss function to obtain multiple reconstruction loss data.
[0056] Optionally, the first determining module may further include: a determining submodule, used to determine the number of layers of the lightweight video feature extractor corresponding to the minimum value of multiple reconstructed loss data as the target number of the lightweight video feature extractor.
[0057] Optionally, after determining the target number of layers for the lightweight video feature extractor based on multiple reconstruction loss data, the system may further include: an adjustment unit, used to input the first image features into the scene classifier and adjust the parameters of the scene classifier so that the category label corresponding to the first image features is the source scene video.
[0058] Optionally, the third processing unit may further include: a processing module for negativeing the target loss data to obtain adversarial loss data.
[0059] In this embodiment, a first acquisition unit is used to acquire a first video frame of the source scene video; a first processing unit is used to input the first video frame into a lightweight video feature extractor for feature extraction, obtaining multiple first image features of the first video frame, and inputting the multiple first image features into a sample reconstruction unit to obtain each first image information corresponding to each first image feature, wherein the lightweight video feature extractor is a multi-level structure feature extractor; a first determination unit is used to determine the target layer number of the lightweight video feature extractor based on each first image information and the first video frame; a second acquisition unit is used to acquire a second video frame of the target scene video; a second processing unit is used to input the second video frame into the lightweight video feature extractor with the determined target layer number for feature extraction, obtaining a second image feature of the second video frame, and inputting the second image feature into a scene classifier to obtain a second video frame. The system comprises: a target loss data corresponding to a frequency frame; a third processing unit, used to determine the adversarial loss data corresponding to the target loss data, and to adjust the parameters of a lightweight video feature extractor with a determined number of layers based on the adversarial loss data to maximize the adversarial loss data, wherein the adversarial loss data is used to characterize the probability value of considering the target scene video as the source scene video; and a second determination unit, used to determine the adaptive anomaly detection of the lightweight video feature extractor and scene classifier in the target scene video when the adversarial loss data is maximized. This solves the technical problem that when existing artificial intelligence technologies detect anomalies in different scenarios, the detection performance of a model trained in a single training scenario may decrease in other scenarios. It achieves the technical effect of shortening the distance between different scenarios when performing anomaly detection in different scenarios and improving the detection performance of a model trained in a single training scenario applicable to different scenarios.
[0060] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0061] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0062] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0063] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0064] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a first processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0065] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0066] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for video anomaly detection, characterized in that, include: Obtain the first video frame of the source scene video; The first video frame is input into a lightweight video feature extractor for feature extraction to obtain multiple first image features of the first video frame. The multiple first image features are then input into a sample reconstructor to obtain each first image information corresponding to each first image feature. The lightweight video feature extractor is a multi-level structure feature extractor. Based on each first image information and the first video frame, the target number of the lightweight video feature extractor is determined; Obtain the second video frame of the target scene video; The second video frame is input into the lightweight video feature extractor that has determined the target layer number for feature extraction, to obtain the second image feature of the second video frame, and the second image feature is input into the scene classifier to obtain the target loss data corresponding to the second video frame; Based on the target loss data, the adversarial loss data corresponding to the target loss data is determined. Based on the adversarial loss data, the parameters of the lightweight video feature extractor with a determined number of layers are adjusted to maximize the adversarial loss data. The adversarial loss data is used to characterize the probability value of considering the target scene video as the source scene video. When the adversarial loss data is maximized, the lightweight video feature extractor and scene classifier are determined to perform adaptive anomaly detection in the target scene video.
2. The method according to claim 1, characterized in that, Determining the target layer number of the lightweight video feature extractor based on each first image information and the first video frame includes: Calculate multiple reconstruction loss data between each of the first image information and the first video frame; Based on the multiple reconstruction loss data, the target number of the lightweight video feature extractor is determined.
3. The method according to claim 2, characterized in that, The calculation of multiple reconstruction loss data between each first image information and the first video frame includes: The first image information and the first video frame are calculated using the mean squared error loss function to obtain the multiple reconstruction loss data.
4. The method according to claim 2, characterized in that, Determining the target number of the lightweight video feature extractor based on the multiple reconstruction loss data includes: The number of layers in the lightweight video feature extractor corresponding to the minimum value of the multiple reconstructed loss data is determined as the target number of the lightweight video feature extractor.
5. The method according to claim 2, characterized in that, After determining the target number of the lightweight video feature extractor based on the plurality of reconstruction loss data, the method further includes: The first image feature is input into the scene classifier, and the parameters of the scene classifier are adjusted so that the category label corresponding to the first image feature is the source scene video.
6. The method according to claim 1, characterized in that, The step of determining the adversarial loss data corresponding to the target loss data based on the target loss data includes: The target loss data is negativeized to obtain the adversarial loss data.
7. A system for video anomaly detection, characterized in that, include: The first acquisition unit is used to acquire the first video frame of the source scene video; The first processing unit is configured to input the first video frame into a lightweight video feature extractor for feature extraction, obtain multiple first image features of the first video frame, and input the multiple first image features into a sample reconstructor to obtain each first image information corresponding to each first image feature, wherein the lightweight video feature extractor is a multi-level structure feature extractor. The first determining unit is configured to determine the target number of the lightweight video feature extractor based on each first image information and the first video frame. The second acquisition unit is used to acquire the second video frame of the target scene video; The second processing unit is used to input the second video frame into the lightweight video feature extractor that has determined the target layer number for feature extraction, to obtain the second image feature of the second video frame, and input the second image feature into the scene classifier to obtain the target loss data corresponding to the second video frame; The third processing unit is used to determine the adversarial loss data corresponding to the target loss data based on the target loss data, and to adjust the parameters of the lightweight video feature extractor with a determined number of layers based on the adversarial loss data so as to maximize the adversarial loss data. The adversarial loss data is used to characterize the probability value of considering the target scene video as the source scene video. The second determining unit is used to determine the adaptive anomaly detection of the lightweight video feature extractor and scene classifier in the target scene video when the adversarial loss data is maximized.
8. A processor, characterized in that, The processor is used to run a program, wherein the program executes the method according to any one of claims 1 to 6 when it runs.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Anomaly detection method based on reconstruction and prediction
CN113705490A
Lightweight adaptive video anomaly detection method for intelligent hardware
CN117690052A