# Research on the Face Forgery Detection Model Based on Adversarial Training and Disentanglement
## 3 Method
### Disentangled Framework  
Figure 3 presents the disentangled framework that we have developed. The core of this network is the discriminator D, which consists of three primary components a shared feature encoder, denoted as Encoder, additional convolutional blocks, referred to as \"Conv Block\" and a set of classifiers, labeled C\({}^{*}\), including C\({}_{\text{ls}}\), C\({}_{\text{t}}\), and C\({}_{\text{d}}\). For training, suppose that we have N samples \(\{(\text{S}^{(i)},y_{\text{f}}^{(i)},y_{\text{t}}^{(i)},\ldots)\}_{\text{N}}^{ \text{i=1}}\) generated and labeled by G, where S\({}^{(i)}\) represents the face forgery image, \(y_{\text{f}}^{(i)}\in\{0,1\}\) indicating the authenticity of the image, and \(y_{\text{t}}^{(i)}\in\{0,1,2,3,4\}\) indicates the label defining the type of forgery type. Figure 3: The framework of our disentangled module. This framework also involves the discriminator D. Specifically, a modified Xception network serves as the backbone of the feature extraction network, Encoder. In the final phase of feature extraction, two additional convolutional blocks effectively transform the high-dimensional features into two lower-dimensional feature representations, \(\text{f}_{1}\) and \(\text{f}_{2}\). The features \(\text{f}_{1}\) and \(\text{f}_{2}\) are then fed into their respective classifiers, C\({}_{\text{ls}}\) and C\({}_{\text{t}}\). C\({}_{\text{ls}}\) is used to detect the authenticity of the image, while C\({}_{\text{t}}\) identifies the type of forgery. Finally, a distribution classifier C\({}_{\text{d}}\) is employed to further classify the relevant features. We input \(\mathrm{S}^{(i)}\) into the shared Encoder to extract a comprehensive feature representation fea. Furthermore, by integrating the shared encoder with the additional convolutional block, we efficiently transform the high-dimensional features extracted by Encoder into two lower-dimensional feature representations \(\mathrm{f}_{1}\) and \(\mathrm{f}_{2}\). This process captures the forgery features for the task and the forgery type features, respectively, while also reducing the feature dimensions which will more effectively disentangle the features. Subsequently, the forgery classifier \(\mathrm{C}_{\mathrm{ls}}\) processes the feature vector \(\mathrm{f}_{1}\) to classify the authenticity of the image, and the forgery type classifier \(\mathrm{C}_{\mathrm{t}}\) uses \(\mathrm{f}_{2}\) to identify the specific forgery technique. Each classifier independently completes its respective classification task. For the classification tasks, we employ the AM-Softmax [25] loss \(\mathcal{L}_{\mathrm{C}_{\mathrm{ls}}}\) as the objective function for the forgery classifier \(\mathrm{C}_{\mathrm{ls}}\), and we use cross-entropy loss \(\mathcal{L}_{\mathrm{C}_{\mathrm{t}}}\) for the forgery type classifier \(\mathrm{C}_{\mathrm{t}}\):  
\[\mathcal{L}_{\mathrm{C}_{\mathrm{ls}}}=\mathcal{L}_{\mathrm{am-softmax}}( \mathrm{C}_{\mathrm{ls}}(\mathrm{f}_{1}^{(i)}),\mathrm{y}_{\mathrm{t}}^{(i)}) \tag{2}\]  
\[\mathcal{L}_{\mathrm{C}_{\mathrm{t}}}=\mathcal{L}_{\mathrm{ce}}(\mathrm{C}_{ \mathrm{t}}(\mathrm{f}_{2}^{(i)}),\mathrm{y}_{\mathrm{t}}^{(i)}) \tag{3}\]  
where \(\mathcal{L}_{\mathrm{am-softmax}}\) represents the AM-Softmax loss, and \(\mathcal{L}_{\mathrm{ce}}\) represents the cross-entropy loss. It is important to note that E, \(\mathrm{C}_{\mathrm{ls}}\), and \(\mathrm{C}_{\mathrm{t}}\) utilize the front and back parts of the backbone network, respectively. To obtain the disentanglement capabilities of our detector, we design a distribution classifier \(\mathrm{C}_{\mathrm{d}}\) to discern the Mutual Information between \(\mathrm{f}_{1}\) and \(\mathrm{f}_{2}\). Mutual Information is a measure from information theory that quantifies the amount of information obtained about one random variable through another random variable.