A production-ready Computer Vision service designed for real-time object detection. It features a scalable FastAPI backend, Dockerized deployment, CPU optimization algorithms, and a full observability stack (Prometheus & SQLite logs).
Note: This dashboard demonstrates real-time inference capabilities with minimal latency.
- ⚡ Real-time Inference: Streams processed video via MJPEG with YOLOv8 bounding boxes.
- 🛠️ MLOps Architecture:
- Fully Dockerized for easy deployment.
- Configuration Management via
.envfiles (12-factor app). - CI/CD Ready structure.
- 📉 CPU Optimization: Implemented "Smart Throttling" algorithm to maintain stable 30 FPS and prevent CPU overheating on standard hardware.
- 📊 Observability:
- Prometheus Metrics (
/metrics) for monitoring request latency and throughput. - SQLite Logging for tracking detection history on uploaded images.
- Prometheus Metrics (
- 🛡️ Security: Stream endpoints hidden from Swagger documentation to prevent service overload.
- 🎨 Interactive Dashboard: Custom Dark Mode UI for monitoring system status and video feed.
| Component | Technology | Description |
|---|---|---|
| Framework | FastAPI | High-performance async web framework. |
| Model | YOLOv8 (Ultralytics) | State-of-the-art object detection model (yolov8n.pt). |
| Vision | OpenCV | Image processing and video stream handling. |
| Database | SQLite | Lightweight storage for detection logs. |
| Container | Docker | Multi-stage build based on python:3.12-slim. |
| Metrics | Prometheus | Instrumentator for exposing app metrics. |
.
├── data/ # Persisted data (SQLite DB)
├── main.py # Application entry point & logic
├── Dockerfile # Docker image configuration
├── requirements.txt # Python dependencies
├── .env.example # Template for environment variables
└── README.md # Project documentation
- Docker & Docker Compose installed.
- Git.
git clone https://github.com/Western-1/YOUR_REPO_NAME.git
cd YOUR_REPO_NAMEcp .env.example .env
# You can modify VIDEO_SOURCE in .env to use a YouTube URL, RTSP stream, or local file.# Build the image
docker build -t yolo-service .
# Run the container (Map port 8000 and mount data volume)
docker run -d -p 8000:8000 -v $(pwd)/data:/app/data --env-file .env --name yolo-app yolo-service- Dashboard: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Metrics: http://localhost:8000/metrics
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Main Dashboard (HTML). |
POST |
/detect_image |
Upload an image, get it back with bounding boxes + Log to DB. |
POST |
/detect_json |
Upload an image, get JSON stats (e.g., {"person": 3, "car": 1}). |
GET |
/history |
View recent detection logs from the database. |
GET |
/metrics |
Prometheus scraping endpoint. |
GET |
/video_feed |
(Internal) MJPEG video stream. |
| Variable | Default | Description |
|---|---|---|
APP_NAME |
YOLOv8 MLOps Service |
Name displayed on Dashboard. |
MODEL_PATH |
yolov8n.pt |
Path to the YOLO weight file. |
VIDEO_SOURCE |
(Intel Sample Video) | URL to video file, YouTube link, or RTSP stream. |
MAX_LOG_ENTRIES |
1000 |
Database rotation limit. |
Developed by Andriy Vlonha (@Western-1).
MIT License - see LICENSE file for details.
Copyright (c) 2026 Andriy Vlonha
Andriy Vlonha 📧 Email: [email protected] 💼 LinkedIn: Andriy Vlonha 🐙 GitHub: @Western-1 📱 Telegram: @Westerny


