Welcome to the official repository for the paper "SAFIRE: Segment Any Forged Image Region", accepted at AAAI 2025.
SAFIRE specializes in image forgery localization through two methods: binary localization and multi-source partitioning.
- Binary localization identifies the forged regions in an image by generating a heatmap that visualizes the probability of each pixel being manipulated.
- Multi-source partitioning divides the image into segments based on their originating sources. This task is proposed for the first time in this paper.
Authors: Myung-Joon Kwon*, Wonjun Lee*, Seung-Hun Nam, Minji Son, and Changick Kim
Title: SAFIRE: Segment Any Forged Image Region
Conference: Proceedings of the AAAI Conference on Artificial Intelligence, 2025
The paper is available on [arXiv Link].
The SafireMS Dataset is introduced in our paper and is publicly available on Kaggle for RESEARCH PURPOSES ONLY:
-
SafireMS-Auto: Automatically generated datasets used for pretraining.
-
SafireMS-Expert: Manually created datasets designed for evaluating multi-source partitioning performance.
-
Clone the repository
git clone https://github.com/mjkwon2021/SAFIRE.git cd SAFIRE
-
Download pre-trained weights
Download the weights from [Google Drive Link].
Place the downloaded weights in the root directory of this repository. -
Install dependencies
conda env create -f environment.yaml conda activate safire
For manual installation, run the commands listed in
manual_env_setup.txt
.
SAFIRE supports two inference types: binary forgery localization and multi-source partitioning.
-
Prepare Input Images
- Place your input images in the directory:
ForensicsEval/inputs
.
- Place your input images in the directory:
-
Output Locations
- Outputs for binary forgery localization will be saved in:
ForensicsEval/outputs_binary
. - Outputs for multi-source partitioning will be saved in:
ForensicsEval/outputs_multi
.
- Outputs for binary forgery localization will be saved in:
Run the following command:
python infer_binary.py --resume="safire.pth"
- Using k-means clustering:
python infer_multi.py --resume="safire.pth" --cluster_type="kmeans" --kmeans_cluster_num=3
- Using DBSCAN clustering:
python infer_multi.py --resume="safire.pth" --cluster_type="dbscan" --dbscan_eps=0.2 --dbscan_min_samples=1
To evaluate the model on your test dataset:
-
Download the test dataset
Obtain the test dataset and place it in a desired location. -
Set the dataset path
Update the dataset path inForensicsEval/project_config.py
to point to your downloaded dataset. -
Run the evaluation
- For binary prediction:
python test_binary.py --resume="safire.pth"
- For multi-source partitioning:
python test_multi.py --resume="safire.pth" --cluster_type="kmeans" --kmeans_cluster_num=3
- For binary prediction:
-
View Results
The evaluation results will be saved as an Excel file.
If you find this repository helpful, please consider citing our paper:
@article{kwon2024safire,
title={SAFIRE: Segment Any Forged Image Region},
author={Kwon, Myung-Joon and Lee, Wonjun and Nam, Seung-Hun and Son, Minji and Kim, Changick},
journal={arXiv preprint arXiv:2412.08197},
year={2024}
}