{"notes":[{"id":"face-antispoofing/cdftn","category":"face-antispoofing","legacyPath":"face-antispoofing/2212-cdftn","legacySlug":"2212-cdftn","legacyPaths":[],"title":"CDFTN","subtitle":"The Entanglement of Style","author":"Z. Yuan","paperDate":"2022-12-07","publishedOn":"2025-05-01","paperTitle":"Cyclically Disentangled Feature Translation for Face Anti-spoofing","paperUrl":"https://arxiv.org/abs/2212.03651","bibliography":{"title":"Cyclically Disentangled Feature Translation for Face Anti-spoofing","authors":["Haixiao Yue","Keyao Wang","Guosheng Zhang","Haocheng Feng","Junyu Han","Errui Ding","Jingdong Wang"],"url":"https://arxiv.org/abs/2212.03651","pdfUrl":"https://arxiv.org/pdf/2212.03651","codeUrl":null,"preprint":{"id":"2212.03651","submittedOn":"2022-12-07","url":"https://arxiv.org/abs/2212.03651"},"publication":{"venue":"AAAI","year":2023,"kind":"conference","url":"https://arxiv.org/abs/2212.03651"},"citation":"@misc{faceantispoofingcdftn2022,\n  title = {{Cyclically Disentangled Feature Translation for Face Anti-spoofing}},\n  author = {Haixiao Yue and Keyao Wang and Guosheng Zhang and Haocheng Feng and Junyu Han and Errui Ding and Jingdong Wang},\n  year = {2022},\n  eprint = {2212.03651},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2212.03651}\n}\n","citationPath":"/content/papers/citations/face-antispoofing/cdftn.0a18d25d8e5a.bib"},"thumbnail":{"src":"/content/papers/assets/6c4ecef910b8482ed2b534997f5dfb90162e8866d64f8a0311143aa2035993c0.jpg","width":1700,"height":696},"locale":"en","path":"/content/papers/en/face-antispoofing/cdftn.0c828d790933.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"phase-1","text":"Phase 1","depth":2},{"id":"feature-disentangling-and-adversarial-learning","text":"Feature Disentangling and Adversarial Learning","depth":3},{"id":"classifier-for-retaining-liveness-information","text":"Classifier for Retaining Liveness Information","depth":3},{"id":"cross-domain-generation-and-style-recombination","text":"Cross-Domain Generation and Style Recombination","depth":3},{"id":"consistency-loss","text":"Consistency Loss","depth":3},{"id":"phase-2","text":"Phase 2","depth":2},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-other-methods","text":"Comparison with Other Methods","depth":3},{"id":"multi-target-domain-feature-translation","text":"Multi-Target Domain Feature Translation","depth":3},{"id":"ablation-study","text":"Ablation Study","depth":3},{"id":"visualization-analysis","text":"Visualization Analysis","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[]}],"text":"After SSAN brought the idea of \"style\" into our FAS reading, many researchers began to focus on this question.\n\nThis led to several follow-up studies, and we continue to explore this paper.\n\n## Defining the Problem\n\nFAS may be posed as binary classification, but in practice it is a gate at which a live face must be distinguished from an attack.\n\nOn one side, there is a real human face, with flesh and breath; on the other, there is a high-resolution photo, a replayed video, or a silicone mask.\n\nEarly methods relied on handcrafted features, such as LBP, HOG, and SIFT, which once shone brightly. Later, CNNs took over, starting with ImageNet pre-trained models like VGG and ResNet, progressively stacking deeper and wider architectures. Some methods began incorporating LSTMs to capture temporal information, and others introduced a materials science perspective.\n\nBut no matter how methods evolved, one problem remained unsolved:\n\n> **Change the dataset, and the model becomes useless.**\n\nWhen the shooting device, ambient lighting, or cultural region changes, liveness models become like a disrupted compass, unable to point in the right direction.\n\nThus, Domain Generalization (DG) was born. We want models to learn the abstract \"liveness semantics\" rather than memorize the appearance of a specific dataset. However, DG methods are often built on multiple labeled domains, a resource that is not commonly available in real-world scenarios.\n\nA more deployment-friendly approach is Unsupervised Domain Adaptation (UDA), where there is a labeled source and an unlabeled target.\n\nUDA methods typically fall into three categories:\n\n1. Feature alignment, minimizing the distribution gap between source and target;\n2. Adversarial training, using a discriminator to obscure the source;\n3. Image transformation, directly making the source look like the target.\n\nAll are effective but have one problem:\n\n> **They don't \"truly disentangle semantics and style.\"**\n\nThe authors’ motivation is that distribution alignment or image translation may fail to preserve information needed for live/spoof decisions. These three techniques can also overlap.\n\nSo, if we accept that the difference between live and spoofed faces comes from \"semantics,\" and the difference between domains comes from \"style and background,\" can we design a model that truly overturns the domain framework?\n\n## Solving the Problem\n\n\n\n![model_arch](/content/papers/assets/6c4ecef910b8482ed2b534997f5dfb90162e8866d64f8a0311143aa2035993c0.jpg)\n\n\n\nThis paper introduces an architecture called **Cyclically Disentangled Feature Translation Network** (CDFTN for short).\n\nYou can probably sense the intense pressure from the above diagram—it looks complex, and it truly is.\n\nThe authors’ goal is not to directly classify real vs fake faces, but to first \"disentangle\" the latent features of a face across different dimensions, and then \"reassemble\" them into a representation that can bridge domain differences.\n\nThe entire process can be divided into two phases:\n\n1. **Phase 1: Feature disentangling, cross-domain translation, and generation of new images.**\n2. **Phase 2: Using the images generated in Phase 1 to train the final classifier.**\n\nThe core concept of this method is to decompose each face into two subspaces:\n\n- **Liveness Space**: Corresponds to semantic features of live vs. spoofed faces (which should exhibit cross-domain stability).\n- **Content Space**: Contains domain-specific information, such as device, lighting, and background, which can be seen as interference or noise.\n\nNext, you’ll need some background in adversarial learning, so let’s assume you’re already a GAN master. Let’s dive straight in.\n\n## Phase 1\n\n### Feature Disentangling and Adversarial Learning\n\nEach domain has a liveness encoder and a content encoder:\n\n- $E_s^L, E_t^L$: Extract liveness features from the source and target domains, respectively.\n- $E_s^C, E_t^C$: Extract content and style features from the source and target domains, respectively.\n\nTo keep liveness features focused on the live/spoof decision while hiding which domain they came from, the authors use **adversarial learning** to encourage both liveness encoders to produce domain-indistinguishable latent vectors $z^L$. Its loss function can be written as:\n\n$$\n\\min_{E_s^L,E_t^L} \\max_{D_L} \\mathcal{L}_{D_L} =\n\\mathbb{E}_{x^s \\sim P_S}[\\log D_L(E_s^L(x^s))] +\n\\mathbb{E}_{x^t \\sim P_T}[\\log(1 - D_L(E_t^L(x^t)))]\n$$\n\nHere, $D_L$ distinguishes whether $z^L$ comes from the source or target; the two liveness encoders try to \"trick\" it so their extracted features are difficult to distinguish by domain.\n\n### Classifier for Retaining Liveness Information\n\nA classifier $C$ supervises liveness discrimination on the source. The paper uses a two-element one-hot label $y^s$; with $C_k$ denoting the probability of class $k$, the full cross-entropy is:\n\n$$\n\\mathcal{L}_{cls} = -\\mathbb{E}_{(x^s, y^s)} \\left[\\sum_{k\\in\\{0,1\\}} y_k^s \\log C_k(E_s^L(x^s))\\right]\n$$\n\nSource classification encourages discriminative features, while domain adversarial training encourages alignment. These are optimization objectives, not guarantees of perfect disentanglement or correct target-domain classification.\n\n### Cross-Domain Generation and Style Recombination\n\nThis is where **CDFTN** shines.\n\nIn the first phase, the model not only extracts liveness features but also needs to \"exchange liveness and content features across different domains\" to generate new \"pseudo-labeled images.\"\n\nThe reason for this is that in real-world applications, the source and target domains often have significant differences (e.g., camera brand, shooting environment, lighting), and relying solely on data from the source domain for training usually fails to generalize to the target.\n\nBy using cross-domain recombination, the model can better \"see\" the potential variations in style across domains, thus expanding the available training data and making the final learned liveness detection more cross-domain stable.\n\nFirst, we obtain the following from the source and target domains:\n\n$$\n(z^L_s, z^C_s) = (E_s^L(x^s), E_s^C(x^s)), \\quad\n(z^L_t, z^C_t) = (E_t^L(x^t), E_t^C(x^t)).\n$$\n\nHere, $z^L$ represents the features most relevant for distinguishing real vs. fake faces in the \"liveness space,\" while $z^C$ represents the domain-specific style information (such as device effects, background, lighting characteristics).\n\nNext, the latent vectors of the two domains are exchanged, generating the following \"pseudo-labeled images\":\n\n$$\n\\hat{x}^t = G_t(z^L_s, z^C_t), \\quad\n\\hat{x}^s = G_s(z^L_t, z^C_s),\n$$\n\nHere $G_s,G_t$ are separate domain decoders. The target-style synthetic image $\\hat{x}^t$ inherits the source label $y^s$ through its source liveness feature. This transfers a label to a generated sample; it does not assign a predicted label to an original unlabeled target image. The reverse image $\\hat{x}^s$ supports the cycle constraints and does not automatically have a known target ground-truth label.\n\nThe significance of this is: if we can preserve the original real/fake semantics (carried by $z^L$) while simultaneously making the style closer to the target domain (determined by $z^C$), we can obtain additional training images that \"look similar to the target but still preserve real or fake face semantics.\" These images can then be used by the classifier to learn better recognition in the target domain.\n\nSeparate image discriminators $D_s,D_t$ distinguish captured images from generated ones in each domain. GAN real/fake here means captured/generated, not FAS live/spoof. The adversarial objective includes both domains:\n\n$$\n\\begin{aligned}\n\\mathcal{L}_{adv} ={}&\n\\mathbb{E}_{x^s}[\\log D_s(x^s) + \\log(1 - D_s(\\hat{x}^s))] \\\\\n&+ \\mathbb{E}_{x^t}[\\log D_t(x^t) + \\log(1 - D_t(\\hat{x}^t))].\n\\end{aligned}\n$$\n\nThe generators $G_s,G_t$ try to make their images look like real samples from the corresponding domains so that the discriminators cannot identify them as generated. That is the training objective; the authors also report that the generated images do not have good visual quality.\n\n### Consistency Loss\n\nTo avoid confusion or loss of **liveness features** or **original image content** during the style transformation process, the authors introduce three additional consistency losses to strengthen constraints, ensuring that the exchanged images retain their \"real/fake\" semantics and do not suffer from excessive style distortions.\n\n1. **Reconstruction Loss $\\mathcal{L}_{re}$**\n\n   Without cross-domain exchange (i.e., sending the same image's $z^L$ and $z^C$ back to the same decoder), we should be able to reconstruct the original image. If the reconstruction error is too high, it indicates that the encoder or decoder failed to correctly extract or restore the image, and it needs to be penalized during training.\n\n2. **Cycle Loss $\\mathcal{L}_{cyc}$**\n\n   Inspired by the concept of CycleGAN, if we have generated $\\hat{x}$ (the exchanged image), we can feed it back into the corresponding encoder to extract $(z^L, z^C)$ and then convert it back to the original domain. We require the final reconstruction to be \"as close as possible\" to the original image. This \"round-trip\" mechanism helps prevent irreversible information loss during cross-domain transformations.\n\n3. **Latent Space Loss $\\mathcal{L}_{lat}$**\n\n   This loss primarily ensures that the liveness features $z^L$ do not undergo significant deformation after cross-domain exchange. For instance, if the original image represents a \"real face,\" after multiple domain transformations, it should still maintain the \"real face\" semantics, not be distorted by style exchanges or noise operations. This loss constrains the model to preserve the semantic consistency of liveness features before and after the exchange.\n\nCombining these steps creates a closed-loop feature translation process: **disentangle, exchange, then use adversarial learning and consistency losses to correct the result**. The target-style pseudo-labeled images $\\hat{x}^t$ carry source liveness labels and will be used in the second phase.\n\n## Phase 2\n\nAfter completing Phase 1, the authors **fix** the entire generation framework and use the \"pseudo-labeled images\" $\\hat{x}^t$ generated earlier to train the final classifier $M$. The paper compares two design choices:\n\n- **LGSC (Feng et al., 2020)**: A multi-task design with classification, $L_1$ regression of spoof cues, and triplet loss.\n- **ResNet-18**: A binary classification design.\n\nIf using LGSC, the final loss can be written as:\n\n$$\n\\mathcal{L}_{stage2} = \\alpha_1 \\mathcal{L}_a + \\alpha_2 \\mathcal{L}_r + \\alpha_3 \\mathcal{L}_{tri},\n$$\n\nWhereas if using ResNet-18, only the binary classification part is retained.\n\n---\n\nThis is one of the more complex papers we've read recently. Overall, the core idea of CDFTN is:\n\n1. **First disentangle liveness semantics from domain-related content**, using adversarial learning to encourage cross-domain consistency of liveness features.\n2. **Then exchange features between domains**, generating more \"pseudo-labeled images\" through cross-domain generation.\n3. **Finally, use these pseudo-images as supplemental data** to train a more robust final classifier.\n\nFrom a methodological perspective, this architecture is indeed complex, but its approach is straightforward: the \"real/fake\" judgment of the same face should not be influenced by differences like camera brand or lighting conditions. Therefore, by first disentangling the \"liveness\" semantics and then attributing domain differences to content space, we can achieve more generalized and accurate liveness detection across domains.\n\n## Discussion\n\nThis paper evaluates the effectiveness of **CDFTN** in the context of cross-domain face anti-spoofing through both **Single Target Domain Translation (SS2ST)** and **Multi-Target Domain Translation (SS2MT)**.\n\nThe authors used four commonly used cross-domain FAS datasets:\n\n- **CASIA-MFSD** (C)\n- **Replay-Attack** (I)\n- **MSU-MFSD** (M)\n- **Oulu-NPU** (O)\n\nIn the **single target domain** setting, one source (including all data) and one target (with its training set) are selected for the experiment.\n\nThis results in 12 test scenarios:\n\n- C → I, C → M, C → O\n- I → C, I → M, I → O\n- M → C, M → I, M → O\n- O → C, O → I, O → M\n\nIn the **multi-target domain** setting, one of the C, I, M, O datasets is chosen as the source, and the other three are treated as unlabeled targets.\n\nThus, there are 4 scenarios:\n\n- C → I & M & O\n- I → C & M & O\n- M → C & I & O\n- O → C & I & M\n\nFor evaluation metrics, the authors used the following two common quantitative metrics:\n\n1. **HTER (Half Total Error Rate)**:\n\n   $$\n   \\mathrm{HTER} = \\frac{ \\mathrm{FRR} + \\mathrm{FAR} }{2},\n   $$\n\n   where $\\mathrm{FRR}$ and $\\mathrm{FAR}$ are the False Rejection Rate and False Acceptance Rate, respectively.\n\n2. **AUC (Area Under the Curve)**: The higher the AUC, the better the classifier's ability to distinguish between real and fake faces.\n\n### Comparison with Other Methods\n\n![compare](/content/papers/assets/62b64e8636829a1c7edbd58e7fc8b1941fe71b808164f5f0ec1aee273c12c201.jpg)\n\nThe authors first compared **CDFTN** with other cross-domain learning methods, and the results are shown in the table above:\n\n- Table 1 reports HTER, not per-direction AUC. CDFTN-L averages 13.2% across 12 directions, and CDFTN-R averages 13.8%. Baseline averages with missing directions should not be compared directly with these complete averages.\n- For C → O, CDFTN-L/R scores 29.9%/32.5% HTER, worse than MDDR at 24.7% and some other baselines. Nor is each CDFTN variant best elsewhere: CDFTN-R has 14.4% on C → M versus DR-UDA’s 9.0%. The proposed explanations involving Oulu’s attack devices and resizing blur were not isolated in a controlled causal experiment.\n\nCDFTN is itself a UDA method. These comparisons support disentanglement, generation, and classifier retraining in several settings; they do not show that domain adaptation generally fails or prove universally invariant liveness representations.\n\n### Multi-Target Domain Feature Translation\n\n\n\n![multi_target](/content/papers/assets/fdbfcd3fac06c11c7e8b5ca11647fdeb653976bd4d5f08de8ba8b39c672d9307.jpg)\n\n\n\nThe authors compared three different settings:\n\n1. **SS2ST**: Single target domain.\n2. **SS2BT**: Merging multiple target domains into a \"mixed\" single domain for SS2ST.\n3. **SS2MT**: Uses separate domain encoders, decoders, and associated discriminators, cycling liveness features from the source through the targets and back. Source liveness features and each target’s content then generate training images.\n\nFor all four groups of target-averaged HTER and AUC values in Table 2, **SS2MT** outperforms both **SS2BT** and **SS2ST**.\n\nThis indicates that when dealing with multiple subdomains, using a single encoder (treating all targets as one entity) may degrade performance due to large internal domain differences.\n\nSS2MT uses multiple unlabeled target domains in a joint training process before training a classifier for them. This avoids separately running the whole pipeline per target, but subnetworks grow with the number of domains, so compute, memory, and elapsed time need measurement. Table 2 also reports target-averaged results, not improvement in every individual target.\n\n### Ablation Study\n\n\n\n![ablation](/content/papers/assets/dec35700ed2205bfda5ac90cde1178076c5efe2cac270a2e8ef27b1a893fb24f.jpg)\n\n\n\nThe authors remove four loss terms in turn. Table 3 above reports CDFTN-L with LGSC; the ResNet-18/LGSC comparison is primarily in Table 1.\n\nThe results show:\n\n1. Removing **$L_{cls}^L$** (the cross-entropy loss for the liveness classifier on the source) caused a performance drop, indicating that if $z^L_s$ doesn't retain liveness discriminability, the model struggles to extract genuinely discriminative liveness features.\n2. Removing **$L_{cyc}$** (cycle consistency) removes the closed-loop translation constraint; mean HTER rises from 8.1% to 11.0%.\n3. Removing **$L_{re}$** (self-reconstruction loss) caused the model to lose the ability to accurately restore the original image, undermining the basic constraints on the encoder/decoder. This had a significant impact on performance.\n4. Removing **$L_{lat}$** (latent space consistency) caused liveness features to distort or be lost during reconstruction, similarly degrading results.\n\nAcross the nine directions in Table 3, full-model HTER averages 8.1%. Removing reconstruction, liveness classification, latent consistency, and cycle consistency gives 19.7%, 12.0%, 11.7%, and 11.0%, respectively. Reconstruction has the largest effect, but latent consistency is not second by these averages, despite that ranking in the paper’s prose. Ablations support usefulness in this setting rather than directly proving the proposed mechanisms.\n\n### Visualization Analysis\n\n\n\n![visualization](/content/papers/assets/9b0d77242ef4b0932093caad22658488b1671f3e8f619036de03ee28b1801894.jpg)\n\n\n\nFor the **M → I** experiment, the authors sample 500 examples from each domain and use t-SNE to display the features in 2D. Blue and orange denote source and target; circles and crosses denote live and spoof faces. Before translation is on the left and after translation on the right. In this example, same-class examples across domains are closer and the drawn decision boundary is clearer after translation. The plot alone cannot quantify domain differences in every setting.\n\n## Conclusion\n\nIn the research history of FAS, the weight of the term \"style\" has gradually increased.\n\nInitially considered an interference factor, it later became a key explanation for the failure of recognition generalization, and further became an explicit modeling dimension. The relationship between style and semantics has become the core of many methodologies in recent years.\n\nCDFTN is a key point along this path.\n\nIt not only disentangles semantics from style, but more importantly, it transforms this disentanglement into part of the generation mechanism and trains a classifier using cross-domain pseudo-labeled samples, attempting to establish a semantic-driven style reconstruction process.\n\nCompared to research directions focusing on \"how to combat domain shift,\" respecting the existence of style and allowing the model to learn to coexist with it is also an important topic.\n","imageSizes":{"/content/papers/assets/6c4ecef910b8482ed2b534997f5dfb90162e8866d64f8a0311143aa2035993c0.jpg":{"width":1700,"height":696},"/content/papers/assets/62b64e8636829a1c7edbd58e7fc8b1941fe71b808164f5f0ec1aee273c12c201.jpg":{"width":1692,"height":424},"/content/papers/assets/fdbfcd3fac06c11c7e8b5ca11647fdeb653976bd4d5f08de8ba8b39c672d9307.jpg":{"width":1132,"height":516},"/content/papers/assets/dec35700ed2205bfda5ac90cde1178076c5efe2cac270a2e8ef27b1a893fb24f.jpg":{"width":1536,"height":338},"/content/papers/assets/9b0d77242ef4b0932093caad22658488b1671f3e8f619036de03ee28b1801894.jpg":{"width":1152,"height":508}}}
