Deepfake Video Detection Using Deep Learning
Deepfake Video Detection Using Deep Learning
A PROJECT REPORT
Submitted By :
RAMYA.R 210821205084
SUJITHA.P 210821205110
SRIMATHI.K 210821205108
Chennai)
May 2025
KINGS ENGINEERING COLLEGE
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
Dr. D. C. Jullie Josephine M.Tech., PhD Mrs. K.Benitlin Subha M.E., (PhD)
Chennai -602117
ACKNOWLEDGEMENT
We thank God for his blessings and also for giving as good knowledge and
strength in enabling us to finish our project. Our deep gratitude goes to our founder late
Dr. D. Selvaraj, M.A., M.Phil., for his patronage in the completion of our project. We
like to take this opportunity to thank our honourable chairperson Dr.S. Nalini Selvaraj,
M.COM., MPhil., Ph.D. and our noble-hearted director, Mr.S. Amirtharaj, M.Tech.,
M.B.A and his wife, Mrs. Merilyn Jemmimah Amirtharaj, B.E., M.B.A., for their
support given to us to finish our project successfully. We wish to express our sincere
thanks to our beloved principal. Dr. C. Ramesh Babu Durai M.E., Ph.D for his kind
encouragement and his interest towards us.
We are extremely grateful and thanks to our professor Dr. D. C. Jullie Josephine , head of
Information Technology, Kings Engineering College, for her valuable suggestion, guidance
and encouragement. We wish to express our sense of gratitude to our project supervisor
Mrs. K.Benitlin Subha M.E., (PhD) Assistant Professor of Information Technology
Department, Kings Engineering College whose idea and direction made our project a grand
success. We express our sincere thanks to our parents, friends and staff members who
have helped and encouraged us during the entire course of completing this project work
successfully.
PROBLEM STATEMENT
In today’s digitally connected world, the proliferation of deepfake technology presents a
growing threat to the authenticity of visual media. Deepfakes—AI-generated synthetic
videos that can realistically impersonate individuals—are becoming increasingly difficult to
detect with the naked eye due to advancements in generative models. These manipulated
videos pose serious risks, including the spread of misinformation, identity fraud, and damage
to public trust in digital content.
Existing detection techniques often rely on isolated image-level analysis or static classifiers,
which fail to capture the spatiotemporal characteristics that distinguish real videos from
deepfakes. Furthermore, with the rapid evolution of deepfake generation methods, single-
model approaches struggle to generalize across varied datasets and manipulation techniques.
This inadequacy in traditional detection models calls for more robust and adaptive solutions.
Our approach aims to enhance detection accuracy by training on large-scale datasets such as
Celeb-DF, ensuring adaptability and robustness in real-world scenarios. FakeSpotter thus
contributes to the broader goal of safeguarding digital content authenticity and mitigating the
social, political, and ethical threats posed by deepfake media
ABSTRACT
In today’s digital landscape, the rapid advancement of deepfake technology has raised
serious concerns due to its ability to generate highly convincing fake videos. These synthetic
media artifacts are widely used to spread misinformation, manipulate public opinion, and
perpetrate identity fraud, presenting significant challenges across social, political, and legal
domains. Traditional detection methods often fall short when addressing the spatial and
temporal anomalies introduced by deepfake algorithms.
NOTATION
S.N NAME NOTATION DESCRIPTION
O
Class Name
Associations
represents static
relationships between
Class A NAME Class B classes. Roles
representsthe way the
2. Association
two classes see each
Class A Class B
other.
3. Actor
It aggregates several
classes into a single
classes.
Class B Class A
Interaction between the
4. Aggregation
system and external
Class A environment
Class B
5. Relation uses
(uses) Used for additional
process
communication.
Extends relationship is
used when one use case
6. Relation extends
is similar to another use
(extends)
case but does a bit
more.
Communication
7. Communication
between various use
cases.
Represents physical
modules which is a
collection of
14. Component
components.
Represents physical
15. Node modules which are a
collection of
components.
A circle in DFD
represents a state or
16. Data process which has been
triggered due to some
Process/State
event or acion.
Represents external
17. External entity
entities such as
keyboard,sensors,etc.
Represents
Transition
18. communication that
occurs between
processes.
19. Object Lifeline Represents the vertical
dimensions that the
object communications.
ABBREVIATION
Acrony
Description Definition
m
MongoDB,
A full-stack JavaScript-based framework used for
MERN Express.js, React.js,
web application development.
Node.js
Application
A set of protocols and tools for building and
API Programming
integrating software applications.
Interface
exchange.
Hypertext Markup The standard language for creating web pages and
HTML
Language applications.
CHAPTER 5............................................................................................................................31
MODELS AND METHODS...................................................................................................31
5.1 CONVOLUTIONAL NEURAL NETWORK (CNN)......................................................31
5.2 RECURRENT NEURAL NETWORK (RNN) – LSTM..................................................32
5.3 SUPPORT VECTOR MACHINE (SVM) (For Baseline Comparison)............................33
5.4 DECISION TREE / RANDOM FOREST (For Feature Selection or Ensemble
Approaches).............................................................................................................................33
5.5 K-NEAREST NEIGHBORS (KNN) (For Similarity Matching in Model Behavior
Analysis)..................................................................................................................................34
Summary of Selected Models in FakeSpotter:........................................................................34
CHAPTER VI..........................................................................................................................35
MODULES AND UML DIAGRAMS....................................................................................35
6.1 MODULES........................................................................................................................35
6.2 MODULES DESCRIPTION.............................................................................................35
6.3 UML DIAGRAMS............................................................................................................38
6.3.1 Data Flow Diagram (DFD).............................................................................................38
1.User:.....................................................................................................................................47
2.Admin (inherits from User):.................................................................................................47
3.Video:...................................................................................................................................48
4.FrameProcessor:...................................................................................................................48
5.FeatureExtractor (CNN Module):........................................................................................48
6.SequenceAnalyzer (LSTM Module):...................................................................................48
7.PredictionEngine:.................................................................................................................48
8.Result:...................................................................................................................................48
CHAPTER 7............................................................................................................................54
IMPLEMENTATION.......................................................................................................54
CHAPTER 8............................................................................................................................60
FEASIBILITY STUDY AND SYSTEM TESTING..............................................................60
8.1 FEASIBILITY STUDY....................................................................................................60
8.2 SYSTEM TESTING..........................................................................................................62
RESULTS................................................................................................................................66
SOURCE CODE:....................................................................................................................72
REFERENCES........................................................................................................................90
CHAPTER 1
INTRODUCTION
Despite growing awareness, many existing deepfake detection systems are not equipped to
handle the complex and evolving nature of synthetic media. Traditional image-based
classifiers often lack the ability to capture temporal inconsistencies across video frames and
are limited in detecting subtle artifacts embedded by sophisticated generative models.
By integrating both spatial and temporal information, FakeSpotter delivers robust and
accurate deepfake detection. The model is trained using the Celeb-DF dataset and
incorporates transfer learning from pre-trained VGG-16 networks to improve
generalization and performance. This hybrid architecture not only detects deepfakes more
accurately but also adapts to the evolution of manipulation techniques .
1.1 DOMAIN INTRODUCTION
Artificial Intelligence (AI), particularly in the form of machine learning (ML) and deep
learning, has revolutionized the analysis of visual and video content. Within the domain of
digital media forensics, AI algorithms now play a vital role in detecting manipulated content
that evades human scrutiny.
Convolutional Neural Networks (CNNs) are widely used in computer vision for detecting
visual patterns such as edges, textures, and shapes in images. In contrast, Recurrent Neural
Networks (RNNs)—and more specifically LSTM architectures—are designed to handle
sequential data, making them suitable for modeling time-series patterns in videos.
The hybrid CNN-RNN approach combines these strengths to form a system capable of
analyzing both spatial and temporal dimensions of video data, thus making it ideal for
deepfake detection. This technique has been increasingly adopted in domains such as
surveillance, digital forensics, and media authentication, and continues to show promising
results in combating synthetic media threats.
1.2 OBJECTIVES
The core objective of the FakeSpotter framework is to effectively identify and classify
deepfake videos using a robust, hybrid deep learning approach that combines both spatial
and temporal analysis. By leveraging the strengths of Convolutional Neural Networks
(CNNs) and Recurrent Neural Networks (RNNs), this system aims to provide accurate and
scalable deepfake detection capable of addressing real-world challenges posed by
manipulated media.
FakeSpotter aims to:
3.Preprocess input video data, including frame extraction, face detection, and
normalization, to ensure clean and consistent inputs for model training and inference.
5.Train and evaluate the model using the Celeb-DF dataset, a challenging
benchmark for real-world deepfake scenarios.
3.Preprocess video inputs by extracting and aligning face regions from each frame to
create consistent, structured sequences for analysis.
The FakeSpotter framework is modular and scalable, making it adaptable for use in various
real-world applications including:
Ultimately, FakeSpotter aims to become a critical tool in the broader effort to preserve
digital content integrity, promote responsible AI usage, and protect the public from
malicious synthetic media.
CHAPTER II
LITERATURE REVIEW
The detection of deepfake videos has become a pressing concern with the rapid evolution of
generative adversarial networks (GANs) and face-swapping technologies. Numerous studies
have proposed various machine learning and deep learning techniques to address the
challenge of synthetic media detection. This chapter highlights relevant works that have
contributed to the development of CNN, RNN, and hybrid models for deepfake
identification.
Authors: Soudy, A. H., Sayed, O., Tag-Elser, H., Ragab, R., Mohsen, S., Mostafa, T.,
Abohany, A. A., & Slim, S. O.
This study proposes a hybrid approach utilizing Convolutional Neural Networks (CNNs)
in combination with Vision Transformers (ViTs) to identify subtle inconsistencies in
deepfake videos. The model is capable of capturing both local (pixel-level) and global
(semantic) anomalies. Their results show a significant boost in accuracy when combining
traditional CNNs with transformer-based models for deepfake forensics.
[2] Title: Celeb-DF: A Large-Scale Challenging Dataset for Deepfake Forensics (2020)
Authors: Li, Y., Yang, X., Sun, P., Qi, H., Lyu, S.
This paper introduces the Celeb-DF dataset, a high-quality and diverse video dataset
designed to test deepfake detection systems under realistic conditions. The authors
emphasize the necessity of evaluating models on datasets with minimal visual artifacts to
ensure generalization in real-world scenarios. Celeb-DF has become a standard benchmark
in deepfake research.
[3] Title: Deepfake Detection for Video: An Open Source Challenge (2020)
[4] Title: Deep CNN Models-Based Ensemble Approach to Driver Drowsiness Detection
(2021)
With the explosive growth of video-sharing platforms and social media, the threat posed by
deepfake videos has become increasingly severe. These AI-generated fake videos are
capable of realistically mimicking facial expressions, voices, and movements of real
individuals, making them highly deceptive and difficult to detect with the naked eye. As a
result, they pose serious risks including identity theft, reputation damage, political
manipulation, and misinformation dissemination.
Current deepfake detection systems typically rely on image-based classifiers or static pattern
recognition methods. However, these methods struggle to detect high-quality deepfakes
that exhibit few spatial irregularities. They often overlook temporal inconsistencies, such as
unnatural blinking or misaligned lip movements, which are crucial cues in video-based
analysis.
Furthermore, many existing models lack the scalability, generalization, and adaptability
required to handle the diverse techniques used to generate deepfakes. As deepfake
generation becomes more advanced and accessible, there is a critical need for robust,
hybrid detection frameworks that combine spatial and temporal analysis to effectively
counter these synthetic threats.
1.Data Preprocessing: Input videos are converted into frames. Each frame undergoes
face detection, cropping, and alignment using tools like dlib or OpenCV to focus on
relevant facial regions.
This hybrid architecture ensures the model captures both static artifacts and temporal
inconsistencies—two critical components in deepfake detection. By training the system on
the Celeb-DF dataset, the framework gains the ability to generalize across different
manipulation techniques and video qualities.
Through this approach, FakeSpotter provides a scalable and reliable deepfake identification
mechanism, contributing to the broader goal of digital content verification and media
integrity protection.
CHAPTER 4
SYSTEM REQUIREMENTS
To effectively train, test, and deploy the deep learning-based FakeSpotter framework, the
following hardware configuration is recommended:
Processor: Intel Core i7 / AMD Ryzen 7 or higher (with multi-core support for deep
learning)
RAM: Minimum 16 GB DDR4 (32 GB preferred for large datasets and model
training)
Storage: 512 GB SSD (for fast read/write operations and dataset handling)
GPU: NVIDIA GPU with CUDA support (e.g., RTX 3060 or higher for model
training)
Internet: Stable broadband connection (for dataset access, model updates, and cloud
deployment)
4.2 SOFTWARE REQUIREMENTS
The FakeSpotter system utilizes a range of software tools, libraries, and frameworks for
model development, training, and deployment:
Deployment Platform: AWS EC2 / Google Colab / Render / Heroku (for model
hosting)
Video input must be broken down into frames. Each frame is then preprocessed through
resizing, normalization, and face alignment using facial detection tools such as dlib or
MTCNN. This standardized input structure ensures consistent and accurate feature
extraction by the CNN.
Each preprocessed video frame is converted into a numerical representation using VGG-16
CNN, which extracts spatial features like edges, shapes, and texture anomalies. These
features are vectorized and passed into the RNN for sequential analysis.
The LSTM-based RNN processes temporal sequences of frame-level features. This enables
the model to learn patterns over time and detect temporal inconsistencies in deepfake videos.
A softmax/sigmoid activation function in the final dense layer is used to classify each frame
(or sequence) as real or fake. Frame-wise predictions are aggregated to make a final
judgment on the entire video.
4.4 NON-FUNCTIONAL REQUIREMENTS
4.4.1 Reliability
The system must consistently deliver accurate predictions across various datasets and
deepfake techniques. It should exhibit minimal false positives/negatives and ensure robust
behavior during large-scale batch predictions.
Training and inference must be optimized using GPU acceleration and model pruning if
necessary. Inference time for real-time applications (e.g., live video analysis) must remain
within acceptable latency thresholds.
4.4.3 Scalability
The system should support scaling on cloud infrastructure to handle larger datasets and more
concurrent video inputs for batch validation. Containerization tools (e.g., Docker) may be
used for deployment scalability.
4.4.4 Security
Security measures must be enforced to prevent tampering with training datasets or model
outputs. This includes:
4.4.5 Interoperability
The system should be compatible with video input from diverse sources such as MP4 files,
live streams, and dataset repositories. It must support integration with web-based user
interfaces for uploading videos and retrieving classification results.
4.5 REQUIRED LIBRARIES AND FRAMEWORKS
Matplotlib / Seaborn – For plotting training curves, loss metrics, and confusion
matrices
Flask / FastAPI – For exposing the model as an API (if deployed for external use)
The FakeSpotter framework leverages multiple deep learning techniques, with a primary
focus on hybrid architectures that combine Convolutional Neural Networks (CNNs) and
Recurrent Neural Networks (RNNs). These methods are essential for extracting spatial and
temporal features from video data to identify deepfakes. This chapter outlines the various
models and algorithms relevant to the development of the FakeSpotter system.
CNNs are a class of deep neural networks widely used for image recognition and
classification tasks. In the FakeSpotter system, CNNs are employed for spatial feature
extraction from individual video frames. These features may include texture irregularities,
inconsistent lighting, and facial distortions that often go unnoticed by the human eye.
Application in FakeSpotter:
Pretrained CNN models like VGG-16 are used through transfer learning to reduce
training time and increase accuracy.
Working Process:
These feature maps are passed into the next stage (RNN) for temporal analysis.
RNNs, and specifically Long Short-Term Memory (LSTM) networks, are designed to
process sequential data. In FakeSpotter, LSTMs are used to model temporal dependencies
across video frames, capturing inconsistencies in motion patterns, facial expressions, and
blinking.
Application in FakeSpotter:
Working Process:
SVM is a classical supervised learning algorithm often used as a baseline model for
classification tasks. Though not part of the core architecture of FakeSpotter, SVMs were
explored during the early experimentation phase for frame-based classification.
Applications:
Used as a lightweight alternative in systems where deep learning resources are limited.
Decision Trees and Random Forests are ensemble learning methods used in some deepfake
detection pipelines for feature ranking or ensemble prediction. While not the core model
in FakeSpotter, these algorithms can assist in:
CHAPTER 6
MODULES AND UML DIAGRAMS
6.1 MODULES
The FakeSpotter system is structured into the following major functional modules:
Admin Panel
Video Upload and Preprocessing
Face Detection and Alignment
Feature Extraction (CNN Module)
Temporal Analysis (RNN/LSTM Module)
Classification and Result Display
The Admin Panel module allows authorized users to manage system configurations, oversee
detection results, and analyze system performance logs.
Functionality:
This module handles user-uploaded videos, converting them into frame sequences for further
processing.
Functionality:
Face detection and alignment are critical for ensuring consistent frame inputs to the CNN.
Functionality:
This module uses a pre-trained CNN model (e.g., VGG-16) to extract spatial features from
each aligned frame.
Functionality:
Using LSTM, this module analyzes the extracted frame-level features over time to identify
deepfake-specific temporal inconsistencies.
Functionality:
The final module classifies the input video as real or fake and displays the result to the user.
Functionality:
Unified Modeling Language (UML) diagrams illustrate the functional and data flow
structure of the FakeSpotter system.
The Data Flow Diagram (DFD) illustrates how data flows through the FakeSpotter system,
from video input to final deepfake classification. It outlines the sequence of operations,
including preprocessing, feature extraction, temporal analysis, and result generation.
Key Points:
Clarifies interactions between users, the CNN-RNN model, and storage systems
(e.g., feature vectors, logs)DFD – Level 1 (Simplified Flow)
Process Flow Summary:
2. Preprocessing – The video is broken into frames; faces are detected and aligned.
3. CNN Feature Extraction – Each frame is passed through the VGG-16 network to
temporal inconsistencies.
6. Fake.Output Display – The result is shown to the user with an option to download a
report
The Use Case Diagram outlines the functional requirements of the FakeSpotter system by
identifying the primary actors (Admin and User) and their interactions with the system’s core
modules.
Key Elements:
Actors:
Admin – The system administrator who monitors operations and manages datasets,
- Upload Video
- Download Report
The User interacts with the system through the Upload Video use case, triggering
The Admin accesses the Admin Panel, which provides tools to update the detection model,
Use cases are connected to their respective actors with association lines (as per UML
standards), forming a visual relationship between system functionality and the roles that
access them.
Diagram Summary :
Admin
User
This diagram highlights the high-level functionalities available to each system actor and
The Activity Diagram outlines the workflow involved in the core functionality of the
content. This diagram visually represents the sequence of activities performed, from video
This Activity Diagram helps visualize how the FakeSpotter system orchestrates AI
components (CNN + LSTM) and backend services to deliver a reliable deepfake detection
result. It aids developers and stakeholders in understanding both user interactions and system
operations.
Components:
The Sequence Diagram outlines the chronological flow of interactions among various
components in the FakeSpotter system. It visualizes how the user interacts with the system
and how internal modules such as the backend server, AI model, and database work together
to process deepfake detection tasks.
Depictions:
Lifelines:
User Interface (UI) – Where the user uploads the video and views results.
Backend Server (API Layer) – Manages requests and coordinates between modules.
The Class Diagram represents the static structure of the FakeSpotter system by outlining the
key classes, their attributes, methods, and the relationships among them. This diagram forms
the backbone of the object-oriented architecture and illustrates how different system
Key Points:
2.Attributes and methods are described for each class, helping developers understand
1.User:
Attributes: adminPrivileges
4.FrameProcessor:
Methods: extractFeatures(frame)
7.PredictionEngine:
8.Result:
6. Admin inherits from User and manages system operations and results.
1. Scalability
2. Maintainability
3. Efficient collaboration
4. Seamless development-to-deployment transition
5. The FakeSpotter project, built using React.js (frontend) and Python (Flask/TensorFlow
backend), adheres to a well-structured format for AI-powered applications.
PROJECT FILES AND SETUP OVERVIEW
The FakeSpotter project follows a modular directory structure that separates concerns
between the frontend interface and backend deep learning functionality. The system
leverages modern web development frameworks alongside AI libraries to deliver a seamless
deepfake detection platform.
node_modules/Contains all Node.js packages used for both frontend and backend
operations. Dependencies include:
1. components/ – Reusable React components (e.g., video uploader, result cards, modals)
2. hooks/ – Custom React hooks for managing state (e.g., video upload, model inference)
3. integrations/ – API logic for integrating TensorFlow or Python-backend inference
engines
4. lib/ – Helper functions for video splitting, face alignment, and feature formatting
5. pages/ – Core routes like Home, Upload, Result Dashboard
6. types/ – TypeScript interfaces for consistent data types across the app
7. App.tsx / App.css – Root application logic and styling
8. main.tsx – React app entry point
models/Contains trained model files (.h5, .pb) exported from TensorFlow/Keras. May
include:
supabase
If used, this contains configurations for Supabase authentication and storage (can be replaced
with Firebase, MongoDB, or local DB).
Other Core Files:
npm install
npm run dev
Backend / AI Model
TensorFlow model can run as:
In-browser via TensorFlow.js
Python backend via Flask/FastAPI
Pre-trained weights for VGG-16 + LSTM loaded at runtime
Setup:
Visual Studio Code (VS Code) is the primary development environment used throughout the
FakeSpotter project.
Features of VS Code:
IMPLEMENTATION
In the initial phase of implementation, the focus was on analyzing the structure and patterns
within deepfake and real video samples. Frame-level inconsistencies were key indicators of
manipulation.
Studying eye blinking patterns, lip synchronization, and facial distortions over time.
between frames.
This exploratory analysis informed the feature extraction process and helped refine the
The performance of the FakeSpotter system heavily relies on the quality of the training
We used the Celeb-DF (v2) dataset, a large-scale and high-quality deepfake dataset that
includes:
techniques.
2. Frame Extraction: Each video was decomposed into a sequence of frames at a fixed
3. Face Detection and Alignment: Using dlib and OpenCV, faces were detected in each
4. Image Normalization: Pixel values were scaled between 0 and 1 to ensure model
5. Resizing: All frames were resized to 64x64 pixels for compatibility with the CNN input
layer.
6. Label Encoding: Videos were labeled as real (0) or fake (1) for supervised training.
7. Sequence Generation: Frame sequences of length 10 were created for temporal modeling
by LSTM.
8. Train-Test Split: Data was split into 80% training and 20% testing sets to validate
generalization.
7.3 MACHINE LEARNING APPROACH
A Convolutional Neural Network (CNN) based on VGG-16 was used to extract spatial
Model: Pre-trained VGG-16 layers were used with frozen weights (transfer learning).
frame.
Implementation: TensorFlow and Keras were used to load VGG-16 and extract
Architecture:
Model Structure:
python
model = Sequential([
TimeDistributed(MaxPooling2D((2, 2))),
TimeDistributed(Flatten()),
LSTM(64),
Dense(64, activation='relu'),
Dense(1, activation='sigmoid')
])
Output: Each video sequence is classified as real (0) or fake (1) based on learned
spatiotemporal patterns.
IMPLEMENTATION PROCESS
CHAPTER 8
FEASIBILITY STUDY AND SYSTEM TESTING
Feasibility studies are essential to assess whether a project can be successfully implemented,
both technically and economically, while ensuring user satisfaction and long-term
sustainability. For FakeSpotter, the feasibility study was conducted to evaluate cost-
effectiveness, technical readiness, and operational practicality.
Economic Feasibility
Technical Feasibility
Operational Feasibility
Deployment via cloud services (e.g., Render, Heroku) and GPU-enabled local systems
ensures minimal infrastructure investment while maintaining high detection accuracy and
scalability. Overall, the project is economically feasible for academic, forensic, or content
verification use cases.
8.1.2 TECHNICAL FEASIBILITY
From a technical perspective, FakeSpotter is designed using reliable and proven components:
4.Optional React frontend for user-friendly video upload and result display
All tools are compatible with standard computing environments and require no proprietary
hardware or software, making the project technically sound and deployable on multiple
platforms.
The FakeSpotter system is intuitive and simple to operate. Users upload a video, and the
system processes it to return a deepfake classification along with a confidence score. The
web interface (if implemented) provides a clean dashboard, while the backend automates
feature extraction, sequence analysis, and decision-making.
Clear system flow, lightweight infrastructure, and visual feedback make it suitable for users
in academic research, media authentication, and cyber forensics with minimal technical
training required.
8.2 SYSTEM TESTING
Testing ensures the reliability, functionality, and usability of FakeSpotter under various
conditions. Multiple testing methodologies were employed to validate different system
components.
3.Unit Testing
4.Functional Testing
5.Performance Testing
6.Integration Testing
7.Validation Testing
8.System Testing
9.Output Testing
Internal functions of the CNN-LSTM model pipeline and API routes were tested to ensure
proper feature transformation, LSTM sequence handling, and frame classification logic.
Python unit tests validated data preprocessing, model input/output, and intermediate layers.
8.2.1.2 BLACK BOX TESTING
Tested the system from the user's perspective: videos were uploaded, and outputs were
validated without inspecting internal operations. Verified that real and fake videos were
correctly classified based on system predictions.
Each module—video preprocessor, frame extractor, face aligner, CNN feature encoder, and
LSTM classifier—was tested independently to verify correctness using mock data.
Stress-tested the system with videos of varying lengths, resolutions, and face complexities.
Measured latency from upload to result generation and ensured real-time feasibility for small
to medium videos.
8.2.1.6 INTEGRATION TESTING
3.File handler
Compared system outputs with labeled test samples from the Celeb-DF dataset to verify
detection accuracy, precision, and recall. Confirmed the model met project goals and dataset
benchmarks.
1.Video upload
2.Frame extraction
3.Model inference
4.Result display
Tested cross-browser compatibility and device responsiveness for the frontend (if deployed).
8.2.1.9 OUTPUT TESTING
Verified that the output classification (Real/Fake) and confidence scores were accurate and
interpretable by end users. Output reports matched frame analysis consistency.
Pilot testing was conducted with sample users (e.g., digital forensics researchers, students).
Feedback confirmed the system's ease of use, effectiveness, and potential for further
improvement with larger datasets.
CHAPTER 9
RESULTS
OUTPUTS:
IF IT’S REAL:
IF IT’S FAKE:
CHAPTER 10
CONCLUSION
The FakeSpotter framework marks a significant advancement in the field of digital media
The system effectively captures frame-level artifacts and sequence-based inconsistencies that
dataset, the model demonstrates strong generalization to real-world deepfake scenarios and is
applications in digital forensics, media integrity validation, academic research, and public
awareness campaigns.
Future Enhancements
To further improve detection capabilities and expand the system's impact, future work on
Real-time inference on edge devices using model quantization and ONNX conversion for
lightweight deployment.
Web-based and mobile frontends for public or institutional use in content verification
workflows.
Continuous learning framework, allowing the model to adapt to newly emerging deepfake
With these upgrades, FakeSpotter aspires to become a leading tool in the global effort to
safeguard digital authenticity, combat synthetic media threats, and promote ethical AI usage.
SOURCE CODE:
Main.py:
import os
import cv2
import numpy as np
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = 'static/uploads'
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
model = load_model("model/deepfake_mobilenet.h5")
def predict_video(video_path):
cap = cv2.VideoCapture(video_path)
cap.release()
if not ret:
prediction = model.predict(frame)[0]
@app.route('/')
def index():
return render_template('index.html')
def predict():
result = None
video_filename = None
if request.method == 'POST':
file = request.files['video']
filename = "test.mp4"
file.save(video_path)
result = predict_video(video_path)
video_filename = filename
if __name__ == '__main__':
app.run(debug=True)
Cnn_Mobilenet.py:
import os
import cv2
import numpy as np
# Parameters
IMG_SIZE = 224
DATASET_PATH = "dataset"
def load_data():
data = []
if not os.path.exists(folder):
continue
if ret:
data.append([frame, label])
cap.release()
return data
data = load_data()
x = GlobalAveragePooling2D()(x)
x = Dense(128, activation='relu')(x)
x = Dropout(0.5)(x)
os.makedirs("model", exist_ok=True)
model.save("model/deepfake.h5")
INDEX.HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
background: #317180;
color: #333;
nav {
background-color: #1a1a1a;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
nav h2 {
margin: 0;
}
nav a {
color: white;
text-decoration: none;
margin-left: 20px;
font-weight: bold;
.container {
display: flex;
flex-wrap: wrap;
max-width: 1100px;
background: #f2f7fb;
border-radius: 8px;
overflow: hidden;
.text-section, .image-section {
flex: 1;
padding: 40px;
.text-section {
min-width: 300px;
.text-section h1 {
color: #004080;
.text-section p {
font-size: 18px;
line-height: 1.6;
.btn {
margin-top: 30px;
display: inline-block;
font-size: 16px;
background-color: #004080;
color: white;
text-decoration: none;
border-radius: 5px;
.btn:hover {
background-color: #0059b3;
/* Slideshow styling */
.slideshow-container {
position: relative;
max-width: 100%;
height: 300px;
margin: auto;
overflow: hidden;
.slide {
display: none;
width: 100%;
height: 300px;
.slide img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 8px;
/* Next/prev buttons */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
user-select: none;
background: rgba(0,0,0,0.5);
.next {
right: 0;
.prev:hover, .next:hover {
background-color: rgba(0,0,0,0.8);
</style>
</head>
<body>
<nav>
<h2>Deepfake Detector</h2>
<div>
</div>
</nav>
<div class="container">
<div class="text-section">
<h1>What is a Deepfake?</h1>
<p>
These manipulations use deep learning (GANs) and are used in entertainment, but
also pose risks like misinformation, identity fraud, and privacy invasion.
</p>
</div>
<div class="image-section">
<div class="slideshow-container">
alt="Slide 1"></div>
<div class="slide"><img src="{{ url_for('static', filename='images/img2.jpg') }}"
alt="Slide 2"></div>
alt="Slide 3"></div>
alt="Slide 4"></div>
alt="Slide 5"></div>
</div>
</div>
</div>
<script>
let slideIndex = 0;
showSlides();
function showSlides() {
let slides = document.getElementsByClassName("slide");
slides[i].style.display = "none";
slideIndex++;
function changeSlide(n) {
slideIndex += n - 1;
showSlides();
</script>
</body>
</html>
PREDICT.HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
background-color: #317180;
color: #333;
nav {
background-color: #1a1a1a;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
nav h2 {
margin: 0;
}
nav a {
color: white;
text-decoration: none;
margin-left: 20px;
font-weight: bold;
.container {
max-width: 600px;
background-color: #f2f7fb;
padding: 40px;
border-radius: 8px;
text-align: center;
h1 {
color: #004080;
input[type="file"] {
padding: 10px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 16px;
button {
font-size: 16px;
background-color: #004080;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #0059b3;
video {
margin-top: 20px;
border-radius: 8px;
h2 {
margin-top: 20px;
color: white;
</style>
</head>
<body>
<nav>
<h2>Deepfake Detector</h2>
<div>
</div>
</nav>
<div class="container">
<h1>Upload a Video</h1>
</form>
{% if video %}
<h3>Uploaded Video:</h3>
</video>
{% endif %}
{% if result == "Real" %}
{% endif %}
</div>
</body>
</html>
REFERENCES
1.Y. Li, X. Yang, P. Sun, H. Qi, and S. Lyu, “Celeb-DF: A Large-Scale Challenging Dataset
3.T. Nguyen, C. Nguyen, D. Nguyen, D. Chu, and K. Nguyen, “Deep Learning for
Deepfakes Creation and Detection: A Survey,” Computers & Security, vol. 102, 2021, doi:
10.1016/j.cose.2020.102109.
4.J. Agarwal, R. Farid, “Protecting World Leaders Against Deep Fakes,” Proceedings of the
2019.
5.K. Afchar, W. Nozick, J. Yamagishi, and I. Echizen, “MesoNet: A Compact Facial Video