β¦ β¦β¦ββββ¦ββββββ βββββββββ
ββββββββββ ββββ β ββ βββββ
ββ β©ββββ©ββββββ ββββ© βββ
VisionOps is a production-ready computer vision platform that performs real-time object detection using YOLOv8 and motion analysis using Optical Flow, with a live analytics dashboard. It ingests video streams (webcam or file), runs intelligent detection and motion analysis on every frame, and serves the results through a REST API and interactive dashboard. Designed to mirror industrial Operations Insight Platforms.
- π― YOLOv8 Object Detection β Real-time COCO object detection with configurable confidence thresholds and class filtering
- π Optical Flow Motion Analysis β Dense (Farneback) and Sparse (Lucas-Kanade) motion tracking with heatmap visualization
- πΊ Live MJPEG Streaming β Annotated video stream accessible via browser or
<img>tag - π Real-Time Dashboard β Dark-themed Streamlit dashboard with live metrics, charts, and event logs
- β‘ FastAPI Backend β High-performance REST API with auto-generated Swagger documentation
- ποΈ SQLite Event Logging β Persistent detection event storage with session statistics
- πΌοΈ Data Augmentation β Albumentations-based preprocessing and dataset augmentation tools
- π§ Runtime Configuration β Update thresholds, flow modes, and video sources without restart
- π₯οΈ GPU Acceleration β Automatic CUDA/MPS detection with CPU fallback
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VisionOps Platform β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββ β
β β Video Source β β Processing Pipeline β β
β β β β β β
β β β’ Webcam ββββββΆβ OpenCV βββββββββββββββββββββββ β β
β β β’ Video β β Capture βββΆβ YOLOv8 Detector β β β
β β File β β β β (Object Detection) β β β
β ββββββββββββββββ β β ββββββββββ¬βββββββββββββ β β
β β β β β β
β β β ββββββββββΌβββββββββββββ β β
β β ββΆβ Optical Flow β β β
β β β (Motion Analysis) β β β
β β ββββββββββ¬βββββββββββββ β β
β β β β β
β β ββββββββββΌβββββββββββββ β β
β β β Frame Merger β β β
β β β (Overlay Composer) β β β
β β ββββββββββ¬βββββββββββββ β β
β ββββββββββββββββββββββββΌβββββββββββββββββββ β
β β β
β ββββββββββββββββββββββΌββββββββββββββββββ β
β β β β β
β βββββββββΌβββββββ ββββββββββΌβββββββ ββββββββΌβββ β
β β FastAPI β β Streamlit β β SQLite β β
β β REST API β β Dashboard β β Logger β β
β β + MJPEG β β (Live UI) β β (DB) β β
β ββββββββββββββββ βββββββββββββββββ βββββββββββ β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
git clone https://github.com/yourusername/VisionOps.git
cd VisionOpspython3 -m venv venv
source venv/bin/activate # Linux/macOS
# or
venv\Scripts\activate # Windowspip install -r requirements.txtpython -c "from ultralytics import YOLO; print('YOLOv8 OK')"
python -c "import cv2; print(f'OpenCV {cv2.__version__} OK')"
python -c "import fastapi; print('FastAPI OK')"Note: The YOLOv8 nano model (
yolov8n.pt) is automatically downloaded on first run (~6 MB).
# From the VisionOps/ directory
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadThe API will be available at http://localhost:8000
Swagger docs: http://localhost:8000/docs
# In a separate terminal
streamlit run dashboard.py --server.port 8501The dashboard will open at http://localhost:8501
# Upload a sample image for detection
curl -X POST "http://localhost:8000/detect" \
-F "file=@samples/test_image.jpg" \
| python -m json.tool# Place images in samples/ directory, then:
python augment_dataset.py --count 10| Method | Endpoint | Description | Response Type |
|---|---|---|---|
| GET | / |
Health check β status + uptime | JSON |
| GET | /stream |
MJPEG live annotated video stream | MJPEG Stream |
| POST | /detect |
Upload image β detections + motion score | JSON |
| GET | /stats |
Session statistics (frames, objects, FPS) | JSON |
| GET | /events |
Recent detection events (supports ?class_filter=) |
JSON |
| POST | /config |
Update confidence, flow mode, source | JSON |
{
"detections": [
{
"class_name": "person",
"confidence": 0.87,
"bbox": [120.5, 45.2, 380.1, 490.8]
}
],
"motion_score": 23.45,
"object_counts": {"person": 1},
"processing_time_ms": 45.23,
"image_size": {"height": 720, "width": 1280}
}All settings are centralized in utils/config.py:
| Parameter | Default | Description |
|---|---|---|
MODEL_PATH |
yolov8n.pt |
YOLOv8 model weights file |
CONFIDENCE_THRESHOLD |
0.45 |
Minimum detection confidence |
INPUT_SIZE |
(640, 640) |
Model input resolution |
FLOW_MODE |
dense |
Optical flow mode (dense / sparse) |
MAX_KEYPOINTS |
100 |
Max keypoints for sparse flow |
MOTION_THRESHOLD |
2.0 |
Minimum magnitude for high-motion zones |
DB_PATH |
db/visionops.db |
SQLite database file path |
API_HOST |
0.0.0.0 |
FastAPI bind address |
API_PORT |
8000 |
FastAPI port |
STREAMLIT_PORT |
8501 |
Streamlit dashboard port |
STREAM_FPS_TARGET |
30 |
Target frames per second for streaming |
LOG_BATCH_SIZE |
10 |
Events batched before DB write |
| Technology | Role |
|---|---|
| Python 3.10+ | Core language |
| OpenCV | Video capture, frame processing |
| Ultralytics YOLOv8 | Object detection (nano model) |
| Optical Flow | Motion analysis (Farneback + LK) |
| FastAPI | REST API server |
| Streamlit | Frontend dashboard |
| NumPy | Array operations |
| Matplotlib | Charts and visualizations |
| Albumentations | Data augmentation |
| SQLite | Event logging |
| Uvicorn | ASGI server |
VisionOps/
βββ main.py # FastAPI app entry point
βββ dashboard.py # Streamlit dashboard
βββ augment_dataset.py # Standalone augmentation script
βββ core/
β βββ __init__.py
β βββ detector.py # YOLOv8 detection logic
β βββ motion.py # Optical Flow (Dense + Sparse)
β βββ pipeline.py # Combined detection + motion pipeline
β βββ augment.py # Albumentations preprocessing
βββ api/
β βββ __init__.py
β βββ routes.py # FastAPI route definitions
βββ db/
β βββ __init__.py
β βββ logger.py # SQLite event logger
βββ utils/
β βββ __init__.py
β βββ visualizer.py # Drawing bboxes, flow, overlays
β βββ config.py # All configuration constants
βββ samples/ # Sample videos/images for testing
βββ requirements.txt
βββ README.md
βββ .gitignore
- π TensorRT Optimization β Export YOLOv8 to TensorRT for 5-10x faster inference on NVIDIA GPUs
- πΉ Multi-Camera Support β Process multiple video streams simultaneously with load balancing
- π‘ RTSP Stream Support β Connect to IP cameras and network video recorders
- π§ Custom Model Training β Fine-tune YOLOv8 on domain-specific datasets via the augmentation pipeline
- π Prometheus + Grafana β Enterprise-grade monitoring and alerting
- π³ Docker Deployment β Containerized deployment with docker-compose
- π Alert System β Configurable alerts for specific object classes or motion thresholds
- βοΈ Cloud Deployment β AWS/GCP deployment guides with auto-scaling
MIT License β see LICENSE for details.
VisionOps β Built with β€οΈ using YOLOv8, OpenCV, FastAPI, and Streamlit