# minatharwat93/skin-burn-classification-using-efficientnetb3 architecture

> Architecture diagram of the GitHub repository minatharwat93/skin-burn-classification-using-efficientnetb3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minatharwat93/skin-burn-classification-using-efficientnetb3
- Repository: https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3

## Overview

##### Project type and purpose
- This is a specialized ML-powered web service: a FastAPI application that hosts a TensorFlow Lite image-classification model (EfficientNetB3) for skin-burn degree detection.
- Offline development happens in a Jupyter Notebook; deployment and inference happen via a REST API (`main.py`).

##### File structure
- Top-level artifacts:
- `Skin Burn Classification Using EfficientNetB3.ipynb`: model development/training
- `Data.txt`: lists dataset sources
- `EfficientNetB3_skin_burn_model.tflite`: the inference model
- `main.py`: FastAPI server code
- `requirements.txt` & `runtime.txt`: dependency specification & runtime constraints
- `Procfile`: deploy script for Heroku (or similar PaaS)
- No separate “frontend” directory—this is an API-only backend service.

##### Key architectural insights from README
- Offline pipeline: data ingestion → preprocessing → model training (TensorFlow/Keras) → evaluate → convert to TensorFlow Lite.
- Online inference pipeline: image upload → preprocessing → TFLite inference → JSON response (class, probabilities, first-aid instructions).
- Deployment: Uvicorn ASGI server, optionally on Heroku/Docker.

##### Main components
a. **Offline Training Pipeline**
- Data sources (public datasets)
- Jupyter Notebook (Python, TensorFlow/Keras)
- Trained Keras model → TFLite converter → `*.tflite`
b. **Model Store**
- File system (packaged with the service) or object store
c. **API Service (Online Inference)**
- FastAPI application (`main.py`)
- Preprocessing module (resize, normalize, quantize)
- TFLite Interpreter component
- First-aid logic & metadata (lookup tables in code)
- Uvicorn ASGI server
d. **Client / Consumer**
- HTTP client / Mobile app / cURL / Swagger UI
e. **Deployment Environment**
- PaaS (Heroku via `Procfile`) or container
- Python runtime (specified in `runtime.txt`)

##### Relationships & interactions
- Offline: Notebook reads Data.txt → trains model → outputs `.tflite`
- Deployment: `.tflite` + service code pushed to PaaS
- At runtime: Client → POST `/predict` → FastAPI receives file → preprocessing → pass image tensor to TFLite → inference results → FastAPI builds JSON → response back to client

##### Architectural patterns & design principles
- **Separation of concerns**:
- Training vs. Inference
- Model storage vs. API code
- **Stateless microservice**: each `/predict` request is independent
- **Lightweight model format**: TFLite for fast, small-footprint inference
- **12-factor app compliance** via `Procfile`, `runtime.txt`, and environment variables

##### Essential details to capture
- **Preprocessing steps** (resize to 240×240, normalize, quantize)
- **Model loading** at startup vs. per‐request
- **API endpoints** (`/predict`)
- **Response payload structure** (predicted_class, probabilities, first_aid)
- **Dependencies** (TensorFlow Lite runtime, FastAPI, Uvicorn)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Offline Training Pipeline
    subgraph "Offline Training Pipeline"
        direction TB
        Notebook["Jupyter Notebook\n(Skin Burn Classification)"]:::offline
        Data["Data Sources\n(Data.txt)"]:::offline
        Converter["Model Training & Conversion\n(Keras → TFLite)"]:::offline
        ModelStore["Trained TFLite Model\n(.tflite)"]:::offline
    end

    %% Online Inference Pipeline
    subgraph "Online Inference Pipeline"
        direction TB
        Client["Client / Consumer\n(HTTP Client / Mobile App / Swagger)"]:::external
        APIService["FastAPI Application\n(main.py)"]:::inference
        Preprocessor["Preprocessing Module\n(resize, normalize, quantize)"]:::inference
        Interpreter["TFLite Interpreter\n(v2.9)"]:::inference
        FirstAid["First‐Aid Logic & Metadata Lookup"]:::inference
        Response["JSON Response\n(predicted_class, probabilities, first_aid)"]:::inference
    end

    %% Deployment Environment
    subgraph "Deployment Environment"
        direction TB
        PaaS["PaaS / Container\n(Heroku via Procfile)"]:::external
        Requirements["Dependency Specification\n(requirements.txt)"]:::external
        Runtime["Python Runtime Constraint\n(runtime.txt)"]:::external
        ProcfileNode["Deployment Config\n(Procfile)"]:::external
        Documentation["Project Documentation\n(README.md)"]:::external
    end

    %% Offline Flow
    Data -->|reads| Notebook
    Notebook -->|trains model| Converter
    Converter -->|outputs .tflite| ModelStore

    %% Deployment Pipeline
    ModelStore -->|packaged with code| PaaS
    APIService -->|loads model at startup| ModelStore

    %% Inference Flow
    Client -->|POST /predict| APIService
    APIService -->|calls| Preprocessor
    Preprocessor -->|tensor| Interpreter
    Interpreter -->|results| FirstAid
    FirstAid -->|builds JSON| Response
    Response -->|returns| Client

    %% Deployment Config Flow
    Requirements -.->|specifies deps| APIService
    Runtime -.->|specifies runtime| PaaS
    ProcfileNode -.->|defines launch| PaaS
    Documentation -.->|describes architecture| APIService

    %% Click Events
    click Notebook "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/Skin Burn Classification Using EfficientNetB3.ipynb"
    click Data "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/Data.txt"
    click ModelStore "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/EfficientNetB3_skin_burn_model.tflite"
    click APIService "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/main.py"
    click Preprocessor "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/main.py"
    click Interpreter "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/main.py"
    click FirstAid "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/main.py"
    click Requirements "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/requirements.txt"
    click Runtime "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/runtime.txt"
    click ProcfileNode "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/tree/main/Procfile"
    click Documentation "https://github.com/minatharwat93/skin-burn-classification-using-efficientnetb3/blob/main/README.md"

    %% Styles
    classDef offline fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef inference fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFD580,stroke:#000,stroke-width:1px
```
