CoolFace
Apppublic

ankitkumar-13/ManTraNet-Image-Forgery-Detection

sourceHugging Faceotherupdated 5mo agoView on Hugging Face
0likes
App README

ManTra-Net: Image Forgery Detection & Localization

![Paper](https://openaccess.thecvf.com/contentCVPR2019/papers/WuManTra-NetManipulationTracingNetworkforDetectionandLocalizationofImageCVPR2019_paper.pdf) ![GitHub](https://github.com/ISICV/ManTraNet)

Overview

ManTra-Net (Manipulation Tracing Network) is an end-to-end image forgery detection and localization model published at CVPR 2019. It takes any image as input and produces a pixel-level forgery likelihood map.

Architecture

ManTraNet is composed of two sub-networks:

  1. 1.Image Manipulation Trace Feature Extractor — trained on 385 manipulation classes, sensitive to different forgery types
  2. 2.Local Anomaly Detection Network — compares local features against regional averages to detect anomalous regions

Supported Forgery Types

  • ✂️ Copy-move
  • 🔀 Splicing
  • 🗑️ Object removal
  • 🎨 Enhancement / color manipulation

Pretrained Models

IndexTraining Window SizesNotes
Ptrain0[7, 15, 31, 63]Base model
Ptrain1[7, 15, 31, 63]Variant 1
Ptrain2[7, 15, 31, 63]Variant 2
Ptrain3[7, 15, 31, 63]Variant 3
Ptrain4[7, 15, 31]Best overall (recommended)

API Usage

This Space exposes a full REST API via Gradio:

Python (gradio_client)

python
from gradio_client import Client

client = Client("ankitkumar-13/ManTraNet-Image-Forgery-Detection")
result = client.predict(
    image="path/to/image.jpg",
    model_choice="Ptrain4 — Best (copy-move, splicing, removal, enhancement)",
    api_name="/predict"
)
# Returns: (heatmap_image, overlay_image, stats_markdown)
heatmap_path, overlay_path, stats = result

cURL (base64 image)

bash
# Convert image to base64 first
B64=$(base64 -w 0 your_image.jpg)

curl -X POST \
  https://ankitkumar-13-mantranet-image-forgery-detection.hf.space/run/predict \
  -H 'Content-Type: application/json' \
  -d "{\"data\": [\"data:image/jpeg;base64,${B64}\", \"Ptrain4 — Best (copy-move, splicing, removal, enhancement)\"]}"

JavaScript (fetch)

javascript
const formData = new FormData();
formData.append('file', fileInput.files[0]);

// Upload file first
const uploadResp = await fetch(
  'https://ankitkumar-13-mantranet-image-forgery-detection.hf.space/upload',
  { method: 'POST', body: formData }
);
const { files } = await uploadResp.json();

// Run prediction
const resp = await fetch(
  'https://ankitkumar-13-mantranet-image-forgery-detection.hf.space/run/predict',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      data: [{ path: files[0] }, "Ptrain4 — Best (copy-move, splicing, removal, enhancement)"]
    })
  }
);
const result = await resp.json();

Citation

bibtex
@inproceedings{Wu2019ManTraNet,
  title={ManTra-Net: Manipulation Tracing Network For Detection And Localization of Image Forgeries With Anomalous Features},
  author={Yue Wu, Wael AbdAlmageed, and Premkumar Natarajan},
  booktitle={The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2019}
}

License

This software is made available for academic or non-commercial purposes only. For commercial licensing, contact USC Stevens Institute for Innovation.