# krishnaprasanna21/deepfake_video_detection architecture

> Architecture diagram of the GitHub repository krishnaprasanna21/deepfake_video_detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krishnaprasanna21/deepfake_video_detection
- Repository: https://github.com/krishnaprasanna21/deepfake_video_detection

## Overview

##### Project type and purpose
- This is a deepfake‐detection model creation pipeline implemented as a set of Jupyter notebooks.
- Purpose: preprocess the Celeb-DF video dataset, train a convolutional neural network (DeepCNN), save the trained model (.h5), and run inference on new video data.

##### File structure
- Top-level files:
- Readme.md – project overview and instructions
- *.ipynb notebooks – data preprocessing, training, model exploration, and prediction
- deepfake-detection-model.h5, deepfake-detection-model1.h5 – saved trained model artifacts
- No nested directories; notebooks encapsulate each pipeline stage.
- External dependencies implied by the README: Google Colab (execution environment) and Google Drive (storage).

##### README for additional insights
- Libraries: dlib, OpenCV (cv2), PIL, TensorFlow, NumPy, Pandas, scikit-learn, etc.
- Dataset: Celeb-DF (video frames → face crops)
- Pipeline stages:
a. Data ingestion & frame extraction
b. Face cropping & dataset saving
c. Model definition (DeepCNN), train/test split
d. Training & evaluation
e. Model serialization (.h5)
f. Prediction on unseen data using saved .h5

a. Main components
- Data Source (Celeb-DF videos, Google Drive storage)
- Preprocessing Notebook (frame extraction, face cropping)
- Feature Store (folder of cropped images)
- Training Notebook (DeepCNN model, train/test split, evaluation)
- Model Artifacts (.h5 files)
- Prediction Notebook (load .h5, run inference)
- Execution Environment (Google Colab)
b. Relationships and interactions
- From Feature Store → Training → Model Artifacts
- From Model Artifacts + New Video Input → Prediction
- Google Drive ↔ Execution Environment (for loading/saving data and models)
c. Architectural patterns and design principles
- Linear ML pipeline (ETL → training → inference)
- Clear separation of concerns: data prep, training, inference
- Notebooks as orchestration layers rather than monolithic scripts
d. Key technologies and frameworks
- Python Jupyter Notebooks
- dlib & OpenCV for face detection/cropping
- TensorFlow (or PyTorch if referenced) for model definition and training
- Google Colab (compute) and Google Drive (storage)
- Supporting libraries: NumPy, Pandas, scikit-learn, matplotlib/seaborn for analysis and visualization

## Diagram (Mermaid)

```mermaid
flowchart TD
    DataSource["1. Data Source\n(Celeb-DF Videos)"]:::component
    FeatureStore["Feature Store\n(Cropped Images Folder)"]:::storage
    ModelArtifacts["5. Model Artifacts\n(.h5 files)"]:::storage
    GoogleDrive["Google Drive"]:::storage

    subgraph "Execution Environment: Google Colab"
        Preprocess["2. Preprocessing Notebook\n(analysis.ipynb)"]:::notebook
        Crop["3. Face Cropping Notebook\n(capture_img (2).ipynb)"]:::notebook
        Train["4. Model Training Notebook\n(deepfake_detection_train.ipynb)"]:::notebook
        Predict["6. Prediction Notebook\n(model_play.ipynb\nmodel_play (2).ipynb)"]:::notebook
    end

    DataSource -->|"Raw Videos"| Preprocess
    Preprocess -->|"Extracted Frames"| Crop
    Crop -->|"Cropped Faces"| FeatureStore
    FeatureStore -->|"Dataset"| Train
    Train -->|"Model Weights"| ModelArtifacts
    ModelArtifacts -->|"Load Model"| Predict
    DataSource -->|"New Video Input"| Predict

    GoogleDrive -.-> Preprocess
    GoogleDrive -.-> Crop
    GoogleDrive -.-> Train
    GoogleDrive -.-> Predict
    FeatureStore -.-> GoogleDrive
    ModelArtifacts -.-> GoogleDrive

    %% Click Events
    click DataSource "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/Readme.md"
    click Preprocess "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/analysis.ipynb"
    click Crop "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/capture_img (2).ipynb"
    click Train "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/deepfake_detection_train.ipynb"
    click ModelArtifacts "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/deepfake-detection-model.h5"
    click ModelArtifacts "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/deepfake-detection-model1.h5"
    click Predict "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/model_play.ipynb"
    click Predict "https://github.com/krishnaprasanna21/deepfake_video_detection/blob/main/model_play (2).ipynb"

    %% Styles
    classDef component fill:#ffffff,stroke:#000000,stroke-width:1px
    classDef notebook fill:#eeeeee,stroke:#000000,stroke-width:1px
    classDef storage fill:#dddddd,stroke:#000000,stroke-width:1px
    class DataSource,Preprocess,Crop,Train,Predict component
    class FeatureStore,ModelArtifacts,GoogleDrive storage
```
