Instructions to use salmanzaman777/image-forgery-m3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use salmanzaman777/image-forgery-m3 with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://salmanzaman777/image-forgery-m3") - Notebooks
- Google Colab
- Kaggle
M3 β Image Forgery Detection (ELA + ResNet50 fusion)
Binary classifier that flags tampered images. Two-branch Keras model:
- ELA branch β 3-block CNN over an Error Level Analysis map (JPEG quality 90, brightness scale 15).
- RGB branch β frozen ImageNet ResNet50 backbone.
- Branches are concatenated β Dense(256) β Dropout(0.5) β sigmoid.
Output is the probability the image is forged (label 1); threshold 0.5.
Inputs
Two tensors in order [rgb, ela], each (224, 224, 3), float32 normalized to
[0, 1] (no ResNet preprocess_input). See the Space's app.py for the exact
preprocessing.
Usage
from huggingface_hub import hf_hub_download
import tensorflow as tf
path = hf_hub_download("salmanzaman777/image-forgery-m3", "M3_best.keras", revision="v1")
model = tf.keras.models.load_model(path)
prob = model.predict([rgb, ela])[0][0] # >0.5 => forged
Training data
CASIA v2 (authentic + tampered), 70/15/15 stratified split, class-weighted loss.
Limitations
Research demo, not a forensic tool. Trained on CASIA v2 artifacts; performance degrades on out-of-distribution sources, heavy re-compression, or screenshots.
- Downloads last month
- 147