# a73720177-design/face_recognize architecture

> Architecture diagram of the GitHub repository a73720177-design/face_recognize, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/a73720177-design/face_recognize
- Repository: https://github.com/a73720177-design/face_recognize

## Overview

This is a camera-based safe authentication application: a user enrolls or selects a numbered compartment, proves identity with a registered face, then registers or verifies an ordered pose/hand pattern to unlock it. The live UI coordinates camera and landmark processing, ownership and pattern storage, and—on Linux with ROS 2 enabled—motor requests and status. The sampled Python code supports the application flow; motor-controller behavior is represented only at the level supported by the repository overview and tree, so those links are dashed and unevidenced.

Main entry points: [`py/safe_app.py`](https://github.com/a73720177-design/face_recognize/blob/main/py/safe_app.py) (Live safe session), [`py/recognition.py`](https://github.com/a73720177-design/face_recognize/blob/main/py/recognition.py) (CLI menu and enrollment), [`py/safe_slot.py`](https://github.com/a73720177-design/face_recognize/blob/main/py/safe_slot.py) (Slot ownership and pattern store), [`ros2_ws/src/safe_motor_control/scripts/motor_control`](https://github.com/a73720177-design/face_recognize/blob/main/ros2_ws/src/safe_motor_control/scripts/motor_control) (ROS 2 motor controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_menu["CLI menu and enrollment<br/>[recognition.py]"]
  node_live["Live safe session<br/>[safe_app.py]"]
end

subgraph group_auth["Authentication"]
  node_vision["Landmark detection and rendering<br/>[vision_utils.py]"]
  node_face["Face enrollment and matching<br/>[face_identity.py]"]
  node_gate["Stable face gate<br/>[face_gate.py]"]
  node_pattern["Pose pattern verification<br/>[safe_pattern.py]"]
end

subgraph group_state["Compartment state"]
  node_slots[("Slot ownership and pattern store<br/>[safe_slot.py]")]
end

subgraph group_motor["Motor control"]
  node_rosout["ROS 2 authorization output<br/>[ros2_auth.py]"]
  node_controller["ROS 2 motor controller"]
end

node_user(("Safe user"))
node_camera(("Camera"))
node_actuator(("Safe motor hardware"))

node_user -->|"selects task"| node_menu
node_menu -->|"starts session"| node_live
node_menu -->|"enrolls face"| node_face
node_menu -->|"checks slot"| node_slots
node_user -->|"presents gestures"| node_live
node_camera -->|"supplies frames"| node_live
node_live -->|"creates detectors"| node_vision
node_live -->|"identifies person"| node_face
node_live -->|"confirms identity"| node_gate
node_live -->|"verifies gestures"| node_pattern
node_live -->|"reads ownership"| node_slots
node_pattern -->|"loads and saves"| node_slots
node_slots -->|"migrates legacy data"| node_pattern
node_live -->|"updates authorization"| node_rosout
node_rosout -.->|"publishes requests"| node_controller
node_controller -.->|"reports status"| node_rosout
node_controller -.->|"controls motors"| node_actuator

click node_menu "https://github.com/a73720177-design/face_recognize/blob/main/py/recognition.py"
click node_live "https://github.com/a73720177-design/face_recognize/blob/main/py/safe_app.py"
click node_vision "https://github.com/a73720177-design/face_recognize/blob/main/py/vision_utils.py"
click node_face "https://github.com/a73720177-design/face_recognize/blob/main/py/face_identity.py"
click node_gate "https://github.com/a73720177-design/face_recognize/blob/main/py/face_gate.py"
click node_pattern "https://github.com/a73720177-design/face_recognize/blob/main/py/safe_pattern.py"
click node_slots "https://github.com/a73720177-design/face_recognize/blob/main/py/safe_slot.py"
click node_rosout "https://github.com/a73720177-design/face_recognize/blob/main/py/ros2_auth.py"
click node_controller "https://github.com/a73720177-design/face_recognize/blob/main/ros2_ws/src/safe_motor_control/scripts/motor_control"

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_menu,node_live,node_user toneBlue
class node_vision,node_face,node_gate,node_pattern toneAmber
class node_slots toneMint
class node_rosout,node_controller toneRose
class node_camera,node_actuator toneIndigo
```

## Components

### Application flow

- [CLI menu and enrollment](https://github.com/a73720177-design/face_recognize/blob/main/py/recognition.py): `py/recognition.py`
- [Live safe session](https://github.com/a73720177-design/face_recognize/blob/main/py/safe_app.py): `py/safe_app.py`

### Authentication

- [Landmark detection and rendering](https://github.com/a73720177-design/face_recognize/blob/main/py/vision_utils.py): `py/vision_utils.py`
- [Face enrollment and matching](https://github.com/a73720177-design/face_recognize/blob/main/py/face_identity.py): `py/face_identity.py`
- [Stable face gate](https://github.com/a73720177-design/face_recognize/blob/main/py/face_gate.py): `py/face_gate.py`
- [Pose pattern verification](https://github.com/a73720177-design/face_recognize/blob/main/py/safe_pattern.py): `py/safe_pattern.py`

### Compartment state

- [Slot ownership and pattern store](https://github.com/a73720177-design/face_recognize/blob/main/py/safe_slot.py): `py/safe_slot.py`

### Motor control

- [ROS 2 authorization output](https://github.com/a73720177-design/face_recognize/blob/main/py/ros2_auth.py): `py/ros2_auth.py`
- [ROS 2 motor controller](https://github.com/a73720177-design/face_recognize/blob/main/ros2_ws/src/safe_motor_control/scripts/motor_control): `ros2_ws/src/safe_motor_control/scripts/motor_control`

### Other components

- **Safe user**
- **Camera**
- **Safe motor hardware**

## Connections

- Safe user → CLI menu and enrollment: selects task (evidence: `py/recognition.py`)
- CLI menu and enrollment → Live safe session: starts session (evidence: `py/recognition.py`)
- CLI menu and enrollment → Face enrollment and matching: enrolls face (evidence: `py/recognition.py`)
- CLI menu and enrollment → Slot ownership and pattern store: checks slot (evidence: `py/recognition.py`)
- Safe user → Live safe session: presents gestures (evidence: `py/safe_app.py`)
- Camera → Live safe session: supplies frames (evidence: `py/safe_app.py`)
- Live safe session → Landmark detection and rendering: creates detectors (evidence: `py/safe_app.py`)
- Live safe session → Face enrollment and matching: identifies person (evidence: `py/safe_app.py`)
- Live safe session → Stable face gate: confirms identity (evidence: `py/safe_app.py`)
- Live safe session → Pose pattern verification: verifies gestures (evidence: `py/safe_app.py`)
- Live safe session → Slot ownership and pattern store: reads ownership (evidence: `py/safe_app.py`)
- Pose pattern verification → Slot ownership and pattern store: loads and saves (evidence: `py/safe_pattern.py`)
- Slot ownership and pattern store → Pose pattern verification: migrates legacy data (evidence: `py/safe_slot.py`)
- Live safe session → ROS 2 authorization output: updates authorization (evidence: `py/safe_app.py`)
- ROS 2 authorization output → ROS 2 motor controller: publishes requests
- ROS 2 motor controller → ROS 2 authorization output: reports status
- ROS 2 motor controller → Safe motor hardware: controls motors
