# ojasrane/face-recognition architecture

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

- Interactive diagram: https://gitdiagram.com/ojasrane/face-recognition
- Repository: https://github.com/ojasrane/face-recognition

## Overview

This is a comparative face-recognition lab centered on Olivetti Faces, with PCA/eigenfaces and LDA/Fisherfaces workflows plus a Streamlit explorer. Users choose a method, select a test subject and image, then inspect a match or class prediction and confusion-matrix view. Training scripts and precomputed assets support those demos; notebooks explain the algorithms. The custom LDA implementation is a reference implementation, distinct from the scikit-learn pipeline used for Fisherfaces training. Relationship evidence is limited to the README and sampled sources; unsampled details are not inferred.

Main entry points: [`web_app/pages/pca.py`](https://github.com/ojasrane/face-recognition/blob/main/web_app/pages/pca.py) (PCA demo), [`web_app/pages/lda.py`](https://github.com/ojasrane/face-recognition/blob/main/web_app/pages/lda.py) (Fisherfaces demo), [`utils.py`](https://github.com/ojasrane/face-recognition/blob/main/utils.py) (Dataset constants), [`PCA/train.py`](https://github.com/ojasrane/face-recognition/blob/main/PCA/train.py) (PCA training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interactive lab"]
  node_landing["Method landing page<br/>[landing_page.py]"]
  node_pca_demo["PCA demo<br/>[pca.py]"]
  node_lda_demo["Fisherfaces demo<br/>[lda.py]"]
end

subgraph group_methods["Recognition methods"]
  node_pca_train["PCA training<br/>[train.py]"]
  node_pca_test["PCA matching test<br/>[test.py]"]
  node_lda_train["Fisherfaces training<br/>[train.py]"]
  node_lda_test["Fisherfaces test<br/>[test.py]"]
  node_custom_lda["Reference LDA"]
end

subgraph group_data["Data and artifacts"]
  node_shared_config["Dataset constants<br/>[utils.py]"]
  node_olivetti[("Olivetti Faces")]
  node_cached_faces[("Cached face splits")]
  node_pca_model["PCA model artifact<br/>[pca.pkl]"]
  node_lda_model["Fisherfaces artifact<br/>[lda.pkl]"]
end

subgraph group_learning["Experiments and learning"]
  node_pca_notebook["PCA walkthrough"]
  node_lda_notebook["LDA walkthrough"]
end

node_visitor(("Lab visitor"))

node_visitor -->|"opens"| node_landing
node_landing -->|"routes to"| node_pca_demo
node_landing -->|"routes to"| node_lda_demo
node_visitor -->|"selects image"| node_pca_demo
node_visitor -->|"selects image"| node_lda_demo
node_pca_train -->|"loads faces"| node_olivetti
node_lda_train -->|"loads faces"| node_olivetti
node_pca_train -->|"uses constants"| node_shared_config
node_lda_train -->|"uses constants"| node_shared_config
node_pca_train -->|"exports model"| node_pca_model
node_lda_train -->|"exports model"| node_lda_model
node_pca_demo -->|"uses constants"| node_shared_config
node_lda_demo -->|"uses constants"| node_shared_config
node_pca_demo -->|"loads model"| node_pca_model
node_pca_demo -->|"loads splits"| node_cached_faces
node_lda_demo -->|"loads model"| node_lda_model
node_lda_demo -->|"loads splits"| node_cached_faces
node_pca_test -->|"loads model"| node_pca_model
node_lda_test -->|"loads model"| node_lda_model
node_visitor -->|"explores method"| node_pca_notebook
node_visitor -->|"explores method"| node_lda_notebook

click node_landing "https://github.com/ojasrane/face-recognition/blob/main/web_app/landing_page.py"
click node_pca_demo "https://github.com/ojasrane/face-recognition/blob/main/web_app/pages/pca.py"
click node_lda_demo "https://github.com/ojasrane/face-recognition/blob/main/web_app/pages/lda.py"
click node_pca_train "https://github.com/ojasrane/face-recognition/blob/main/PCA/train.py"
click node_pca_test "https://github.com/ojasrane/face-recognition/blob/main/PCA/test.py"
click node_lda_train "https://github.com/ojasrane/face-recognition/blob/main/LDA/train.py"
click node_lda_test "https://github.com/ojasrane/face-recognition/blob/main/LDA/test.py"
click node_custom_lda "https://github.com/ojasrane/face-recognition/blob/main/LDA/linear_discriminant_analysis.py"
click node_shared_config "https://github.com/ojasrane/face-recognition/blob/main/utils.py"
click node_cached_faces "https://github.com/ojasrane/face-recognition/blob/main/web_app/assets/datasets/olivetti_faces_dataset.npz"
click node_pca_model "https://github.com/ojasrane/face-recognition/blob/main/web_app/assets/models/pca/pca.pkl"
click node_lda_model "https://github.com/ojasrane/face-recognition/blob/main/web_app/assets/models/lda/lda.pkl"
click node_pca_notebook "https://github.com/ojasrane/face-recognition/blob/main/analysis/face_recognition_using_PCA.ipynb"
click node_lda_notebook "https://github.com/ojasrane/face-recognition/blob/main/analysis/face_recognition_using_LDA.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_landing,node_pca_demo,node_lda_demo toneBlue
class node_pca_train,node_pca_test,node_lda_train,node_lda_test,node_custom_lda toneAmber
class node_shared_config,node_olivetti,node_cached_faces,node_pca_model,node_lda_model toneMint
class node_pca_notebook,node_lda_notebook toneRose
class node_visitor toneIndigo
```

## Components

### Interactive lab

- [Method landing page](https://github.com/ojasrane/face-recognition/blob/main/web_app/landing_page.py): `web_app/landing_page.py`
- [PCA demo](https://github.com/ojasrane/face-recognition/blob/main/web_app/pages/pca.py): `web_app/pages/pca.py`
- [Fisherfaces demo](https://github.com/ojasrane/face-recognition/blob/main/web_app/pages/lda.py): `web_app/pages/lda.py`

### Recognition methods

- [PCA training](https://github.com/ojasrane/face-recognition/blob/main/PCA/train.py): `PCA/train.py`
- [PCA matching test](https://github.com/ojasrane/face-recognition/blob/main/PCA/test.py): `PCA/test.py`
- [Fisherfaces training](https://github.com/ojasrane/face-recognition/blob/main/LDA/train.py): `LDA/train.py`
- [Fisherfaces test](https://github.com/ojasrane/face-recognition/blob/main/LDA/test.py): `LDA/test.py`
- [Reference LDA](https://github.com/ojasrane/face-recognition/blob/main/LDA/linear_discriminant_analysis.py): `LDA/linear_discriminant_analysis.py`

### Data and artifacts

- [Dataset constants](https://github.com/ojasrane/face-recognition/blob/main/utils.py): `utils.py`
- **Olivetti Faces**
- [Cached face splits](https://github.com/ojasrane/face-recognition/blob/main/web_app/assets/datasets/olivetti_faces_dataset.npz): `web_app/assets/datasets/olivetti_faces_dataset.npz`
- [PCA model artifact](https://github.com/ojasrane/face-recognition/blob/main/web_app/assets/models/pca/pca.pkl): `web_app/assets/models/pca/pca.pkl`
- [Fisherfaces artifact](https://github.com/ojasrane/face-recognition/blob/main/web_app/assets/models/lda/lda.pkl): `web_app/assets/models/lda/lda.pkl`

### Experiments and learning

- [PCA walkthrough](https://github.com/ojasrane/face-recognition/blob/main/analysis/face_recognition_using_PCA.ipynb): `analysis/face_recognition_using_PCA.ipynb`
- [LDA walkthrough](https://github.com/ojasrane/face-recognition/blob/main/analysis/face_recognition_using_LDA.ipynb): `analysis/face_recognition_using_LDA.ipynb`

### Other components

- **Lab visitor**

## Connections

- Lab visitor → Method landing page: opens (evidence: `README.md`)
- Method landing page → PCA demo: routes to (evidence: `web_app/landing_page.py`)
- Method landing page → Fisherfaces demo: routes to (evidence: `web_app/landing_page.py`)
- Lab visitor → PCA demo: selects image (evidence: `web_app/pages/pca.py`)
- Lab visitor → Fisherfaces demo: selects image (evidence: `web_app/pages/lda.py`)
- PCA training → Olivetti Faces: loads faces (evidence: `PCA/train.py`)
- Fisherfaces training → Olivetti Faces: loads faces (evidence: `LDA/train.py`)
- PCA training → Dataset constants: uses constants (evidence: `PCA/train.py`)
- Fisherfaces training → Dataset constants: uses constants (evidence: `LDA/train.py`)
- PCA training → PCA model artifact: exports model (evidence: `README.md`)
- Fisherfaces training → Fisherfaces artifact: exports model (evidence: `README.md`)
- PCA demo → Dataset constants: uses constants (evidence: `web_app/pages/pca.py`)
- Fisherfaces demo → Dataset constants: uses constants (evidence: `web_app/pages/lda.py`)
- PCA demo → PCA model artifact: loads model (evidence: `web_app/pages/pca.py`)
- PCA demo → Cached face splits: loads splits (evidence: `web_app/pages/pca.py`)
- Fisherfaces demo → Fisherfaces artifact: loads model (evidence: `web_app/pages/lda.py`)
- Fisherfaces demo → Cached face splits: loads splits (evidence: `web_app/pages/lda.py`)
- PCA matching test → PCA model artifact: loads model (evidence: `README.md`)
- Fisherfaces test → Fisherfaces artifact: loads model (evidence: `README.md`)
- Lab visitor → PCA walkthrough: explores method (evidence: `README.md`)
- Lab visitor → LDA walkthrough: explores method (evidence: `README.md`)
