Skip to content

SAFIRE: Segment Any Forged Image REgion (AAAI 2025). Official Repo.

Notifications You must be signed in to change notification settings

mjkwon2021/SAFIRE

Repository files navigation

💎 SAFIRE

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.

📄 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].


🎨 Example input / output:


🎁 SafireMS Dataset

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 Dataset on Kaggle SafireMS Dataset on Kaggle SafireMS Dataset on Kaggle SafireMS Dataset on Kaggle SafireMS Dataset on Kaggle

  • SafireMS-Expert: Manually created datasets designed for evaluating multi-source partitioning performance.
    SafireMS Dataset on Kaggle


⚙️ Setup

  1. Clone the repository

    git clone https://github.com/mjkwon2021/SAFIRE.git
    cd SAFIRE
  2. Download pre-trained weights
    Download the weights from [Google Drive Link].
    Place the downloaded weights in the root directory of this repository.

  3. Install dependencies

    conda env create -f environment.yaml
    conda activate safire

    For manual installation, run the commands listed in manual_env_setup.txt.


🚀 Inference

SAFIRE supports two inference types: binary forgery localization and multi-source partitioning.

  1. Prepare Input Images

    • Place your input images in the directory: ForensicsEval/inputs.
  2. 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.

Binary Forgery Localization

Run the following command:

python infer_binary.py --resume="safire.pth"

Multi-Source Partitioning

  • 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

🧪 Test

To evaluate the model on your test dataset:

  1. Download the test dataset
    Obtain the test dataset and place it in a desired location.

  2. Set the dataset path
    Update the dataset path in ForensicsEval/project_config.py to point to your downloaded dataset.

  3. 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
  4. View Results
    The evaluation results will be saved as an Excel file.


📚 Citation

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}
}

About

SAFIRE: Segment Any Forged Image REgion (AAAI 2025). Official Repo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages