Skip to content

rahulpmishra/document-forgery-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Document Forgery Detection

AI-powered document tampering detection system built with Error Level Analysis (ELA), a CNN-based classifier, and a Streamlit interface for real-time analysis.

Document Forgery Detection Demo

Why It Matters

This project turns an image-forensics workflow into a usable ML application for identifying manipulated document images. It demonstrates practical computer vision work across preprocessing, feature extraction through ELA, CNN inference, model evaluation, and user-facing deployment through both a web app and a batch testing utility.

Demo

What It Does

  • Detects whether a document image is Forged or Authentic
  • Uses Error Level Analysis to expose compression inconsistencies caused by tampering
  • Runs CNN-based prediction with confidence scoring
  • Provides a Streamlit interface for interactive testing
  • Includes a batch testing script for folders or single-image inference
  • Ships with demo images, evaluation outputs, and sample prediction results

How It Works

Error Level Analysis

The input image is resaved as JPEG and compared against the original image. Regions with different compression artifacts become more visible, helping the model focus on signs of editing or manipulation.

CNN-Based Classification

The ELA-transformed image is resized to 128 x 128, normalized, and passed to a trained CNN model that predicts whether the document is forged or authentic.

Key Assets

  • Demo GIF: assets/demo.gif
  • Evaluation outputs: artifacts/model_results/
  • Sample inference images: artifacts/raw_test_images/
  • Batch output example: artifacts/test_results.json
  • Trained model: models/trained_model.h5

Quick Start

Installation

git clone https://github.com/rahulpmishra/document-forgery-detection.git
cd document-forgery-detection
pip install -r requirements.txt

Run the Streamlit App

streamlit run streamlit_app.py

Then open http://localhost:8501.

Run Batch Testing

python batch_test.py artifacts/raw_test_images --output results.json

You can also test:

python batch_test.py image.jpg
python batch_test.py /path/to/images
python batch_test.py /path/to/images --model ./models/my_model.h5

Model and Dataset

  • Model type: CNN classifier
  • Preprocessing: Error Level Analysis + resize + normalization
  • Input size: 128 x 128
  • Training dataset: CASIA v2.0
  • Training data summary:
    • Total images: 11,129
    • Authentic: 8,144
    • Forged: 2,985

Tech Stack

  • Python
  • TensorFlow / Keras
  • Streamlit
  • Pillow
  • NumPy

Project Structure

document-forgery-detection/
|-- assets/
|   `-- demo.gif
|-- streamlit_app.py
|-- batch_test.py
|-- models/
|   |-- trained_model.h5
|   `-- model_history.json
|-- artifacts/
|   |-- model_results/
|   |-- raw_test_images/
|   `-- test_results.json
|-- requirements.txt
`-- README.md

Project Files

  • streamlit_app.py - Streamlit app for interactive forgery detection
  • batch_test.py - command-line inference tool for batches and single images
  • models/trained_model.h5 - trained CNN model
  • assets/demo.gif - short visual preview of the app
  • artifacts/model_results/ - evaluation visuals and metrics
  • artifacts/raw_test_images/ - sample images for testing
  • artifacts/test_results.json - example batch prediction results

Author

Rahul P Mishra

About

Document forgery detection system using CNN and Error Level Analysis (ELA) with a Streamlit app for real-time inference, batch image testing, and image forensics workflows.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages