AI-powered document tampering detection system built with Error Level Analysis (ELA), a CNN-based classifier, and a Streamlit interface for real-time analysis.
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.
- Preview GIF is shown at the top of this README
- Full demo video: Watch the project demo
- Training notebook: Kaggle - Image Forgery Detection CNN Training
- Detects whether a document image is
ForgedorAuthentic - 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
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.
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.
- 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
git clone https://github.com/rahulpmishra/document-forgery-detection.git
cd document-forgery-detection
pip install -r requirements.txtstreamlit run streamlit_app.pyThen open http://localhost:8501.
python batch_test.py artifacts/raw_test_images --output results.jsonYou 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 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
- Total images:
- Python
- TensorFlow / Keras
- Streamlit
- Pillow
- NumPy
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
streamlit_app.py- Streamlit app for interactive forgery detectionbatch_test.py- command-line inference tool for batches and single imagesmodels/trained_model.h5- trained CNN modelassets/demo.gif- short visual preview of the appartifacts/model_results/- evaluation visuals and metricsartifacts/raw_test_images/- sample images for testingartifacts/test_results.json- example batch prediction results
Rahul P Mishra
- LinkedIn: rahulpmishra
- Kaggle: rahulprakashmishra
