How tangnguyendeveloper/face_identify works
Project Type and Purpose
• This is a C++ full-stack application for real-time face detection and embedding extraction.
• It comprises a processing backend (MTCNN + ResNetv1 TFLite), a storage layer (self-developed embedding DB), and a lightweight web UI for monitoring.
File Structure
• Top-level directories:
• src/ – implementation folders: camera (RTSP/Internal), config, mtcnn detector, embedding
• models/ – Caffe MTCNN model files (.prototxt/.caffemodel) and the ResNetv1 embedding model (.tflite)
• etc/ – configuration files for camera and models
• embedding_db.db – SQLite DB for storing face embeddings
• webconsole/– static web UI (index.html, root.js, styles.css)
Architectural Patterns
• Modules are loosely coupled via interfaces (e.g. ICamera, IConfig, IDetector, IEmbedder).
• Configuration-driven initialization from etc/*.conf.
• Streaming pipeline: camera → detector → embedder → storage/UI.
• Web UI served by the backend over a lightweight HTTP/WebSocket.
Main Components & Their Interactions
a. Input Layer
• Camera Module (two implementations):
• InternalCamera (src/camera/internal_camera.cpp)
• RTSPCamera (src/camera/rtsp_camera.cpp)
• Configured via etc/camera_and_models.conf
b. Detection Layer
• MTCNN Detector (src/mtcnn/*) using Caffe models (models/det1–3)
c. Preprocessing & Embedding Layer
• Face alignment/cropping → ResNetv1 Embedding Extractor (face_embedding.cpp)
• Model is TensorFlow→TFLite converted (models/embedding_20180402-114759.tflite)
d. Storage Layer
• Self-developed embeddingDB (SQLite, embedding_db.db) with C++ wrapper (embedding_db_impl.hpp)
e. Presentation & Logging
• logging.hpp records events
• stream.hpp pushes frames and data to webconsole
f. Web UI
• index.html + root.js + styles.css serve live video and embedding info
Technologies & Frameworks
• CMake (build orchestrator)
• OpenCV (image I/O & drawing)
• TensorFlow Lite (inference engine for ResNetv1 embedding)
• Caffe (runtime for MTCNN detector)
• SQLite (embedding_db.db)
• Embedded HTTP/WebSocket server (from stream.hpp)
• JavaScript/HTML/CSS for webconsole