πŸ–ΌοΈ Image Forgery Detection Model

license: mit pipeline_tag: image-classification library_name: tensorflow tags: - image-forgery-detection - ai-generated-images - deepfake-detection - fake-image-detection - image-forensics - computer-vision - mobilenetv2 - tensorflow - keras

πŸ•΅οΈ AI Image Forgery Detector (Real vs Fake)

This model detects whether an image is REAL (camera-captured) or FAKE (AI-generated / manipulated).

It is a fine-tuned MobileNetV2 model trained using TensorFlow/Keras, designed for AI image forgery detection, including synthetic and deepfake-style images.


πŸ” What This Model Can Do

βœ” Detect AI-generated images
βœ” Detect manipulated or synthetic content
βœ” Works on faces, objects, landscapes, and artworks
βœ” Outputs prediction + confidence score

Class Labels

  • 0 β†’ Fake
  • 1 β†’ Real

🧠 Model Architecture

  • Base model: MobileNetV2 (ImageNet pretrained)
  • Framework: TensorFlow / Keras
  • Input size: 224 Γ— 224 RGB image
  • Output: Sigmoid probability
  • Task: Binary image classification

Additional layers:

  • Global Average Pooling
  • Dense (ReLU)
  • Dropout (regularization)
  • Sigmoid output layer

πŸ“Š Evaluation Results

The model was evaluated using accuracy, precision, recall, and F1-score, with threshold optimization based on macro F1-score to handle class imbalance.

Best Validation Results

  • Accuracy: ~87%
  • Fake class: High precision
  • Real class: High recall
  • Threshold: Optimized (~0.65)

Results may vary depending on image quality and source.


πŸ–ΌοΈ Example Predictions

βœ… Real Image (Correct Classification)

Real Image Example

Prediction: REAL
Confidence: High


❌ AI-Generated Image (Correct Classification)

Fake Image Example

Prediction: FAKE
Confidence: High


πŸš€ How to Use This Model

import tensorflow as tf
import numpy as np
from PIL import Image

IMG_SIZE = 224

# Load model
model = tf.keras.models.load_model("forgery_model.keras")

# Load and preprocess image
img = Image.open("test.jpg").convert("RGB")
img = img.resize((IMG_SIZE, IMG_SIZE))
img = np.array(img) / 255.0
img = np.expand_dims(img, axis=0)

# Predict
probability = model.predict(img)[0][0]

label = "REAL" if probability > 0.65 else "FAKE"
print("Prediction:", label)
print("Confidence:", probability)
🎯 Intended Use
This model is suitable for:

AI-generated image detection

Image forgery analysis

Academic projects

Research and experimentation

Educational demonstrations

❌ Not recommended for legal, forensic, or high-risk decision-making systems.

⚠️ Limitations
Extremely realistic AI images may still fool the model

Performance can drop on:

Heavy compression

Very low resolution

Extreme image edits

Model predictions are probabilistic, not absolute truth

Always validate outputs before real-world use.

πŸ§ͺ Training Details
Base: MobileNetV2 (ImageNet weights)

Optimizer: Adam (low learning rate)

Loss: Binary Crossentropy

Data augmentation applied

Class imbalance handled using class weights

Threshold tuning performed after training

🧭 Ethical Considerations
Predictions can be incorrect

False positives / negatives are possible

Use responsibly and transparently

Do not rely solely on this model for critical decisions

πŸ“œ License
This model is released under the MIT License.

πŸ‘€ Author
Kumaran
Hugging Face: kumaran-0188

Built as part of an AI image forgery detection project using TensorFlow.

πŸ™Œ Acknowledgements
TensorFlow & Keras

MobileNetV2

AI-generated image datasets (CIFAKE-style)

Hugging Face ecosystem
Downloads last month
32
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support