How sridesiyan/monitor-v2 works
Purpose and active shape
This repository implements restaurant-table video analytics: detecting people/pose, tracking staff and diners, associating activity with configured table regions, and producing occupancy, serving, cleanliness, and session records. It contains a legacy Python implementation under coe-intern-main/ and a deployment-oriented restaurant_monitoring/ application built around Axelera Voyager pipelines. The vendored voyager-sdk-latest/ is runtime infrastructure, not restaurant business logic.
Entry points and orchestration
The deployment-facing entry points are restaurant_monitoring/apps/main.py, restaurant_monitoring/inference.py, and restaurant_monitoring/deploy.py. They initialize the runtime, execute a configured inference pipeline, and attach restaurant-specific postprocessing. The legacy/offline entry point is coe-intern-main/analytics/pipeline.py; a top-level analytics/pipeline.py also exists, suggesting an alternate wrapper or copy.
The primary declarative composition is restaurant_monitoring/pipelines/restaurant_full_pipeline.yaml, with separable detection, tracking, pose, serving, occupancy, rendering, database, and export pipeline definitions in restaurant_monitoring/pipelines/.
Video inference and tracking boundary
Frames enter through the application/runtime layer and are processed by an Axelera/Voyager graph. The restaurant pipeline configuration and model configuration are in:
• restaurant_monitoring/pipelines/restaurant_detection.yaml
• restaurant_monitoring/pipelines/restaurant_tracking.yaml
• restaurant_monitoring/models/yolov8s.toml
Detection/pose/tracker metadata crosses from the SDK-managed graph into Python business logic through restaurant_monitoring/runtime/inference_runtime.py and restaurant_monitoring/decoders/embeddings.py. The deployment includes a pose weight file, restaurant_monitoring/yolov8n-pose.pt. The SDK build artifacts show the full pipeline uses YOLO detection, YOLO pose, OSNet ReID, and OC-SORT tracking.
Table spatial model and state machine
Table definitions are a critical domain boundary: configured regions map raw tracked-person positions to restaurant tables. Core implementation paths are:
• restaurant_monitoring/analytics/table_manager.py
• restaurant_monitoring/analytics/roi_config.py
• restaurant_monitoring/configs/tables.json
ROI support includes automatic/dwell-based derivation (restaurant_monitoring/analytics/auto_roi.py, restaurant_monitoring/analytics/dwell_cluster.py), but configured tables are the stable interface consumed by analytics. Per-table lifecycle transitions are controlled by restaurant_monitoring/restaurant/table_fsm.py, separating temporal restaurant state from frame-level model detections.
Restaurant event analytics
Business rules consume tracks, pose/embedding signals, table assignments, and FSM state:
• Occupancy: restaurant_monitoring/restaurant/occupancy_engine.py
• Serving detection: restaurant_monitoring/restaurant/serving_detector.py
• Customer/session continuity: restaurant_monitoring/restaurant/session_manager.py
• Cleanliness/plate state: restaurant_monitoring/restaurant/cleanliness_engine.py
The equivalent production-packaged implementations are duplicated under restaurant_monitoring/runtime/business/, including runtime/business/fsm/table_fsm.py and runtime/business/tracking/serving_detector.py. This duplication is an important maintenance boundary: changes must identify whether the normal Python path, packaged runtime path, or both are authoritative.
Persistence, rendering, and outputs
Event/state results are persisted through the database layer:
• restaurant_monitoring/database/db.py
• restaurant_monitoring/database/models.py
• restaurant_monitoring/database/serving_event_logger.py
SQLite database artifacts are stored under restaurant_monitoring/outputs/databases/; reports are emitted under restaurant_monitoring/outputs/reports/. Annotated video generation is isolated in restaurant_monitoring/renderer/renderer.py, keeping presentation separate from analytics decisions.
Runtime and infrastructure dependencies
The deployment targets the Axelera Voyager SDK and accelerator ecosystem, represented by restaurant_monitoring/runtime/sdk_initializer.py, restaurant_monitoring/runtime/cpu_stream.py, and the vendored voyager-sdk-latest/voyager-sdk-latest/. Voyager supplies pipeline execution, model compilation, video/GStreamer integration, inference operators, and native trackers. No network service, web API, or cloud dependency is evident from the supplied tree; persistence and exports are local SQLite/filesystem outputs.
Main entry points: occupancy_engine.py Restaurant Event Analytics · restaurant_full_pipeline.yaml Restaurant Full Pipeline · inference_runtime.py Inference Metadata Decoder · inference.py Inference Orchestration
Components 20
Deployment Runtime
Voyager-backed application and pipeline execution.
- Application Entry Points · Initializes deployment and attaches restaurant postprocessing.
restaurant_monitoring/apps/main.py - Inference Orchestration
restaurant_monitoring/inference.py - Deployment Setup
restaurant_monitoring/deploy.py - SDK Initialization
restaurant_monitoring/runtime/sdk_initializer.py - Voyager SDK · Executes accelerator inference, GStreamer, and native tracking.
- Restaurant Full Pipeline · Composes detection, tracking, pose, analytics, rendering, persistence, and export stages.
restaurant_monitoring/pipelines/restaurant_full_pipeline.yaml - Detection Pipeline
restaurant_monitoring/pipelines/restaurant_detection.yaml - Tracking Pipeline
restaurant_monitoring/pipelines/restaurant_tracking.yaml - YOLO Model Configuration
restaurant_monitoring/models/yolov8s.toml - Inference Metadata Decoder · Converts SDK detection, pose, tracking, and embedding metadata for Python analytics.
restaurant_monitoring/runtime/inference_runtime.py
Restaurant Analytics
Table mapping and temporal business decisions.
- Table Spatial Model · Maps tracked positions to configured restaurant table regions.
restaurant_monitoring/analytics/table_manager.py - Configured Tables · Stable table-region interface consumed by analytics.
restaurant_monitoring/configs/tables.json - Table Lifecycle FSM · Separates per-table temporal state from frame-level detections.
restaurant_monitoring/restaurant/table_fsm.py - Restaurant Event Analytics · Derives occupancy, serving, sessions, and cleanliness events.
restaurant_monitoring/restaurant/occupancy_engine.py - Packaged Runtime Business Logic · Parallel runtime implementation that must be kept authoritative with or distinct from normal Python logic.
restaurant_monitoring/runtime/business/fsm/table_fsm.py
Local Outputs
Persistence, reports, and rendered video.
- Database Layer
restaurant_monitoring/database/db.py - SQLite Databases
- Annotated Video Renderer · Renders analytics without making business decisions.
restaurant_monitoring/renderer/renderer.py - Reports and Exports
Other components
- Legacy Offline Pipeline · Separate pre-deployment analytics implementation.
coe-intern-main/analytics/pipeline.py
Connections 21
- Application Entry Points → Inference Orchestration: runs
- Deployment Setup → SDK Initialization: configures
- Inference Orchestration → SDK Initialization: initializes
- SDK Initialization → Voyager SDK: loads
- Inference Orchestration → Restaurant Full Pipeline: executes
- Restaurant Full Pipeline → Detection Pipeline: includes
- Restaurant Full Pipeline → Tracking Pipeline: includes
- Detection Pipeline → YOLO Model Configuration: uses
- Voyager SDK → Inference Metadata Decoder: emits metadata to
- Restaurant Full Pipeline → Inference Metadata Decoder: bridges results through
- Inference Metadata Decoder → Table Spatial Model: supplies tracks and pose
- Configured Tables → Table Spatial Model: defines regions for
- Table Spatial Model → Table Lifecycle FSM: assigns tracks to
- Inference Metadata Decoder → Restaurant Event Analytics: supplies signals to
- Table Lifecycle FSM → Restaurant Event Analytics: provides table state
- Restaurant Event Analytics → Database Layer: persists events via
- Database Layer → SQLite Databases: stores
- Restaurant Event Analytics → Annotated Video Renderer: annotates through
- Restaurant Event Analytics → Reports and Exports: exports
- Packaged Runtime Business Logic → Table Lifecycle FSM: parallel implementation
- Legacy Offline Pipeline → Restaurant Event Analytics: legacy counterpart