# greamown/openvino_face_recognition architecture

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

- Interactive diagram: https://gitdiagram.com/greamown/openvino_face_recognition
- Repository: https://github.com/greamown/openvino_face_recognition

## Overview

##### Main Components

a) Input Processing Layer:
- Image/Video Input Source
- Data Preprocessing Pipeline

b) Model Layer:
- Face Detection Model (Ultra-Light-Fast-Generic-Face-Detector-1MB)
- FaceNet Model (for face recognition/embedding)

c) Processing Pipeline:
- Async Pipeline
- Normal Pipeline

d) Database Layer:
- Feature Storage
- Configuration Storage

##### Component Relationships and Flow

**[Input Source] → [Preprocessing] → [Face Detection Model] → [Face Embedding Model] → [Feature Matching] → [Recognition Result]**

##### Specific Implementation Details

a) Configuration Management:
- config/config.json (contains model paths and parameters)
- database/db_config.json

b) Model Components:
- Face Detection Module (models/face_detection/)
- FaceNet Module (models/facenet/)

c) Pipeline Components:
- Async Pipeline (common/pipelines/async_pipeline.py)
- Normal Pipeline (common/pipelines/normal.py)

##### Technical Stack Representation

- OpenVINO Framework
- Python
- Docker
- Intel CPU optimization

##### Important Elements to Highlight

a) Model Pipeline:
- Conversion from original models to OpenVINO IR format (.xml, .bin)
- Optimization for Intel CPU

b) Feature Processing:
- Initial feature extraction flow (init_features.py)
- Real-time recognition flow (facial_recognition.py)

**[Configuration Layer]**
- ↓
**[Input Processing Layer]**
- ↓
**[Model Processing Layer]**
- ↓
**[Feature Processing Layer]**
- ↓
**[Database Layer]**

##### The feature storage and matching system

Remember to indicate the Docker containerization boundary and the Intel CPU optimization aspects, as these are crucial architectural elements of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Configuration Layer"
        Config["Configuration Management"]:::config
        DBConfig["Database Configuration"]:::config
    end

    subgraph "Input Layer"
        Input["Image/Video Input"]:::input
        PreProcess["Data Preprocessing"]:::process
        ImgCapture["Input Processing"]:::process
    end

    subgraph "Model Layer"
        FaceDetect["Face Detection Model"]:::model
        FaceNet["FaceNet Recognition Model"]:::model
        ModelBase["Model Base Implementation"]:::model
    end

    subgraph "Processing Layer"
        AsyncPipe["Async Pipeline"]:::process
        NormalPipe["Normal Pipeline"]:::process
        Utils["Utility Functions"]:::util
        PerfMon["Performance Monitoring"]:::monitor
    end

    subgraph "API Layer"
        DetectionAPI["Detection API"]:::api
        RecognitionAPI["Recognition API"]:::api
    end

    subgraph "Feature Processing"
        InitFeatures["Feature Initialization"]:::process
        Recognition["Main Recognition System"]:::process
    end

    subgraph "Database Layer"
        DB["Feature & Config Storage"]:::database
    end

    %% Relationships
    Config --> PreProcess
    DBConfig --> DB
    Input --> ImgCapture
    ImgCapture --> PreProcess
    PreProcess --> FaceDetect
    FaceDetect --> FaceNet
    FaceNet --> Recognition
    ModelBase --> FaceDetect
    ModelBase --> FaceNet
    AsyncPipe --> Recognition
    NormalPipe --> Recognition
    DetectionAPI --> FaceDetect
    RecognitionAPI --> FaceNet
    Recognition --> DB
    InitFeatures --> DB
    Utils --> Recognition
    PerfMon --> Recognition

    %% Styles
    classDef input fill:#a8d1ff
    classDef process fill:#90EE90
    classDef model fill:#FFE5B4
    classDef config fill:#E6E6E6
    classDef database fill:#FFB6C1
    classDef api fill:#DDA0DD
    classDef util fill:#F0E68C
    classDef monitor fill:#20B2AA

    %% Click Events
    click Config "https://github.com/greamown/openvino_face_recognition/blob/master/config/config.json"
    click DBConfig "https://github.com/greamown/openvino_face_recognition/blob/master/database/db_config.json"
    click FaceDetect "https://github.com/greamown/openvino_face_recognition/blob/master/models/face_detection/version-RFB-320.xml"
    click FaceNet "https://github.com/greamown/openvino_face_recognition/blob/master/models/facenet/facenet_keras.xml"
    click AsyncPipe "https://github.com/greamown/openvino_face_recognition/blob/master/common/pipelines/async_pipeline.py"
    click NormalPipe "https://github.com/greamown/openvino_face_recognition/blob/master/common/pipelines/normal.py"
    click DB "https://github.com/greamown/openvino_face_recognition/blob/master/database/db.py"
    click ImgCapture "https://github.com/greamown/openvino_face_recognition/blob/master/common/images_capture.py"
    click DetectionAPI "https://github.com/greamown/openvino_face_recognition/blob/master/model_api/detection.py"
    click RecognitionAPI "https://github.com/greamown/openvino_face_recognition/blob/master/model_api/recognition.py"
    click PerfMon "https://github.com/greamown/openvino_face_recognition/blob/master/common/performance_metrics.py"
    click Recognition "https://github.com/greamown/openvino_face_recognition/blob/master/facial_recognition.py"
    click InitFeatures "https://github.com/greamown/openvino_face_recognition/blob/master/init_features.py"
    click ModelBase "https://github.com/greamown/openvino_face_recognition/blob/master/common/model.py"
    click Utils "https://github.com/greamown/openvino_face_recognition/blob/master/common/utils.py"
```
