How lakshman-a01/deepfake-detection-system-deeplearning works
Purpose and Runtime Entry Point
This is a Python deepfake-detection application for uploaded images and videos. It classifies detected face crops as real or fake using a trained deep-learning workflow developed in notebooks. The intended runtime entry point is deep/app.py; related launch/prototype modules are deep/main.py and deep/new.py.
Web Application and User Flow
The application is a server-rendered web interface: users navigate from home/login/registration views to image or video upload forms, then receive corresponding display/result pages. Template boundaries are in deep/templates/home.html, deep/templates/Upload_image.html, deep/templates/Upload_Video.html, deep/templates/Display_image.html, and deep/templates/Display_Video.html. Styling and bundled media are served from deep/static/style.css and deep/static/.
Upload and Media Storage Boundary
Uploaded media is persisted under deep/uploads/, separating user-provided content from static demonstration assets. Video examples and uploads present in the repository indicate the application accepts MP4 inputs, while image handling is supplied through the image upload/display templates. Relevant paths: deep/uploads/tomc_orginial.mp4, deep/uploads/tomo.mp4, and deep/static/Very_realistic_Tom_Cruise_Deepfake___AI_Tom_Cruise.mp4.
Video Detection Pipeline
For video inputs, the core processing flow is: ingest video → extract frames → locate faces → crop face regions → classify each crop with the deep-learning model → present an aggregate/display result. Face localization uses the bundled OpenCV Haar cascade at deep/haarcascade_frontalface_default.xml. The model experimentation and training pipeline are represented by deep/model/Preprocessing.ipynb, deep/model/deepfake_detection_train.ipynb, and deep/model/Prediction.ipynb.
Image Detection Pipeline
For static images, the pipeline bypasses frame extraction: upload image → detect/crop a face → invoke the classifier → render the image result. This is exposed separately from video processing through deep/templates/Upload_image.html and deep/templates/Display_image.html, allowing modality-specific request handling and presentation.
Model and ML Boundary
Model preprocessing, training, and prediction are notebook-driven rather than packaged as a dedicated Python model module. deep/model/Preprocessing.ipynb prepares facial inputs, deep/model/deepfake_detection_train.ipynb trains the detector, and deep/model/Prediction.ipynb performs inference-oriented work. Application code in deep/app.py is therefore the integration boundary between web requests, OpenCV face detection, filesystem media, and the trained-model inference logic.
Dependencies and Deployment Assumptions
The project runs in a local Python/Conda environment with dependencies declared in deep/requirements.txt. It depends materially on deep-learning libraries and computer-vision support for classification and face detection, plus a Python web-server framework for browser interaction. No cloud infrastructure, remote model-serving endpoint, database, or external API is indicated; media and inference appear to be local.
Components 16
Web application
- Application entry point · Integrates requests, local media, face detection, and inference.
deep/app.py - Alternate launch modules
deep/main.py - Home and auth views
deep/templates/home.html - Image upload form
deep/templates/Upload_image.html - Video upload form
deep/templates/Upload_Video.html - Image result page
deep/templates/Display_image.html - Video result page
deep/templates/Display_Video.html - Styles and demo media
Local media processing
- Uploaded media storage · Separates user-provided images and videos from static assets.
- Video frame pipeline · Extracts frames, detects faces, crops them, and aggregates classifications.
- Image face pipeline · Detects and crops a face directly from an uploaded image.
- Haar face detector
deep/haarcascade_frontalface_default.xml
Notebook ML workflow
- Face preprocessing
deep/model/Preprocessing.ipynb - Detector training
deep/model/deepfake_detection_train.ipynb - Classifier inference · Inference-oriented classifier workflow used by the application integration boundary.
deep/model/Prediction.ipynb
Other components
- Local Python dependencies · Provides web, computer-vision, and deep-learning runtime dependencies.
deep/requirements.txt
Connections 22
- Home and auth views → Image upload form: navigate
- Home and auth views → Video upload form: navigate
- Application entry point → Home and auth views: renders
- Application entry point → Image upload form: renders
- Application entry point → Video upload form: renders
- Application entry point → Styles and demo media: serves
- Image upload form → Uploaded media storage: uploads image
- Video upload form → Uploaded media storage: uploads video
- Uploaded media storage → Image face pipeline: image input
- Uploaded media storage → Video frame pipeline: video input
- Image face pipeline → Haar face detector: locates faces
- Video frame pipeline → Haar face detector: locates faces per frame
- Image face pipeline → Classifier inference: classifies face crop
- Video frame pipeline → Classifier inference: classifies face crops
- Classifier inference → Image result page: image result
- Classifier inference → Video result page: aggregate result
- Application entry point → Image result page: renders
- Application entry point → Video result page: renders
- Face preprocessing → Detector training: prepared facial inputs
- Detector training → Classifier inference: trained detector
- Local Python dependencies → Application entry point: runtime environment
- Alternate launch modules → Application entry point: related launch flow