Video frame tampering detection method, device, equipment and medium in power grid environment
By using the time series anomaly detection model in video inter-frame tampering detection, the problem of video tampering detection in power grid frequency detection technology without reference to power grid frequency is solved, achieving effective detection of videos in different scenes, and enhancing applicability and practicality. It provides a video forensics method without reference to the power grid frequency database.
Patent Information
- Application Number
- CN202410788949.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing video tampering detection technology based on power grid frequency is difficult to detect inter-frame video tampering in lighting environments without reference to power grid frequency, especially in line exposure modes and dynamic scenes.
A method is adopted to obtain the line brightness signal samples of the video, perform DC component removal and down-sampling processing, and train the time series anomaly detection model, including convolution blocks, bidirectional gated recurrent units and attention mechanisms, to detect whether the video is has been tampered with, enabling video inter-frame tampering detection without extracting power grid signals.
It realizes the processing of video brightness in different scenes, converts two-dimensional data into one-dimensional time series, without extracting power grid signals, enhances applicable scenarios and practicality, and provides a video inter-frame tampering detection method without a reference power grid frequency database. , effectively used for video forensics containing ENF signals.
Smart Images

Figure CN118368483B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video tampering detection, and in particular to a method, device, equipment and medium for detecting video inter-frame tampering in a power grid environment. Background Art
[0002] Electric Network Frequency (ENF) refers to the transmission frequency of the power grid, which fluctuates around 50Hz or 60Hz. Videos shot in a power grid environment may show flicker artifacts caused by changes in the intensity of light sources in the AC power grid, showing the same pattern as ENF fluctuations. This flicker is characterized by its time-varying and quasi-periodic nature, and is an effective clue for video tampering forensics.
[0003] At present, there are two types of video forensics technologies based on ENF signals. One type of technology uses the real ENF database as a reference to detect and locate tampered videos. The other type uses the phase continuity of the ENF signal to detect and locate tampering in videos under global exposure mode. These two types of technologies have the following defects: first, the ENF signal needs to be accurately estimated from the video and the real ENF database needs to be used as a reference to achieve detection; second, the video collected under the line exposure mode and the dynamic scene are not considered, which makes it difficult to implement video tampering detection. Summary of the invention
[0004] The purpose of the present invention is to realize inter-frame tampering detection of a video collected by a CMOS sensor under a lighting environment without the need to refer to a power grid frequency.
[0005] The technical solution adopted by the present invention to solve its technical problem is:
[0006] A method for detecting video frame tampering in a power grid environment comprises the following steps:
[0007] Acquire a data set containing multiple videos; wherein the videos include original videos containing power grid frequency signals and inter-frame tampered videos;
[0008] For each video, the average brightness value of all row pixels of each frame is calculated to obtain the row brightness sequence of each frame, and the row brightness sequences of all frames are connected to obtain the row brightness signal samples of each video;
[0009] Removing direct current components and performing downsampling operations on the row brightness signal samples to obtain preprocessed one-dimensional time series samples;
[0010] The one-dimensional time series sample is used to train a time series anomaly detection model; wherein the time series anomaly detection model includes: a feature extraction module consisting of two convolution blocks, each of which contains a one-dimensional convolution layer, a batch normalization layer, an activation layer and a maximum pooling layer, and the two convolution blocks are connected in series; a time series processing module consisting of a bidirectional gated recurrent unit, wherein the bidirectional gated recurrent unit exchanges two independent unidirectional gated recurrent unit layers, which receive the output features of the second convolution block, one for forward processing of the input sequence, and the other for reverse processing of the input sequence; a key information processing module consisting of an attention mechanism, which receives the output of the time series processing module as input, calculates the attention weight of each time step, and generates a weighted feature representation according to the attention weight; a classification module consisting of a Dropout layer and a fully connected layer, wherein the Dropout layer is used to reduce model overfitting and improve the generalization ability of the model, and the fully connected layer maps the weighted feature representation to the output category to obtain a classification result;
[0011] The video to be detected is detected by using the trained sequence anomaly detection model to output the classification result of the video, so as to determine whether the video has been tampered with.
[0012] Preferably, when the video is a static video, for each video, the average brightness value of all row pixels of each frame is calculated to obtain a row brightness sequence of each frame, and the row brightness sequences of all frames are connected to obtain a row brightness signal sample of each video, specifically including:
[0013] Calculate the average brightness value of all row pixels of each frame of each static video, and convert each frame image of the static video into a row brightness sequence;
[0014] The line brightness sequences of all frames are connected to form a line brightness signal sample representing each static video. .
[0015] Preferably, when the video is a dynamic video, for each video, the average brightness value of all row pixels of each frame is calculated to obtain a row brightness sequence of each frame, and the row brightness sequences of all frames are connected to obtain a row brightness signal sample of each video, specifically including:
[0016] A Gaussian mixture model is used to distinguish the foreground and background of each dynamic video, and a background subtraction algorithm is used to generate a binary mask for each frame to mark and block moving objects. In the binary mask, the pixel value representing the moving object is 255, and the pixel value representing the static area is 0.
[0017] The binary foreground mask of each frame is overlaid on the original dynamic video frame to block the moving object, wherein the pixel value of the moving object is modified to 255, while the pixel value of the static area remains unchanged, thereby obtaining each preprocessed dynamic video;
[0018] Calculate the average brightness value of unobstructed pixels in all rows of pixels in each frame of the preprocessed dynamic video, and convert each frame of the video into a one-dimensional brightness sequence;
[0019] Connect the one-dimensional brightness sequence of all frames to form a row brightness signal sample representing each dynamic video .
[0020] Preferably, removing the DC component and down-sampling the row brightness signal samples to obtain pre-processed one-dimensional time series samples specifically includes:
[0021] The row brightness signal samples are processed by removing the DC component, that is, the row brightness signal samples are subtracted from their average value to obtain a one-dimensional time series sample after the DC component is removed;
[0022] The one-dimensional time series samples after the DC component is removed are downsampled to 1000 Hz to obtain one-dimensional time series samples.
[0023] Preferably, using the one-dimensional time series samples to train a time series anomaly detection model specifically includes the following steps:
[0024] Read multiple one-dimensional time series samples and their corresponding category labels;
[0025] Each one-dimensional time series sample is standardized and divided into 80% of the samples as training samples and the remaining 20% as test samples.
[0026] The time series anomaly detection model is trained using training samples. The training process is repeated for 100 training cycles, and each training cycle completely traverses the training samples. In the processing of each batch, forward propagation, loss calculation, and back propagation are performed. The training process uses the cross entropy loss function and the Adam optimization algorithm to adjust the model weights.
[0027] After the training is completed, the time series anomaly detection model is tested using test samples, a single forward propagation is performed, and the accuracy, recall, and F1 score are calculated to evaluate the detection performance of the time series anomaly detection model.
[0028] Preferably, the inter-frame tampered video is generated by performing frame deletion, frame duplication and frame insertion of random frame numbers and fixed frame numbers at random positions on the original video.
[0029] The embodiment of the present invention further provides a video frame inter-frame tampering detection device in a power grid environment, comprising:
[0030] A data set acquisition unit, used to acquire a data set containing multiple videos; wherein the videos include original videos containing power grid frequency signals and inter-frame tampered videos;
[0031] A row brightness signal sample calculation unit is used to calculate the average brightness value of all row pixels of each frame of each video, obtain a row brightness sequence of each frame, and connect the row brightness sequences of all frames to obtain a row brightness signal sample of each video;
[0032] A preprocessing unit, used for removing DC components and performing downsampling operations on the row brightness signal samples to obtain preprocessed one-dimensional time series samples;
[0033] A training unit, used to train a time series anomaly detection model using the one-dimensional time series samples; wherein the time series anomaly detection model includes: a feature extraction module consisting of two convolution blocks, each of which contains a one-dimensional convolution layer, a batch normalization layer, an activation layer and a maximum pooling layer, and the two convolution blocks are connected in series; a time series processing module consisting of a bidirectional gated recurrent unit, wherein the bidirectional gated recurrent unit exchanges two independent unidirectional gated recurrent unit layers, which receive the output features of the second convolution block, one for forward processing of the input sequence, and the other for reverse processing of the input sequence; a key information processing module consisting of an attention mechanism, which receives the output of the time series processing module as input, calculates the attention weight of each time step, and generates a weighted feature representation according to the attention weight; a classification module consisting of a Dropout layer and a fully connected layer, wherein the Dropout layer is used to reduce model overfitting and improve the generalization ability of the model, and the fully connected layer maps the weighted feature representation to the output category to obtain a classification result;
[0034] The detection unit is used to detect the video to be detected through the trained sequence anomaly detection model to output the classification result of the video, so as to determine whether the video has been tampered with.
[0035] An embodiment of the present invention also provides a video frame tampering detection device in a power grid environment, which includes a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement the video frame tampering detection method in the power grid environment as described above.
[0036] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program can be executed by a processor of a device where the computer-readable storage medium is located to implement the video frame tampering detection method in a power grid environment as described above.
[0037] The present invention has the following effects:
[0038] 1) The present invention realizes the processing of video brightness in different scenes, converts two-dimensional data into one-dimensional time series, does not need to extract power grid signals, and does not restrict video scenes, thereby enhancing the applicable scenes and practicality;
[0039] 2) The time series anomaly detection model of the present invention realizes the video frame tampering detection without reference to the power grid frequency database by learning the characteristics of different time series samples, and effectively provides a forensic method for videos containing ENF signals. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A step diagram of a method for detecting video frame tampering in a power grid environment provided by the first embodiment of the present invention;
[0041] Figure 2 A schematic diagram of the working principle of the video frame tampering detection method according to an embodiment of the present invention;
[0042] Figure 3 A flow chart for generating row brightness signal samples;
[0043] Figure 4 Flowchart for generating preprocessed one-dimensional time series samples;
[0044] Figure 5 It is a structural diagram of the time series anomaly detection model of an embodiment of the present invention;
[0045] Figure 6 A schematic diagram of the structure of a video frame tampering detection device in a power grid environment provided by a second embodiment of the present invention. DETAILED DESCRIPTION
[0046] The present invention will be further described below in conjunction with examples and accompanying drawings. It should be understood that the examples are only used to illustrate the present invention, but not to limit the scope of the present invention. Without departing from the spirit and scope of the present invention, the changes and advantages that those skilled in the art can think of are all included in the present invention, and are protected by the attached claims and equivalents.
[0047] See also Figure 1 and Figure 2 The first embodiment of the present invention provides a method for detecting video frame tampering in a power grid environment, which can be performed by a video frame tampering detection device in a power grid environment (hereinafter referred to as a detection device), and in particular, is performed by one or more processors in the detection device to implement the following steps:
[0048] S101, obtaining a data set including multiple videos; wherein the videos include original videos containing power grid frequency signals and inter-frame tampered videos.
[0049] In this embodiment, the detection device may be a device with computing and processing capabilities, such as a laptop computer, a desktop computer, a server or a workstation, etc., and the present invention does not make any specific limitation.
[0050] In this embodiment, the inter-frame tampered video can be generated by modifying the original video.
[0051] Specifically, this embodiment introduces multiple original videos (which may include original static videos and original dynamic videos), clips all original videos to 1 minute, and then uses three inter-frame tampering methods to modify the original videos to obtain tampered videos, where the three inter-frame tampering methods specifically include frame deletion, frame duplication, and frame insertion. Finally, a static video dataset, a dynamic video dataset, and a mixed static and dynamic video dataset can be obtained.
[0052] S102, for each video, calculate the average brightness value of all row pixels of each frame, obtain a row brightness sequence of each frame, and connect the row brightness sequences of all frames to obtain a row brightness signal sample of each video.
[0053] like Figure 3 As shown, specifically, for static video:
[0054] Calculate the average brightness value of all row pixels of each frame of each static video, and convert each frame image of the static video into a row brightness sequence;
[0055] The line brightness sequences of all frames are connected to form a line brightness signal sample representing each static video. .
[0056] And for dynamic video:
[0057] A Gaussian mixture model is used to distinguish the foreground and background of each dynamic video, and a background subtraction algorithm is used to generate a binary mask for each frame to mark and block moving objects. In the binary mask, the pixel value representing the moving object is 255, and the pixel value representing the static area is 0.
[0058] The binary mask of each frame is overlaid on the original dynamic video frame to cover the moving object, wherein the pixel value of the moving object is modified to 255, while the pixel value of the static area remains unchanged, thereby obtaining each pre-processed dynamic video;
[0059] Calculate the average brightness value of unobstructed pixels in all rows of pixels in each frame of the preprocessed dynamic video, and convert each frame of the video into a one-dimensional brightness sequence;
[0060] Connect the one-dimensional brightness sequence of all frames to form a row brightness signal sample representing each dynamic video .
[0061] S103, removing direct current components and performing down-sampling operations on the row brightness signal samples to obtain pre-processed one-dimensional time series samples.
[0062] like Figure 4 As shown, specifically, for static video:
[0063] For each line luminance signal sample of the static video Remove the DC component and convert the row brightness signal samples Subtract the mean , get the one-dimensional time series sample after removing the DC component ;
[0064] For the one-dimensional time series samples after removing the DC component Take downsampling processing, time series samples Downsample to 1000Hz to obtain the time series samples used for the final detection model .
[0065] Likewise, for dynamic video:
[0066] The row brightness signal samples after motion detection preprocessing for each dynamic video Remove the DC component and use the row brightness signal samples Subtract the mean , get the one-dimensional time series sample after removing the DC component ;
[0067] For the one-dimensional time series samples after removing the DC component Take downsampling processing, time series samples Downsample to 1000Hz to obtain the time series samples used for the final detection model .
[0068] The sample generation method of this embodiment is derived from the relevant processing method in extracting the power grid frequency signal in the video. Considering that the power grid frequency signal in the video is mainly manifested as the change in brightness, and the signal is quasi-periodic and time-varying, it is considered to obtain the brightness signal samples in the order of each frame of video acquisition in the row exposure mode.
[0069] In addition, the one-dimensional time series samples calculated in this embodiment are calculated along each frame and each line of the video with a sequential rule, and a row cannot be randomly jumped for calculation. The length of the one-dimensional sequence obtained by calculating each frame is consistent with the height of each frame. Connecting the row brightness sequences of all frames will obtain a one-dimensional time series with a length of frame height * number of frames.
[0070] In this way, this embodiment calculates the brightness mean of each frame and each line of the video based on the characteristics and influence of the power grid frequency signal to connect all frames to obtain a one-dimensional time series, thereby ensuring the continuity and integrity of the data, being able to more accurately reflect the time-varying characteristics of the video brightness, and having higher accuracy in capturing the details of the brightness changes, which helps to more accurately detect video tampering.
[0071] S104: training a time series anomaly detection model using the one-dimensional time series samples.
[0072] like Figure 5 As shown, in this embodiment, the time series anomaly detection model includes: a feature extraction module composed of two convolution blocks, each convolution block contains a one-dimensional convolution layer, a batch normalization layer, an activation layer and a maximum pooling layer, and the two convolution blocks are connected in series; a time series processing module composed of a bidirectional gated recurrent unit (Bi-GRU), which receives the output features of the second convolution block, wherein the bidirectional gated recurrent unit exchanges two independent unidirectional gated recurrent unit layers, one for forward processing of the input sequence, and the other for reverse processing of the input sequence; a key information processing module composed of an attention mechanism, which receives the output of the time series processing module as input, calculates the attention weight of each time step, and generates a weighted feature representation according to the attention weight; a classification module composed of a Dropout layer and a fully connected layer, wherein the Dropout layer is used to reduce model overfitting and improve the generalization ability of the model, and the fully connected layer maps the weighted feature representation to the output category to obtain a classification result.
[0073] The time series anomaly detection model of this embodiment can first extract high-level local features and then capture the long-term dependencies in these high-level features. It can better retain and utilize the temporal dependency information in the time series and improve the effect of time series anomaly detection. At the same time, the addition of the attention mechanism allows the model to dynamically focus on important features at different positions in the sequence when processing the sequence, thereby improving the model's ability to capture key information.
[0074] In this embodiment, after obtaining the above-mentioned time series samples, a time series anomaly detection model can be trained based on the one-dimensional time series samples. Specifically:
[0075] First, read multiple one-dimensional time series samples and their corresponding category labels;
[0076] Among them, the category labels include original or tampered, which are marked in advance.
[0077] Then, each one-dimensional time series sample is standardized and divided into 80% of the samples as training samples and the remaining 20% as test samples.
[0078] The ratio of training samples to test samples can be divided according to actual needs and is not limited to a ratio of 4:1.
[0079] Next, the training samples are used to train the time series anomaly detection model. The training process is carried out for 100 training cycles, and each training cycle completely traverses the training samples. In the processing of each batch, forward propagation, loss calculation and back propagation are performed. The training process uses the cross entropy loss function and the Adam optimization algorithm to adjust the model weights.
[0080] In particular, the learning rate can be set to 1e-3.
[0081] Finally, after the training is completed, the time series anomaly detection model is tested using the test sample, a single forward propagation is performed, and the accuracy, recall, and F1 score are calculated to evaluate the detection performance of the time series anomaly detection model.
[0082] S105, detecting the video to be detected by using the trained sequence anomaly detection model to output a classification result of the video, thereby determining whether the video has been tampered with.
[0083] The embodiments of the present invention have the following effects:
[0084] 1) The embodiment of the present invention realizes the processing of video brightness of different scenes, converts two-dimensional data into one-dimensional time series, does not need to extract power grid signals, and does not restrict video scenes, thereby enhancing the applicable scenes and practicality;
[0085] 2) The time series anomaly detection model of the embodiment of the present invention realizes the video frame tampering detection without reference to the power grid frequency database by learning the characteristics of different time series samples, and effectively provides a forensics method for videos containing ENF signals.
[0086] See also Figure 6 The second embodiment of the present invention further provides a video frame tampering detection device in a power grid environment, which includes:
[0087] The data set acquisition unit 210 is used to acquire a data set including a plurality of videos; wherein the videos include original videos including power grid frequency signals and inter-frame tampered videos;
[0088] The row brightness signal sample calculation unit 220 is used to calculate the average brightness value of all row pixels of each frame of each video, obtain the row brightness sequence of each frame, and connect the row brightness sequences of all frames to obtain the row brightness signal samples of each video;
[0089] A preprocessing unit 230, configured to remove DC components and perform downsampling operations on the row brightness signal samples to obtain preprocessed one-dimensional time series samples;
[0090] A training unit 240 is used to train a time series anomaly detection model using the one-dimensional time series samples; wherein the time series anomaly detection model includes: a feature extraction module consisting of two convolution blocks, each of which contains a one-dimensional convolution layer, a batch normalization layer, an activation layer and a maximum pooling layer, and the two convolution blocks are connected in series; a time series processing module consisting of a bidirectional gated recurrent unit, which receives the output features of the second convolution block, wherein the bidirectional gated recurrent unit exchanges two independent unidirectional gated recurrent unit layers, one for forward processing of the input sequence, and the other for reverse processing of the input sequence; a key information processing module consisting of an attention mechanism, which receives the output of the time series processing module as input, calculates the attention weight of each time step, and generates a weighted feature representation according to the attention weight; a classification module consisting of a Dropout layer and a fully connected layer, wherein the Dropout layer is used to reduce model overfitting and improve the generalization ability of the model, and the fully connected layer maps the weighted feature representation to the output category to obtain a classification result;
[0091] The detection unit 250 is used to detect the video to be detected by using the trained sequence anomaly detection model to output the classification result of the video, so as to determine whether the video has been tampered with.
[0092] The third embodiment of the present invention also provides a video frame tampering detection device in a power grid environment, which includes a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement the video frame tampering detection method in the power grid environment as described above.
[0093] The fourth embodiment of the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program can be executed by a processor of a device where the computer-readable storage medium is located to implement the video frame-to-frame tampering detection method in a power grid environment as described above.
[0094] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0095] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A video frame tampering detection method in a power grid environment, It is characterized in that The following steps are involved: Acquire a data set containing multiple videos; wherein the videos include original videos containing power grid frequency signals and inter-frame tampered videos; For each video, the average brightness value of all rows of pixels in each frame is calculated to obtain the row brightness sequence of each frame, and the row brightness sequences of all frames are connected to obtain the row brightness signal samples of each video; wherein, when the video is a dynamic video, the average brightness value of all rows of pixels in each frame is calculated to obtain the row brightness sequence of each frame, and the row brightness sequences of all frames are connected to obtain the row brightness signal samples of each video, specifically including: for each dynamic video, a Gaussian mixture model is used to distinguish the foreground and background, and a background subtraction algorithm is used to generate a binary mask for each frame to mark and mask The moving object is blocked, wherein the pixel value representing the moving object in the binary mask is 255, and the pixel value representing the static area is 0; the binary mask of each frame is covered on the original dynamic video frame to block the moving object, wherein the pixel value of the moving object is modified to 255, while the pixel value of the static area remains unchanged, and each preprocessed dynamic video is obtained; the average brightness value of the unblocked pixels in all rows of pixels in each frame of the preprocessed dynamic video is calculated, and each frame of the video is converted into a one-dimensional brightness sequence; the one-dimensional brightness sequences of all frames are connected to form a row brightness signal sample representing each dynamic video ; Removing direct current components and performing downsampling operations on the row brightness signal samples to obtain preprocessed one-dimensional time series samples; The one-dimensional time series sample is used to train a time series anomaly detection model; wherein the time series anomaly detection model includes: a feature extraction module composed of two convolution blocks, each of which contains a one-dimensional convolution layer, a batch normalization layer, an activation layer and a maximum pooling layer, and the two convolution blocks are connected in series; a time series processing module composed of a bidirectional gated recurrent unit, which receives the output features of the second convolution block, wherein the bidirectional gated recurrent unit exchanges two independent unidirectional gated recurrent unit layers, one for forward processing of the input sequence, and the other for reverse processing of the input sequence; a key information processing module composed of an attention mechanism, which receives the output of the time series processing module as input, calculates the attention weight of each time step, and generates a weighted feature representation according to the attention weight; a classification module composed of a Dropout layer and a fully connected layer, wherein the Dropout layer is used to reduce model overfitting and improve the generalization ability of the model, and the fully connected layer maps the weighted feature representation to the output category to obtain a classification result; The video to be detected is detected by using the trained sequence anomaly detection model to output the classification result of the video, so as to determine whether the video has been tampered with.
2. The video frame tampering detection method in a power grid environment according to claim 1, It is characterized in that When the video is a static video, for each video, the average brightness value of all row pixels of each frame is calculated to obtain the row brightness sequence of each frame, and the row brightness sequences of all frames are connected to obtain the row brightness signal samples of each video, specifically including: Calculate the average brightness value of all row pixels of each frame of each static video, and convert each frame image of the static video into a row brightness sequence; The line brightness sequences of all frames are connected to form a line brightness signal sample representing each static video. .
3. According to the method for detecting video frame tampering in a power grid environment as described in claim 1, It is characterized in that The row brightness signal samples are subjected to a DC component removal and downsampling operation to obtain preprocessed one-dimensional time series samples, specifically including: The row brightness signal samples are processed by removing the DC component, that is, the row brightness signal samples are subtracted from their average value to obtain a one-dimensional time series sample after the DC component is removed; The one-dimensional time series samples after the DC component is removed are downsampled to 1000 Hz to obtain one-dimensional time series samples.
4. According to the method for detecting video frame tampering in a power grid environment as described in claim 1, It is characterized in that The one-dimensional time series samples are used to train a time series anomaly detection model, specifically including the following: Read multiple one-dimensional time series samples and their corresponding category labels; Each one-dimensional time series sample is standardized and divided into 80% of the samples as training samples and the remaining 20% as test samples. The time series anomaly detection model is trained using training samples. The training process is repeated for 100 training cycles, and each training cycle completely traverses the training samples. In the processing of each batch, forward propagation, loss calculation, and back propagation are performed. The training process uses the cross entropy loss function and the Adam optimization algorithm to adjust the model weights. After the training is completed, the time series anomaly detection model is tested using test samples, a single forward propagation is performed, and the accuracy, recall, and F1 score are calculated to evaluate the detection performance of the time series anomaly detection model.
5. According to the method for detecting video frame tampering in a power grid environment as described in claim 1, It is characterized in that The inter-frame tampered video is generated by performing frame deletion, frame duplication and frame insertion of random frame numbers and fixed frame numbers at random positions on the original video.
6. A video frame tampering detection device in a power grid environment, It is characterized in that include: A data set acquisition unit, used to acquire a data set containing multiple videos; wherein the videos include original videos containing power grid frequency signals and inter-frame tampered videos; The row brightness signal sample calculation unit is used to calculate the average brightness value of all row pixels of each frame of each video, obtain the row brightness sequence of each frame, and connect the row brightness sequences of all frames to obtain the row brightness signal samples of each video; when the video is a dynamic video, the row brightness signal sample calculation unit is specifically used to: adopt a Gaussian mixture model to distinguish the foreground and background of each dynamic video, use a background subtraction algorithm to generate a binary mask for each frame to mark and block the moving object, wherein the pixel value representing the moving object in the binary mask is 255, and the pixel value representing the static area is 0; the binary mask of each frame is covered on the original dynamic video frame to block the moving object, wherein the pixel value of the moving object is modified to 255, while the pixel value of the static area remains unchanged, to obtain each preprocessed dynamic video; calculate the average brightness value of the unblocked pixels in all row pixels of each frame of the preprocessed dynamic video, and convert each frame of the video into a one-dimensional brightness sequence; connect the one-dimensional brightness sequences of all frames to form a row brightness signal sample representing each dynamic video ; A preprocessing unit, used for removing DC components and performing downsampling operations on the row brightness signal samples to obtain preprocessed one-dimensional time series samples; A training unit, used for training a time series anomaly detection model using the one-dimensional time series samples; wherein the time series anomaly detection model comprises: a feature extraction module consisting of two convolution blocks, each of which contains a one-dimensional convolution layer, a batch normalization layer, an activation layer and a maximum pooling layer, and the two convolution blocks are connected in series; a time series processing module consisting of a bidirectional gated recurrent unit, which receives the output features of the second convolution block, wherein the bidirectional gated recurrent unit exchanges two independent unidirectional gated recurrent unit layers, one for forward processing of the input sequence, and the other for reverse processing of the input sequence; a key information processing module consisting of an attention mechanism, which receives the output of the time series processing module as input, calculates the attention weight of each time step, and generates a weighted feature representation according to the attention weight; a classification module consisting of a Dropout layer and a fully connected layer, wherein the Dropout layer is used to reduce model overfitting and improve the generalization ability of the model, and the fully connected layer maps the weighted feature representation to the output category to obtain a classification result; The detection unit is used to detect the video to be detected through the trained sequence anomaly detection model to output the classification result of the video, so as to determine whether the video has been tampered with.
7. A video frame tampering detection device in a power grid environment, It is characterized in that It includes a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement the video frame tampering detection method in a power grid environment as described in any one of claims 1 to 5.
8. A computer-readable storage medium, It is characterized in that A computer program is stored, and the computer program can be executed by a processor of the device where the computer-readable storage medium is located to implement the video frame tampering detection method in a power grid environment as described in any one of claims 1 to 5.
