# Detection of Forged Images Using a Combination of Passive Methods Based on Neural Networks
## 3 Materials and Methods
### Discrete Wavelet Transform
The second folder contains 7491 manipulated images sourced from the realistic images part of the IMD2020 dataset, Realistic Tampering Dataset (RTD), CASIA V2.0, and an additional 218 images from CASIA V1.0, in order to make number of manipulated and pristine images equal. However, it remains uncertain whether there is a 50% incidence of manipulation in real-world applications, potentially introducing classifier bias. Table 2 illustrates the distribution of images from each dataset. Therefore, as explained in Table 2 the final dataset used in this paper consists of 14,982 images in total, half original and half Manipulated, since some of the images were not supported by model all images were converted to jpg format. The second step of the final program is to apply the methods described to the dataset, as both methods generate an image as output. The result is two new sets of images with specific inconsistencies enhanced, using methods from the TensorFlow library whenever applicable. The dataset was divided into three parts: 70% for training, 20% for validation, and 10% for testing. Each image was resized to 224 by 224 pixels to match the input size required by MobileNetV2, a pre-trained neural network that was initially considered but ultimately not used in favor of a custom model due to improved performance. The experiment consisted of first creating two additional sets of images using the two selected passive methods. Subsequently, three convolutional neural networks were trained: Model A using the original dataset, and Models B and C utilizing the outputs of the selected passive methods. These models were then combined by concatenating them at the penultimate layer. Additionally, an extra dense layer followed by a batch regularization layer was introduced so the model could learn how to combine the results, this combination is the final merged model. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **CASIA V1.0** & **CASIA V2.0** & **IMD2020** & **RTD** & **Total** \\ \hline Authentic & 0 & 7491 & 0 & 0 & 7491 \\ Tampered & 218 & 5123 & 1930 & 220 & 7491 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Images used from each Dataset for to Assemble our Dataset. To enhance accuracy and mitigate overfitting, three techniques were employed. First, a model checkpoint callback was implemented, which saved the model weights corresponding to the minimum validation loss achieved during training. Second, an early stopping condition was defined, terminating training after 50 epochs without any improvement in validation loss. The third technique used to reduce overfitting was the use of dataset augmentation techniques applied at the end of every epoch to the training images, which randomly flipped the image in the four-axis and changed the brightness, contrast, saturation, and hue of the images randomly. The experiments were conducted on a system with the following specifications: Windows 11 operating system, Intel(R) Core(TM) i5-8300H CPU 2.30 GHz, 16 GB RAM, GeForce GTX 1050 graphics card, Python version 3.10, CUDA version 11.2, cuDNN version 8.1.1, and TensorFlow version 2.10.0. The training was performed with a batch size of 32 over a total of 500 epochs, as the dataset exhibited significant variation in manipulations, leading to fluctuation in the loss of validation images. ## 4 Results and Discussion

After training, the final Accuracy obtained by the merged model was 89.59% in the set of test images, higher than the model trained just with original images, which obtained 78.64%. The Figures 8-11 illustrate the area under the curve (AUC) of the Receiver Operating Characteristic (ROC) for the models, assessed across both validation and test datasets, highlighting their performance capabilities. Complementarily, Figures 12-15 present detailed graphics depicting the accuracy and loss metrics during the training phase for models A, B, C and the specifically proposed merged model, showcasing each model's progression and comparative effectiveness throughout the training process.