# davidgh96/20-21_dagahe architecture

> Architecture diagram of the GitHub repository davidgh96/20-21_dagahe, 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/davidgh96/20-21_dagahe
- Repository: https://github.com/davidgh96/20-21_dagahe

## Overview

This repository implements a facial presentation-attack classifier, with two ways to train and run it: separate local scripts or a self-contained Google Colab script. The workflow is image datasets → VGG19-based model training → saved model and weights → per-image prediction as attack or real. The README also documents using a previously trained model instead of training. The Colab script combines model creation, training, and prediction; the separate scripts divide those responsibilities. Arrows reflect README statements and the shown source; no separate dataset or model files are present in the tree.

Main entry points: [`fitModel.py`](https://github.com/davidgh96/20-21_dagahe/blob/main/fitModel.py) (Local trainer), [`predictModel.py`](https://github.com/davidgh96/20-21_dagahe/blob/main/predictModel.py) (Image predictor), [`ModuloCompletoGoogleColab.py`](https://github.com/davidgh96/20-21_dagahe/blob/main/ModuloCompletoGoogleColab.py) (Combined Colab script), [`createModelVGG19.py`](https://github.com/davidgh96/20-21_dagahe/blob/main/createModelVGG19.py) (VGG19 model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_architecture["VGG19 model"]
  node_trainer["Local trainer<br/>[fitModel.py]"]
end

subgraph group_inference["Image inference"]
  node_predictor["Image predictor<br/>[predictModel.py]"]
end

subgraph group_colab["Colab workflow"]
  node_colab_script["Combined Colab script"]
end

node_user(("User"))
node_datasets["Labeled image sets"]
node_artifacts["Model and weights"]
node_test_image["Input image"]
node_classification["Attack or real"]

node_user -->|"runs training"| node_trainer
node_datasets -->|"provides images"| node_trainer
node_trainer -->|"creates model via"| node_architecture
node_trainer -->|"saves model"| node_artifacts
node_user -->|"runs prediction"| node_predictor
node_artifacts -->|"loads model"| node_predictor
node_test_image -->|"supplies image"| node_predictor
node_predictor -->|"returns class"| node_classification
node_user -->|"runs workflow"| node_colab_script
node_datasets -->|"provides images"| node_colab_script
node_test_image -->|"supplies image"| node_colab_script
node_colab_script -->|"prints class"| node_classification

click node_architecture "https://github.com/davidgh96/20-21_dagahe/blob/main/createModelVGG19.py"
click node_trainer "https://github.com/davidgh96/20-21_dagahe/blob/main/fitModel.py"
click node_predictor "https://github.com/davidgh96/20-21_dagahe/blob/main/predictModel.py"
click node_colab_script "https://github.com/davidgh96/20-21_dagahe/blob/main/ModuloCompletoGoogleColab.py"

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_architecture,node_trainer,node_user toneBlue
class node_predictor toneAmber
class node_colab_script toneMint
class node_datasets,node_artifacts,node_test_image,node_classification toneIndigo
```

## Components

### Model training

- [VGG19 model](https://github.com/davidgh96/20-21_dagahe/blob/main/createModelVGG19.py): `createModelVGG19.py`
- [Local trainer](https://github.com/davidgh96/20-21_dagahe/blob/main/fitModel.py): `fitModel.py`

### Image inference

- [Image predictor](https://github.com/davidgh96/20-21_dagahe/blob/main/predictModel.py): `predictModel.py`

### Colab workflow

- [Combined Colab script](https://github.com/davidgh96/20-21_dagahe/blob/main/ModuloCompletoGoogleColab.py): `ModuloCompletoGoogleColab.py`

### Other components

- **User**
- **Labeled image sets**
- **Model and weights**
- **Input image**
- **Attack or real**

## Connections

- User → Local trainer: runs training (evidence: `README.md`)
- Labeled image sets → Local trainer: provides images (evidence: `fitModel.py`)
- Local trainer → VGG19 model: creates model via (evidence: `fitModel.py`)
- Local trainer → Model and weights: saves model (evidence: `fitModel.py`)
- User → Image predictor: runs prediction (evidence: `README.md`)
- Model and weights → Image predictor: loads model (evidence: `predictModel.py`)
- Input image → Image predictor: supplies image (evidence: `predictModel.py`)
- Image predictor → Attack or real: returns class (evidence: `predictModel.py`)
- User → Combined Colab script: runs workflow (evidence: `README.md`)
- Labeled image sets → Combined Colab script: provides images (evidence: `ModuloCompletoGoogleColab.py`)
- Input image → Combined Colab script: supplies image (evidence: `ModuloCompletoGoogleColab.py`)
- Combined Colab script → Attack or real: prints class (evidence: `ModuloCompletoGoogleColab.py`)
