Patent ID: 12243290

DETAILED DESCRIPTION

In the drawings, like reference numerals designate identical or corresponding parts throughout the several views. Further, as used herein, the words “a,” “an” and the like generally carry a meaning of “one or more,” unless stated otherwise. The drawings are generally drawn to scale unless specified otherwise or illustrating schematic structures or flowcharts.

Furthermore, the terms “approximately,” “approximate,” “about,” and similar terms generally refer to ranges that include the identified value within a margin of 20%, 10%, or preferably 5%, and any values therebetween.

The present disclosure provides a solution to the ever-increasing sophistication of DeepFake videos. The solution includes an improvement in classification accuracy over known image transformers while increasing generalization for unseen videos. An aspect is a video transformer that takes into consideration relationships among frames. The relationships are considered through the use of segment embeddings in the transformer. Accuracy of classification is improved through training on aligned facial images and their corresponding UV texture maps. Generalization is improved through the training with incremental learning.

The video transformer extracts features that are more informative for video classification. The improved information is obtained by way of extraction of spatial features that have temporal information. See Oscar de Lima, Sean Franklin, Shreshtha Basu, Blake Karwoski, and Annet George. 2020. Deepfake Detection using Spatiotemporal Convolutional Networks.arXiv: Computer Vision and Pattern Recognition abs/2006.14749 (2020); Korshunov et al.; and Sabir et al., each incorporated herein by reference in their entirety. Transformers were first proposed for natural language processing tasks, by Vaswani et al. See Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is All you Need. InAdvances in Neural Information Processing Systems, I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (Eds.), Vol. 30. Curran Associates, Inc. https_://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053 c1c4a845aa-Paper.pdf, incorporated herein by reference in its entirety. Since then, transformers have shown powerful performance in the natural language processing tasks, for example, machine translation, text classification, question-answering, and natural language understanding. See Myle Ott, Sergey Edunov, David Grangier, and M. Auli. 2018. Scaling Neural Machine Translation. In WMT, incorporated herein by reference in its entirety. Widely used transformer architectures include Bidirectional Encoder Representations from Transformers (BERT), Robustly Optimized BERT Pre-training (RoBERTa), and Generative Pre-trained Transformer (GPT) v1-v3. See Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. InNAACL-HLT; Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, M. Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. RoBERTa: A Robustly Optimized BERT Pretraining Approach.ArXivabs/1907.11692 (2019); Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, et al. 2020. Language Models are Few-Shot Learners. InAdvances in Neural Information Processing Systems, H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (Eds.), Vol. 33. Curran Associates, Inc., 1877-1901. https://proceedings.neurips. cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf; Alec Radford and Karthik Narasimhan. 2018. Improving Language Understanding by Generative Pre-Training; and Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language Models are Unsupervised Multitask Learners. (2019); each incorporated herein by reference in their entirety. Thus, an aspect is a transformer model that can accommodate the video sequences by learning temporal features. See Salman Khan, Muzammal Naseer, Munawar Hayat, Syed Waqas Zamir, Fahad Shahbaz Khan, and Mubarak Shah. 2021. Transformers in Vision: A Survey. arXiv:2101.01169 [cs.CV], incorporated herein by reference in its entirety.

In some methods, to extract more informative features, models have been trained on the aligned facial images and their corresponding UV texture maps. See Hang Dai, Nick Pears, Patrik Huber, and William A P Smith. 2020. 3D Morphable Models: The Face, Ear and Head. In 3D Imaging, Analysis and Applications. Springer, 463-512; Hang Dai, Nick Pears, William Smith, and Christian Duncan. 2020. Statistical modeling of craniofacial shape and texture.International Journal of Computer Vision128, 2 (2020), 547-571; and Jianzhu Guo, Xiangyu Zhu, Yang Yang, Fan Yang, Zhen Lei, and Stan Z. Li. 2020. Towards Fast, Accurate and Stable 3D Dense Face Alignment. InProceedings of the European Conference on Computer Vision(ECCV), each incorporated herein by reference in its entirety. The existing methods use aligned 2D face images. Such an alignment only centralizes the face without considering whether the face is frontalized, i.e., facing towards the camera. When the face is not frontalized, the face part that is not captured by the camera can cause facial information loss and misalignment with the face images that are frontalized. With the UV texture, all face images are aligned into the UV map that is created from the generated 3D faces. Since the generated 3D faces cover all the facial parts, there is substantially no information loss. In a UV map, the facial part for all the faces can be located in the same spatial space. For example, all the nose parts are located in the same region on the UV map. So the faces in UV maps are more consistently aligned.

In some embodiments, to deal with the input combination of face image and UV texture map, the transformer models include learnable segment embeddings in the input data structure. The segment embeddings help the model to distinguish different types of inputs in one data structure. In the embodiment, a segment embedding is a fixed token for face image and a fixed token for UV texture map. There are two vectors in the segment embeddings layer. All tokens belonging to the face image are assigned to a first vector (index 0), whereas all tokens belonging to input 2 are assigned to the second vector (index 1).

Furthermore, an incremental learning strategy is used for fine tuning the models on different datasets incrementally to achieve state-of-the-art performance on new datasets while maintaining the performance on the previous datasets, thus improving generalization. Experimental results on five different public datasets show that the video transformer achieves better performance than other state-of-the-art methods. The segment embedding enables the video transformer to extract more informative temporal features, thereby improving the detection accuracy.

The incremental learning strategy improves the generalization capability of the video transformer. Experiments show that the video transformer model can achieve good performance on a new dataset, while maintaining their performance on previous dataset.

FIG.1is a diagram of a machine learning system in accordance with an exemplary aspect of the disclosure. In an exemplary embodiment, a server102or artificial intelligence (AI) workstation may be configured for DeepFake recognition. With such a configuration, one or more client computers112may be used to perform DeepFake recognition for several videos at a time. In the embodiment, the server102may be connected to a cloud service110. The cloud service110may be accessible via the Internet. The cloud service110may provide a database system and may serve streaming video. Mobile devices104,106may access video served by the cloud service110. Viewers of the video served by the cloud service110may not realize that they are viewing real or fake videos.

An aspect is a DeepFake video recognition service having one or more servers102and one or more client computers112. The DeepFake video recognition service can determine whether a video is fake and take appropriate action, such as remove a fake video or insert a label that indicates that the video has been detected as being a fake video, so that viewers are aware that a video is fake, or viewers are only provided with real videos.

Another aspect is a DeepFake recognition software application that any user of a display device will be made aware that a video is fake, or may be provided with a list of videos, downloaded, stored, or streamed, that the application has determined to be fake. The DeepFake recognition software application may be configured to run in the background as a daemon, or be configured to be invoked by a command and/or function associated with a graphical widget. In addition, videos that have been determined to be fake may be stored in a database120containing fake videos. The database120may be maintained in a server computer or in a cloud service110.

In some embodiments, a video streaming service may include a DeepFake detection system of the present disclosure. The DeepFake detection system may perform an operation of blocking fake videos from being distributed by the streaming service, or other action based on a setup function of the streaming service. The streaming service may be setup to label videos as being fake, store fake videos in a separate distribution channel, “Fake Video Channel” or other action under the discretion of the video streaming service.

In some embodiments, the DeepFake detection system of the present disclosure may take the form of a product, such as a DeepFake detector device or software application. The DeepFake detector device or software application may be connected to a streaming service110and may capture video distributed by the streaming service in order to determine if video to be streamed is real or fake. The DeepFake detector device or software application may be incorporated into a network system as middleware that is connected between a video streaming service110and an end user display device104,106. Videos that are detected as being fake may be subjected to a follow-up action, such as inserting a label into the video as an indication that it has been detected as being fake or real. Another action may be to redirect those videos detected as being fake into a database120storing fake videos, for example, to be further analyzed, or separately distributed in a fake video channel. A further action may be to block fake videos from being broadcast by the streaming service.

In some embodiments, a DeepFake detector may be a mobile application that can be installed in a mobile display device104,106. The DeepFake detector mobile application may inform the user of the mobile display device that a video is real or fake, by for example, displaying an indication message, or outputting an audio sound or voice message, in order to make the user aware that a video being streamed has been detected as being fake.

A convolution neural network is typically used for image recognition, and one example is the Xception network. Xception has been arranged as a depthwise separable convolutional network.FIG.2is a block diagram of a depthwise separable convolutional neural network. A depthwise separable convolution, commonly called “separable convolution” in deep learning frameworks such as TensorFlow and Keras, consists in a depthwise convolution, i.e. a spatial convolution performed independently over each channel of an input, and a pointwise convolution, i.e. a 1×1 convolution. In Xception, the pointwise convolution is followed by a depthwise convolution.

Depthwise separable convolutions implemented (e.g. in TensorFlow) first performs the 1×1 convolution first. In Inception, both operations are followed by a ReLU non-linearity, however depthwise. separable convolutions are usually implemented without nonlinearities.

The basic building block of a transformer is the multi-head self-attention mechanism. See Vaswani et al. The self-attention mechanism is responsible for learning the relationship among the elements of input sequence. Transformer architectures can accommodate the full-length input sequences in a parallel manner and learn the dependency among frames. The transformer models can also be scaled to extremely complex models on large-scale datasets.

In the natural language processing tasks e.g., text classification, machine translation, question answering, transformers have achieved state-of-the-art performance, including BERT, RoBERT and GPTv1-3. See Devlin et al.; Liu et al.; Brown et al.; Alec Radford, Luke Metz, and Soumith Chintala. 2016. Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks.CoRRabs/1511.06434 (2016); and Radford et al. (2018), each incorporated herein by reference in their entirety. BERT-large model which had 340 million parameters was beaten by a considerable margin by the GPT-3 model which had 175 billion parameters. See Brown et al. At present, the state-of-the-art Switch transformer can scale up to a gigantic 1.6 trillion parameters. See William Fedus, Barret Zoph, and Noam Shazeer. 2021. Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity.ArXivabs/2101.03961 (2021), incorporated herein by reference in its entirety. Inspired by the success of Transformers in NLP tasks, switch transformer models were considered for vision and multi-modal vision-language tasks.

A large number of transformer based models have been used to deal with the vision tasks, such as image classification, object detection, image segmentation, image captioning, video classification, and visual question answering. See Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. 2020. An Image is Worth 16×16 Words: Transformers for Image Recognition at Scale. arXiv:2010.11929 [cs.CV]; Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. 2020. End-to-End Object Detection with Transformers.ArXivabs/2005.12872 (2020); Hugo Touvron, Matthieu Cord, Matthij s Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. 2020. Training data-efficient image transformers & distillation through attention.ArXivabs/2012.12877 (2020); Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. 2019. ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks. InAdvances in Neural Information Processing Systems; Rohit Girdhar, João Carreira, Carl Doersch, and Andrew Zisserman. 2019. Video Action Transformer Network.IEEE/CVF Conference on Computer Vision and Pattern Recognition(CVPR) (2019), 244-253; Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. 2019. VideoBERT: A Joint Model for Video and Language Representation Learning.IEEE/CVF International Conference on Computer Vision(ICCV) (2019), 7463-7472; Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. 2020. UNITER: UNiversal Image-TExt Representation Learning. InProceedings of European Conference on Computer Vision(ECCV); Lu et al; and Di Qi, Lin Su, Jia Song, Edward Cui, Taroon Bharti, and Arun Sacheti. 2020. ImageBERT: Cross-modal Pre-training with Large-scale Weak-supervised Image-Text Data.ArXivabs/2001.07966 (2020), each incorporated herein by reference in their entirety. The transformer based models achieve state-of-the-art performance in the vision tasks. However, the self-attention operation of the transformer architecture scales quadratically, which becomes enormously expensive as the length of the input sequence increases. A number of more efficient transformer architectures have been used to address this issue. See Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The Long-Document Transformer.ArXivabs/2004.05150 (2020); Hang Dai, Shujie Luo, Yong Ding, and Ling Shao. 2020. Commands for autonomous vehicles by progressively stacking visual-linguistic representations. InEuropean Conference on Computer Vision. Springer, 27-32; Shujie Luo, Hang Dai, Ling Shao, and Yong Ding. 2020. C4AV: Learning Cross-Modal Representations from Transformers. InEuropean Conference on Computer Vision. Springer, 33-38; Touvron et al.; and Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. 2020. Linformer: Self-Attention with Linear Complexity.ArXivabs/2006.04768 (2020), each incorporated herein by reference in their entirety. Specifically, there are several efficient transformer based methods to achieve state-of-the-art performance in image classification tasks. However, few transformer models have addressed video classification.

Unlike still images, videos contain a sequence of frames. An aspect is to determine whether a sequence of frames in a video is fake or real. In some videos, it is possible that only specific sequences of frames may have been modified with fake images. It should be understood that normal video production involves modifying/editing videos to enhance or replace backgrounds, perform graphic editing functions to incorporate object motion, and other graphics functions. DeepFake on the other hand, involves modifying/replacing face images in an original video. Recognizing the distinction between edited videos during normal video production and videos that have had face images modified or replaced is a task of DeepFake video detection.FIG.3is a user interface screen showing example frames of a video. The video transformer classifies the video as “Fake,” and may display an indication of whether the frames302are fake or real304. The user interface112may enable display of a number of frames302at a time. The number of frames is fixed based on the screen size or width of a window in the display screen. The frames302may be scrolled left or right to display another set of frames, for example by clicking on an arrow310. In some embodiments, the video transformer may detect one or more of a subset of frames that it has determined to be fake, and provide an indicator to show the frame(s) deemed to be fake. The indicator may be a highlight306around the perimeter of the frame(s). In some embodiments, the user interface112may also include a score308representing a probability that a frame(s) is fake.FIG.4is a user interface screen showing another example of frames402of a video. The display shows an indication404that the video transformer classifies the video as “Fake.”

FIG.5is a block diagram illustrating an example computer system for implementing the machine learning training and inference methods according to an exemplary aspect of the disclosure. The computer system may be an AI workstation or server102running a server operating system, for example Ubuntu Linux OS, Windows Server, a version of Unix OS, or Mac OS Server. The computer system102may include one or more central processing units (CPU)550having multiple cores. The computer system500may include a graphics board512having multiple GPUs, each GPU having GPU memory. The graphics board512may perform many of the operations of the disclosed machine learning methods in parallel. The computer system500includes main memory502, typically random access memory RAM, which contains the software being executed by the processing cores550and GPUs512, as well as a non-volatile storage device504for storing data and the software programs. Several interfaces for interacting with the computer system500may be provided, including an I/O Bus Interface510, Input/Peripherals518such as a keyboard, touch pad, mouse, Display Adapter516and one or more Displays508, and a Network Controller506to enable wired or wireless communication through a network99. The interfaces, memory and processors may communicate over the system bus526. The computer system500includes a power supply521, which may be a redundant power supply.

In some embodiments, the computer system102may include a server CPU and a graphics card by NVIDIA, in which the GPUs have multiple CUDA cores.

The machine learning training and inference method includes a backbone to extract image features as well as a video transformer model. The video transformer model is trained using an incremental learning strategy. Inspired by Vision Transformer, the high level image features are more informative than the image patches. See Dosovitskiy et al. Thus, the video transformer model employs a pre-trained CNN backbone to extract image features. It has been determined that XceptionNet achieves better performance than other backbone networks in DeepFake detection. Thus, embodiments use XceptionNet as the image feature extractor. See Chollet; and Ross Wightman. 2019. PyTorch Image Models. https://github.com/rwightman/pytorch-image-models. https://doi.org/10.5281/zenodo.4414861, each incorporated herein by reference in their entirety.

FIG.6illustrates the architecture of the video transformer for DeepFake detection. Although the figure is described as showing a video transformer, the video transformer includes image preprocessing, a backbone, as well as a video transformer section. As part of preprocessing, the transformer architecture600employs a Single Stage Detector (SSD) to detect and crop faces602frame by frame. See Gary Bradski. 2000. The OpenCV Library.Dr. Dobb's Journal of Software Tools(2000), incorporated herein by reference in its entirety. The transformer architecture600uses 3D Dense Face Alignment (3DDFA) model604to generate UV texture maps606from the detected face images. See Jianzhu Guo, Xiangyu Zhu, and Zhen Lei. 2018. 3DDFA. https://github.com/cleardusk/3DDFA; and Guo et al. (2020), each incorporated herein by reference in their entirety. The transformer architecture600uses both face images602and their UV texture maps606in the extraction of the image features. Known methods use aligned 2D face images. However, alignment of 2D face images only centralizes the face without considering whether the face is frontalized, i.e., facing forward towards a camera. When the face is not frontalized, a face part that is not captured by the camera can cause facial information loss and misalignment with the face images that are frontalized. On the other hand, in the case of the UV texture, all face images are aligned into the UV map that is created from generated 3D faces. Since the generated 3D faces cover all the facial parts, there is substantially reduced information loss. In UV map, the facial part for all the faces can be located in the same spatial space. In addition, the aligned face image can also provide pose, eyes blink and mouth movement information that cannot be perceived in the UV texture image, so both face images and their UV texture maps are used to extract the image features.

To learn the intra-frame dependencies, the transformer architecture600is trained on a sequence of the cropped facial images602with their UV texture maps606. In some embodiments, the pre-trained XceptionNet612is employed to extract feature maps from face images602and the UV texture maps606. After getting the feature maps of each face image frame and the corresponding UV texture map, the feature vectors are re-shaped using a 2D convolution layer614and a linear layer to accommodate the input dimension of video transformer630.

In the video transformer architecture600, the property of parallel input processing is exploited, which is inherent in the transformer models. The transformer networks can learn to detect the intra-frame discrepancies, such as flickering, blurry frames, and mouth movement. See Güera et al.; and Sabir et al. A single face frame and UV texture map that are input to the XceptionNet backbone can be represented as:

f∈ℝ⁢N2⁢T×D(1)u∈ℝ⁡(N2⁢T)×D(2)
where f represents face feature vector, and u represents UV texture map feature vector, N represents the total number of patches. In one embodiment, for facial image and UV texture map, N is 576, while N is 324 for facial image only. T represents the number of input frames and D represents the constant latent vector dimension. Each face image frame is concatenated with the corresponding UV texture map into concatenated feature vector624:

(f,u)∈ℝ(NT)×D(3)

In some embodiments, a one dimensional learnable segment embedding is used to help distinguish different types of inputs in the input data structure. The segment embeddings622are included as part of the feature vector which results from the fusion of facial images and their corresponding UV texture map feature vectors as obtained in Equation 3. The segment embeddings622can be defined as:

Eseg∈ℝ(NT)×D(4)

The input feature vector624to the transformer can be extracted from the concatenation of the facial frame and its corresponding UV map:

framei=[((face0⁢…⁢faceN2⁢T),(uV0⁢…⁢uvN2⁢T))×D]+Eseg-face⁢‐⁢uvNT(5)

where N=576, T=9 and D=768.

A learnable positional embedding628is then added to the whole input feature vector:
Epos∈N+1)×D(6)

The video transformer architecture600consists of 12 encoders632, where each encoder632includes a multi-head self-attention layer, two Norm layers and a Multi-Layer Perceptron (MLP).

The encoders632feed their output to a tan-h activation function634, and normalization function636, and then to a fully connected layer638, to provide a final output640of a classification result, either “Fake” or “Real”.

The video transformer architecture600is trained using a deep learning algorithm, i.e., an algorithm that can be used to train a network having an architecture having multiple layers without problems such as vanishing gradient. In one embodiment, an incremental learning strategy is used to fine-tune a pretrained transformer model on new datasets, without sacrificing its performance on previous datasets.FIG.7illustrates incremental learning in accordance with an exemplary aspect of the disclosure. D1 represents the real data used to train the models. D2 comprises of FaceSwap and Deepfakes datasets. D3 represents the Face2Face dataset and D4 represents Neural Textures dataset. D5 and D6 represents DFDC dataset and D7 represents DeepFake Detection (DFD) dataset. The loss function in the incremental learning consists of two parts: one part that measures the similarity between the weights from a new dataset and the old weights from the previous dataset, and the other one is to measure the accuracy of the training model on the new dataset. See Francisco M Castro, Manuel J Marin-Jiménez, Nicolás Guil, Cordelia Schmid, and Karteek Alahari. 2018. End-to-end incremental learning. InProceedings of the European conference on computer vision(ECCV). 233-248, incorporated herein by reference in its entirety. The former one forces the weights to be as similar as possible to the old weights, so it still performs well on the previous dataset. And the latter one guarantees that the model performs well on the new dataset.

The incremental learning first trains (702) the video transformer model on FaceSwap and Deepfakes subsets (D2) in FaceForensics++ dataset that are generated using faceswap technique. See Rössler et al. Then (704,706) the model is fine-tuned on the other two subsets of the FaceForensics++ dataset, Face2Face (D3) and Neural Textures (D4), which are generated by a different technique called facial re-enactment. See Rössler et al. To show the performance on unseen dataset, the model is also fine-tuned on DFDC dataset (D5, D6) and DeepFake Detection (DFD) dataset (D7). See Dolhansky et al.; and Rössler et al. The model is trained with segment embeddings on 280 k images from FaceSwap and Deepfakes subsets (D2) of FaceForensics++ dataset. The trained model is fine-tuned on only 2,500 images from the Face2Face subset (D3) which are 0.05% of the Face2Face subset. The trained model is finetuned on 2,500 images from Neural Textures subset (D4). Then the trained model is fine-tuned from the previous step on 2,500 images from DFD dataset (D7). See Rössler et al. Finally, the trained model is fine-tuned on 6,000 DFDC images (D5, D6), which are also of the DFDC dataset. See Dolhansky et al.

Example Implementations

In order to evaluate the video transformer architecture, example implementations have been trained and evaluated on a public DeepFake detection benchmark, FaceForensics++. See Rössler et al. The FaceForensics++ dataset includes four different subsets: (1) FaceSwap, (2) Deepfakes, (3) Face2Face and (4) Neural Textures. The first two subsets contain videos generated by the face swapping techniques, whereas the other two subsets are generated by the facial re-enactment techniques. There are 1,000 videos in each subset. The FaceForensics++ benchmark also contains 1,000 real videos. 720 videos were used from each subset for training and 140 videos for validation and 140 videos for testing. The FaceForensics++ dataset contains around 1.7 million frames. FaceSwap and Deepfakes subsets are used for model training by employing only 280 k frames for training. These models are further fine-tuned on Face2Face and Neural Textures subsets. The trained models are also fine-tuned on DFDC dataset and DFD dataset. See Dolhansky et al.; and Rössler et al. Table 1 shows the exact number of frames used to train and fine-tune the models from each dataset.

TABLE 1DatasetTrainingValidationTestPrestine138000276001400FaceSwap69000138001400Deepfakes69000138001400Face2Face25005001400Neural Textures25005001400DFDC600012003500DFD25005001400

For face detection, a Single Shot Detector (SSD) was deployed with ResNet as a backbone. 3DDFA-V2 (604) was deployed to generate UV texture maps (606). See Guo et al; Guo et al. (2020); and Hang Dai, Nick Pears, William A P Smith, and Christian Duncan. 2017. A 3d morphable model of craniofacial shape and texture variation. InProceedings of the IEEE International Conference on Computer Vision.3085-3093, each incorporated herein by reference in their entirety. XceptionNet (612) was used for image feature extraction. See Chollet et al. A transformer architecture was deployed, including 12 transformer layers. See Dosovitskiy et al. [FIG.8] [FIG.9]

FIG.8is a block diagram of an image transformer for the architecture ofFIG.6. The image Transformer800receives as input a 1D sequence of token embeddings816. To handle 2D images, the image x∈RH×W×C(804,812) is reshaped into a sequence of flattened 2D patches (814) xp∈RN×(P 2·C), where (H, W) is the resolution of the original image, C is the number of channels, (P, P) is the resolution of each image patch, and N=HW/P2is the resulting number of patches, which also serves as the effective input sequence length for the Transformer. The image Transformer800uses constant latent vector size D through all of its layers, the patches are flattened and mapped to D dimensions with a trainable linear projection. The output of this projection is referred to as the patch embeddings806.

Similar to BERT's [class] token (class embedding), a learnable embedding to the sequence of embedded patches806(z00=xclass) is prepared, whose state at the output of the Transformer encoder (zL0) serves as the image representation y. Both during pre-training and fine-tuning, a classification head (*) is attached to zL0. The classification head is implemented by a MLP with one hidden layer at pre-training time and by a single linear layer at fine-tuning time.

Position embeddings are added to the patch embeddings806to retain positional information. 1-D positional embedding encodes the input patches as a sequence of patches in the original raster order. Learnable 1D position embeddings are used, since significant performance gains have not been observed from using more advanced 2D-aware position embeddings. The resulting sequence of embedding vectors816serves as input to the transformer encoder808.

The Transformer encoder (808) consists of alternating layers of multiheaded self-attention (MSA) (826) and MLP blocks (830). Layer norm (824) is applied before every block, and residual connections after every block. Regarding self-attention, sstandard qkv self-attention (SA) is one building block for neural architectures. For each element in an input sequence z∈RN×D, a weighted sum is computed over all values v in the sequence. The attention weights Aijare based on the pairwise similarity between two elements of the sequence and their respective query qiand key kjrepresentations. Multihead self-attention (MSA) is an extension of SA in which k self-attention operations are run, called “heads”, in parallel, and project their concatenated outputs.

FIG.9is a block diagram of a video transformer for the architecture ofFIG.6in accordance with an exemplary aspect of the disclosure. The Vision Transformer (ViT) (632) base architecture was modified for the Video Transformer by adding the learnable segment embeddings906to the input data structure. See Luke Melas. 2020. PyTorch Pretrained ViT. https://github.com/lukemelas/PyTorch-Pretrained-ViT, incorporated herein by reference in its entirety. The learnable segment embeddings enable the learning of the visual details in image frames with temporal information.

The raw input size of the images fed to the video transformer model is [3, 299, 299]. This size is used to make other inputs compatible to the backbone network XceptionNet that is used for image feature extraction in hybrid models. After extracting image features through XceptionNet, a feature vector of dimension [2048, 10, 10] is obtained, then this feature vector is passed to a 2D convolutional layer and a linear layer, which gives us a feature vector of dimension [1, 32, 768]. After the two reshaped feature vectors are obtained for facial images and UV texture maps, these two feature vectors are concatenated and a feature vector of dimension [1, 64, 768] is obtained. A one dimensional learnable segment embedding is added to the feature vector as [1, 64, 768]. This is done for all the sequence frames and these frames are concatenated as [1, 576, 768]. The learnable positional embeddings are added to the feature vector and a [class] token is added at the beginning of the feature vector. The final feature vector [1, 577, 768] is used as the input to the proposed video transformer model. All models are trained for 5 epochs, with a learning rate of 3×10−3. SGD is used as the optimizer, and CrossEntropyLoss is used as the loss function.

Ablation Study

An ablation study with different experimental settings to show the effectiveness of the proposed modules. The models are trained with 8 different configurations:(1) Patch embedding transformer trained on face images only(2) Patch embedding transformer trained on face and UV textures without segment embeddings(3) Patch embedding transformer trained on face and UV textures with segment embeddings(4) Hybrid image transformer trained on face images only(5) Hybrid transformer trained on face and UV textures without segment embeddings(6) Hybrid transformer trained on face and UV textures with segment embeddings(7) Hybrid video transformer trained on 9 frames (face+UV texture maps) without segment embeddings(8) Hybrid video transformer trained on 9 frames (face+UV texture maps) with segment embeddings

The listed models are trained and evaluated on 2 subsets of FaceForensics++ dataset: FaceSwap and Deepfakes. The models are trained on around 280 k images. The performance comparison is shown in Table 2.

TABLE 2FaceForensics++ModelsAUCF1-ScoreAccuracyPatch Img Only74.39%65.88%72.31%Patch UV Img66.48%56.79%66.58%Patch SE UV Img77.10%68.71%73.26%Hyb Img Only98.03%96.19%97.37%Hyb UV Img98.57%97.20%98.09%Hyb SE Img99.28%98.92%99.28%Video98.74%97.54%98.32%Video SE99.64%99.28%99.52%

Patch embedding transformer trained on face images only. The patch embedding based models are trained on 2D image patches. The first model is trained on face images only, and no UV texture maps. The input image is reshaped into 2D patches as xinput=f+E, f represents the reshaped face frame image. N refers to the number of patches, which is 324 in our case. D represents the constant latent vector dimension, which is 768 in our model. After adding a BERT styled [class] token at the beginning of our input, the dimension of the input feature vector is [1, 325, 768].

Patch embedding transformer trained on face and UV textures without segment embeddings. This model is trained on 2D patches of facial images and the UV texture maps without adding the learnable segment embeddings to the input data structure. The positional embeddings are used, so that this model is compared to the model with both the positional embeddings and the segment embeddings. As illustrated in the first model and the second model of Table 2, it shows that the UV texture map provides useful information for DeepFake detection in the patch embedding transformer models.

Patch embedding transformer trained on face and UV textures with segment embeddings. One dimensional learnable segment embeddings with positional embeddings is added to train this model. The purpose of adding segment embeddings is to help model distinguish the face image patches and the UV texture map patches. As shown in the second model and the third model of Table 2, it can be seen that the model trained with the segment embeddings performs better than the model trained without segment embeddings. This implies that the proposed segment embeddings help enhance the feature learning, thereby improving the detection performance.

Hybrid image transformer trained on face images only. The hybrid image transformer model is trained on image features extracted from face image only using the XceptionNet backbone. As can be seen from Table 2, the hybrid model outperforms the patch embedding based model. So the image feature backbone is necessary in the transform based DeepFake detection model.

Hybrid transformer trained on face and UV textures without segment embeddings. Hybrid transformer model for face images and UV texture maps is trained without the learnable segment embeddings. The results in Table 2 show that the UV texture map provides useful information for DeepFake detection in the hybrid transformer models. This lies in the fact that the UV texture map is losslessly better aligned than the aligned face image. The aligned face image also provides pose, eyes blink and mouth movement information that cannot be prevented in the UV texture image.

Hybrid transformer trained on face and UV textures with segment embeddings. This hybrid image transformer model is trained using segment embeddings. The hybrid image transformer model is compared with and without the segment embeddings as shown in Table 2, it can be seen that the model trained with the segment embeddings performs better than the model trained without the segment embeddings. So the segment embeddings help the model distinguish the two different types of the input data, thereby enhancing the feature learning in the transformer.

Hybrid video transformer trained on facial image frames (face+UV texture maps) without segment embeddings. The structure of the video based transformer model is different from the image only based transformer models as described above. The video based models are fed with the consecutive face images and their corresponding UV texture maps. The video transformer model is trained on the face image frames and their corresponding UV texture maps without adding the segment embeddings. Only the positional embeddings are added to the input sequence of the face frames and their corresponding UV maps. The video transformer performs better compared to the image only based transformer model without the segment embeddings.

Hybrid video transformer trained on facial image frames (face+UV texture maps) with segment embeddings. The hybrid video transformer achieves the best performance among all the experimental settings. This model is trained on the consecutive face image frames along with their corresponding UV texture maps. Both the segment embeddings and the positional embeddings are added to the input data structure. Separate embeddings are added to each of the input face frames and each of the corresponding UV texture maps. It helps the video transformer model to discriminate the input frames and achieve better performance as shown in Table 2.FIGS.3and4above show frames of two example DeepFake videos from DeepFake Detection (DFD) dataset. The image transformer model classifies the videos as “Real”, while the video transformer correctly classifies both videos as “Fake.”

Incremental Learning

FIG.10is a flowchart for incremental learning in accordance with an exemplary aspect of the disclosure. The performance of models with incremental learning is shown in Table 3. In S1002, the models are fine-tuned on 280 k images from FaceSwap and Deefakes subsets from the FaceForensics++ dataset. In S1004, S1006, the models are fine-tuned on four different datasets: (1) Face2Face, (2) Neural Textures, (3) DFD and (4) DFDC. See Rössler et al; and Dolhansky et al.

TABLE 3Fine-TuningDatasetFSDFPristineF2FNTDFDDFDCCumulative AccuracyF2F95.00%99.28%100%99.28%98.39%Neural Textures96.42%99.28%100%100%94.28%98.00%DFD97.85%100%98.56%98.57%90.00%99.28%97.38%DFDC93.57%92.14%76.97%88.57%51.42%93.27%91.69%83.95%

Less than 0.5% of original data is used to fine tune the models with incremental learning. More specifically, in S1008, S1010, 2500 images are used to fine-tune the model on Face2Face, 2500 images on Neural Textures, 2500 images on DFD dataset, and 6000 images on DFDC dataset. Note that the DFDC dataset includes around 1.5 million frames. Table 3 shows that the proposed models fine tuned on a small amount of data can still achieve good performance on new datasets, while maintaining their performance on the previous datasets. The main reason lies in the loss function in incremental learning. As mentioned above, the loss function consists of two parts: one part that measures the similarity between the weights from a new dataset and the old weights from the previous dataset, and the other one is to measure the accuracy of the training model on the new dataset. The former one forces the weights to be as similar as possible to the old weights, so it still performs well on the previous dataset. And the latter one guarantees that the model performs well on the new dataset.

Comparison

The results achieved are compared by the proposed models with state-of-the-art DeepFake detection systems. Image Transformer refers to the model trained with the settings as described above and Video Transformer refers to the model trained with the settings as described above. In Table 4, the results of fusing are demonstrated on the predictions from Image Transformer and Video Transformer by averaging the probabilities from both models to get the final output score. The fused models outperform state-of-the-art DeepFake detection systems on FaceForensics++ dataset, DFD dataset and DFDC datasets.

TABLE 4MethodFF+DFDDFDCRossler et al.95.73%88.07%85.60%Mittal et al.84.40%Zhu et al.99.61%89.84%87.93%Li et al.93.34%73.52%Bonettini et al.89.35%85.71%Guera et al.83.10%Image + Image99.79%99.28%91.69%Fusion

In Table 5, the video transformer model outperforms state-of-the-art detection systems when trained and tested on a specific subset of FaceForensics++ dataset: Face2Face. The video transformer model can be fine-tuned on a smaller amount of data and achieve better performance when compared to other methods as shown in Table 5. This demonstrates a more enhanced generalization capability of the video transformer model with incremental learning.

TABLE 5MethodAccuracyNum. Train ImagesRossler et al.98.36%870kAfchar et al.84.56%9kZhu et al.98.22%172kLi et al.98.64%Image + Image Fusion99.28%5k

Numerous modifications and variations of the present invention are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims, the invention may be practiced otherwise than as specifically described herein.