# gamal1osama/teeth_diseases_classification_cnn architecture

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

- Interactive diagram: https://gitdiagram.com/gamal1osama/teeth_diseases_classification_cnn
- Repository: https://github.com/gamal1osama/teeth_diseases_classification_cnn

## Overview

##### Project Type and Purpose
- This is a deep‐learning‐powered image classification system specifically designed for classifying teeth diseases.
- It consists of two logical layers:
- An offline “model development” pipeline (data preprocessing, model training, evaluation)
- An online “serving” layer (a Streamlit web app for real-time inference)

##### File Structure Analysis
- Top-level directories:
- Building The Classifiers From Scratch/ → Jupyter notebook + configs + best‐model artifacts for a custom CNN.
- VGG16/ → Jupyter notebook + history pickle for fine-tuned VGG16.
- Xception/ → Jupyter notebook + model file + history for fine-tuned Xception.
- Deployment/ → Streamlit app (`app.py`) and static assets used at inference time.
- Paper About The Problem/ → research PDFs and summaries (context, not part of runtime).
- Configuration/build files:
- requirements.txt → Python dependencies
- .devcontainer/ → VSCode dev container configuration
- Patterns:
- Separation of concerns: each modeling experiment in its own directory
- Clear divide between “development” notebooks and “deployment” code

##### README Insights
- Highlights three CNN architectures: custom, VGG16, Xception
- Emphasizes data preprocessing, model training & evaluation metrics (F1-score)
- Mentions a Streamlit web application for real-time inference

a. Main Components
1. Data Store (raw tooth images; assumed stored on disk or cloud)
2. Preprocessing & Training Module
- Custom CNN notebook
- VGG16 notebook
- Xception notebook
3. Model Artifacts Storage
- `.pkl` and `.keras` files located in each model folder
4. Inference / Serving Layer
- Streamlit app (`Deployment/app.py`)
5. Dev Container (optional)
- Docker/VSCode devcontainer.json for local consistency
b. Relationships & Data Flow
1. Raw Images → Preprocessing pipelines (notebooks)
2. Preprocessed Data → Training (custom CNN, VGG16, Xception)
3. Training → Model Artifacts (saved to disk)
4. Streamlit App loads Model Artifacts → User-uploaded Image → Prediction → UI
5. (Optional) Devcontainer provides a reproducible dev environment for both training and serving
c. Architectural Patterns & Principles
- Modular experimentation: isolating each architecture in its own folder
- Batch training offline vs. online inference separation
- Use of transfer learning for VGG16 and Xception
- Configuration-driven pipeline (pickle config files for preprocessing, augmentations)
d. Key Technologies & Frameworks
- Python, Jupyter Notebooks
- TensorFlow / Keras
- Streamlit for web UI
- Pickle for config/model serialization
- Docker/Devcontainer for environment consistency

##### Diagramming Recommendations
- Raw Data → Preprocessing → Training → Artifacts → Inference → User
- Blue = Offline components (notebooks, training pipeline)
- Green = Online components (Streamlit app, UI)
- Gray = Supporting infra (Devcontainer, requirements.txt)
- Compute (training jobs, notebooks)
- Storage (model files, pickles)
- User interface (web UI)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Raw Data
    RawData["Raw Tooth Images"]:::storage

    %% Model Development Layer
    subgraph "Model Development" 
        direction TB
        Preprocessing["Shared Preprocessing Pipeline"]:::offline
        CustomCNN["Custom CNN Notebook"]:::offline
        VGG16NB["VGG16 Notebook"]:::offline
        XceptionNB["Xception Notebook"]:::offline

        Preprocessing --> CustomCNN
        Preprocessing --> VGG16NB
        Preprocessing --> XceptionNB

        CustomCNN --> PreprocConfig
        CustomCNN --> AugConfig
        CustomCNN --> CustomHistory
        VGG16NB --> VGG16History
        XceptionNB --> XceptionModel
        XceptionNB --> XceptionHistory
    end

    %% Model Artifacts Storage
    subgraph "Model Artifacts Storage"
        direction TB
        PreprocConfig["preprocessing_config.pkl"]:::storage
        AugConfig["augmented_data_pipeline_config.pkl"]:::storage
        CustomHistory["Teeth_Disease_History.pkl"]:::storage
        VGG16History["VGG16_finetuned_History.pkl"]:::storage
        XceptionModel["Xception_fine_tuned.keras"]:::storage
        XceptionHistory["Xception_finetuned_History.pkl"]:::storage
    end

    %% Model Serving Layer
    subgraph "Model Serving" 
        direction TB
        StreamlitApp["Streamlit App (app.py)"]:::online
        UI["User Interface"]:::online
    end

    %% Supporting Infrastructure
    subgraph "Supporting Infra"
        direction TB
        DevContainer["Devcontainer Configuration"]:::infra
        Requirements["requirements.txt"]:::infra
    end

    %% Data Flow Connections
    RawData --> Preprocessing
    XceptionHistory --> StreamlitApp
    CustomHistory --> StreamlitApp
    VGG16History --> StreamlitApp
    PreprocConfig --> StreamlitApp
    AugConfig --> StreamlitApp
    StreamlitApp --> UI

    DevContainer --> Preprocessing
    DevContainer --> StreamlitApp
    Requirements --> Preprocessing
    Requirements --> StreamlitApp

    %% Click Events
    click CustomCNN "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Building The Classifiers From Scratch/teeth_diseases_classification_cnn.ipynb"
    click PreprocConfig "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Building The Classifiers From Scratch/Details About Best Model/preprocessing_config.pkl"
    click AugConfig "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Building The Classifiers From Scratch/Details About Best Model/augmented_data_pipeline_config.pkl"
    click CustomHistory "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Building The Classifiers From Scratch/Details About Best Model/Teeth_Disease_History.pkl"
    click VGG16NB "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/VGG16/teeth-diseases-classification-vgg16.ipynb"
    click VGG16History "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/VGG16/VGG16_finetuned_History.pkl"
    click XceptionNB "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Xception/teeth-diseases-classification-xception.ipynb"
    click XceptionModel "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Xception/Xception_fine_tuned.keras"
    click XceptionHistory "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Xception/Xception_finetuned_History.pkl"
    click StreamlitApp "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/Deployment/app.py"
    click DevContainer "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/.devcontainer/devcontainer.json"
    click Requirements "https://github.com/gamal1osama/teeth_diseases_classification_cnn/blob/main/requirements.txt"

    %% Styles
    classDef offline fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef online fill:#90EE90,stroke:#000,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef storage fill:#FFE4B5,stroke:#000,stroke-width:1px
```
