# Research on the Face Forgery Detection Model Based on Adversarial Training and Disentanglement
## 3 Method
### Entriching Forged Samples  
Data augmentation is a crucial technical means that effectively increases the size and diversity of datasets by introducing minor modifications to existing data or by creating synthetic new data from existing datasets. In the field of face forgery detection, employing data augmentation technologies to generate forged images and thereby enhance data diversity has become a common practice. Inspired by the work of [PERSON] et al. [23], this study not only generates additional samples as an enhancement method but also utilizes adversarial training to dynamically construct forged data that more closely resembles advanced forgery techniques. In this process, the generator network plays a crucial role.  
The input to the generator network selects a real or an original forged image (i.e., a forged image in the original data) from the original dataset as the first input image. If the input is a real image, another real image is randomly selected as a reference image and fed into the generator network of the backbone system to produce randomly selected forged areas, including the eyes, nose, mouth, and eyebrows. The selection of the forgery area is achieved through probability distribution. However, if the input image is an original forged image, since it already has forged features, it will directly become the input of the discriminator network.  
This study employs an image synthesis method aimed at simulating the effect of face forgery within specific facial regions by cleverly blending the input image with the reference image. This approach is predicated on the assumption that face forgery significantly impacts facial regions in images, particularly in key feature areas such as the eyes, nose, and mouth.  
Figure 2: The framework of our model. Our framework has two main networks: the generator G and the discriminator D. D includes a shared feature encoder, classifiers C*, and additional convolutional blocks. G’s main role is to generate a rich range of forged samples. We train the model primarily through adversarial methods, ultimately employing only D for the detection of forgeries.  
To ensure the diversity of the generated images, regional features are mapped to one-dimensional logits vectors in the generator network, and the Softmax function is used to obtain their probability distribution. A polynomial distribution selects a forgery region from this distribution at random, encouraging the model to explore various options and thus enrich the data's diversity.  
After selecting the forged area, the synthesis process focuses on the key regions. This objective is achieved using a mask-based image fusion technology, as described by the following equation:  
\[I_{a}=M_{i}\odot I_{r}+(J-M_{i})\odot I_{p} \tag{1}\]  
Here, \(M_{i}\) represents the grayscale mask of the selected forged area, \(J\) is an all-1 matrix, and \(\odot\) indicates element-wise multiplication. This approach ensures that other parts of the input image \(I_{p}\) remain unaffected by introducing the all-1 matrix \(J\), allowing image fusion and retention of the original input through element-wise operations. The resulting composite image \(I_{a}\) is then used in subsequent detection tasks, where an auxiliary task for forgery area estimation employs the L1 loss \(\mathcal{L}_{\text{R}}\) to guide the classification of the forgery area [23].