Context-Aware Weakly Supervised Image Manipulation Localization With SAM Refinement

Xinghao Wang, Tao Gong, Qi Chu, Bin Liu, Nenghai Yu

Introduction

The proliferation of digital image manipulation tools has made the detection of tampered content—such as splicing or copy-move forgeries—a critical task for digital forensics. While fully supervised deep learning models achieve high accuracy, they rely on massive datasets with pixel-level annotations, which are expensive and time-consuming to produce. Weakly supervised methods offer a more scalable alternative by training only on image-level labels (e.g., "authentic" vs. "manipulated"). However, these methods often struggle with precision, typically producing coarse "blurry" localization maps that fail to delineate the sharp boundaries characteristic of digital tampering.

This paper introduces a novel framework that bridges this gap by combining a boundary-aware localization module with the zero-shot segmentation capabilities of the Segment Anything Model (SAM).

Methodology

The proposed architecture utilizes a dual-branch Transformer-CNN design to capture both global context and local texture inconsistencies.

Context-Aware Boundary Localization (CABL)

Manipulated regions often share similar textures with authentic parts of an image, making internal detection difficult. The "smoking gun" of a forgery is frequently found at the boundary where the fake object meets the real background. The CABL module employs non-learnable Sobel filters to explicitly extract high-frequency edge information. By focusing on these edges, the model learns to identify "context-inconsistency"—the mathematical artifacts left behind during the blending of disparate image regions.

CAM-Guided SAM Refinement (CGSR)

Standard weakly supervised models rely on Class Activation Mapping (CAM) to identify regions of interest. However, CAMs are notoriously imprecise. To address this, the authors introduce CGSR, which uses coarse CAM outputs to automatically generate "visual prompts" (bounding boxes and positive/negative points). These prompts are then fed into a frozen Segment Anything Model (SAM). SAM leverages its extensive pre-trained knowledge to refine the initial blurry heatmaps into sharp, high-precision masks without requiring any additional pixel-level training.

Overview of the proposed pipeline, highlighting the CABL and CGSR modules.

Experimental Setup and Results

The model was trained on the CASIAv2 benchmark and evaluated across four diverse datasets to test generalization: CASIAv1, Columbia, COVERAGE, and IMD2020.

Quantitative Performance

The framework achieved state-of-the-art results among weakly supervised methods. On the real-world IMD2020 dataset, the model reached a Pixel-level F1 (P-F1) score of 0.368, nearly doubling the performance of previous leaders like WSCL (0.193). Furthermore, it achieved an average Image-level AUC (I-AUC) of 0.805 across all test sets, occasionally outperforming partially supervised models.

Qualitative Comparison

Visualizations demonstrate a significant improvement in localization quality. While previous weakly supervised methods often produce broad, inaccurate blobs, the proposed framework generates masks that tightly follow the contours of manipulated objects, even in challenging cases like copy-move forgeries.

Qualitative comparison of localization results across different datasets.

Discussion and Limitations

A key insight of this work is the strategic use of SAM as a zero-shot post-processor. By using a weak model to "point" SAM in the right direction, the system achieves high-fidelity masks without pixel-level supervision. The method also demonstrates robustness against common image degradations like JPEG compression and Gaussian blur.

However, some limitations remain. The use of SAM during inference introduces additional computational overhead compared to standard CNNs. Additionally, the final mask quality is sensitive to the initial CAM's accuracy; if the prompt generator fails to identify the general region of tampering, SAM cannot recover the correct mask. Finally, as generative AI produces increasingly seamless boundaries, future work may need to evolve beyond the current edge-centric approach.

Summary updated

BibTeX
@article{wang2025context,
  author = {Xinghao Wang and Tao Gong and Qi Chu and Bin Liu and Nenghai Yu},
  title = {{Context-Aware Weakly Supervised Image Manipulation Localization With SAM Refinement}},
  journal = {IEEE Signal Processing Letters},
  year = {2025},
}
Figure