suzuran0y/CCTV-Smartphone-AI-Monitoring
本地监控 + AI 视觉 — LAN-based smartphone-powered AI monitoring framework with structured event output for data acquisition and analysis.
Sentinel Real‑Time Monitoring System
What it is
Sentinel is an open‑source framework that turns ordinary Android smartphones into network‑camera nodes and streams their video to a PC‑side Flask server. The PC hosts a web dashboard where you can watch live MJPEG video, record segmented MP4/AVI files, and (optionally) run AI‑based analysis on frames that meet a motion‑trigger.
Core pieces
| Component | Role | Key tech |
|---|---|---|
| CamFlow (Android app) | Captures the phone’s camera, compresses each frame to JPEG and POSTs it to the server. | Android 8+, Java/Kotlin, HTTP upload |
PC server (server.py) |
Receives frames, stores the latest image in a FrameBuffer, serves an MJPEG stream, records video, and runs an optional AI monitor thread. |
Python 3.9+, Flask, OpenCV, threading |
| Browser dashboard | UI for live preview, start/stop recording, adjust parameters, view logs and AI events. | HTML/JS, CSS, Flask templates |
How it works (high‑level flow)
- Start the server –
python server.pylaunches Flask, prints the address (e.g.,http://192.168.1.10:5000). - Launch CamFlow – the app asks for the server address, then continuously captures frames and POSTs them to
/upload. - FrameBuffer – the server keeps the most recent JPEG in memory; the MJPEG endpoint (
/stream) streams it to any browser. - Recording – a background worker reads from the buffer and writes segmented video files (configurable FPS, codec, segment length).
- AI trigger (optional) – a motion‑detection module flags frames; when triggered, the AI monitor calls a pluggable vision model (e.g., a multimodal LLM or CV model) and stores a structured JSON event (
has_person,risk_level,confidence,summary). - Dashboard – lets you tweak stream FPS, JPEG quality, recording settings, and AI parameters (prompt template, motion threshold, etc.) and view logs/events in real time.
Main features
- Zero‑cost hardware – any Android phone becomes a camera node; no IP cameras needed.
- LAN‑only operation – all traffic stays on the local network, preserving privacy.
- Live MJPEG preview – viewable in any modern browser, no plugins.
- Segmented video recording – automatic file rotation to avoid huge files.
- Configurable parameters – stream FPS, upload rate, recording codec, AI trigger thresholds, prompt templates, etc.
- Layered AI processing – cheap motion detection first, then optional large‑model inference to save compute/API costs.
- Structured event logs – JSON records for downstream analysis or model training.
- Extensible architecture – AI module is an interface; you can drop in any vision model or inference service.
Typical use cases
| Scenario | Why Sentinel fits |
|---|---|
| Home or lab surveillance | Uses existing phones, stores data locally, no cloud subscription. |
| Research prototype for behavior analysis | Easy to plug in custom vision models and get structured JSON outputs. |
| Teaching distributed vision systems | Demonstrates “mobile capture → PC processing → web control” architecture. |
| Small‑scale data collection | Generates synchronized video + event JSON for later model training. |
Getting started (quick steps)
- Clone the repo
git clone https://github.com/suzuran0y/CCTV-Smartphone-AI-Monitoring.git cd CCTV-Smartphone-AI-Monitoring - Install Python deps
pip install -r requirements.txt - Run the server
Note the printedpython server.pyIP:PORT. - Install CamFlow on a phone (APK provided in
PhoneCamSender/or build from Android Studio) and enter the server address. - Open a browser on the same LAN and go to
http://<server_ip>:5000– you’ll see the live dashboard. - Use the Settings tab to enable the AI monitor, adjust thresholds, and start recording.
Extending the AI module
The folder app/ai/ contains:
ai_ark.py– a thin wrapper that calls a vision model (currently a placeholder for an online inference API).ai_monitor_worker.py– runs the state‑machine (SLEEP → OBSERVE) and writes events.motion_trigger.py– simple frame‑difference motion detector. To use a different model, replaceai_ark.pywith code that sends the JPEG to your own endpoint and returns a JSON payload matching the expected schema.
License & contribution
- License: MIT – you can freely use, modify, and redistribute.
- Contributions are welcomed via pull requests; the project follows a typical open‑source workflow.
All information above is taken directly from the repository’s README; no additional features have been inferred.
관련
- 프로젝트
- 프로젝트
- 프로젝트
- 프로젝트
- 프로젝트