# ytashan/deepfake-image-detection architecture

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

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

## Overview

This repository is an educational deepfake-image classifier implemented in a Kaggle/Jupyter notebook. Its documented workflow prepares CIFAKE images, trains an EfficientNetB0-based binary classifier, fine-tunes the backbone, saves the best validation-AUC checkpoint, and evaluates it; the saved model also supports individual and folder predictions. The README documents optional evaluation on a separate deepfake dataset and the model’s architecture and metrics. No notebook source was provided, so relationships below reflect README statements only; the alternate notebook’s role is unclear.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_data_prep["Image generators"]
  node_augmentation["Image augmentation"]
end

subgraph group_model["Classifier"]
  node_backbone["EfficientNetB0"]
  node_classification_head["Classification head"]
end

subgraph group_train["Training and evaluation"]
  node_training["Initial training"]
  node_fine_tuning["Fine-tuning"]
  node_checkpoint[("Best-model checkpoint")]
  node_evaluation["Performance evaluation"]
  node_metrics["Evaluation metrics"]
end

subgraph group_infer["Prediction"]
  node_single_prediction["Single-image prediction"]
  node_batch_prediction["Folder prediction"]
  node_prediction["Real/fake result"]
end

node_researcher(("Notebook user"))
node_cifake[("CIFAKE dataset")]
node_deepfake_dataset[("Deepfake dataset")]
node_alternate_notebook["Alternate notebook"]

node_cifake -->|"supplies images"| node_data_prep
node_data_prep -->|"augments images"| node_augmentation
node_data_prep -->|"provides training data"| node_training
node_backbone -->|"extracts features for"| node_classification_head
node_training -->|"trains classifier"| node_backbone
node_training -->|"continues as"| node_fine_tuning
node_fine_tuning -->|"saves best model"| node_checkpoint
node_cifake -->|"supplies test images"| node_evaluation
node_deepfake_dataset -.->|"supports optional evaluation"| node_evaluation
node_evaluation -->|"calculates metrics"| node_metrics
node_researcher -->|"requests prediction"| node_single_prediction
node_checkpoint -->|"loads model for"| node_single_prediction
node_researcher -->|"requests batch"| node_batch_prediction
node_checkpoint -->|"loads model for"| node_batch_prediction
node_single_prediction -->|"returns label and score"| node_prediction
node_batch_prediction -->|"returns predictions"| node_prediction

click node_alternate_notebook "https://github.com/ytashan/deepfake-image-detection/blob/main/deepfake-image-final.ipynb"

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_data_prep,node_augmentation,node_researcher toneBlue
class node_backbone,node_classification_head,node_cifake,node_deepfake_dataset toneAmber
class node_training,node_fine_tuning,node_checkpoint,node_evaluation,node_metrics toneMint
class node_single_prediction,node_batch_prediction,node_prediction toneRose
class node_alternate_notebook toneTeal
```

## Components

### Data preparation

- **Image generators**
- **Image augmentation**

### Classifier

- **EfficientNetB0**
- **Classification head**

### Training and evaluation

- **Initial training**
- **Fine-tuning**
- **Best-model checkpoint**
- **Performance evaluation**
- **Evaluation metrics**

### Prediction

- **Single-image prediction**
- **Folder prediction**
- **Real/fake result**

### Other components

- **Notebook user**
- **CIFAKE dataset**
- **Deepfake dataset**
- [Alternate notebook](https://github.com/ytashan/deepfake-image-detection/blob/main/deepfake-image-final.ipynb): `deepfake-image-final.ipynb`

## Connections

- CIFAKE dataset → Image generators: supplies images (evidence: `README.md`)
- Image generators → Image augmentation: augments images (evidence: `README.md`)
- Image generators → Initial training: provides training data (evidence: `README.md`)
- EfficientNetB0 → Classification head: extracts features for (evidence: `README.md`)
- Initial training → EfficientNetB0: trains classifier (evidence: `README.md`)
- Initial training → Fine-tuning: continues as (evidence: `README.md`)
- Fine-tuning → Best-model checkpoint: saves best model (evidence: `README.md`)
- CIFAKE dataset → Performance evaluation: supplies test images (evidence: `README.md`)
- Deepfake dataset → Performance evaluation: supports optional evaluation (evidence: `README.md`)
- Performance evaluation → Evaluation metrics: calculates metrics (evidence: `README.md`)
- Notebook user → Single-image prediction: requests prediction (evidence: `README.md`)
- Best-model checkpoint → Single-image prediction: loads model for (evidence: `README.md`)
- Notebook user → Folder prediction: requests batch (evidence: `README.md`)
- Best-model checkpoint → Folder prediction: loads model for (evidence: `README.md`)
- Single-image prediction → Real/fake result: returns label and score (evidence: `README.md`)
- Folder prediction → Real/fake result: returns predictions (evidence: `README.md`)
