Skip to content

mo-tunn/IFDS

Repository files navigation

IFDS - Image Forgery Detection System

Tests Pytest Coverage SonarQube Coverage Quality Gate Bugs Vulnerabilities Duplications Python

IFDS is a Streamlit-based image forgery analysis application. It combines classical OpenCV feature-matching methods such as SIFT, SURF, AKAZE, and ORB with optional deep learning models. For each uploaded image, the system produces algorithm-level evidence, a weighted final verdict, a comparative analysis table, and downloadable PDF/HTML reports.

Screenshots

Application Home

IFDS application home

Analysis Result

IFDS analysis result

Mobile View

IFDS mobile view

Scrum Board

IFDS Scrum board

SonarQube Dashboard

SonarQube dashboard

Graphviz Architecture Graph

IFDS architecture graph

Key Features

  • Classical analysis with SIFT, SURF, AKAZE, and ORB detectors.
  • Optional AI analysis with Xception CNN and EfficientNet CNN model wrappers.
  • Explainability support through Grad-CAM heatmaps for Xception results.
  • Weighted final verdict labels: Authentic, Tampered, or Review needed.
  • PDF/HTML reports with image metadata, algorithm results, comparison data, and final verdict details.
  • Modern Streamlit dashboard with status cards, analysis controls, result cards, and responsive layout.
  • Supported input formats: GIF, JPG/JPEG, PNG, BMP, and TIFF.

Quality Summary

Tool / Metric Result
Pytest 58 tests passed
Pytest coverage 95.01%
SonarQube Quality Gate Passed / OK
SonarQube coverage 94.8%
Bugs 0
Vulnerabilities 0
Security Hotspots 0
Code Smells 14
Duplications 3.0%
Lines of Code 2536
Reliability Rating A
Security Rating A
Maintainability Rating A

SonarQube notes and evidence:

Project Structure

.
├── app.py                  # Streamlit application entrypoint
├── config/                 # Application settings and model paths
├── data/
│   ├── raw/                # Local raw datasets
│   ├── processed/          # Processed local outputs
│   └── models/             # Model weights
├── docs/                   # Documentation and delivery evidence
├── notebooks/              # Training notebooks
├── src/
│   ├── ai_models/          # Xception, EfficientNet, and Grad-CAM components
│   ├── classical/          # SIFT, SURF, AKAZE, and ORB detectors
│   ├── preprocessing/      # Image loading and preprocessing
│   ├── reporting/          # PDF/HTML report generation
│   └── verdict.py          # Final verdict service
├── tests/                  # Pytest test suite
└── ui/                     # Streamlit UI components

Installation

Python 3.10 or newer is recommended.

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

For macOS/Linux activation:

source .venv/bin/activate

Install development and test dependencies when needed:

pip install -r requirements-dev.txt

Running The App

streamlit run app.py

Windows virtual environment alternative:

.venv\Scripts\python.exe -m streamlit run app.py

After the app opens, select the analysis methods from the sidebar, upload a supported image, and press Start Analysis.

Tests And Coverage

python -m pytest tests -q --cov=src --cov-report=xml --cov-report=term-missing

Latest verification result:

58 passed
TOTAL: 1202 statements, 60 missing, 95.01% coverage

SonarQube Analysis

The project includes the required SonarQube configuration in sonar-project.properties.

Basic workflow:

python -m pytest tests -q --cov=src --cov-report=xml --cov-report=term-missing
sonar-scanner.bat -Dsonar.host.url=http://localhost:9000 -Dsonar.token=<local-token>

Latest successful local analysis:

Quality Gate: OK / Passed
SonarQube coverage: 94.8%
Bugs: 0
Vulnerabilities: 0
Security Hotspots: 0
Duplications: 3.0%

Model Files

AI models are optional. When model weights are missing, the application continues with classical analysis and reporting.

Expected model paths:

data/models/xception_finetuned.h5
data/models/efficientnet_finetuned.h5

If model files are missing after cloning the repository, use Git LFS:

git lfs pull

Training metrics are documented in model_metrics.md.

Delivery Documents

Main project delivery artifacts prepared for the course:

Training Notes

The notebooks/ directory contains notebooks prepared for model training with Kaggle/CASIA datasets. Local datasets can be kept under data/raw/; that directory is intentionally not committed.

Before Pushing To GitHub

  • Do not commit .env files, Streamlit secrets, virtual environments, datasets, or large model weights.
  • data/raw/, data/processed/, and data/models/ are reserved for local work.
  • Large .h5 model files should be shared through Git LFS instead of normal Git history.

License

This project is released under the MIT License. See the LICENSE file for details.

About

Image Forgery Detection System built with Streamlit, OpenCV classical detectors, AI model support, Grad-CAM visualization, PDF/HTML reporting, SonarQube analysis, Doxygen documentation and Graphviz architecture outputs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors