Context-aware TFL: A Universal Context-aware Contrastive Learning Framework for Temporal Forgery Localization

Qilin Yin, Wei Lu, Xiangyang Luo, Xiaochun Cao · DOI

TL;DR

This paper introduces UniCaCLF, a novel framework for precisely locating tampered segments within videos. It leverages a context-aware contrastive learning approach to enhance the discriminability of forged video frames by contrasting them against the global video context, significantly outperforming existing methods.

What Problem Does This Paper Address?

The field of multimedia forensics has made strides in detecting deepfakes, but most existing methods treat forgery as a binary classification problem (real vs. fake) for the entire video. This overlooks a more insidious threat: temporal forgery localization (TFL), where only small, specific segments of a video are manipulated. These subtle alterations can completely change the meaning of the original content and are difficult to detect with methods assuming full-video forgery. TFL aims to pinpoint the exact start and end times of these tampered clips within a larger video, a task that is more challenging and realistic than simple classification.

Methods

The core of UniCaCLF is its universal context-aware contrastive learning framework. The key idea is that forged instants (frames or short segments) will likely deviate significantly from the overall "normal" context of the video.

Here's a breakdown of the novel components:

  • Context-Aware Perception Layer (CaP Layer): This layer is designed to identify and enhance features from potentially forged instants. It comprises two sub-modules:
  • Heterogeneous Activation Operation (HAO): This module uses a novel heterogeneous activation operation to selectively amplify features of instants that are distant from the global video context. It essentially highlights anomalies.
  • Adaptive Context Updater (ACU): To prevent forged instants from negatively influencing the global context, ACU uses a memory buffer to update the global context, downplaying the impact of outliers.
  • Context-Aware Contrastive Loss (CaCL): This is a supervised, sample-by-sample contrastive loss. Instead of comparing features across different videos (which can have diverse tampering types), CaCL focuses on learning within a single video. It aims to:
  • Compress the distance between genuine instant features and the global context.
  • Enlarge the distance between forged instant features and the global context. This intra-sample contrastive approach makes the model more robust to different tampering methods.

The framework also uses a pre-trained feature extractor and a feature pyramid to handle segments of varying lengths. The final output is generated by classification and regression heads.

Datasets

The paper evaluates UniCaCLF on five public datasets:

  • LAV-DF: A large-scale multimodal dataset for forgery detection and localization.
  • AV-Deepfake1M: Another large-scale multimodal dataset.
  • TVIL: A visual-only modified dataset.
  • HAD: An audio-only modified dataset.
  • Psynd: A multi-speaker English corpus dataset.

Key Insights and Ideas

  • Anomaly Detection is Key for TFL: The paper posits that temporal forgeries are best detected by identifying deviations from the norm, rather than relying solely on semantic understanding.
  • Intra-Sample Contrastive Learning is Crucial: The success of CaCL in focusing on within-video anomalies, rather than cross-video comparisons, is a significant insight. This makes the model more generalizable to diverse tampering techniques.
  • Global Context as a Reference: Using the global video context as a benchmark to identify outliers is an intuitive yet effective strategy for anomaly detection in this domain.
  • Complementary Components: The HAO, ACU, and CaCL modules are shown to be complementary, with each contributing to the overall performance improvement.

Key Results

UniCaCLF demonstrates state-of-the-art performance across multiple datasets and scenarios:

  • LAV-DF: Achieved a significant performance gain of 16.39% in [email protected] and 2.37% in AR@10 compared to previous best results.
  • AV-Deepfake1M: Outperformed other methods by a large margin, achieving 52.71% [email protected] and 92.32% AR@5.
  • TVIL: Achieved an average AP of 82.27% and AR of 90.84, outperforming competitors by at least 2.92% and 1.07%, respectively.
  • HAD: Showed strong results, outperforming TriDet by 6.01% under [email protected].
  • Cross-Dataset Generalization: UniCaCLF showed superior generalization capabilities, exceeding competitors by 5.24% in AP and 7.35% in AR when tested on the Psynd dataset after training on HAD.
  • Efficiency: The paper highlights that UniCaCLF has fewer trainable parameters and GFLOPS than many competitors, and achieves a high inference speed (35.08 samples/sec).

Limitations and Future Work

  • Temporal Modeling Capability: The paper notes that the CaP layer itself lacks strong temporal modeling capabilities. While a multi-level feature pyramid can provide some temporal information, this is an area for potential improvement.
  • Self-Attention Limitations: The authors acknowledge that transformer-based self-attention mechanisms can lead to rank loss and high similarity between instant features, which their CaP layer aims to mitigate. However, the inherent limitations of the CaP layer in capturing temporal information might be a trade-off.
  • Future Work: The paper suggests that the multi-level feature pyramid can provide temporal information, implying that further exploration of how to better integrate temporal modeling within the CaP layer or in conjunction with it could lead to even better performance.

Summary updated

BibTeX
@article{yin2026context,
  author = {Qilin Yin and Wei Lu and Xiangyang Luo and Xiaochun Cao},
  title = {{Context-aware TFL: A Universal Context-aware Contrastive Learning Framework for Temporal Forgery Localization}},
  journal = {IEEE Trans. Dependable Secur. Comput.},
  year = {2026},
  doi = {10.1109/tdsc.2026.3680621},
}
Figure