# rizwann2912/deepfake-detection architecture

> Architecture diagram of the GitHub repository rizwann2912/deepfake-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rizwann2912/deepfake-detection
- Repository: https://github.com/rizwann2912/deepfake-detection

## Overview

This Django application lets a user submit a video and sequence length for deepfake classification, then displays a REAL/FAKE result and confidence. The documented inference approach extracts ResNeXt features and classifies their sequence with an LSTM; the sampled view also shows face cropping and heatmap generation. Routing, upload validation, inference, and result presentation are visible, but the view excerpt omits parts of the request flow. The README describes model training, but no training implementation appears in the supplied tree.

Main entry points: [`ml_app/views.py`](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py) (Request views), [`ml_app/urls.py`](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/urls.py) (App routes), [`ml_app/management/commands/download_model.py`](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/management/commands/download_model.py) (Model downloader), [`ml_app/templates`](https://github.com/rizwann2912/deepfake-detection/tree/main/ml_app/templates) (Pages and results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app_routes["App routes<br/>[urls.py]"]
  node_upload_form["Upload form<br/>[forms.py]"]
  node_page_views["Request views<br/>[views.py]"]
  node_page_templates["Pages and results"]
  node_shared_templates["Shared page layout"]
  node_browser_script["Upload preview script<br/>[script.js]"]
end

subgraph group_inference["Detection pipeline"]
  node_frame_processing["Frame and face processing<br/>[views.py]"]
  node_sequence_dataset["Video sequence dataset<br/>[views.py]"]
  node_resnext_lstm["ResNeXt LSTM classifier<br/>[views.py]"]
  node_prediction_viz["Prediction and heatmap<br/>[views.py]"]
end

subgraph group_assets["Model assets"]
  node_video_storage[("Uploaded videos")]
  node_model_files[("Trained models")]
  node_model_downloader["Model downloader<br/>[download_model.py]"]
end

subgraph group_runtime["Django runtime"]
  node_project_routes["Project routes<br/>[urls.py]"]
  node_settings["Application settings<br/>[settings.py]"]
end

node_user(("Video submitter"))
node_drive(("Google Drive"))

node_user -->|"requests pages"| node_app_routes
node_project_routes -->|"includes routes"| node_app_routes
node_app_routes -->|"dispatches requests"| node_page_views
node_page_views -->|"validates input"| node_upload_form
node_page_views -.->|"stores upload"| node_video_storage
node_settings -->|"configures media"| node_video_storage
node_page_views -->|"processes video"| node_frame_processing
node_page_views -->|"loads sequences"| node_sequence_dataset
node_page_views -->|"loads weights"| node_model_files
node_sequence_dataset -->|"extracts frames"| node_frame_processing
node_page_views -->|"runs inference"| node_resnext_lstm
node_page_views -->|"generates result"| node_prediction_viz
node_page_views -->|"renders pages"| node_page_templates
node_page_templates -.->|"uses layout"| node_shared_templates
node_model_downloader -->|"writes model"| node_model_files
node_model_downloader -->|"downloads from"| node_drive

click node_app_routes "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/urls.py"
click node_project_routes "https://github.com/rizwann2912/deepfake-detection/blob/main/project_settings/urls.py"
click node_upload_form "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/forms.py"
click node_page_views "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py"
click node_page_templates "https://github.com/rizwann2912/deepfake-detection/tree/main/ml_app/templates"
click node_shared_templates "https://github.com/rizwann2912/deepfake-detection/tree/main/templates"
click node_video_storage "https://github.com/rizwann2912/deepfake-detection/tree/main/uploaded_videos"
click node_frame_processing "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py"
click node_sequence_dataset "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py"
click node_resnext_lstm "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py"
click node_prediction_viz "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py"
click node_model_files "https://github.com/rizwann2912/deepfake-detection/tree/main/models"
click node_model_downloader "https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/management/commands/download_model.py"
click node_settings "https://github.com/rizwann2912/deepfake-detection/blob/main/project_settings/settings.py"
click node_browser_script "https://github.com/rizwann2912/deepfake-detection/blob/main/static/js/script.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_routes,node_upload_form,node_page_views,node_page_templates,node_shared_templates,node_browser_script toneBlue
class node_frame_processing,node_sequence_dataset,node_resnext_lstm,node_prediction_viz toneAmber
class node_video_storage,node_model_files,node_model_downloader toneMint
class node_project_routes,node_settings toneRose
class node_user,node_drive toneIndigo
```

## Components

### Web interface

- [App routes](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/urls.py): `ml_app/urls.py`
- [Upload form](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/forms.py): `ml_app/forms.py`
- [Request views](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py): `ml_app/views.py`
- [Pages and results](https://github.com/rizwann2912/deepfake-detection/tree/main/ml_app/templates): `ml_app/templates`
- [Shared page layout](https://github.com/rizwann2912/deepfake-detection/tree/main/templates): `templates`
- [Upload preview script](https://github.com/rizwann2912/deepfake-detection/blob/main/static/js/script.js): `static/js/script.js`

### Detection pipeline

- [Frame and face processing](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py): `ml_app/views.py`
- [Video sequence dataset](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py): `ml_app/views.py`
- [ResNeXt LSTM classifier](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py): `ml_app/views.py`
- [Prediction and heatmap](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/views.py): `ml_app/views.py`

### Model assets

- [Uploaded videos](https://github.com/rizwann2912/deepfake-detection/tree/main/uploaded_videos): `uploaded_videos`
- [Trained models](https://github.com/rizwann2912/deepfake-detection/tree/main/models): `models`
- [Model downloader](https://github.com/rizwann2912/deepfake-detection/blob/main/ml_app/management/commands/download_model.py): `ml_app/management/commands/download_model.py`

### Django runtime

- [Project routes](https://github.com/rizwann2912/deepfake-detection/blob/main/project_settings/urls.py): `project_settings/urls.py`
- [Application settings](https://github.com/rizwann2912/deepfake-detection/blob/main/project_settings/settings.py): `project_settings/settings.py`

### Other components

- **Video submitter**
- **Google Drive**

## Connections

- Video submitter → App routes: requests pages (evidence: `ml_app/urls.py`)
- Project routes → App routes: includes routes (evidence: `project_settings/urls.py`)
- App routes → Request views: dispatches requests (evidence: `ml_app/urls.py`)
- Request views → Upload form: validates input (evidence: `ml_app/views.py`)
- Request views → Uploaded videos: stores upload
- Application settings → Uploaded videos: configures media (evidence: `project_settings/settings.py`)
- Request views → Frame and face processing: processes video (evidence: `ml_app/views.py`)
- Request views → Video sequence dataset: loads sequences (evidence: `ml_app/views.py`)
- Request views → Trained models: loads weights (evidence: `ml_app/views.py`)
- Video sequence dataset → Frame and face processing: extracts frames (evidence: `ml_app/views.py`)
- Request views → ResNeXt LSTM classifier: runs inference (evidence: `ml_app/views.py`)
- Request views → Prediction and heatmap: generates result (evidence: `ml_app/views.py`)
- Request views → Pages and results: renders pages (evidence: `ml_app/views.py`)
- Pages and results → Shared page layout: uses layout
- Model downloader → Trained models: writes model (evidence: `ml_app/management/commands/download_model.py`)
- Model downloader → Google Drive: downloads from (evidence: `ml_app/management/commands/download_model.py`)
