# Comparison of Deepfake Detection Techniques through Deep Learning
## 3 Approach
### Implementation  
Input data are a dataset that is labeled and clustered into two categories of real and fake. They are augmented for training purposes using the following specifications:  
* Rotation range of 20 for DenseNET and no rotation on Custom CNN
* Scaling factor of 1/255 was used for coefficient reduction
* Shear range of 0.2 to randomly apply shearing transformations
* Zoom range of 0.2 to randomly zoom inside pictures
* Randomized images using horizontal and vertical flipping  
After augmentation, the face images are classified as either fake or real using three different models: Custom CNN, VGG, and DenseNET. We defined two classes for our binary classification task: 0 to denote the real (e.g., normal, validation, and disguised face images) and 1 to denote fake (e.g., impersonator face images) groups, respectively. The \"Real and Fake Face-Detection\" dataset was used to train the three models at a learning rate of 0.001 and for 10 epochs. The test accuracy was then calculated using the test set. We applied data augmentation to flip all original images horizontally and vertically,  
Figure 3: Detailed steps of post-processing in our proposed approach for deepfake detection. hence a three-fold increase of the dataset size (original image + horizontally flipped image + vertically flipped image). **The Custom CNN architecture** included six convolution layers (Conv2D) each paired with batch normalization, max pooling and dropout layers. Rectified Linear Unit (ReLU) and sigmoid activation functions were applied for the input and output layers respectively. Dropout was applied to each layer to minimize over-fitting and padding was also applied to the kernel to allow for a more accurate analysis of images. The Custom CNN architectures have been trained and validated on the original and augmented datasets with a 1/255 scaling factor. Data augmentation was performed to observe effects of data aggregation on model performance and promote the generalizability of the findings. Details on augmentation process includes horizontal flip along with a 0.2 zoom range, shear range of 0.2 along with rescaling factor to avoid image quality to factor in model behavior during classification since not all the images had the same pixel-level quality. Following a similar approach to [56], **the VGG-19** model that was used is a 16-layer CNN architecture paired with three fully connected layers, five maxpooling layers and one SoftMax layer that is modeled from architectures in [56]. VGG-19 has been pretrained on a wide variety of object categories, which leads to its ability to learn rich feature representations. VGG-19 has demonstrated that it can provide a high accuracy level when classifying partial faces. This architecture demonstrated that its highest accuracy is accessible when its size is increased [57]; therefore, we have applied a high-end configuration to it by adding a dense layer after the last layer block that provides the facial features and added a dense layer as the output layer with sigmoid activation function to fine-tune the model for the task of deepfake detection. **The DenseNET architecture** used in this work is Keras's DenseNet-264 architecture with an additional dense layer as the last output layer. This architecture starts with a 7 \(\times\) 7 stride 2 convolutional layer followed by a 3 \(\times\) 3 stride-2 MaxPooling layer. It also includes four dense blocks paired with batch normalization and ReLU activation function for the input layers and sigmoid activation function for the output layer. Furthermore, there are transition layers between each denseblock that include a 2 by 2 average pooling layer along with a 1 by 1 convolutional layer. The last dense block is followed by a classification layer that leverages the feature maps of all layers of the network for the task of classification which we have coupled with a denseblock with the sigmoid activation function as the output layer. This model was trained on 100,000 images and validated on 20,000 images.