CFL-Net: Image Forgery Localization Using Contrastive Learning

Fahim Faisal Niloy, Kishor Kumar Bhaumik, Simon S. Woo

Introduction

Image forgery detection has traditionally relied on identifying specific "footprints" left by manipulation processes, such as JPEG compression artifacts, camera sensor noise patterns, or edge inconsistencies. While these specialized methods perform well in controlled settings, they often struggle with real-world forgeries that employ diverse techniques like splicing, copy-move, and object removal.

CFL-Net (Contrastive Forgery Localization Network) addresses this limitation by shifting the focus from specific artifact detection to a more generalized statistical analysis. By leveraging contrastive learning, the model learns to differentiate between tampered and untampered regions based on the unique statistical signatures present within each individual image.

The Problem with Traditional Cross-Entropy

Standard forgery detection models typically utilize Cross-Entropy (CE) loss. However, the authors argue that CE loss is fundamentally ill-suited for this task. CE loss attempts to force all "tampered" pixels from thousands of different images into a single cluster in the feature space. In reality, a spliced object in one image has a completely different statistical signature than a removed person in another. Forcing these disparate signals to converge leads to overfitting and poor generalization. CFL-Net instead promotes "divergence," aiming to make tampered and untampered regions separable within the context of a single image.

Methodology

CFL-Net employs a sophisticated two-stream architecture designed to capture both visual and hidden noise features.

Two-Stream Encoder and Fusion

The network processes input through two parallel streams:

  1. RGB Encoder: Processes the standard visual information.
  2. SRM Encoder: Utilizes Steganalysis Rich Model (SRM) filters. These high-pass filters highlight noise and edge inconsistencies that are often invisible to the human eye but indicative of manipulation.

Features from both streams are fused and passed through an Atrous Spatial Pyramid Pooling (ASPP) module. This allows the model to capture information at multiple scales, identifying both minute edge artifacts and larger tampered objects.

The CFL-Net architecture featuring two-stream encoders, feature fusion, and the contrastive learning module.

Contrastive Learning Module

The core innovation of CFL-Net is its Contrastive Learning Module. Instead of directly predicting a mask, a "Projection Head" maps features into a space where a supervised contrastive loss is applied. The feature map is divided into a grid of patches, and the model is trained to pull patches of the same type (e.g., all tampered) together while pushing patches of different types (tampered vs. untampered) apart. This process occurs per image, allowing the model to adapt to the specific noise and color distribution of the file it is currently analyzing.

Experimental Results

CFL-Net was evaluated on several major benchmarks, including IMD-20 (real-world internet manipulations), CASIA v1/v2, and NIST-16. Notably, the model achieved state-of-the-art results without requiring the massive synthetic pre-training common in competing architectures.

  • IMD-20: Achieved 89.9% AUC, a 5.1% improvement over previous benchmarks.
  • NIST-16: Reached a near-perfect 99.7% AUC.
  • CASIA: Achieved 86.3% AUC.

Qualitative evaluations demonstrate that CFL-Net produces significantly cleaner and more accurate localization masks compared to existing methods like ManTraNet, which often produce noisy or incomplete predictions.

Qualitative comparison of forgery localization between the ground truth (GT), ManTraNet, and CFL-Net across various manipulation types.

Conclusion

CFL-Net represents a significant step forward in generalized image forgery localization. By moving away from specific artifact detection and embracing a patch-based contrastive learning approach, the model achieves superior generalization on real-world data. Future work will look into more sophisticated fusion mechanisms, such as Vision Transformers, and refining the decoder head to further sharpen mask boundaries.

Summary updated

BibTeX
@inproceedings{niloy2023cfl,
  author = {Fahim Faisal Niloy and Kishor Kumar Bhaumik and Simon S. Woo},
  title = {{CFL-Net: Image Forgery Localization Using Contrastive Learning}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2023},
  doi = {10.1109/wacv56688.2023.00462},
}
Figure