How inbasperu/visionguard works
Project type and purpose
• VisionGuard is a native desktop application (full-stack in the sense of UI + compute pipeline) written in C++ using Qt6 for the front end, OpenCV for camera capture and image processing, and OpenVINO for model inference.
• Its goal is real-time gaze tracking and eye-state estimation to remind users to take breaks, while monitoring system resources and keeping all data local.
File structure
• Top-level directories:
• src/ & include/ → core application logic and headers
• omz_models/ → pretrained inference models in multiple precisions (FP32, FP16, INT8)
• third_party/ → embedded libs (gflags, monitors, nlohmann/json, utils)
• docs/ → architecture, installation, usage, benchmarks
• Build & deployment:
• CMakeLists.txt & build scripts (build.sh/ps1) for cross-platform build
• VisionGuardInstaller.nsi for Windows installer
• Configuration:
• config.json for default settings
• gflags for CLI/GUI flags parsing
• Patterns & modules:
• Pipeline of estimators (face detection → landmarks → head pose → gaze → eye state) behind an IEWrapper
• MVC-like: mainwindow UI handling events and displaying results; vision_guard core implements the logic; results_marker overlays on frames
README for additional insights
• Mentions “Architecture” doc in docs/ARCHITECTURE.md that describes backend processes and model pipeline
• Lists key components: UI (Qt6), CV (OpenCV), Inference (OpenVINO), Resource Monitoring
a. Main components:
1. UI Layer (Qt6 MainWindow & System Tray)
2. Camera Capture (OpenCV VideoCapture)
3. Inference Pipeline:
• IEWrapper (OpenVINO Runtime)
• FaceDetector
• LandmarksEstimator
• HeadPoseEstimator
• GazeEstimator
• EyeStateEstimator
4. Resource Monitor (CPU/Memory via monitors lib)
5. Configuration & Flags (gflags + config.json + nlohmann::json)
6. Persistence (screen_time_stats.json)
7. External Models (omz_models folder)
b. Relationships & interactions:
• UI triggers start/stop capture and device selection (CPU/GPU/NPU).
• Camera Capture feeds frames into the Inference Pipeline.
• Each estimator module passes its results downstream; IEWrapper abstracts loading/executing models.
• Results go back to UI for overlay (ResultsMarker) and notifications.
• Resource Monitor runs in parallel, streaming stats to UI.
• Usage statistics are accumulated and periodically written to JSON.
c. Architectural patterns:
• Pipeline pattern for sequential model execution.
• Observer/Publisher-Subscriber for UI updates (e.g., new gaze data, resource stats).
• MVC-style separation: MainWindow (View+Controller) vs. vision_guard core (Model).
• Plugin-like support for multiple inference devices via IEWrapper abstraction.
d. Relevant technologies:
• Qt6 (GUI event loop, signals/slots)
• OpenCV (frame capture & basic processing)
• OpenVINO Runtime (model inference)
• gflags (CLI/GUI flags management)
• nlohmann/json (config & stats serialization)
• monitors lib (resource usage)
Key advice
• Every component and its role (no shortcuts).
• Use layers: Presentation (Qt), Processing (OpenCV + Inference), Infrastructure (Monitoring, Config, Persistence).
• Keep it simple but detailed: show threading boundaries if possible (e.g., main GUI thread vs. inference thread).
• Validate against docs/ARCHITECTURE.md to ensure alignment with existing textual architecture.
• Iterate with developers to fill in missing details (e.g., exact class names or interactions).