Overview
Deepfake detection models reach high accuracy on standard benchmarks, but they are usually trained on data that reflects the population that was easiest to collect, not the population the model will meet after deployment. This project measures how much detection accuracy drops when the distribution of a facial attribute in the test data differs from the one in the training data, and whether that drop depends on the attribute.
A controlled experimental framework trains three convolutional architectures under fixed attribute distributions and evaluates them on test sets whose attribute composition is progressively shifted. Grad-CAM++ heatmaps complement the quantitative analysis, showing not only whether a model fails but also where it looks when it does.
Dataset
The experiments use the FaceForensics++ (C23) subset manipulated with the DeepFake method. Its autoencoder-based pipeline introduces neural synthesis and blending artefacts, which makes it a more relevant testbed for deep learning detectors than graphics-based methods such as FaceSwap.
Frames were extracted from the videos and resized to 224x224, giving 59 552 frames from 200 unique videos. Labels come from the DeepFakeAnnotations (MAD) dataset, which provides per-frame annotations for 41 attributes. Four binary attributes were selected, ranging from visually salient structural features to subtler demographic characteristics:
- Ethnicity: White / Asian
- Sex: male / female
- Eyeglasses: present / absent
- Heavy makeup: present / absent
Experimental design
Three ImageNet-pretrained backbones were compared: Xception, InceptionV3 and EfficientNetV2-S. Each is extended with global average pooling, dropout (0.3) and a single sigmoid output, and trained with Adam (learning rate 1e-4) and binary cross-entropy for up to 15 epochs with early stopping.
The experiment follows a controlled distributional shift protocol:
- For each attribute, the training set is fixed at one of three ratios: 2:8, 5:5 or 8:2.
- Each trained model is evaluated on nine test sets with ratios 1:9 to 9:1.
- Every set is balanced with respect to the real / fake label, so only the attribute distribution changes.
- Samples are drawn with Monte Carlo sampling, and each configuration is repeated 10 times.
A ratio a:b gives the share of the first group listed above, so ethnicity 2:8 means 20% White and 80% Asian subjects. The full grid (4 attributes × 3 training ratios × 9 test ratios × 3 architectures × 10 repetitions) gives 3 240 evaluation runs. Architectures are compared with ANOVA, Welch's ANOVA or Kruskal–Wallis, chosen according to normality and variance tests, followed by the matching post-hoc procedure.
Results
The figures show EfficientNetV2-S accuracy across the nine test ratios for each training configuration. Shaded areas mark the spread over 10 repetitions, and red squares mark the test ratio equal to the training ratio.
Ethnicity

Ethnicity produces some of the most pronounced effects. Under Asian-dominant (2:8) training, accuracy peaks on the most Asian-dominant test set and declines sharply as the share of White subjects grows, an 18.0% drop for EfficientNetV2-S. Balanced training reduces the decline to 8.3%. Under White-dominant (8:2) training the curve is almost flat, but it sits below the peaks of the other two configurations.

All three architectures follow the same trend, with EfficientNetV2-S consistently on top.
Eyeglasses

Eyeglasses show the opposite pattern: under every training configuration, accuracy rises as the share of subjects wearing glasses grows. Eyeglass frames, with their hard edges, reflections and occlusion boundaries, appear to make deepfake artefacts easier to detect. Under 8:2 training the swing exceeds 30% for all three architectures, with the lowest accuracy of the whole experiment (.628 for Xception), which makes eyeglasses the most volatile attribute.
Makeup

Makeup leaves detection almost unchanged. Under 2:8 training, EfficientNetV2-S stays between .963 and .979 across the whole test range. The 8:2 configuration introduces a visible slope, but the swing is much smaller than for ethnicity or eyeglasses.
Sex

Sex shows the most nuanced behaviour. Balanced training gives a practically flat curve. Female-dominant (2:8) training produces a mild downward slope as the share of male subjects grows, and male-dominant (8:2) training reverses it. The curves cross near the middle of the test axis, so which sex is easier to detect is not intrinsic to either group but depends on which group dominated the training.
Architecture comparison
Accuracy range (minimum → maximum over the nine test ratios). A larger range means greater sensitivity to distributional shift.
| Attribute | Train | EfficientNetV2-S | InceptionV3 | Xception |
|---|---|---|---|---|
| Ethnicity | 2:8 | .774 → .954 | .717 → .950 | .708 → .948 |
| 5:5 | .877 → .960 | .832 → .946 | .821 → .947 | |
| 8:2 | .888 → .902 | .836 → .856 | .842 → .859 | |
| Eyeglasses | 2:8 | .839 → .937 | .804 → .929 | .769 → .887 |
| 5:5 | .800 → .972 | .743 → .955 | .735 → .951 | |
| 8:2 | .683 → .963 | .658 → .955 | .628 → .940 | |
| Makeup | 2:8 | .963 → .979 | .923 → .955 | .925 → .964 |
| 5:5 | .933 → .987 | .895 → .980 | .891 → .976 | |
| 8:2 | .845 → .980 | .798 → .967 | .763 → .960 | |
| Sex | 2:8 | .896 → .936 | .856 → .911 | .836 → .886 |
| 5:5 | .931 → .950 | .889 → .904 | .909 → .928 | |
| 8:2 | .886 → .950 | .842 → .921 | .835 → .905 |
EfficientNetV2-S achieves the highest mean accuracy in all 12 configurations and the lowest standard deviation in most of them. The differences are statistically significant at most test ratios, but the advantage is quantitative rather than qualitative: all three architectures follow the same trends.
Explainability analysis
Accuracy alone cannot tell apart a model that is slightly less confident about the right facial cues from one that has stopped looking at the face. Grad-CAM++ heatmaps were therefore generated for EfficientNetV2-S across all training configurations.

The heatmaps reveal a consistent pattern: distributional mismatch redirects attention away from the face toward irrelevant regions.
- Ethnicity: a model trained on Asian-dominant data spreads its attention into the background on White subjects, and the heatmap contracts onto the face as the share of White subjects in training increases.
- Sex: female-dominant training makes the model focus on the torso of male subjects, while male-dominant training diffuses its attention on female subjects across the whole image.
- Makeup: the heatmaps stay broadly centred on the face in every configuration, matching the flat accuracy curves.
Conclusions
Sensitivity to distributional shift is not a single problem but depends strongly on the attribute. Eyeglasses induce swings above 30 percentage points, ethnicity causes steep monotonic degradation, sex shows a reversible crossing pattern, and makeup leaves detection nearly invariant. A uniform diversity requirement would be wasteful for some attributes and insufficient for others, and this ranking gives an empirical basis for deciding where the annotation budget matters most.
Balanced (5:5) training narrowed the gap between best-case and worst-case performance for every attribute and architecture, without architectural changes or debiasing algorithms. It is not always optimal, though: under White-dominant ethnicity training it trades peak accuracy for a flat, lower plateau.
Finally, aggregate accuracy can hide whether a model is right for the right reasons. A model that reaches 85% accuracy by looking at the torso is riskier than one that reaches the same accuracy by looking at the face, so spatial explainability should be a routine part of fairness audits.
