# boobathi-phygit-01/insightface_phytec_board_convertion architecture

> Architecture diagram of the GitHub repository boobathi-phygit-01/insightface_phytec_board_convertion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/boobathi-phygit-01/insightface_phytec_board_convertion
- Repository: https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion

## Overview

#### Purpose
Local face-recognition attendance system using TensorFlow Lite models. It captures enrolled face embeddings, performs live camera inference, matches identities against stored embeddings, and records attendance in CSV.

#### Entry Points
- `embedding_capture_tflite.py`: enrollment workflow; captures faces and generates known-person embeddings.
- `live_inference_tflite.py`: live recognition/attendance runtime, likely driven by a webcam feed.
- `attendance_system.py`: attendance recording/application orchestration.
- `tflite_common.py`: shared TensorFlow Lite inference and face-processing utilities.

#### Detection and Recognition Models
The pipeline separates face localization from identity embedding:
- `det_500g_640x640_full_quantized.tflite` is the quantized 640×640 face detector.
- `w600k_mbf_full_quantized.tflite` is the quantized face-recognition embedding model.
- `tflite_common.py` is the architectural boundary for model loading, tensor preparation, inference, and output interpretation used by both enrollment and live recognition.

#### Enrollment and Identity Store
`embedding_capture_tflite.py` detects/crops a face, runs the recognition model, and persists its numeric representation with an assigned name:
- `known_embeddings.npy` stores the enrolled embedding vectors.
- `known_names.pkl` stores the corresponding identity labels.
This creates an offline local identity database; no remote enrollment service is present.

#### Live Recognition Flow
`live_inference_tflite.py` is the operational pipeline:
1. Acquire camera frames.
2. Detect faces using `det_500g_640x640_full_quantized.tflite`.
3. Generate an embedding per detected face with `w600k_mbf_full_quantized.tflite`.
4. Compare generated embeddings against `known_embeddings.npy`.
5. Resolve the matched entry in `known_names.pkl`.
6. Send recognized identities into attendance handling.

The main control boundary is between real-time vision inference and persistence: inference produces recognized names/confidence-like match results, while attendance logic decides how to record them.

#### Attendance Persistence
`attendance_system.py` owns attendance-domain behavior and writes the durable log:
- `attendance.csv` is the local attendance record.
The CSV is the system’s final output and likely requires duplicate/time handling to avoid repeatedly recording the same continuously visible person.

#### Runtime and Infrastructure
The repository is a local Python application with TensorFlow Lite model execution and NumPy/Pickle/CSV file persistence. It is designed for on-device or workstation operation with a camera; all models, identity data, and attendance records are repository-local. No server, database, cloud API, or web runtime is represented in the repository.

Main entry points: [`tflite_common.py`](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/tflite_common.py) (TFLite Vision Utilities), [`live_inference_tflite.py`](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/live_inference_tflite.py) (Identity Matching), [`embedding_capture_tflite.py`](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/embedding_capture_tflite.py) (Embedding Capture), [`known_embeddings.npy`](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/known_embeddings.npy) (Known Embeddings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_enrollment["Enrollment"]
  node_capture["Embedding Capture<br/>Python workflow"]
end

subgraph group_live["Live Recognition"]
  node_live_inference["Live Inference<br/>Python runtime"]
  node_camera(("Webcam Frames<br/>local camera input"))
  node_matcher["Identity Matching<br/>recognition stage"]
end

subgraph group_assets["Local Assets"]
  node_detector{{"Face Detector<br/>quantized TFLite model"}}
  node_recognizer{{"Face Embedding Model<br/>quantized TFLite model"}}
  node_embeddings[("Known Embeddings<br/>NumPy identity store")]
  node_names[("Known Names<br/>Pickle identity store<br/>[known_names.pkl]")]
  node_attendance_csv["Attendance Log<br/>CSV record<br/>[attendance.csv]"]
end

node_common["TFLite Vision Utilities<br/>shared Python module<br/>[tflite_common.py]"]
node_attendance["Attendance Handler<br/>Python application"]

node_capture -->|"uses inference utilities"| node_common
node_capture -->|"writes enrolled vectors"| node_embeddings
node_capture -->|"writes assigned labels"| node_names
node_common -->|"loads and runs"| node_detector
node_common -->|"loads and runs"| node_recognizer
node_camera -->|"frames"| node_live_inference
node_live_inference -->|"detects and embeds faces"| node_common
node_live_inference -->|"live embeddings"| node_matcher
node_embeddings -->|"reference vectors"| node_matcher
node_names -->|"identity labels"| node_matcher
node_matcher -->|"recognized identities"| node_attendance
node_attendance -->|"records attendance"| node_attendance_csv

click node_capture "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/embedding_capture_tflite.py"
click node_common "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/tflite_common.py"
click node_detector "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/det_500g_640x640_full_quantized.tflite"
click node_recognizer "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/w600k_mbf_full_quantized.tflite"
click node_embeddings "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/known_embeddings.npy"
click node_names "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/known_names.pkl"
click node_live_inference "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/live_inference_tflite.py"
click node_matcher "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/live_inference_tflite.py"
click node_attendance "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/attendance_system.py"
click node_attendance_csv "https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/attendance.csv"

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_capture toneBlue
class node_live_inference,node_camera,node_matcher toneAmber
class node_detector,node_recognizer,node_embeddings,node_names,node_attendance_csv toneMint
class node_common,node_attendance toneNeutral
```

## Components

### Enrollment

- [Embedding Capture](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/embedding_capture_tflite.py): Python workflow · Enrolls a named person from captured faces. · `embedding_capture_tflite.py`

### Live Recognition

- [Live Inference](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/live_inference_tflite.py): Python runtime · Runs webcam detection, embedding, and identity matching. · `live_inference_tflite.py`
- **Webcam Frames**: local camera input
- [Identity Matching](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/live_inference_tflite.py): recognition stage · Compares live embeddings with enrolled vectors and resolves names. · `live_inference_tflite.py`

### Local Assets

Repository-local models and persisted data.

- [Face Detector](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/det_500g_640x640_full_quantized.tflite): quantized TFLite model · 640×640 face-localization model. · `det_500g_640x640_full_quantized.tflite`
- [Face Embedding Model](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/w600k_mbf_full_quantized.tflite): quantized TFLite model · Produces face identity embeddings. · `w600k_mbf_full_quantized.tflite`
- [Known Embeddings](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/known_embeddings.npy): NumPy identity store · Enrolled face embedding vectors. · `known_embeddings.npy`
- [Known Names](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/known_names.pkl): Pickle identity store · Labels aligned with enrolled embeddings. · `known_names.pkl`
- [Attendance Log](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/attendance.csv): CSV record · Durable local attendance output. · `attendance.csv`

### Other components

- [TFLite Vision Utilities](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/tflite_common.py): shared Python module · Loads models and performs face preprocessing, inference, and output interpretation. · `tflite_common.py`
- [Attendance Handler](https://github.com/boobathi-phygit-01/insightface_phytec_board_convertion/blob/main/attendance_system.py): Python application · Applies attendance and duplicate/time recording rules. · `attendance_system.py`

## Connections

- Embedding Capture → TFLite Vision Utilities: uses inference utilities
- Embedding Capture → Known Embeddings: writes enrolled vectors
- Embedding Capture → Known Names: writes assigned labels
- TFLite Vision Utilities → Face Detector: loads and runs
- TFLite Vision Utilities → Face Embedding Model: loads and runs
- Webcam Frames → Live Inference: frames
- Live Inference → TFLite Vision Utilities: detects and embeds faces
- Live Inference → Identity Matching: live embeddings
- Known Embeddings → Identity Matching: reference vectors
- Known Names → Identity Matching: identity labels
- Identity Matching → Attendance Handler: recognized identities
- Attendance Handler → Attendance Log: records attendance
