# gokulnathsuresh05/senior_citizen_identification architecture

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

- Interactive diagram: https://gitdiagram.com/gokulnathsuresh05/senior_citizen_identification
- Repository: https://github.com/gokulnathsuresh05/senior_citizen_identification

## Overview

This repository is a face-based senior-citizen and gender classifier, with both a GUI and a command-line image workflow. Its other major product branch prepares UTKFace data, trains the two-output CNN, and evaluates it. The README documents the high-level detection pipeline and training steps; source excerpts confirm several implementation details, but do not show all GUI and training internals.

Main entry points: [`src/detect_and_predict.py`](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py) (Image Detection CLI), [`src/train_model.py`](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/train_model.py) (Training Runner), [`app/gui.py`](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/app/gui.py) (Desktop GUI), [`models/senior_gender_model.keras`](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/models/senior_gender_model.keras) (Trained Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Image Inference"]
  node_gui["Desktop GUI<br/>[gui.py]"]
  node_cli["Image Detection CLI"]
  node_face_detection["Face Detection"]
  node_face_filtering["Detection Filtering"]
  node_face_merge["Duplicate Removal"]
  node_face_preprocess["Face Preprocessing"]
  node_result["Annotated Result"]
end

subgraph group_training["Model Training"]
  node_cnn["CNN Classifier<br/>[build_model.py]"]
  node_model_file["Trained Model"]
  node_training["Training Runner<br/>[train_model.py]"]
  node_data_pipeline["Data Pipeline<br/>[data_generator.py]"]
end

subgraph group_dataset["Dataset Preparation"]
  node_detected_dataset["Face Dataset Creator"]
  node_label_analysis["Label Analysis<br/>[analyze_labels.py]"]
  node_dataset_check["Dataset Check<br/>[check_dataset.py]"]
  node_dataset_split["Dataset Split<br/>[split_dataset.py]"]
  node_class_weights["Class Weights"]
end

subgraph group_evaluation["Model Evaluation"]
  node_evaluation["Model Evaluation<br/>[evaluate_model.py]"]
end

node_user(("User"))
node_input_image["Input Image"]
node_test_data["Test Dataset"]

node_user -->|"opens"| node_gui
node_user -->|"runs"| node_cli
node_input_image -->|"selects"| node_gui
node_input_image -->|"processes"| node_cli
node_cli -->|"detects faces"| node_face_detection
node_face_detection -->|"filters"| node_face_filtering
node_face_filtering -->|"removes duplicates"| node_face_merge
node_face_merge -->|"crops and preprocesses"| node_face_preprocess
node_face_preprocess -->|"predicts"| node_cnn
node_gui -.->|"loads model"| node_model_file
node_cli -.->|"loads model"| node_model_file
node_cnn -->|"generates annotations"| node_result
node_gui -->|"saves image"| node_result
node_cli -->|"saves image"| node_result
node_user -.->|"prepares faces"| node_detected_dataset
node_user -->|"analyzes labels"| node_label_analysis
node_user -->|"checks data"| node_dataset_check
node_user -->|"splits data"| node_dataset_split
node_user -->|"calculates weights"| node_class_weights
node_dataset_split -->|"provides splits"| node_training
node_training -.->|"uses batches"| node_data_pipeline
node_training -->|"builds model"| node_cnn
node_training -->|"saves model"| node_model_file
node_test_data -->|"supplies samples"| node_evaluation
node_evaluation -.->|"loads model"| node_model_file

click node_gui "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/app/gui.py"
click node_cli "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py"
click node_face_detection "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py"
click node_face_filtering "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py"
click node_face_merge "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py"
click node_face_preprocess "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py"
click node_cnn "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/build_model.py"
click node_model_file "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/models/senior_gender_model.keras"
click node_detected_dataset "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/create_detected_dataset.py"
click node_label_analysis "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/analyze_labels.py"
click node_dataset_check "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/check_dataset.py"
click node_dataset_split "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/split_dataset.py"
click node_class_weights "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/calculate_class_weights.py"
click node_training "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/train_model.py"
click node_data_pipeline "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/data_generator.py"
click node_evaluation "https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/evaluate_model.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_gui,node_cli,node_face_detection,node_face_filtering,node_face_merge,node_face_preprocess,node_result,node_user toneBlue
class node_cnn,node_model_file,node_training,node_data_pipeline toneAmber
class node_detected_dataset,node_label_analysis,node_dataset_check,node_dataset_split,node_class_weights toneMint
class node_evaluation toneRose
class node_input_image,node_test_data toneIndigo
```

## Components

### Image Inference

- [Desktop GUI](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/app/gui.py): `app/gui.py`
- [Image Detection CLI](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py): `src/detect_and_predict.py`
- [Face Detection](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py): `src/detect_and_predict.py`
- [Detection Filtering](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py): `src/detect_and_predict.py`
- [Duplicate Removal](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py): `src/detect_and_predict.py`
- [Face Preprocessing](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/detect_and_predict.py): `src/detect_and_predict.py`
- **Annotated Result**

### Model Training

- [CNN Classifier](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/build_model.py): `src/build_model.py`
- [Trained Model](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/models/senior_gender_model.keras): `models/senior_gender_model.keras`
- [Training Runner](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/train_model.py): `src/train_model.py`
- [Data Pipeline](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/data_generator.py): `src/data_generator.py`

### Dataset Preparation

- [Face Dataset Creator](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/create_detected_dataset.py): `src/create_detected_dataset.py`
- [Label Analysis](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/analyze_labels.py): `src/analyze_labels.py`
- [Dataset Check](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/check_dataset.py): `src/check_dataset.py`
- [Dataset Split](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/split_dataset.py): `src/split_dataset.py`
- [Class Weights](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/calculate_class_weights.py): `src/calculate_class_weights.py`

### Model Evaluation

- [Model Evaluation](https://github.com/gokulnathsuresh05/senior_citizen_identification/blob/main/src/evaluate_model.py): `src/evaluate_model.py`

### Other components

- **User**
- **Input Image**
- **Test Dataset**

## Connections

- User → Desktop GUI: opens (evidence: `README.md`)
- User → Image Detection CLI: runs (evidence: `README.md`)
- Input Image → Desktop GUI: selects (evidence: `app/gui.py`)
- Input Image → Image Detection CLI: processes (evidence: `README.md`)
- Image Detection CLI → Face Detection: detects faces (evidence: `README.md`)
- Face Detection → Detection Filtering: filters (evidence: `README.md`)
- Detection Filtering → Duplicate Removal: removes duplicates (evidence: `README.md`)
- Duplicate Removal → Face Preprocessing: crops and preprocesses (evidence: `README.md`)
- Face Preprocessing → CNN Classifier: predicts (evidence: `README.md`)
- Desktop GUI → Trained Model: loads model
- Image Detection CLI → Trained Model: loads model
- CNN Classifier → Annotated Result: generates annotations (evidence: `README.md`)
- Desktop GUI → Annotated Result: saves image (evidence: `app/gui.py`)
- Image Detection CLI → Annotated Result: saves image (evidence: `README.md`)
- User → Face Dataset Creator: prepares faces
- User → Label Analysis: analyzes labels (evidence: `README.md`)
- User → Dataset Check: checks data (evidence: `README.md`)
- User → Dataset Split: splits data (evidence: `README.md`)
- User → Class Weights: calculates weights (evidence: `README.md`)
- Dataset Split → Training Runner: provides splits (evidence: `README.md`)
- Training Runner → Data Pipeline: uses batches
- Training Runner → CNN Classifier: builds model (evidence: `src/train_model.py`)
- Training Runner → Trained Model: saves model (evidence: `README.md`)
- Test Dataset → Model Evaluation: supplies samples (evidence: `src/evaluate_model.py`)
- Model Evaluation → Trained Model: loads model
