Skip to content

code-with-nc/Federated-Optimization-for-DF-Image-Forgery-Detection-Using-FedYogi-with-CNN-and-ResNet50

Repository files navigation

🔐 Federated-Optimization-for-DF-Image-Forgery-Detection-Using-FedYogi-with-CNN-and-ResNet50

A privacy-preserving image forgery detection framework using Federated Learning (FL).

This project combines the FedYogi optimizer with CNN and ResNet50 architectures to improve convergence and stability on non-IID forensic datasets while preserving data privacy.

The framework is trained and evaluated using the CASIA 1.0 Image Tampering Dataset for detecting manipulated and forged images.


🚀 Key Features

  • Federated Learning-based image forgery detection
  • Privacy-preserving distributed training
  • FedYogi optimizer integration
  • CNN-based forgery detection model
  • ResNet50-based transfer learning model
  • Non-IID client data simulation
  • CASIA 1.0 dataset support
  • Deepfake and image tampering analysis
  • Federated model aggregation
  • Digital forensic image validation
  • Performance evaluation metrics and visualizations

🧠 Introduction

Digital forensics faces significant challenges in detecting manipulated and forged images while maintaining data privacy and security.

Traditional centralized machine learning approaches require sharing raw forensic images across servers, which introduces:

  • privacy risks
  • data leakage
  • legal concerns
  • centralized attack surfaces

Federated Learning Solution

Federated Learning (FL) solves this issue by allowing multiple clients to collaboratively train models without sharing raw images.

Only model updates are shared with the central server.


FedYogi Optimizer

This project uses FedYogi, an adaptive federated optimization algorithm designed to improve:

  • convergence stability
  • performance under non-IID data
  • distributed learning efficiency

📂 Folder Structure

Federated_Optimization_for_DF/
├── Model/                 # CNN and ResNet50 model architectures
├── Model_Image/           # Sample images for testing
├── Results/               # Evaluation metrics and visualizations
├── 596.pdf                # Research paper / documentation
└── README.md

📊 CASIA 1.0 Dataset

Dataset Download

🔗 CASIA 1.0 Dataset


Authentic Images

  • 800 images
  • 8 categories
  • 100 images per category

Categories

Code Category
ani Animal
arc Architecture
art Art
cha Characters
nat Nature
pla Plants
sec Scene
txt Texture

Tampered Image Types

1️⃣ Spliced Images

Sp_D_CND_A_pla0005_pla0023_0281.jpg

Meaning:

  • Sp → Splicing
  • D → Different source image
  • pla0005 → source image
  • pla0023 → target image
  • 0281 → tampered image ID

2️⃣ Copy-Move Images

Sp_S_CND_A_pla0016_pla0016_0196.jpg

Meaning:

  • S → Same image used for tampering

⚙️ Methodology


1️⃣ Data Split

CASIA 1.0 dataset is distributed among multiple simulated clients to create a federated learning environment.


2️⃣ Local Training

Each client independently trains:

  • CNN model
  • ResNet50 model

on local forensic data.


3️⃣ Federated Aggregation

FedYogi optimizer aggregates model updates at the central server.


4️⃣ Evaluation Metrics

Performance is evaluated using:

  • Accuracy
  • Precision
  • Recall
  • F1-Score

5️⃣ Privacy Preservation

Raw forensic images never leave client systems.

Only encrypted or aggregated model parameters are exchanged.


📐 FedYogi Optimizer Equation

mt = β1 * mt-1 + (1-β1) * gt

vt = vt-1 - (1-β2) * sign(vt-1 - g²t)

wt+1 = wt - η * mt / (√vt + ε)

Where:

  • gt → aggregated gradient
  • β1, β2 → momentum coefficients
  • η → learning rate
  • ε → numerical stability constant

🛠️ Technologies Used

Machine Learning & AI

  • Python
  • TensorFlow
  • Keras
  • CNN
  • ResNet50
  • Federated Learning

Data Processing

  • NumPy
  • Pandas
  • OpenCV
  • Matplotlib
  • Scikit-learn

Federated Learning

  • FedYogi Optimizer
  • Distributed Training
  • Non-IID Data Handling

Research & Evaluation

  • Accuracy Metrics
  • F1 Score
  • Precision / Recall
  • Training Visualization

💻 Installation


Step 1️⃣ Clone Repository

Using HTTPS

git clone https://github.com/code-with-nc/Federated-Optimization-for-DF-Image-Forgery-Detection-Using-FedYogi-with-CNN-and-ResNet50.git

Using SSH

git clone git@github.com:code-with-nc/Federated-Optimization-for-DF-Image-Forgery-Detection-Using-FedYogi-with-CNN-and-ResNet50.git

Step 2️⃣ Enter Project Directory

cd Federated-Optimization-for-DF-Image-Forgery-Detection-Using-FedYogi-with-CNN-and-ResNet50

Step 3️⃣ Create Virtual Environment

Linux / Mac

python3 -m venv venv
source venv/bin/activate

Windows

python -m venv venv
venv\Scripts\activate

Step 4️⃣ Install Dependencies

pip install -r requirements.txt

Step 5️⃣ Download CASIA Dataset

Download CASIA 1.0 dataset and place it inside project directory.

Example:

project/
├── dataset/
├── Model/
├── Results/
└── README.md

▶️ How to Run the Project


Train Federated Learning Model

python train_federated.py

Run CNN Model

python cnn_model.py

Run ResNet50 Model

python resnet50_model.py

Run Evaluation

python evaluate.py

Generate Results & Visualizations

python results_visualization.py

🧪 Experimental Workflow

  1. Load CASIA 1.0 dataset
  2. Split dataset among clients
  3. Initialize CNN / ResNet50 models
  4. Train local client models
  5. Aggregate updates using FedYogi
  6. Evaluate global model
  7. Generate graphs and metrics
  8. Compare centralized vs federated performance

📈 Experiments and Results

Centralized Learning Results

Model Accuracy
CNN 57.27%
ResNet50 58.43%

Federated Learning + FedYogi Results

Model Peak Accuracy
CNN ~53.49%
ResNet50 ~55.52%

🔍 Observations

  • FedYogi improves training stability
  • Better convergence under non-IID client data
  • Privacy preserved throughout training
  • Competitive accuracy achieved without centralized data sharing
  • ResNet50 outperformed CNN in most experiments

📊 Outcome of the Project

This project demonstrates that:

  • Federated Learning can be effectively applied in digital forensics
  • Privacy-preserving training is possible without sharing raw forensic data
  • FedYogi provides improved optimization stability for non-IID environments
  • ResNet50 achieves better forgery detection performance compared to traditional CNN models
  • Federated optimization can support secure AI-driven forensic investigation systems

The framework contributes toward:

  • privacy-aware cyber forensic systems
  • distributed AI security research
  • secure deepfake and image forgery detection workflows

🎯 Learning Objectives

After completing this project, learners will be able to:

  • Understand Federated Learning workflows
  • Implement privacy-preserving AI systems
  • Train CNN and ResNet50 models
  • Simulate non-IID federated environments
  • Use FedYogi optimizer
  • Perform image forgery detection
  • Work with forensic image datasets
  • Evaluate distributed machine learning models
  • Analyze convergence behavior in federated systems

🔒 Security & Privacy Benefits

  • Raw images never leave client systems
  • Reduces centralized data exposure
  • Supports distributed forensic collaboration
  • Improves privacy compliance
  • Enhances secure AI training workflows

📚 Citation

If you use this repository or dataset, please cite:


CASIA Dataset

@inproceedings{Dong2013,
  doi = {10.1109/chinasip.2013.6625374},
  url = {https://doi.org/10.1109/chinasip.2013.6625374},
  year = {2013},
  month = jul,
  publisher = {IEEE},
  author = {Jing Dong and Wei Wang and Tieniu Tan},
  title = {CASIA Image Tampering Detection Evaluation Database},
  booktitle = {2013 IEEE China Summit and International Conference on Signal and Information Processing}
}

CASIA Groundtruth Dataset

@article{pham2019hybrid,
  title={Hybrid Image-Retrieval Method for Image-Splicing Validation},
  author={Pham, Nam Thanh and Lee, Jong-Weon and Kwon, Goo-Rak and Park, Chun-Su},
  journal={Symmetry},
  volume={11},
  number={1},
  pages={83},
  year={2019},
  publisher={MDPI}
}

📌 Future Enhancements

  • Differential Privacy integration
  • Secure aggregation
  • Homomorphic encryption
  • Real-time federated deployment
  • Blockchain-based audit validation
  • Multi-modal forgery detection
  • Federated adversarial defense
  • Explainable AI integration

⚠️ Disclaimer

This repository is developed strictly for:

  • academic research
  • educational purposes
  • cyber forensic investigation
  • privacy-preserving AI experimentation

Do not use the framework for malicious surveillance, unauthorized data analysis, or unethical AI activities.


📜 License

MIT License

(or according to institutional/project requirements)


👩‍💻 Author

Narayani

GitHub: https://github.com/code-with-nc


About

A privacy-preserving image forgery detection framework using Federated Learning. Combines FedYogi optimization with CNN and ResNet50 to handle non-IID forensic data. Trains models collaboratively without sharing raw images, improving stability and accuracy on CASIA 1.0.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors