How vibhu-dixit/openmonitor works
Project Type and Purpose
• This is a full-stack web application (“OpenMonitor”) built on Django.
• Purpose: real-time video monitoring, object detection via YOLOv8, historical logging, and alerting (email/SMS) when unauthorized access is detected.
Top-Level Architectural Components
a. Video Sources (CCTV/IP Cameras)
b. Inference Engine
• YOLOv8 model (yolov8s.pt) loaded in backend/messaging_alert_system/inference_manager and supplemented by code in model/video_stream.py and model/yolo.py.
• Uses OpenCV to capture frames and run object detection.
c. Alert & Logging Subsystem
• Django app messages_logger writes events to SQLite3 (db.sqlite3) and triggers external notifications.
• Configured in backend/messaging_alert_system/messages_logger/models.py & views.py.
d. Web Application (Django + Channels)
• REST/admin/API endpoints plus WebSocket consumers for live video (messaging_alert_system/consumers.py, routing.py).
• Templates (vid_stream.html, show_alert.html) and static assets serve the dashboard.
e. Database
• SQLite3 (lightweight, file‐based) stores user/access data, event logs, zone configurations.
f. External Services
• SMTP for email alerts, third-party SMS API for text messaging.
g. Admin Interface & Configuration
• Django admin (static/admin/*) and Django REST Framework docs (static/rest_framework/*) for management.
Component Interactions / Data Flows
1. Cameras → Inference Engine: raw video feeds streamed or polled.
2. Inference Engine → Detection Results:
• If unauthorized object/person detected →
• Write an “alert” record to SQLite via messages_logger.
• Invoke email/SMS API to dispatch notifications.
• Emit a WebSocket message to the front end.
3. Frontend (browser) ← WebSocket Consumer (Django Channels): updates real-time video display and alert banners.
4. Admin/REST UI ↔ Database: CRUD on zones, users, historical logs via Django admin/DRF.
Architectural Patterns & Principles
• MVC (Django apps: Models, Views, Templates).
• Event-driven/asynchronous messaging (Django Channels for WebSockets).
• Separation of concerns:
• inference_manager for CV/inference logic
• messages_logger for persistence & notifications
• Single‐file DB (SQLite) for simplicity in a hackathon context.
a. Cameras at the top left feeding into the Inference Engine component.
– one to Database (SQLite) via Message Logger,
– one to External Services (Email/SMS).
d. On the far right or bottom, show Django Admin/DRF connecting to the Database.
– Inference Engine: inference_manager/models.py, model/yolo.py
– Message Logger: messages_logger/views.py, models.py
– Web App: consumers.py, views.py, templates/vid_stream.html
Final Touches
• Every component has a clear, human-readable label.