Image Tampering Detection
Supervised By: Presented By:
Dr. Habiba Sultana Nargia Easmin Noon
Roll: 20102030
Assistant Professor
Reg. No: 8861
Md. Ashikur Rahman Ashik
Roll: 19102042
Reg. No: 7761
Computer Science and Engineering
Jatiya Kabi Kazi Nazrul Islam University, Trishal, Mymensingh.
Outlines
● Introduction
● Methodology Overview
● Libraries and Tools
● ELA Conversion
● Image Preparation
● Dataset Preparation
● Model Architecture
● Model Training
● Model Evaluation
● Conclusion
● References
2
Overview
● What is Image Tampering Detection?
● Relevance
● Historical Context
● Examples of Image Manipulation
● Consequences of Tampered Images
● Objectives of the Project
3
Methodology
4
Libraries and Tools
1. TensorFlow/Keras: For building and training neural networks.
2. NumPy: For numerical computations and data manipulation.
3. PIL (Pillow): For image processing tasks (opening, resizing).
4. Matplotlib/Seaborn: For data visualization and plotting results.
5. Scikit-learn: For evaluation metrics and model selection.
6. OpenCV (if used): For advanced image processing functions.
7. Explanation of how each tool contributes to the project.
5
ELA Conversion
1. Purpose of ELA
2. Conversion Process
I. Open Original Image
II. Resave Image
III. Calculate Differences
3. Scaling the ELA Image
I. Extract Extremes
II. Max Difference
III. Brightness Adjustment
4. Output 6
Image Preparation
1. Target Size
2. ELA Conversion
3. Pixel Value Scaling
4. Convert to Array
5. Returns a normalized, flattened ELA image
6. Significance
7
Dataset Preparation
1. Dataset Paths: authentic_path, tampered_path
2. Initialization: Two lists, X and Y
3. Image Processing Function: process_images_from_directory(directory, label)
4. Image Loading and Preparation: For each sampled image-
I. Constructs the full file path
II. Applies prepare_image()
III. Appends the processed image to X and the label to Y
5. Error Handling
6. Array Conversion:
I. Converts lists X and Y to NumPy arrays.
II. Reshapes X
7. Data Splitting: Use train_test_split()
8. Significance
8
Dataset Augmentation
1. Purpose of Data Augmentation
2. ImageDataGenerator
3. Augmentation Techniques
I. rotation_range=
II. width_shift_range
III. height_shift_range
IV. zoom_range
V. horizontal_flip
4. Benefits
9
CNN Architecture
1. Model Type: Sequential model
2. Layer Breakdown:
I. Convolutional Layers
II. Batch Normalization
III. Max Pooling Layers
3. Flattening Layer: Converts 3D output into a 1D array
4. Dense Layers: Makes final predictions
5. Model Compilation: Figure: CNN Architecture [1]
10
CNN Model Training
history = model.fit(datagen.flow(X_train, Y_train, batch_size=32),
epochs=30,
validation_data=(X_val, Y_val))
model.save("CNN_model.keras")
● Accuracy: 85.68%
● Precision for Tampered: 0.89
● Recall for Tampered: 0.81
● F1-score for Tampered: 0.85
● Precision for Authentic: 0.83
● Recall for Authentic: 0.91
● F1-score for Authentic: 0.87
11
Random Forest Model
1. Flattening: Converts img to 1D, Dataset to 2D
2. Model Initialization:
rf_model = RandomForestClassifier
(n_estimators=300, random_state=42)
3. Model training: rf_model.fit(X_train_flat, Y_train)
● Accuracy: 84.74%
● Precision for Tampered: 0.85
● Recall for Tampered: 0.83
● F1-score for Tampered: 0.84
● Precision for Authentic: 0.84
● Recall for Authentic: 0.86
● F1-score for Authentic: 0.85
12
Results Visualization
1. Load CNN and Random Forest Models
2. Preparing the Image for Prediction
I. Reshape img to (1, 128, 128, 3) for CNN input.
II. Flatten img to a 1D array for Random Forest input.
3. Make CNN and Random Forest Prediction
4. if cnn_pred_percentage >= rf_pred_percentage
Display CNN prediction,
Else display Random Forest Prediction
13
Results Visualization
14
Conclusion
1. Effective Detection
2. Dual Approach
3. Image Quality Analysis
4. Model Performance
5. Visualization Tools
6. Real-World Application
15
Limitations
1. Dataset Diversity
2. Computational Resources
3. Overfitting Risk
4. Limited Interpretation
5. Dependency on ELA
6. Class Imbalance
16
Future Scope
1. Enhancing Dataset
2. Transfer Learning
3. Real-time Implementation
4. Multi-class Classification
5. Cross-modal Analysis
17
References
[1] https://www.researchgate.net/figure/Fig-Convolutional-Neural-Network-2-Web-portal-for-feeding-
input-biopsy-images-and_fig2_362911026
[2] https://www.researchgate.net/figure/Random-forest-Architecture_fig3_353593737
18
Thank You
Everyone
Feel free to ask any questions or seek clarification.
We welcome your inquiries about the Image
Tampering Detection project.
19