Video detection model training method, video detection method, device and equipment
By perturbing the key points in the video frame sequence, we construct video frame samples that simulate deep forgery videos and train the video detection model, which solves the problems of insufficient video detection accuracy and generalization in the existing technology and achieves more efficient deep forgery. Video detection.
Patent Information
- Application Number
- CN202410923946.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-10-11
AI Technical Summary
In the existing technology, the detection accuracy of the video detection model is not high. Especially when facing deep fake videos, it is difficult to effectively identify the authenticity of the video, and the generalization is insufficient.
By obtaining the video frame sequence, perturbing the key points of the target object, constructing a video frame sequence sample, simulating the random jitter and drift phenomenon of key points in the deep fake video, and training the video detection model based on the sample to improve the detection capability of the model.
The detection accuracy and generalization of the video detection model are improved, allowing the model to more effectively identify abnormal features in deep fake videos and determine the authenticity of the video.
Smart Images

Figure CN118762402A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a video detection model training method, video detection method, device and equipment. Background Art
[0002] With the development of artificial intelligence technology, more and more videos are forged using Deepfake (specifically deep fake technology), and the importance of deep fake video detection has also increased. Among them, deep fake video detection refers to the process of detecting forged videos.
[0003] In related technologies, training samples are constructed by using techniques such as discarding, repeating, and fusing to train a video detection model for detecting the authenticity of a video. For example, for a certain video frame sequence, training samples are constructed by randomly deleting video frames, copying and adding video frames, fusing video frames, and other processes.
[0004] However, the similarity between the training samples and the forged videos obtained by using relevant technologies is low, resulting in low detection accuracy of the video detection model. Summary of the invention
[0005] The embodiment of the present application provides a video detection model training method, video detection method, device and equipment. The technical solution includes the following contents.
[0006] According to one aspect of an embodiment of the present application, a method for training a video detection model is provided, the method comprising:
[0007] Acquire a video frame sequence, wherein the video frame sequence includes a plurality of video frames related to the target object and arranged in chronological order;
[0008] For m video frames in the video frame sequence, perturb the key points of the target object in the video frames to obtain video frame sequence samples, and there is an abnormality in the change of features related to the key points of the target object in the video frame sequence samples, where m is a positive integer;
[0009] A video detection model is trained based on the video frame sequence samples to obtain a trained video detection model, and the trained video detection model is used to detect whether there is an abnormality in the video.
[0010] According to one aspect of an embodiment of the present application, a video detection method is provided, the method comprising:
[0011] Acquire at least one video frame sequence of a video, wherein the video frame sequence includes a plurality of video frames related to a target object and arranged in chronological order;
[0012] Acquire a first feature map of the video frame sequence through a video detection model, where the first feature map is used to indicate changes in features related to key points of the target object in the video frame sequence in a time dimension;
[0013] Obtaining a second feature map based on the first feature map by the video detection model, wherein the second feature map is used to indicate changes in features related to key points of the target object in the video frame sequence in a spatial dimension;
[0014] Obtaining, by means of the video detection model and based on the second feature map, a classification result of the video frame sequence, wherein the classification result of the video frame sequence is used to indicate whether there is an abnormality in a change of features related to key points of the target object in the video frame sequence;
[0015] A detection result of the video is obtained according to the classification results respectively corresponding to the at least one video frame sequence, and the detection result is used to indicate whether there is an abnormality in the video.
[0016] According to one aspect of an embodiment of the present application, a training device for a video detection model is provided, the device comprising:
[0017] A frame sequence acquisition module, used to acquire a video frame sequence, wherein the video frame sequence includes a plurality of video frames related to the target object and arranged in chronological order;
[0018] A key point perturbation module, for perturbing the key points of the target object in the m video frames in the video frame sequence, to obtain video frame sequence samples, wherein the changes of features related to the key points of the target object in the video frame sequence samples are abnormal, and m is a positive integer;
[0019] The detection model training module is used to train the video detection model based on the video frame sequence samples to obtain a trained video detection model, and the trained video detection model is used to detect whether there is anomaly in the video.
[0020] According to one aspect of an embodiment of the present application, a video detection device is provided, the device comprising:
[0021] A frame sequence acquisition module, used to acquire at least one video frame sequence of a video, wherein the video frame sequence includes a plurality of video frames related to a target object and arranged in chronological order;
[0022] A feature map extraction module, used for obtaining a first feature map of the video frame sequence through a video detection model, wherein the first feature map is used for indicating changes in features related to key points of the target object in the video frame sequence in a time dimension;
[0023] The feature map extraction module is further used to obtain a second feature map based on the first feature map through the video detection model, wherein the second feature map is used to indicate changes in features related to key points of the target object in the video frame sequence in a spatial dimension;
[0024] A classification result acquisition module, used to obtain a classification result of the video frame sequence based on the second feature map by using the video detection model, wherein the classification result of the video frame sequence is used to indicate whether there is an abnormality in the change of features related to the key points of the target object in the video frame sequence;
[0025] The inspection result acquisition module is used to obtain the detection result of the video according to the classification results corresponding to the at least one video frame sequence, and the detection result is used to indicate whether there is an abnormality in the video.
[0026] According to one aspect of an embodiment of the present application, a computer device is provided, which includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned video detection model training method, or to implement the above-mentioned video detection method.
[0027] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the training method of the above-mentioned video detection model, or to implement the above-mentioned video detection method.
[0028] According to one aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the training method of the video detection model or executes the video detection method.
[0029] The technical solution provided by the embodiments of the present application may include the following beneficial effects.
[0030] For the video frame sequence related to the target object, the key points of the target object are perturbed to construct video frame sequence samples, which simulates the "random jitter and drift of key points" phenomenon that is common in deep fake videos (videos constructed using deep fake technology). The video detection model is then trained with the video frame sequence samples, which enables the trained video detection model to have the ability to detect "random jitter and drift of key points", which is beneficial to improving the detection accuracy of the video detection model.
[0031] In addition, since the trained video detection model has the ability to detect "random jitter and drift of key points", the trained video detection model can also detect abnormalities in the "key points" for unseen deep fake videos to determine the authenticity of the video, thereby effectively improving the generalization of the video detection model. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0033] Figure 1 is a schematic diagram of a video detection system provided by an embodiment of the present application;
[0034] Figure 2 is a schematic diagram of a video detection model provided by an embodiment of the present application;
[0035] Figure 3 is a schematic diagram of a video detection model provided by another embodiment of the present application;
[0036] Figure 4 is a schematic diagram of an adapter provided by an embodiment of the present application;
[0037] Figure 5 is a flowchart of a method for training a video detection model provided by an embodiment of the present application;
[0038] Figure 6 is a schematic diagram of the FFD (Facial Feature Drift) phenomenon provided by an embodiment of the present application;
[0039] Figure 7 is a flowchart of a method for obtaining video frame sequence samples provided by an embodiment of the present application;
[0040] Figure 8 is a schematic diagram of a method for obtaining video frame sequence samples provided by an embodiment of the present application;
[0041] Fig. 9 is a flow chart of a video detection method provided by an embodiment of the present application;
[0042] Figures 10 to 14 is a schematic diagram of an information authentication interface provided by an embodiment of the present application;
[0043] Fig.15 is a schematic diagram of a first characteristic graph and a second characteristic graph provided by an embodiment of the present application;
[0044] Fig.16 is a block diagram of a training device for a video detection model provided by an embodiment of the present application;
[0045] Fig.17 is a block diagram of a training device for a video detection model provided by another embodiment of the present application;
[0046] Fig.18 is a block diagram of a video detection device provided by an embodiment of the present application;
[0047] Fig.19 It is a block diagram of a computer device provided by one embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0049] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0050] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, mechatronics, etc. Among them, pre-trained models are also called large models and basic models. After fine-tuning, they can be widely used in downstream tasks in various major directions of artificial intelligence. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0051] Computer vision (CV) is a science that studies how to make machines "see". To be more specific, it refers to using cameras and computers to replace human eyes to identify, follow and measure targets, and further perform image processing so that the computer processes the images into images that are more suitable for human observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multidimensional data. Large model technology has brought important changes to the development of computer vision technology. Pre-trained models in the field of vision, such as Swin-Transformer, ViT (Vision Transformer), V-MOE (Vision Mixture-of-Experts), and MAE (Masked Autoencoders), have been fine-tuned and can be quickly and widely applied to specific downstream tasks. Computer vision technology generally includes image processing, image recognition, image semantic understanding, image retrieval, OCR (Optical Character Recognition), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D (Three-Dimensional) technology, virtual reality, augmented reality, simultaneous positioning and map construction, etc.
[0052] The key technologies of speech technology include automatic speech recognition (ASR), text to speech (TTS), and voiceprint recognition. Enabling computers to listen, see, speak, and feel is the future development direction of human-computer interaction, among which speech has become one of the most promising human-computer interaction methods. Large model technology has brought changes to the development of speech technology. Pre-trained models such as WavLM and UniSpeech that use the Transformer architecture have strong generalization and versatility, and can excellently complete speech processing tasks in various directions.
[0053] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can enable effective communication between people and computers using natural language. Natural language processing involves natural language, which is the language people use in daily life. It is closely related to linguistics research and also involves computer science and mathematics. The pre-training model, an important technology for model training in the field of artificial intelligence, is developed from the large language model (Large Language Model) in the field of NLP. After fine-tuning, the large language model can be widely used in downstream tasks. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0054] Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning. The pre-trained model is the latest development of deep learning, which integrates the above technologies.
[0055] Autonomous driving technology refers to the ability of a vehicle to drive itself without the need for a driver. It usually includes technologies such as high-precision maps, environmental perception, computer vision, behavioral decision-making, path planning, and motion control. Autonomous driving includes multiple development paths such as single-vehicle intelligence, vehicle-road collaboration, and networked cloud control. Autonomous driving technology has a wide range of application prospects. In addition to the current fields of logistics, public transportation, taxis, and smart transportation, it will be further developed in the future.
[0056] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless cars, autonomous driving, drones, digital twins, virtual humans, robots, artificial intelligence-generated content (AI-Generated Content, AIGC), conversational interaction, smart medical care, smart customer service, game AI, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0057] The technical solution provided by the embodiments of the present application involves artificial intelligence computer vision technology and machine learning technology to achieve deep fake video detection. For example, it can use computer vision technology to construct video frame sequence samples, and then use computer vision technology and machine learning technology to train a video detection model based on the video frame sequence samples to obtain a video detection model that can be used to detect deep fake videos.
[0058] Deep fake video detection: refers to the process of detecting fake videos (such as face videos). Video fake technologies include but are not limited to: face replacement, face drive, face fusion and other AIGC (Artificial Intelligence Generated Content) technologies. Deep fake video detection can also be called video editing detection.
[0059] Deepfake technology: refers specifically to deep fake technology (widely known as AI face swapping), which represents fake images generated based on deep learning methods (such as images obtained by facial forgery). This technology can be used to generate fake images that do not exist in reality. Deepfake technology is usually divided into face replacement (Face-Swapping) and face drive (Face-Reenactment).
[0060] Adapter: It is a module that can be inserted into a pre-trained neural network (such as the pre-trained model mentioned above) to fine-tune the network to adapt to new tasks or data sets. Adapters usually contain one or two layers of networks, such as fully connected layers, convolutional layers, etc., which perform some transformations on the input data during the forward propagation of the network. By training the inserted Adapter, we can adapt the pre-trained neural network to new tasks without changing the weights of the original network. This method is widely used in transfer learning and multi-task learning.
[0061] Blending: It is a data augmentation method based on image fusion. In the field of Deepfake detection, it specifically refers to creating deep fake images by fusing the facial areas of two images through image fusion (such as Poisson fusion), and using it together with real images to train video detection models.
[0062] Video-level Blending: refers to blending operations at the video level (dimension) to produce a deep fake image sequence. Unlike Image-level Blending, Video-level Blending is rarely studied in the field of Deepfake detection.
[0063] The technical solution provided by the embodiments of the present application can be applied to any scenario requiring deep fake video detection, such as identity authentication (such as verification through recorded video), access control (such as face recognition access control), fake video detection, video detection model training, and training data construction for training video detection models. The technical solution provided by the embodiments of the present application can improve the detection accuracy of the video detection model and the generalization of the video detection model.
[0064] For example, in an identity authentication scenario, after obtaining the input video uploaded by the user, the client uses the trained video detection model to perform deep fake video detection on the input video to determine whether the input video is fake or edited. If the input video is a real video, identity authentication is performed based on the input video; if the input video is a fake video (such as a fake video / edited video), the verification is judged to have failed or the user is prompted to re-upload the video.
[0065] The following is an explanation of the video detection model provided in the embodiments of the present application.
[0066] Please refer to Figure 1 , which shows a schematic diagram of a video detection system provided by an embodiment of the present application. The video detection system may include a model training device 10 and a model using device 20.
[0067] The model training device 10 can be an electronic device such as a mobile phone, a desktop computer, a tablet computer, a laptop computer, a PC (Personal Computer), a vehicle terminal, a server, an intelligent robot, a smart TV, a multimedia playback device, or other electronic devices with strong computing power, which is not limited in the present embodiment of the application. Among them, the server can be a server, a server cluster composed of multiple servers, or a cloud computing service center.
[0068] The model training device 10 is used to train the video detection model 30. The video detection model 30 refers to an AI model used to detect whether there is an abnormality in the video (such as whether it is a deep fake video). The AI model refers to a mathematical model based on artificial intelligence technology that can automatically process and analyze the input data and output corresponding results. The AI model includes models with a large number of parameters trained by deep learning algorithms and artificial neural networks, such as the above-mentioned large model, large language model, pre-trained model, pre-trained neural network, etc.
[0069] The video detection model 30 takes the video frame sequence corresponding to the video as input and takes the classification result of the video frame sequence as output. The classification result is used to indicate whether the video frame sequence is abnormal. Then, based on the classification result of the video frame sequence, it can be judged whether the video is abnormal to achieve deep fake video detection. Optionally, the model training device 10 can use machine learning to train the video detection model 30 using video frame sequence samples to obtain the trained video detection model 30 so that it has better performance.
[0070] The trained video detection model 30 can be deployed in the model using device 20 to provide video detection (such as deep fake video detection) services. The model using device 20 can be an electronic device such as a mobile phone, a desktop computer, a tablet computer, a laptop computer, a personal computer, a vehicle terminal, a server, an intelligent robot, a smart TV, a multimedia playback device, or other electronic devices with strong computing power, which is not limited in the embodiments of the present application.
[0071] Optionally, a client running a target application may be installed in the model using device 20, and the target application may include at least one of the following: a video detection application, an identity authentication application, an access control application, a model training application, a social entertainment application, a game application, a shopping application, and a payment application. Optionally, the target application supports the use of the trained video detection model 30.
[0072] In some embodiments, please refer to Figure 2 , which shows a schematic diagram of a video detection model provided by an embodiment of the present application. The video detection model 30 includes: a temporal feature extraction network 301 and a spatial feature extraction network 302.
[0073] The temporal feature extraction network 301 is used to extract features from the video frame sequence samples to obtain a first feature map corresponding to the target object in the time dimension, and the first feature map can be used to indicate the change of the features corresponding to the target object in the video frame sequence samples in the time dimension. The temporal feature extraction network 301 takes the word embedding blocks (Embedded Patches) of the video frame sequence samples as input and the first feature map as output.
[0074] In one example, the temporal feature extraction network 301 is constructed based on the first pre-trained neural network 301a and the first adapter 301b. The first pre-trained neural network 301a is used to extract features from video frame sequence samples to obtain feature data, and the first adapter 301b is used to adjust the first pre-trained neural network 301a to the temporal task, that is, to convert the feature data to obtain a first feature map related to the temporal dimension.
[0075] Optionally, the first pre-trained neural network 301a is a pre-trained neural network, which can be constructed based on any neural network that can be used to process videos, such as Transformer, Swin-Transformer, ViT, V-MOE, MAE, CNN (Convolutional Neural Networks), RNN (Recurrent Neural Network), ResNet (Residual Networks), CLIP (Contrastive Language-Image Pre-tranining, a text-image pre-training model based on contrastive learning), etc. The first adapter 301b can be inserted into the first pre-trained neural network 301a.
[0076] The spatial feature extraction network 302 is used to extract features from the output of the temporal feature extraction network 301 to obtain a second feature map corresponding to the target object in the spatial dimension. The second feature map can be used to indicate the change in the spatial dimension of the features corresponding to the target object in the video frame sequence samples. The spatial feature extraction network 302 takes the first feature map as input and the second feature map as output.
[0077] In one example, the spatial feature extraction network 302 is constructed based on the second pre-trained neural network 302a and the second adapter 302b. The second pre-trained neural network 302a is used to extract features from the first feature map to obtain feature data, and the second adapter 302b is used to adjust the second pre-trained neural network 302a to the spatial task, that is, to convert the feature data to obtain a second feature map related to the spatial dimension.
[0078] Optionally, the second pre-trained neural network 302a is also a pre-trained neural network, which can be constructed based on any neural network that can be used to process videos, such as Transformer, Swin-Transformer, ViT, V-MOE, MAE, CNN, RNN, ResNet, CLIP, etc. The second adapter 302b can be inserted into the second pre-trained neural network 302a.
[0079] In one example, the network structure of the first pre-trained neural network 301a is the same as the network structure of the second pre-trained neural network 302a, the network structure of the first adapter 301b is the same as the network structure of the second adapter 302b, but the task of the first adapter 301b is different from the task of the second adapter 302b, which is not limited in this embodiment of the present application.
[0080] For example, refer to Figure 3 Taking the construction of a video detection model 30 based on ViT as an example, the video detection model 30 includes 14 blocks, each of which includes a temporal feature extraction network, a spatial feature extraction network, a normalization layer (Norm) and a multilayer perceptron (Multilayer Perceptron, MLP). Among them, the temporal feature extraction network includes a first pre-trained network 301a inserted into a first adapter 301b (i.e., T-Adapter), and the spatial feature extraction network includes a second pre-trained network 302a inserted into a second adapter 302b (i.e., S-Adapter). Both the first pre-trained network 301a and the second pre-trained network 302a can be constructed based on the encoder in ViT, such as including a first normalization layer and a multi-head attention mechanism layer (Multi-Head Attention). Optionally, the pre-trained weights on CLIP can also be used to initialize the first pre-trained network 301a and the second pre-trained network 302a to migrate the pre-trained weights of ViT to the video processing task.
[0081] refer to Figure 4 The first adapter 301b and the second adapter 302b may include two fully connected layers (FC): fully connected layer 1 and fully connected layer 2, and a rectification layer (such as GELU, Gaussian error linear unit).
[0082] Optionally, the video detection model 30 also includes an I3D Head (a network structure for extracting video features, such as overlapping features in the time dimension to obtain a spatiotemporal feature map) and a classifier, the I3D Head takes the output corresponding to the 14 Blocks as input and the spatiotemporal feature map of the video frame sequence sample as output. The classifier is used to classify the video frame sequence samples to obtain the classification results of the video frame sequence samples, and the classifier takes the output of the I3D Head as input and the classification results as output.
[0083] It should be noted that Figures 2 to 4 The video detection model 30 shown is only exemplary and explanatory. The embodiment of the present application does not limit the structure of the video detection model 30, which can be set and adjusted according to actual usage requirements.
[0084] The following is an embodiment of the method of the present application. The training method of the video detection model 30 is explained through this method embodiment. For details not disclosed in the embodiment of the method of the present application, please refer to the above embodiment.
[0085] Please refer to Figure 5, which shows a flowchart of a method for training a video detection model provided by an embodiment of the present application. The execution subject of each step of the method may be Figure 1 As shown in the model training device 10, the method may include the following steps (501-503).
[0086] Step 501: Acquire a video frame sequence, where the video frame sequence includes a plurality of video frames related to a target object and arranged in chronological order.
[0087] A video frame sequence refers to a sequence consisting of multiple video frames. In an embodiment of the present application, the video frame sequence is related to a target object, such as each video frame in the video frame sequence includes the target object; or each video frame in the video frame sequence includes the face of the target object. The embodiment of the present application does not limit the number of video frames in the video frame sequence, which can be set and adjusted according to actual usage requirements, such as the number of video frames in the video frame sequence can be 7, 8, 9, 10, etc.
[0088] Optionally, in the training process of the video detection model, the target object may refer to any object included in the video frame sequence; in the deep fake video detection process, the target object may refer to the object of interest in the video frame sequence, such as an object to be authenticated, an object suspected of being forged (such as face-changing, fictional, AI-generated), an object suspected of being edited, etc. The embodiment of the present application does not limit the type of the target object, and the type of the target object includes at least one of the following: human, animal.
[0089] In one example, multiple video frames related to the target object may be randomly extracted from a real video to construct a video frame sequence; or, multiple continuous video frames related to the target object may be extracted from a real video to construct a video frame sequence. Alternatively, a first number of video frames may be sampled from a real video, and then a second number of continuous video frames may be randomly selected from the first number of video frames to construct a video frame sequence. The embodiment of the present application does not limit the method for constructing a video frame sequence.
[0090] Among them, the first number is greater than the second number, and the first number and the second number can be set and adjusted according to actual usage requirements. A real video refers to a video that has not been forged, and a forged video refers to a video that has been forged (such as processed by deep forging technology). Optionally, a real video may refer to a video of the face of the target object. For example, in an identity authentication scenario, the real video may be a video obtained by shooting the face of the target object with a shooting device.
[0091] Exemplarily, during the training of the video detection model, multiple real videos can be obtained from the database, and then 100 video frames are sampled from each real video, and 8 consecutive video frames are randomly selected from the 100 video frames as a video frame sequence. The training of the video detection model is an iterative process, such as iterating the parameters of the video detection model with a batch of samples each time, and a batch of samples includes at least one sample. The embodiment of the present application is described by taking a certain iterative process of the video detection model as an example.
[0092] Step 502, for m video frames in the video frame sequence, perturb the key points of the target object in the video frames to obtain video frame sequence samples, and there are abnormal changes in the features related to the key points of the target object in the video frame sequence samples, and m is a positive integer.
[0093] The video frame sequence samples refer to samples used to train the above-mentioned video detection model, which can be obtained by adjusting the above-mentioned video frame sequence. Optionally, the above-mentioned m video frames may refer to all video frames in the video frame sequence, that is, by perturbing the key points of the target object in each video frame in the video frame sequence, the video frame sequence samples are obtained; the above-mentioned m video frames may also refer to part of the video frames in the video frame sequence, such as m is greater than or equal to the first threshold, that is, by perturbing the key points of the target object in part of the video frames in the video frame sequence, the video frame sequence samples are obtained. The first threshold can be set and adjusted according to an empirical value, such as the first threshold can be half the number of video frames in the video frame sequence.
[0094] The disturbance in the embodiment of the present application may refer to the process of changing the position, such as the disturbance key point may refer to the process of changing the key position. The key point refers to the point for locating and identifying the part of the target object, and the embodiment of the present application does not limit the type of the key point. For example, in the case where the video detection model is used for the face area of the target object, the above key points may be facial key points, such as the key points corresponding to the eyebrows, eyes, nose, mouth, etc.; in the case where the video detection model is used for the human body posture of the target object, the above key points may be limb key points, such as the key points corresponding to the head, legs, hands, torso, etc.; in the case where the video detection model is used for the palm of the target object, the above key points may be hand key points, such as the key points corresponding to the fingertips, palms, palm prints, etc.; in the case where the video detection model is used for the iris of the target object, the above key points may be iris key points, which are used to locate and identify the key points of the iris.
[0095] Optionally, for facial key points, the features associated with the key points of the target object refer to facial features; for limb key points, the features associated with the key points of the target object refer to posture features; for hand key points, the features associated with the key points of the target object refer to palm features; for iris key points, the features associated with the key points of the target object refer to iris features.
[0096] In the embodiment of the present application, an anomaly may refer to an inconsistency in the timing of a feature, which is used to indicate whether a video frame sequence sample has been forged. For example, the changes in the facial features of the target object in the video frame sequence are originally consistent in timing, that is, the changes are natural and continuous, but after the facial key points are disturbed, the changes in the facial key points of the target object in the video frame sequence samples are inconsistent in timing, and there are unnatural jitters and drifts, which make the position and shape of the facial organs slightly inconsistent, and thus make the changes in the facial key features of the target object in the video frame sequence samples inconsistent in timing, that is, there is an anomaly. The embodiment of the present application refers to this anomaly as FFD (Facial Feature Drift).
[0097] Most Deepfake algorithms generate results frame by frame. For example, Deepfake algorithms usually use frame-by-frame face-swapping operations. In the Deepfake face-swapping process, the detection results (facial key points) of the face detector are often needed for alignment, thereby achieving affine transformation and other subsequent face-swapping processes. However, since most current face detectors recognize and detect faces frame by frame, the consistency of timing cannot be guaranteed, which results in slight inconsistencies in the positions of facial key points between different forged video frames, resulting in the FFD phenomenon. In addition, since the inner face after Deepfake face-swapping is usually generated by a deep neural network (such as a generative adversarial network), it is also difficult to completely align the positions of facial key points between different forged video frames.
[0098] For example, refer to Figure 6 ,For fake videos, even if two consecutive video frames appear relatively still, subtle ,unnatural drift and jitter may be observed within facial features (e.g., eyes, nose, etc.), as shown in the real and fake video frames in the ,dash box 601, the eyeballs have obvious drift.
[0099] In one example, the key points in each video frame can be randomly perturbed, and then the above-mentioned video frame sequence samples can be generated by image-level self-blending to simulate the unnatural jitter and drift of the key points, so as to construct a video frame sequence sample with a high similarity to the forged video. Exemplarily, the above-mentioned video frame sequence samples can be samples constructed by simulating FFD, such as by randomly perturbing the facial key points in each video frame so that the facial key points are temporally offset, and then the above-mentioned video frame sequence samples are generated by image-level self-blending. Since this data augmentation method is constructed according to the characteristics of the deep fake video generation process, it can effectively simulate the timing inconsistency of the deep fake video, thereby effectively improving the detection accuracy of the video detection model and the generalization of the video detection model.
[0100] For example, Figure 7 As shown, step 502 may also include the following sub-steps:
[0101] Step 502a, disturb each pixel in the video frame to obtain a disturbed video frame, and there are differences between the pixel points in the disturbed video frame and the pixel points in the video frame.
[0102] Optionally, each pixel point (including key points) in the video frame is randomly perturbed so that the pixel points generate random jitter, thereby simulating the random jitter and drift of the key points. Since the perturbation can change the position of the pixel points, at the same position, there are differences between the pixel points in the perturbed video frame and the pixel points in the video frame, such as different pixel values.
[0103] In one example, the process of acquiring the disturbed video frame may be as follows:
[0104] 1. Get the affine transformation matrix. The affine transformation matrix has perturbation parameters as elements, and the perturbation parameters are used to change the position of pixels.
[0105] An affine transformation matrix refers to a matrix used to implement an affine transformation. Affine transformation can be used to linearly transform the coordinates of a pixel point to change the position of the pixel point. Exemplarily, if the way to change the position of a pixel point includes at least one of the following: rotation, translation, and scaling, then the affine transformation matrix can be used to implement at least one of the following: rotation, translation, and scaling. Optionally, the way to change the position of a pixel point can also include at least one of the following: horizontal flipping and cropping.
[0106] For example, the affine transformation matrix can realize any one of rotation, translation, and scaling independently, or any two of rotation, translation, and scaling simultaneously, or rotation, translation, and scaling simultaneously, which is not limited in the embodiments of the present application.
[0107] Optionally, the disturbance parameter follows at least one of the following distributions: uniform distribution, Gaussian distribution, Poisson distribution. Exemplarily, for the current video frame, the disturbance parameter can be obtained by sampling according to the uniform distribution, and then an affine transformation matrix is constructed with the disturbance parameter as an element, which is recorded as A.
[0108] 2. Perform affine transformation on the video frame according to the affine transformation matrix to obtain the perturbed video frame.
[0109] Optionally, for each pixel in the video frame, the coordinates of the pixel are multiplied by the affine transformation matrix to obtain the changed position corresponding to the pixel, thereby generating a perturbed video frame. Exemplarily, the perturbed video frame can be represented as follows:
[0110] I warp =AI;
[0111] Among them, I warp is the perturbed video frame (such as represented by the set of pixels after the perturbation), I is the video frame (such as represented by the set of pixels before the perturbation), and A is the affine transformation matrix.
[0112] For the key points in the video frame, the corresponding perturbation process can be expressed as follows:
[0113] L * R=AL R ;
[0114] Among them, L * R is the key point L R The key points after affine transformation (such as represented by the positions of the key points), R is used to indicate the type of key points, such as facial key points.
[0115] The embodiments of the present application add random jitter to simulate the random jitter and drift of key points, which can improve the similarity between the video frame sequence samples and the deep fake video, thereby helping to improve the ability of the video detection model to identify the deep fake video.
[0116] Step 502b, fusing the perturbed video frame and the video frame to obtain a forged video frame, wherein there are differences between the key points of the target object in the forged video frame and the key points of the target object in the video frame, and there are no differences between the non-key points of the target object in the forged video frame and the non-key points of the target object in the video frame.
[0117] Non-key points refer to pixels other than key points. There is a difference between the position of the key points of the target object in the forged video frame and the position of the key points of the target object in the video frame, that is, the key points have drifted. There is no difference between the position of the non-key points of the target object in the forged video frame and the position of the non-key points of the target object in the video frame, that is, the non-key points have not drifted.
[0118] Since the embodiment of the present application only focuses on the jitter of key points and does not consider the jitter of non-key points, a mask can be constructed to change the key points while keeping the non-key points unchanged, so as to improve the similarity between the video frame sequence sample and the deep fake video. Exemplarily, the generation process of the fake video frame may include the following:
[0119] 1. Obtain multiple key point groups corresponding to the target object in the video frame, each key point group includes multiple key points.
[0120] A key point group refers to a group / set of key points. Optionally, multiple key points in each key point group are associated. Exemplarily, each key point group corresponds to the area occupied by a part of the target object for positioning identification, that is, each key point group includes the key points of the part corresponding to the key point group, and each key point in the key point group can jointly reflect the shape, size, position and other information of the part. For example, for facial key points, the target object may correspond to 6 key point groups, such as two eyebrows corresponding to two key point groups, two eyes corresponding to two key point groups, a nose corresponding to one key point group, and a mouth corresponding to one key point group.
[0121] Optionally, key points (such as coordinates) / multiple key point groups of the target object are detected from the video frame through a key point detection model, and the key point detection model can be constructed based on any of the following: DCNN (Deep CNN, deep convolutional neural network), TCNN (Tweaked CNN, adjusted CNN), DAN (Deep Alignment Networks, deep alignment network).
[0122] 2. For any key point group among the multiple key point groups, a mask image corresponding to the video frame is constructed based on the key point group, and the mask image is used to indicate the area of the key point group in the video frame.
[0123] The mask image may refer to an image composed of mask values, such as each pixel in the mask image is represented by a mask value of 0 to 1 (i.e., a binary image), a mask image with all mask values 0 is white, and a mask image with all mask values 1 is black. The size of the mask image is the same as the size of the video frame.
[0124] The shape of the region of the key point group in the video frame is consistent with the shape of the part corresponding to the key point group. The region of the key point group in the video frame may also include the region of the part corresponding to the key point group in the video frame, which is not limited in the embodiments of the present application. For example, the mask value of each pixel in the region corresponding to the key point group is between 0 and 1, which is white, and the mask value of each pixel outside the region corresponding to the key point group is 1, which is black.
[0125] In one example, the process of constructing a mask image may include the following:
[0126] (1) For any pixel point in the video frame, obtain the first distance between the pixel point and the area where the key point group is located.
[0127] The region where the key point group is located refers to the region where the key point group is located in the video frame. The first distance in the embodiment of the present application is used to indicate the distance between the pixel point and the region where the key point group is located.
[0128] In one example, the distances between the pixel point and each key point are first obtained, then a minimum distance is determined from a plurality of distances, and the minimum distance is determined as the first distance.
[0129] In one example, according to the positions of each key point in the key point group, the geometric center corresponding to the key point group is calculated, and then the distance between the pixel point and the geometric center is determined as the first distance.
[0130] Exemplarily, the first distance may be expressed as follows:
[0131] dist(x,y,L r );
[0132] Where dist() is a function used to calculate the distance between two points. x and y are the horizontal and vertical coordinates of the pixel in the video frame. r Used to represent the geometric center corresponding to the key point group r (such as the coordinates of the geometric center).
[0133] (2) Determine a mask value of the pixel point according to the first distance, and the mask value of the pixel point is negatively correlated with the first distance.
[0134] Optionally, the range of the mask value in the embodiment of the present application may be [0, 1].
[0135] In one example, for each key point group, a maximum distance is set, and the maximum distance is greater than or equal to the maximum value of the distance between the edge of the part corresponding to the key point group and the geometric center of the key point group. Exemplarily, for the pixel points belonging to the part corresponding to the key point group, the corresponding mask value range is [0, 1], and the mask value of the pixel point is negatively correlated with the above-mentioned first distance. For the pixel points that do not belong to the part corresponding to the key point group, the corresponding mask value is 0.
[0136] For example, the process of determining the mask value may include the following:
[0137] The first distance is divided by the maximum distance to obtain a first quotient value. If the first quotient value is greater than or equal to 1, the mask value of the pixel point is set to 1. If the first quotient value is less than 1 and greater than or equal to 0, the mask value is set to the first quotient value.
[0138] For each key point group, the mask value of each pixel in the corresponding mask image can be expressed as follows:
[0139]
[0140] Among them, M r (x, y) is used to represent the mask value of any pixel in the mask image. x and y are the horizontal and vertical coordinates of the pixel in the video frame. clip() is a function used to limit the value to a specified range. dist() is a function used to calculate the distance between two points. fdist r It refers to the maximum distance corresponding to the key point group r, where R is a set of multiple key point groups.
[0141] For the clip() function, clip(value, min, max) is used to limit value to the range of [min, max]. If value is less than min, the clip() function returns min. If value is greater than max, the clip() function returns max. If value is in the range of [min, max], the clip() function returns value.
[0142] The above formula can achieve that as the distance from the key point increases, the mask value of the pixel point will smoothly transition from 1 (completely included in the mixture) to 0 (excluded from the mixture) until the maximum distance is reached. In this way, after the perturbed video frame and the video frame are fused based on the mask image, the closer the pixel point in the forged video frame is to the key point, the more obvious the perturbation trace will be, so that the jitter and drift of the key point can be accurately simulated, thereby improving the similarity between the video frame sequence sample and the deep forged video.
[0143] (3) Based on the mask value of each pixel in the video frame, a mask image is constructed.
[0144] Optionally, the mask image can be constructed by replacing the pixel value of each pixel in the video frame with the corresponding mask value.
[0145] For each keypoint group, a mask image is constructed.
[0146] 3. Under the constraints of the mask images corresponding to multiple key point groups, the perturbed video frame and the video frame are fused to obtain the forged video frame.
[0147] The mask value in the mask image is used to indicate the proportion of each pixel in the perturbed video frame in the forged video frame. Optionally, for each mask image, under the constraint of the mask image, the perturbed video frame and the video frame are fused to obtain a mixed video frame corresponding to the mask image, and then the mixed video frames of each mask image are fused to obtain the forged video frame.
[0148] Exemplarily, the process may include the following:
[0149] (1) For any mask image in the mask images corresponding to the multiple key point groups, the perturbed video frame is adjusted based on the mask image to obtain a first mixed video frame, and the video frame is adjusted based on the anti-mask image corresponding to the mask image to obtain a second mixed video frame, wherein the sum of the mask values of the pixels at the same position in the mask image and the anti-mask image is 1.
[0150] The first mixed video frame is used to indicate the amount of the forged video frame used on the perturbed video frame. The second mixed video frame is used to indicate the amount of the forged video frame used on the video frame.
[0151] Optionally, for any pixel in the disturbed video frame, the pixel is multiplied by the mask value corresponding to the pixel in the mask image to obtain a first mixed video frame. Exemplarily, the first mixed video frame can be expressed as follows: r I warp ), where M r is the mask image corresponding to the key point group r.
[0152] Optionally, for any pixel in the video frame, the pixel is multiplied by the mask value corresponding to the pixel in the inverse mask image to obtain a second mixed video frame. Exemplarily, the second mixed video frame can be expressed as follows: (1-M r )·I; where M r is the mask image corresponding to the key point group r.
[0153] (2) Based on the first mixed video frame and the second mixed video frame, a mixed video frame corresponding to the mask image is obtained.
[0154] Optionally, the pixel values of the pixels at the same position in the first mixed video frame and the second mixed video frame are added together to obtain the mixed video frame corresponding to the mask image. Exemplarily, the mixed video frame can be represented as follows:
[0155] I′ r =(M r I warp )+((1-M r )·I), r∈R;
[0156] Among them, M r Determines the I used for each pixel in the mixed video frame warp and I, so as to achieve the mixing effect at the part corresponding to the key point group r.
[0157] (3) The mixed video frames corresponding to multiple mask images are fused to obtain a forged video frame.
[0158] Optionally, a plurality of mixed video frames are weightedly fused to obtain a forged video frame, so that the features of the target object in each mixed video frame are balanced and fused, thereby improving the quality of the forged video frame. Exemplarily, the forged video frame can be represented as follows:
[0159]
[0160] Among them, each key point group r is calculated according to its mixing weight α r Contribute to I′, so that all the features of the target object are evenly integrated into the final forged video frame, and the mixing weight α r It can be set and adjusted according to actual usage requirements, and the embodiments of the present application are not limited to this.
[0161] Step 502c: replace the m video frames with forged video frames corresponding to the m video frames respectively, to obtain a video frame sequence sample.
[0162] During the replacement process, each video frame in the video frame sequence sample is kept in chronological order.
[0163] Step 503: Train a video detection model based on the video frame sequence samples to obtain a trained video detection model. The trained video detection model is used to detect whether there is an abnormality in the video.
[0164] The trained video detection model can be used to provide forged video detection services (such as deep forged video detection services). In an embodiment of the present application, if there is an abnormality in the video frame sequence sample, it can be determined that there is an abnormality in the video corresponding to the video frame sequence sample, and it can be determined that the video is a false video, such as a forged video or an edited video.
[0165] In one example, the classification results of the video frame sequence samples can be obtained through the video detection model, and then the video detection model can be trained based on the classification results. The process may include the following:
[0166] 1. Obtain the first feature map of the video frame sequence samples through the video detection model. The first feature map is used to indicate the change of the corresponding features of the target object in the video frame sequence samples in the time dimension.
[0167] Optionally, the video frame sequence samples are converted into a word embedding block sequence, and then the word embedding block sequence is subjected to feature extraction by a temporal feature extraction network in the video detection model to obtain a first feature map. Figure 2 , for the word embedding block sequence e, its size is (T, N+1, D), where T is the number of video frames in the video frame sequence sample, N+1 is the number of word embedding blocks corresponding to each video frame, and D is the number of channels. T and N+1 can be set and adjusted according to actual usage requirements.
[0168] Optionally, the word embedding block sequence e may also include position word embedding (Position Embedding) and temporal word embedding (Temporal Embedding), where the position word embedding is used to indicate the position of each word embedding block, and the temporal word embedding is used to indicate the time of each word embedding block.
[0169] By performing feature extraction on the word embedding block sequence e through the temporal feature extraction network 301, a first feature graph e can be obtained. t , the first feature map e t The size of is also (T, N+1, D), the first feature map e t The feature map slices in (N+1, D) are stacked in the time dimension.
[0170] It should be noted that the working process of each Block in the video detection model is the same. The embodiment of the present application takes the working process of a Block in the video detection model (such as the first Block) as an example for explanation.
[0171] 2. A second feature map is obtained based on the first feature map through a video detection model. The second feature map is used to indicate changes in the spatial dimension of features corresponding to the target object in the video frame sequence samples.
[0172] Optionally, the second feature map can be obtained by extracting features from the first feature map through a spatial feature extraction network in the video detection model. Since the spatial feature extraction network operates on the spatial dimension, the first feature map can also be converted to the spatial dimension before processing the first feature map. Exemplarily, the process may include the following:
[0173] (1) Perform dimension transformation on the first feature map to obtain a transformed first feature map.
[0174] Optionally, the feature map slices in the transformed first feature map are stacked in the spatial dimension. For example, refer to Figure 2 , for the first feature map e t By doing dimension conversion, we can get the first feature map e′ after conversion. t , the first feature map e′ after conversion t The size of is (N+1, T, D), the first feature map e′ after conversion t The feature map slices (T, D) in are stacked in the time dimension. Exemplarily, the first feature map can be mapped to the converted first feature map, or the first feature map can be converted to the converted first feature map through a convolution layer, which is not limited in the embodiments of the present application.
[0175] (2) A second feature map is obtained based on the converted first feature map through a video detection model.
[0176] Optionally, the second feature map can be obtained by extracting features from the converted first feature map through a spatial feature extraction network in the video detection model. Figure 2 , the converted first feature map e′ is extracted by the spatial feature extraction network 302 t Perform feature extraction to obtain the second feature map e s , the second feature map e s The size of is (N+1, T, D).
[0177] In order to ensure that the video detection model can capture both space and time, the embodiments of the present application explicitly change the channel dimensions of the input, so that the temporal feature extraction network and the spatial feature extraction network can be applied to the spatial dimension and temporal dimension of their input, respectively.
[0178] 3. Based on the second feature map, the video detection model obtains the classification results of the video frame sequence samples. The classification results of the video frame sequence samples are used to indicate whether there is any abnormality in the changes of features related to the key points of the target object in the video frame sequence samples.
[0179] Optionally, the output of the last Block in the video detection model is used as the final second feature map, and the I3D Head in the video detection model is used to extract features from the second feature map to obtain a spatiotemporal feature map. Finally, the classifier in the video detection model is used to classify the spatiotemporal feature map to obtain a classification result of the video frame sequence sample.
[0180] The classification result can be used to indicate whether the video frame sequence sample is forged. For example, for facial key points, the classification result of the video frame sequence sample is used to indicate whether the facial features of the target object have FFD phenomenon.
[0181] 4. Train the video detection model according to the classification results to obtain the trained video detection model.
[0182] Optionally, based on the classification result, a loss function value of the video detection model is determined, and the loss function value is used to indicate the detection accuracy of the video detection model. Exemplarily, if the classification result is a binary classification result: 1 and 0, 1 indicates the presence of an abnormality, 0 indicates the absence of an abnormality, and the label of the video frame sequence sample is 1 (i.e., the presence of an abnormality), then the loss function value can be constructed based on the difference between the classification result and the label, such as the cross entropy loss function, the mean square error loss function, etc., based on the difference between the classification result and the label, to construct the loss function value.
[0183] After obtaining the loss function value, the video detection model can be trained according to the loss function value to obtain a trained video detection model. Since the first pre-trained neural network and the second pre-trained neural network in the video detection model have been pre-trained, only the first adapter and the second adapter can be trained to adapt the video detection model to the deep fake video detection task, which can reduce the difficulty and complexity of the video detection model training, thereby helping to improve the training efficiency of the video detection model.
[0184] Exemplarily, the parameters of the first pre-trained neural network and the parameters of the second pre-trained neural network can be fixed, and the parameters of the first adapter and the parameters of the second adapter can be adjusted according to the loss function value to obtain a trained video detection model. The training of the video detection model is an iterative process, and the termination conditions of the iteration include at least one of the following: minimizing the loss function value, the number of iterative optimizations is greater than or equal to a threshold, the loss function value is less than or equal to a threshold, etc., which is not limited in the embodiments of the present application.
[0185] The embodiment of the present application adjusts the parameters of the first adapter and the parameters of the second adapter so that the video detection model can learn the ability to detect anomalies (i.e., unnatural jitter and drift of key points) of video frame sequence samples in both spatial and temporal dimensions, which is beneficial to improving the accuracy of anomaly detection.
[0186] Optionally, both the first adapter and the second adapter can be lightweight adapters (ie, with fewer network parameters), which helps reduce the structural complexity of the video detection model and facilitates implementation and training.
[0187] To summarize, the technical solution provided in the embodiments of the present application, for a video frame sequence related to a target object, constructs a video frame sequence sample by perturbing the key points of the target object, thereby simulating the "random jitter and drift of key points" phenomenon that is commonly present in deep fake videos (videos constructed using deep fake technology), and then trains a video detection model through the video frame sequence samples, so that the trained video detection model has the ability to detect "random jitter and drift of key points", which is beneficial to improving the detection accuracy of the video detection model.
[0188] In addition, since the trained video detection model has the ability to detect "random jitter and drift of key points", the trained video detection model can also detect abnormalities in the "key points" for unseen deep fake videos to determine the authenticity of the video, thereby effectively improving the generalization of the video detection model.
[0189] In some embodiments, when the key points are the facial key points of the target object, the features of the target object are facial features. The technical solution provided in the embodiment of the present application can be used to construct a video frame sequence sample with FFD phenomenon, and then the video detection model can be trained by the video frame sequence sample to obtain a video detection model that can accurately detect the FFD phenomenon. Figure 8 , the construction of video frame sequence samples may include the following:
[0190] 1. Obtain a video frame sequence, where the FFD phenomenon does not exist in the video frame sequence.
[0191] Optionally, the video frame sequence may refer to a sequence constructed for the face of the target object, such as the video frame sequence includes a plurality of video frames related to the face of the target object sorted in chronological order.
[0192] 2. For any video frame 801 in the video frame sequence, perform key point detection on the video frame 801 to obtain facial key points 802 of the target object.
[0193] Optionally, the facial key points 802 are divided into a plurality of key point groups, such as two eyebrows corresponding to one key point group, two eyes corresponding to one key point group, a nose corresponding to one key point group, and a mouth corresponding to one key point group.
[0194] 3. Based on the facial key points 802 , a mask image 803 of the video frame 801 is constructed.
[0195] The mask image 803 includes four mask images: an eyebrow mask image, an eye mask image, a nose mask image, and a mouth mask image, each mask image corresponding to a key point group. The eyebrow mask image is used to indicate the area occupied by two eyebrows in the video frame 801, the eye mask image is used to indicate the area occupied by two eyes in the video frame 801, the nose mask image is used to indicate the area occupied by the nose in the video frame 801, and the mouth mask image is used to indicate the area occupied by the mouth in the video frame 801.
[0196] Optionally, for any key point group among the four key point groups, a mask image corresponding to the video frame is constructed based on the key point group. The method for constructing the mask image is the same as that in the above embodiment and will not be repeated here.
[0197] 4. Construct an affine transformation matrix by randomly adopting perturbation parameters.
[0198] The affine transformation matrix has perturbation parameters as elements, the perturbation parameters are used to change the position of the pixel points, and the perturbation parameters follow a uniform distribution. The way to change the position of the pixel points includes at least one of the following: rotation, translation, and scaling.
[0199] 5. Perform affine transformation on the video frame 801 according to the affine transformation matrix to obtain the disturbed video frame 804.
[0200] 6. Under the constraint of the mask image 803, the perturbed video frame 804 and the video frame 801 are fused to obtain the forged video frame 805.
[0201] For any mask image among the eyebrow mask image, the eye mask image, the nose mask image and the mouth mask image, the perturbed video frame 804 is adjusted based on the mask image to obtain a first mixed video frame, and the video frame 801 is adjusted based on the anti-mask image corresponding to the mask image to obtain a second mixed video frame; based on the first mixed video frame and the second mixed video frame, a mixed video frame corresponding to the mask image is obtained; and the mixed video frames corresponding to the four mask images are fused to obtain a forged video frame 805.
[0202] 7. Replace each video frame in the video frame sequence with the corresponding forged video frame 805 in sequence to obtain a video frame sequence sample, which has the FFD phenomenon.
[0203] The embodiment of the present application does not limit the order of constructing the mask image 803 and the disturbed video frame 804.
[0204] 8. By training the video detection model with the video frame sequence samples, a video detection model capable of accurately detecting the FFD phenomenon can be obtained.
[0205] To summarize, the technical solution provided in the embodiments of the present application, for a video frame sequence related to a target object, constructs a video frame sequence sample by perturbing the facial key points of the target object, thereby simulating the "random jitter and drift of key points" phenomenon that is commonly present in deep fake videos (videos constructed using deep fake technology), and then trains the video detection model through the video frame sequence samples, so that the trained video detection model has the ability to detect the "FFD phenomenon", which is beneficial to improving the detection accuracy of the video detection model.
[0206] In addition, since the trained video detection model has the ability to detect the "FFD phenomenon", the trained video detection model can also detect abnormalities in the "facial key points" of unseen deep fake videos to determine the authenticity of the video, thereby effectively improving the generalization of the video detection model.
[0207] Please refer to Fig. 9 , which shows a flow chart of a video detection method provided by an embodiment of the present application. The execution subject of each step of the method can be Figure 1 The model shown uses device 20, and the method may include the following steps (901-903).
[0208] Step 901: Acquire at least one video frame sequence of a video, where the video frame sequence includes a plurality of video frames related to a target object and arranged in chronological order.
[0209] The video may refer to any video to be detected. For example, in an identity verification scenario, the video may refer to a video uploaded by a user that is recorded for a face, a palm, an iris, or the like.
[0210] In the detection process of the above video, the number of video frame sequences to be extracted can be set according to actual usage requirements, such as randomly extracting multiple video frame sequences from the video to prevent missed detection and staggered forged parts in the video. For example, 5 video frame sequences can be extracted from the video for the target object in sequence according to the set interval, and each video frame sequence includes 8 consecutive video frames.
[0211] For the contents not described in the embodiments of the present application, please refer to the above embodiments and will not be repeated here.
[0212] Step 902, obtaining the classification result of the video frame sequence through the video detection model, the classification result of the video frame sequence is used to indicate whether there is any abnormality in the change of features related to the key points of the target object in the video frame sequence, the video detection model is trained with video frame sequence samples, for m video frames in the video frame sequence samples, the key points of the target object are disturbed, and there is an abnormality in the change of features related to the key points of the target object in the video frame sequence samples, where m is a positive integer.
[0213] The video detection model in the embodiments of the present application refers to a trained video detection model. The process of acquiring video frame sequence samples and the process of training the video detection model using video frame sequence samples are the same as those described in the above embodiments. For the contents not described in the embodiments of the present application, please refer to the above embodiments and will not be repeated here.
[0214] In one example, the process of obtaining the classification result of the video frame sequence may include the following:
[0215] 1. Obtain the first feature map of the video frame sequence through the video detection model. The first feature map is used to indicate the changes of features related to the key points of the target object in the video frame sequence and in the time dimension.
[0216] Optionally, for any video frame sequence, the video frame sequence samples are converted into a word embedding block sequence, and then the word embedding block sequence is subjected to feature extraction through a temporal feature extraction network in a trained video detection model to obtain a first feature map.
[0217] Optionally, when the key points are facial key points of the target object, the above features are facial features of the target object.
[0218] 2. A second feature map is obtained based on the first feature map through a video detection model. The second feature map is used to indicate how features related to key points of the target object change in a video frame sequence and in a spatial dimension.
[0219] Optionally, the second feature map can be obtained by extracting features from the first feature map through a spatial feature extraction network in a trained video detection model. Since the spatial feature extraction network operates on the spatial dimension, the first feature map can also be converted to the spatial dimension before processing the first feature map.
[0220] Exemplarily, the process may include the following contents: performing dimensional transformation on the first feature map to obtain a transformed first feature map, and stacking the feature map slices in the transformed first feature map in the spatial dimension; obtaining a second feature map based on the transformed first feature map through a video detection model, such as performing feature extraction on the transformed first feature map through a spatial feature extraction network in the video detection model to obtain the second feature map.
[0221] 3. Obtain the classification result of the video frame sequence based on the second feature map through the video detection model.
[0222] Optionally, the output of the last Block in the video detection model is used as the final second feature map, and the I3D Head in the video detection model is used to extract features from the second feature map to obtain a spatiotemporal feature map. Finally, the classifier in the video detection model is used to classify the spatiotemporal feature map to obtain a classification result of the video frame sequence sample.
[0223] The classification result can be used to indicate whether the video frame sequence sample is forged. For example, for facial key points, the classification result of the video frame sequence sample is used to indicate whether the facial features of the target object have FFD phenomenon.
[0224] Step 903: Obtain a detection result of the video according to the classification results corresponding to at least one video frame sequence, where the detection result is used to indicate whether there is an abnormality in the video.
[0225] Optionally, if at least one video frame sequence has an abnormal video frame sequence, it can be determined that the video is abnormal, that is, the video is forged.
[0226] For example, for facial key points, if at least one video frame sequence has a video frame sequence with the FFD phenomenon, it can be determined that the video is a deep fake video.
[0227] In some embodiments, reference Figures 10 to 14 Taking the identity authentication scenario as an example, in response to the user's identity authentication operation, the client displays an information authentication interface 1001, and multiple input options are displayed in the information authentication interface 1001, such as a name input option, an ID card number input option, an ID card photo option, etc. After the user completes the information input, the information authentication interface 1001 updates the displayed prompt information to prompt the user to record the video when the set conditions are met. In response to the user triggering the operation of starting video recording, the information authentication interface 1001 displays a recording area, in which the video recorded by the user can be displayed in real time. After the user completes the recording of the facial video as required, the client calls the trained video detection model to detect the facial video to determine whether the facial video is a real video. If the facial video is a real video and both the information authentication and the facial detection are passed, the information authentication interface 1001 displays a successful authentication notification to prompt the user that the authentication is passed.
[0228] In some embodiments, for a repeated video frame sequence constructed by copying a single image and a forged video frame sequence, the first feature map and the second feature map extracted by the trained video detection model are as follows: Fig.15 As shown, for each video frame in the repeated video frame sequence 1501, the corresponding first feature maps are the same (ie, there is no transformation in the time dimension), and the corresponding second feature maps are also the same (ie, there is no transformation in the spatial dimension).
[0229] For each video frame in the forged video frame sequence 1502, its corresponding first feature map can reflect reasonable time-related motion (such as mouth motion), and its corresponding second feature map can also reflect reasonable space-related motion. This proves that the video detection model in the embodiment of the present application can learn both spatial information and temporal information at the same time.
[0230] In some embodiments, the embodiments of the present application are experimented on several commonly used data sets to compare the generalization with related technologies. The data sets include: FaceForensics++ (FF++ for short), DeepfakeDetection Challenge (DFDC for short), DFDC preview version (DFDCP for short), DeepfakeDetection (DFD for short), and CelebDF (CDF for short).
[0231] The embodiment of the present application is trained on the FF+ dataset and tested for generalization on other datasets. As shown in Table 1, the technical solution provided by the embodiment of the present application can effectively improve the generalization of the video detection model.
[0232] Table 1
[0233]
[0234]
[0235] As shown in Table 2, by comparing the network parameters of the video detection model in the related art, it is found that the video detection model in the embodiment of the present application has the smallest number of parameters and performs best in the CDF-v2 dataset and the DFDC dataset.
[0236] Table 2
[0237] Model #Params Arch CDF-v2 DFDC Avg LipForensics-Scratch
[18] 36.0M R18+MS-TCN 62.5 65.5 64.0 LipForensics
[18] 36.0M R18+MS-TCN 82.4 73.5 78.0 STIL*
[15] 22.7M Designed CNN 73.4 69.1 71.3 FTCN
[52] 26.6M 3D R50+TT 86.9 74.0 80.5 AltFrezzing
[45] 27.2M 3D R50 89.5 - - VideoMAE*
[42] 86.2M Temporal ViT 60.6 55.1 57.9 TimeTransformer*[2] 121.3M Temporal ViT 62.3 61.9 62.1 Ours ~7M ViT+Adapters 92.0 76.2 84.1
[0238] In summary, the technical solution provided by the embodiment of the present application is beneficial to improving the accuracy of anomaly detection because the video detection model can detect whether there are anomalies in the frequency frame sequence samples in both the spatial dimension and the temporal dimension.
[0239] In addition, since the trained video detection model has the ability to detect "random jitter and drift of key points", it is beneficial to improve the detection accuracy of the video detection model. In addition, for unseen deep fake videos, the trained video detection model can also detect abnormalities in the "key points" to determine the authenticity of the video, thereby effectively improving the generalization of the video detection model.
[0240] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0241] refer to Fig.16 , which shows a block diagram of a training device for a video detection model provided by an embodiment of the present application. The device has the function of implementing the above method example, and the device can be the computer device introduced above, or can be set in a computer device. Fig.16 As shown, the device 1600 includes: a frame sequence acquisition module 1601, a key point perturbation module 1602 and a detection model training module 1603.
[0242] The frame sequence acquisition module 1601 is used to acquire a video frame sequence, where the video frame sequence includes a plurality of video frames related to the target object and arranged in chronological order.
[0243] The key point perturbation module 1602 is used to perturb the key points of the target object in the m video frames in the video frame sequence to obtain video frame sequence samples, and there are abnormal changes in the features related to the key points of the target object in the video frame sequence samples, where m is a positive integer.
[0244] The detection model training module 1603 is used to train the video detection model based on the video frame sequence samples to obtain a trained video detection model, and the trained video detection model is used to detect whether there is anomaly in the video.
[0245] In some embodiments, Fig.17 As shown, the key point perturbation module 1602 includes: a pixel point perturbation submodule 1602a, a video frame fusion module 1602b and a sample acquisition submodule 1602c.
[0246] The pixel perturbation submodule 1602a is used to perturb each pixel in the video frame to obtain a perturbed video frame, where the pixel in the perturbed video frame is different from the pixel in the video frame.
[0247] The video frame fusion module 1602b is used to fuse the perturbed video frame and the video frame to obtain a forged video frame, wherein there are differences between the key points of the target object in the forged video frame and the key points of the target object in the video frame, and there are no differences between the non-key points of the target object in the forged video frame and the non-key points of the target object in the video frame.
[0248] The sample acquisition submodule 1602c is used to replace the m video frames with forged video frames corresponding to the m video frames respectively, to obtain the video frame sequence samples.
[0249] In some embodiments, the video frame fusion module 1602b is used to:
[0250] Acquire a plurality of key point groups corresponding to the target object in the video frame, each of the key point groups including a plurality of key points;
[0251] For any key point group among the multiple key point groups, constructing a mask image corresponding to the video frame based on the key point group, wherein the mask image is used to indicate an area of the key point group in the video frame;
[0252] Under the constraints of the mask images respectively corresponding to the multiple key point groups, the perturbed video frame and the video frame are fused to obtain the forged video frame.
[0253] In some embodiments, the video frame fusion module 1602b is further used to:
[0254] For any pixel point in the video frame, obtaining a first distance between the pixel point and the area where the key point group is located;
[0255] Determine a mask value of the pixel point according to the first distance, wherein the mask value of the pixel point is negatively correlated with the first distance;
[0256] The mask image is constructed based on the mask value of each pixel in the video frame.
[0257] In some embodiments, the video frame fusion module 1602b is further used to:
[0258] For any mask image in the mask images respectively corresponding to the multiple key point groups, adjusting the perturbed video frame based on the mask image to obtain a first mixed video frame, and adjusting the video frame based on an inverse mask image corresponding to the mask image to obtain a second mixed video frame, wherein the sum of mask values of pixels at the same position in the mask image and the inverse mask image is 1;
[0259] Based on the first mixed video frame and the second mixed video frame, obtaining a mixed video frame corresponding to the mask image;
[0260] The mixed video frames corresponding to the multiple mask images are fused to obtain the forged video frame.
[0261] In some embodiments, the video frame fusion module 1602b is further used to:
[0262] For any pixel point in the disturbed video frame, multiply the pixel point by a mask value corresponding to the pixel point in the mask image to obtain the first mixed video frame;
[0263] For any pixel point in the video frame, the pixel point is multiplied by the mask value corresponding to the pixel point in the inverse mask image to obtain the second mixed video frame.
[0264] In some embodiments, the pixel perturbation submodule 1602a is further used to:
[0265] Acquire an affine transformation matrix, wherein the affine transformation matrix has a disturbance parameter as an element, and the disturbance parameter is used to change the position of the pixel point, wherein the manner of changing the position of the pixel point includes at least one of the following: rotation, translation, and scaling;
[0266] Performing an affine transformation on the video frame according to the affine transformation matrix to obtain the disturbed video frame.
[0267] In some embodiments, Fig.17 As shown, the detection model training module 1603 also includes: a feature map acquisition submodule 1603a, a classification result acquisition submodule 1603b and a detection model training submodule 1603c.
[0268] The feature map acquisition submodule 1603a is used to obtain the first feature map of the video frame sequence samples through the video detection model, and the first feature map is used to indicate the change of the corresponding features of the target object in the video frame sequence samples in the time dimension.
[0269] The feature map sub-acquisition module 1603a is also used to obtain a second feature map based on the first feature map through the video detection model, and the second feature map is used to indicate the change in the spatial dimension of the features corresponding to the target object in the video frame sequence samples.
[0270] The classification result acquisition submodule 1603b is used to obtain the classification results of the video frame sequence samples based on the second feature map through the video detection model, and the classification results of the video frame sequence samples are used to indicate whether there is any abnormality in the changes of the features related to the key points of the target object in the video frame sequence samples.
[0271] The detection model training submodule 1603c is used to train the video detection model according to the classification result to obtain the trained video detection model.
[0272] In some embodiments, the feature graph sub-acquisition module 1603a is further used to:
[0273] Performing dimension conversion on the first feature map to obtain a converted first feature map;
[0274] The second feature map is obtained based on the converted first feature map through the video detection model; wherein the feature map slices in the first feature map are stacked in the time dimension, and the feature map slices in the converted first feature map are stacked in the space dimension.
[0275] In some embodiments, the video detection model includes a temporal feature extraction network and a spatial feature extraction network, the temporal feature extraction network is constructed based on a first pre-trained neural network and a first adapter, the spatial feature extraction network is constructed based on a second pre-trained neural network and a second adapter, the first adapter is used to obtain the first feature map in combination with the first pre-trained neural network, and the second adapter is used to obtain the second feature map in combination with the second pre-trained neural network; the detection model training submodule 1603c is also used to:
[0276] Determining a loss function value of the video detection model according to the classification result;
[0277] The parameters of the first pre-trained neural network and the parameters of the second pre-trained neural network are fixed, and the parameters of the first adapter and the parameters of the second adapter are adjusted according to the loss function value to obtain the trained video detection model.
[0278] In some embodiments, when the key points are facial key points of the target object, the features are facial features of the target object.
[0279] To summarize, the technical solution provided in the embodiments of the present application, for a video frame sequence related to a target object, constructs a video frame sequence sample by perturbing the key points of the target object, thereby simulating the "random jitter and drift of key points" phenomenon that is commonly present in deep fake videos (videos constructed using deep fake technology), and then trains a video detection model through the video frame sequence samples, so that the trained video detection model has the ability to detect "random jitter and drift of key points", which is beneficial to improving the detection accuracy of the video detection model.
[0280] In addition, since the trained video detection model has the ability to detect "random jitter and drift of key points", the trained video detection model can also detect abnormalities in the "key points" for unseen deep fake videos to determine the authenticity of the video, thereby effectively improving the generalization of the video detection model.
[0281] refer to Fig.18 , which shows a block diagram of a video detection method device provided by an embodiment of the present application. The device has the function of implementing the above method example, and the device can be the computer device introduced above, or can be set in a computer device. Fig.18As shown, the device 1800 includes: a frame sequence acquisition module 1801, a classification result acquisition module 1802 and an inspection result acquisition module 1803.
[0282] The frame sequence acquisition module 1801 is used to acquire at least one video frame sequence of a video, where the video frame sequence includes a plurality of video frames related to a target object and arranged in chronological order.
[0283] The classification result acquisition module 1802 is used to obtain the classification result of the video frame sequence through the video detection model, and the classification result of the video frame sequence is used to indicate whether there is an abnormality in the change of the features related to the key points of the target object in the video frame sequence. The video detection model is trained with video frame sequence samples. For m video frames in the video frame sequence samples, the key points of the target object are disturbed, and there is an abnormality in the change of the features related to the key points of the target object in the video frame sequence samples, where m is a positive integer.
[0284] The inspection result acquisition module 1803 is used to obtain the detection result of the video according to the classification results corresponding to the at least one video frame sequence, and the detection result is used to indicate whether there is an abnormality in the video.
[0285] In some embodiments, the classification result acquisition module 1802 is further used to:
[0286] Acquire a first feature map of the video frame sequence through the video detection model, where the first feature map is used to indicate changes in features related to key points of the target object in the video frame sequence in a time dimension;
[0287] Obtaining a second feature map based on the first feature map by the video detection model, wherein the second feature map is used to indicate changes in features related to key points of the target object in the video frame sequence in a spatial dimension;
[0288] A classification result of the video frame sequence is obtained based on the second feature map through the video detection model.
[0289] In some embodiments, the classification result acquisition module 1802 is further used to:
[0290] Performing dimension conversion on the first feature map to obtain a converted first feature map;
[0291] The second feature map is obtained based on the converted first feature map through the video detection model; wherein the feature map slices in the first feature map are stacked in the time dimension, and the feature map slices in the converted first feature map are stacked in the space dimension.
[0292] In some embodiments, the video detection model includes a temporal feature extraction network and a spatial feature extraction network, the temporal feature extraction network is constructed based on a first pre-trained neural network and a first adapter, the spatial feature extraction network is constructed based on a second pre-trained neural network and a second adapter, the first adapter is used to obtain the first feature map in combination with the first pre-trained neural network, and the second adapter is used to obtain the second feature map in combination with the second pre-trained neural network.
[0293] In summary, the technical solution provided by the embodiment of the present application is beneficial to improving the accuracy of anomaly detection because the video detection model can detect whether there are anomalies in the frequency frame sequence samples in both the spatial dimension and the temporal dimension.
[0294] In addition, since the trained video detection model has the ability to detect "random jitter and drift of key points", it is beneficial to improve the detection accuracy of the video detection model. In addition, for unseen deep fake videos, the trained video detection model can also detect abnormalities in the "key points" to determine the authenticity of the video, thereby effectively improving the generalization of the video detection model.
[0295] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0296] Please refer to Fig.19 , which shows a schematic diagram of the structure of a computer device provided by an embodiment of the present application. The computer device can be any electronic device with data calculation, processing and storage functions, and the computer device can be implemented as Figure 1 The model training device 10 or the model using device 20 in the implementation environment of the illustrated solution may specifically include the following contents.
[0297] The computer device 1900 includes a central processing unit (such as a CPU (Central Processing Unit), a GPU (Graphics Processing Unit) and an FPGA (Field Programmable Gate Array)) 1901, a system memory 1904 including a RAM (Random-Access Memory) 1902 and a ROM (Read-Only Memory) 1903, and a system bus 1905 connecting the system memory 1904 and the central processing unit 1901. The computer device 1900 also includes a basic input / output system (Input / Output System, I / O system) 1906 for helping to transmit information between various devices in the server, and a large-capacity storage device 1907 for storing an operating system 1913, application programs 1914 and other program modules 1915.
[0298] The basic input / output system 1906 includes a display 1908 for displaying information and an input device 1909 such as a mouse and a keyboard for user inputting information. The display 1908 and the input device 1909 are connected to the central processing unit 1901 through an input / output controller 1910 connected to the system bus 1905. The basic input / output system 1906 may also include an input / output controller 1910 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1910 also provides output to a display screen, a printer, or other types of output devices.
[0299] The mass storage device 1907 is connected to the central processing unit 1901 via a mass storage controller (not shown) connected to the system bus 1905. The mass storage device 1907 and its associated computer readable medium provide non-volatile storage for the computer device 1900. That is, the mass storage device 1907 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0300] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technology, CD-ROM, DVD (Digital Video Disc) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1904 and mass storage device 1907 can be collectively referred to as memory.
[0301] According to the embodiment of the present application, the computer device 1900 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1900 can be connected to the network 1912 through the network interface unit 1911 connected to the system bus 1905, or the network interface unit 1911 can be used to connect to other types of networks or remote computer systems (not shown).
[0302] The memory also includes a computer program, which is stored in the memory and configured to be executed by one or more processors to implement the above-mentioned video detection model training method or the above-mentioned video detection method.
[0303] In some embodiments, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, it implements the training method of the video detection model or the above-mentioned video detection method.
[0304] Optionally, the computer readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives) or optical disks, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0305] In some embodiments, a computer program product is further provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the video detection model training method or the above-mentioned video detection method.
[0306] It should be noted that, before collecting the relevant data of the user and during the process of collecting the relevant data of the user, the embodiment of the present application can display a prompt interface, a pop-up window or output a voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that the relevant data is currently being collected, so that the present application only starts to execute the relevant steps of obtaining the relevant data of the user after obtaining the confirmation operation issued by the user on the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user on the prompt interface or pop-up window is not obtained), the relevant steps of obtaining the relevant data of the user are terminated, that is, the relevant data of the user is not obtained. In other words, all user data collected by this application are processed strictly in accordance with the requirements of the laws and regulations of relevant countries, and the informed consent or separate consent of the subject of personal information is obtained with the consent and authorization of the user. The subsequent data use and processing behavior is carried out within the scope of authorization of laws and regulations and the subject of personal information, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the videos, video frame sequences, features, etc. involved in this application are all obtained with full authorization.
[0307] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0308] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A training method for a video detection model, It is characterized in that The method comprises: Acquire a video frame sequence, wherein the video frame sequence includes a plurality of video frames related to the target object and arranged in chronological order; For m video frames in the video frame sequence, perturb the key points of the target object in the video frames to obtain video frame sequence samples, and there is an abnormality in the change of features related to the key points of the target object in the video frame sequence samples, where m is a positive integer; A video detection model is trained based on the video frame sequence samples to obtain a trained video detection model, and the trained video detection model is used to detect whether there is an abnormality in the video.
2. The method according to claim 1, It is characterized in that The perturbing the key points of the target object in the video frame to obtain a video frame sequence sample includes: Perturbing each pixel point in the video frame to obtain a perturbed video frame, wherein the pixel points in the perturbed video frame are different from the pixel points in the video frame; fusing the perturbed video frame and the video frame to obtain a forged video frame, wherein there are differences between key points of the target object in the forged video frame and key points of the target object in the video frame, and there are no differences between non-key points of the target object in the forged video frame and non-key points of the target object in the video frame; The m video frames are replaced by forged video frames respectively corresponding to the m video frames to obtain the video frame sequence samples.
3. The method according to claim 2, It is characterized in that The fusing the disturbed video frame and the video frame to obtain a forged video frame includes: Acquire a plurality of key point groups corresponding to the target object in the video frame, each of the key point groups including a plurality of key points; For any key point group among the multiple key point groups, constructing a mask image corresponding to the video frame based on the key point group, wherein the mask image is used to indicate an area of the key point group in the video frame; Under the constraints of the mask images respectively corresponding to the multiple key point groups, the perturbed video frame and the video frame are fused to obtain the forged video frame.
4. The method according to claim 3, It is characterized in that The step of constructing a mask image corresponding to the video frame based on the key point group includes: For any pixel point in the video frame, obtaining a first distance between the pixel point and the area where the key point group is located; Determine a mask value of the pixel point according to the first distance, wherein the mask value of the pixel point is negatively correlated with the first distance; The mask image is constructed based on the mask value of each pixel in the video frame.
5. The method according to any one of claims 3 to 4, It is characterized in that The fusing the disturbed video frame and the video frame under the constraints of the mask images respectively corresponding to the multiple key point groups to obtain the forged video frame comprises: For any mask image in the mask images respectively corresponding to the multiple key point groups, adjusting the perturbed video frame based on the mask image to obtain a first mixed video frame, and adjusting the video frame based on an inverse mask image corresponding to the mask image to obtain a second mixed video frame, wherein the sum of mask values of pixels at the same position in the mask image and the inverse mask image is 1; Based on the first mixed video frame and the second mixed video frame, obtaining a mixed video frame corresponding to the mask image; The mixed video frames corresponding to the multiple mask images are fused to obtain the forged video frame.
6. The method according to claim 5, It is characterized in that The step of adjusting the disturbed video frame based on the mask image to obtain a first mixed video frame, and adjusting the video frame based on an inverse mask image corresponding to the mask image to obtain a second mixed video frame includes: For any pixel point in the disturbed video frame, multiply the pixel point by a mask value corresponding to the pixel point in the mask image to obtain the first mixed video frame; For any pixel point in the video frame, the pixel point is multiplied by the mask value corresponding to the pixel point in the inverse mask image to obtain the second mixed video frame.
7. The method according to any one of claims 2 to 6, It is characterized in that The perturbing each pixel point in the video frame to obtain a perturbed video frame includes: Acquire an affine transformation matrix, wherein the affine transformation matrix has a disturbance parameter as an element, and the disturbance parameter is used to change the position of the pixel point, wherein the manner of changing the position of the pixel point includes at least one of the following: rotation, translation, and scaling; Performing an affine transformation on the video frame according to the affine transformation matrix to obtain the disturbed video frame.
8. The method according to any one of claims 1 to 7, It is characterized in that The step of training the video detection model based on the video frame sequence samples to obtain the trained video detection model includes: Acquire a first feature map of the video frame sequence samples through the video detection model, where the first feature map is used to indicate changes in the time dimension of features corresponding to the target object in the video frame sequence samples; Obtaining a second feature map based on the first feature map by the video detection model, wherein the second feature map is used to indicate changes in the spatial dimension of features corresponding to the target object in the video frame sequence samples; Obtaining, by means of the video detection model and based on the second feature map, a classification result of the video frame sequence sample, wherein the classification result of the video frame sequence sample is used to indicate whether there is an abnormality in a change of features related to key points of the target object in the video frame sequence sample; The video detection model is trained according to the classification result to obtain the trained video detection model.
9. The method according to claim 8, It is characterized in that The obtaining a second feature map based on the first feature map by using the video detection model includes: Performing dimension conversion on the first feature map to obtain a converted first feature map; Obtaining the second feature map based on the converted first feature map by the video detection model; The feature map slices in the first feature map are stacked in the time dimension, and the feature map slices in the transformed first feature map are stacked in the space dimension.
10. The method according to any one of claims 8 to 9, It is characterized in that The video detection model includes a temporal feature extraction network and a spatial feature extraction network, wherein the temporal feature extraction network is constructed based on a first pre-trained neural network and a first adapter, and the spatial feature extraction network is constructed based on a second pre-trained neural network and a second adapter, wherein the first adapter is used to obtain the first feature map in combination with the first pre-trained neural network, and the second adapter is used to obtain the second feature map in combination with the second pre-trained neural network; The step of training the video detection model according to the classification result to obtain the trained video detection model includes: Determining a loss function value of the video detection model according to the classification result; The parameters of the first pre-trained neural network and the parameters of the second pre-trained neural network are fixed, and the parameters of the first adapter and the parameters of the second adapter are adjusted according to the loss function value to obtain the trained video detection model.
11. The method according to any one of claims 1 to 10, It is characterized in that In the case where the key points are facial key points of the target object, the features are facial features of the target object.
12. A video detection method, It is characterized in that The method comprises: Acquire at least one video frame sequence of a video, wherein the video frame sequence includes a plurality of video frames related to a target object and arranged in chronological order; The classification result of the video frame sequence is obtained through a video detection model, and the classification result of the video frame sequence is used to indicate whether there is an abnormality in the change of features related to the key points of the target object in the video frame sequence, the video detection model is trained with video frame sequence samples, and for m video frames in the video frame sequence samples, the key points of the target object are disturbed, and there is an abnormality in the change of features related to the key points of the target object in the video frame sequence samples, where m is a positive integer; A detection result of the video is obtained according to the classification results respectively corresponding to the at least one video frame sequence, and the detection result is used to indicate whether there is an abnormality in the video.
13. The method according to claim 12, It is characterized in that The obtaining the classification result of the video frame sequence through the video detection model includes: Acquire a first feature map of the video frame sequence through the video detection model, where the first feature map is used to indicate changes in features related to key points of the target object in the video frame sequence in a time dimension; Obtaining a second feature map based on the first feature map by the video detection model, wherein the second feature map is used to indicate changes in features related to key points of the target object in the video frame sequence in a spatial dimension; A classification result of the video frame sequence is obtained based on the second feature map through the video detection model.
14. The method according to claim 13, It is characterized in that The obtaining a second feature map based on the first feature map by using the video detection model includes: Performing dimension conversion on the first feature map to obtain a converted first feature map; Obtaining the second feature map based on the converted first feature map by the video detection model; The feature map slices in the first feature map are stacked in the time dimension, and the feature map slices in the transformed first feature map are stacked in the space dimension.
15. The method according to any one of claims 12 to 14, It is characterized in that The video detection model includes a temporal feature extraction network and a spatial feature extraction network. The temporal feature extraction network is constructed based on a first pre-trained neural network and a first adapter. The spatial feature extraction network is constructed based on a second pre-trained neural network and a second adapter. The first adapter is used to obtain the first feature map in combination with the first pre-trained neural network. The second adapter is used to obtain the second feature map in combination with the second pre-trained neural network.
16. A training device for a video detection model, It is characterized in that The device comprises: A frame sequence acquisition module, used to acquire a video frame sequence, wherein the video frame sequence includes a plurality of video frames related to the target object and arranged in chronological order; A key point perturbation module, for perturbing the key points of the target object in the m video frames in the video frame sequence, to obtain video frame sequence samples, wherein the changes of features related to the key points of the target object in the video frame sequence samples are abnormal, and m is a positive integer; The detection model training module is used to train the video detection model based on the video frame sequence samples to obtain a trained video detection model, and the trained video detection model is used to detect whether there is anomaly in the video.
17. A video detection device, It is characterized in that The device comprises: A frame sequence acquisition module, used to acquire at least one video frame sequence of a video, wherein the video frame sequence includes a plurality of video frames related to a target object and arranged in chronological order; A classification result acquisition module is used to acquire the classification result of the video frame sequence through a video detection model, wherein the classification result of the video frame sequence is used to indicate whether there is an abnormality in the change of the features related to the key points of the target object in the video frame sequence, wherein the video detection model is trained with video frame sequence samples, and for m video frames in the video frame sequence samples, the key points of the target object are disturbed, and there is an abnormality in the change of the features related to the key points of the target object in the video frame sequence samples, where m is a positive integer; The inspection result acquisition module is used to obtain the detection result of the video according to the classification results corresponding to the at least one video frame sequence, and the detection result is used to indicate whether there is an abnormality in the video.
18. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the training method of the video detection model as described in any one of claims 1 to 11, or the video detection method as described in any one of claims 12 to 15.
19. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the training method of the video detection model as described in any one of claims 1 to 11, or the video detection method as described in any one of claims 12 to 15.
20. A computer program product, It is characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. The processor reads and executes the computer program from the computer-readable storage medium to implement the training method of the video detection model as described in any one of claims 1 to 11, or the video detection method as described in any one of claims 12 to 15.
Citation Information
Patent Citations
Video content identification method and device, storage medium and electronic equipment
CN111241985A
Head decoration processing method and device based on artificial intelligence
CN111563868A
False face video identification method and system and readable storage medium
CN111967427A
Video anomaly detection model training method, video anomaly detection method and device
CN113435432A
Key point detection method and device and storage medium
CN116310616A
Cited By
Video detection model training method and apparatus, video detection method and apparatus, and device
WO2026011898A1
