IFDMamba: An Image Forgery Detection Method Based on Context-aware Mamba
Main Article Content
Abstract
To address the challenges in existing image forgery detection methods, including the difficulty of effectively capturing and integrating local fine-grained features with global background features and the overlooked relative definition of pristine and forged pixels within a single image, we propose IFDMamba, a context-aware Mamba-based Image Forgery Detection method. Firstly, we propose a novel context-aware Mamba, which enhances local contextual relationships between image patches by constructing a Gated Spatial Convolution (GaSC) module. Additionally, a bidirectional Mamba model is introduced to capture the global contextual relationships across the entire sequence of image patches. This enables the effective extraction and complementary integration of local fine-grained features and global background features in forged images, facilitating accurate localization of forged regions in complex backgrounds. Secondly, we propose an improved NT-Xent contrastive loss tailored for image forgery detection tasks, utilizing pixel-wise contrastive learning to supervise the extraction of high-level forensic features for each image. This loss function effectively captures the inherent distinction between pristine and forged pixels within an image. Finally, during the model testing phase, we use K-means to map the extracted high-level forensic features to the predicted forgery masks in real-time, further minimizing cross-image interference in the training data. Experimental results demonstrate that IFDMamba achieves consistent performance improvements over mainstream methods on five public datasets—Coverage, NIST, CASIA, MISD, and FF++. The method exhibits strong forgery detection capability and robustness in complex backgrounds, and holds significant application value in combating criminal networks in the black and gray markets that rely on image forgery.