# gadu05/projeto-reconhecimento-facial-ifciencia architecture

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

- Interactive diagram: https://gitdiagram.com/gadu05/projeto-reconhecimento-facial-ifciencia
- Repository: https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia

## Overview

##### Project Type and Purpose
- This is a standalone machine‐learning‐powered desktop application (implemented as a Jupyter notebook) that uses a computer’s webcam to capture facial images and run inference on a pre‐trained TensorFlow model to detect signs of monkeypox. It is not a web or mobile app, nor a client‐server architecture—everything runs locally.

##### Main Components
a. Input Source: Computer webcam (hardware device)
b. Application Layer: Python/Jupyter Notebook code (reconhecimentoFacial.ipynb)
c. Model Loader & Inference Engine: TensorFlow runtime (loads modelo/saved_model.pb and keras_metadata.pb, or uses checkpoint files)
d. Preprocessing Module: Image acquisition and preprocessing routines (e.g., OpenCV code to capture frames, resize, normalize)
e. Postprocessing & Decision Logic: Converts raw model outputs (probabilities or logits) into user–readable predictions (e.g., “disease detected” vs. “no disease detected”)
f. Output/Display Layer: Overlays results on video feed or prints to console
g. External Storage (optional): Google Drive link for downloading model artifacts

##### Relationships and Data Flow
1) The webcam continuously streams raw frames into the notebook’s capture routine.
3) Preprocessed images are passed to the TensorFlow Inference Engine, which loads the model from modelo/ or checkpoint/.
4) The model outputs a prediction for each frame.
5) The postprocessing module interprets these predictions, applies thresholds or smoothing, and generates a final decision.
6) The application layer overlays the decision on the frame or logs it for the user.

##### Architectural Patterns and Design Principles
- Pipeline Pattern: Sequential stages (capture → preprocess → infer → postprocess → display).
- Modularity: Each stage can be separated into distinct functional blocks or micro‐modules for easier maintenance or swapping (e.g., swapping out the model or changing the preprocessing steps).
- Resource Management: The camera device and TensorFlow session should be initialized once and reused rather than reopened per frame.

##### Technologies, Frameworks, and Libraries
- Python 3.x
- Jupyter Notebook interface (reconhecimentoFacial.ipynb)
- OpenCV (cv2) for video capture and image preprocessing
- TensorFlow / Keras for model loading and inference
- Google Drive (external storage) for model artifact distribution

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Local Application"
        Camera["Camera"]:::dataSource
        Capture["Capture Module\n(Frame Acquisition)"]:::processing
        Preprocess["Preprocessing Module\n(Resize, Normalize)"]:::processing
        Inference["Inference Engine\n(TensorFlow Runtime)"]:::processing
        Postprocess["Postprocessing Module\n(Threshold, Label)"]:::processing
        Display["Display Layer\n(Overlay & Logs)"]:::dataSource
        ModelFiles["Model Files\n(SavedModel)"]:::artifact
        Checkpoint["Checkpoint Files"]:::artifact
    end
    GoogleDrive["Google Drive"]:::external

    Camera -->|"Raw frame"| Capture
    Capture -->|"Frame"| Preprocess
    Preprocess -->|"Tensor input"| Inference
    ModelFiles -.->|"Loaded by"| Inference
    Checkpoint -.->|"Loaded by"| Inference
    Inference -->|"Prediction scores"| Postprocess
    Postprocess -->|"Decision"| Display
    GoogleDrive -.->|"Download artifacts"| ModelFiles

    click Capture "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/blob/main/reconhecimentoFacial.ipynb"
    click Preprocess "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/blob/main/reconhecimentoFacial.ipynb"
    click Postprocess "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/blob/main/reconhecimentoFacial.ipynb"
    click Display "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/blob/main/reconhecimentoFacial.ipynb"
    click ModelFiles "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/blob/main/modelo/saved_model.pb"
    click ModelFiles "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/blob/main/modelo/keras_metadata.pb"
    click Checkpoint "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/tree/main/checkpoint/checkpoint"
    click GoogleDrive "https://github.com/gadu05/projeto-reconhecimento-facial-ifciencia/blob/main/README.md"

    classDef dataSource fill:#add8e6,stroke:#333,stroke-width:1px
    classDef processing fill:#90ee90,stroke:#333,stroke-width:1px
    classDef artifact fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef external fill:#ffa500,stroke:#333,stroke-width:1px
```
