This project implements image forgery detection using Convolutional Neural Networks (CNN) and other machine learning techniques to identify manipulated images.
Image-Forgery-Detection-CNN-Updated/
├── .github/
│ └── workflows/ # GitHub Actions workflow files
├── Documents/ # Supplementary documents
├── backend/ # Backend server implementation
│ └── app.py # Flask API entry point
├── configs/ # Configuration files
│ └── model_config.py # Model parameters and settings
├── data/ # Data directory
│ ├── raw/ # Original, immutable data
│ ├── processed/ # Cleaned and processed data ready for modeling
│ ├── interim/ # Intermediate data
│ └── external/ # External data sources
├── docs/ # Project documentation
│ ├── images/ # Documentation images
│ └── plots/ # Generated plots and visualizations
├── frontend/ # React frontend application
│ └── src/ # Frontend source code
├── models/ # Model implementations
│ └── weights/ # Saved model weights
├── reports/ # Test reports and analysis outputs
├── scripts/ # Utility scripts
│ ├── minimal_demo.py # Minimal demo script
│ ├── run_improved_model.py # Script to run the improved model
│ └── ... # Other supporting scripts
├── tests/ # Test suites
│ ├── test_models.py # Model test cases
│ └── generate_test_report.py # Test report generator
├── utils/ # Utility functions and helpers
│ ├── common.py # Common utility functions
│ ├── feature_extraction.py # Feature extraction utilities
│ └── extract_patches.py # Image patch extraction utilities
├── .gitignore # Git ignore file
├── Dockerfile # Docker build configuration
├── README.md # Project overview and instructions
└── requirements.txt # Python dependency list
Install dependencies:
pip install -r requirements.txtFor the frontend:
cd react-frontend
npm installpython scripts/run_improved_model.pycd backend
python app.pycd react-frontend
npm run dev- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
Image forgery detection is a critical task in digital forensics. This project focuses on detecting image manipulations using deep learning techniques. The implementation includes:
- A Convolutional Neural Network (CNN) architecture optimized for forgery detection
- Advanced feature extraction and fusion techniques
- Sophisticated classification methods including XGBoost
- Comprehensive evaluation metrics
- Python 3.7+
- PyTorch 1.7+
- scikit-learn
- XGBoost
- NumPy, Pandas, Matplotlib
Install all required dependencies:
.\install_dependencies.bat- Run the Full Improved Model Demo:
.\run_improved_model.bat- Run the Minimal Demo (demonstrates the improved CNN architecture):
.\run_minimal_demo.bat- Run the XGBoost Demo (demonstrates proper XGBoost configuration):
.\run_xgboost_demo.batsrc/- Source code directorycnn/- CNN implementationfeature_fusion/- Feature fusion techniquesclassification/- Classification methods- Various demo scripts
data/- Data directoryIMPROVED_MODEL.md- Detailed documentation of the improvementsIMPROVED_README.md- Extended documentation with technical details
-
Enhanced CNN Architecture
- Residual connections
- Attention mechanisms
- Batch normalization
- Adaptive pooling
-
Advanced Feature Fusion
- Multiple fusion strategies
- Spatial pyramid pooling
-
Sophisticated Classification
- Ensemble methods
- XGBoost with best practices
- Imbalanced data handling
-
Modern Training Techniques
- Mixed precision training
- Advanced learning rate scheduling
The improved model achieves significantly better performance compared to the original model, with expected accuracy improvements of approximately 2% and enhanced robustness to various forgery types.
For more detailed information:
- See IMPROVED_README.md for technical details
- See IMPROVED_MODEL.md for in-depth explanation of improvements
This project is licensed under the MIT License - see the LICENSE file for details.
- Y. Rao et al. for the original work on CNN-based image forgery detection
- The PyTorch team for their excellent deep learning framework
- The XGBoost team for their powerful gradient boosting implementation
The model was tested on a diverse set of images from the CASIA2 dataset, achieving an accuracy of 100% on the test set. The system correctly identified both tampered and authentic images with high confidence.
To generate your own test report:
.\generate_report.bat
The CNN architecture includes:
- Convolutional layers for feature extraction
- Residual connections for better gradient flow
- Attention mechanisms to focus on important features
- SVM classifier for final decision making
The system can localize tampered regions in an image using a sliding window approach:
- The image is divided into overlapping patches
- Each patch is analyzed by the CNN model
- A heatmap is generated showing the probability of tampering
- Contours are drawn around regions with high tampering probability
