Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.13.0
π‘οΈ Smart Live Surveillance Using YOLOv8
Overview
This project implements a real-time smart surveillance system using the latest YOLOv8 object detection model and Gradio for live webcam streaming. It can detect any type of object, label it in real-time, record video streams, and generate Excel reports with detected objects and timestamps.
Itβs fully compatible with Hugging Face Spaces for cloud deployment.
Features
- Live Object Detection β Detects and labels objects in real-time using YOLOv8.
- Excel Reporting β Saves detected objects with timestamp, name, and confidence score.
- Video Recording β Option to record annotated video with a simple toggle.
- Hugging Face Deployment β Fully compatible with Spaces and no manual credentials needed.
- Cross-Platform β Works on Windows, Linux, or cloud environments.
Technology Stack
- Ultralytics YOLOv8 β Real-time object detection framework.
- Gradio β Web UI for live webcam streaming and controls.
- OpenCV β Video and image processing.
- Pandas + OpenPyXL β Excel report generation.
- Hugging Face Hub β Model hosting and deployment.
Installation
- Clone this repository:
git clone https://huggingface.co/Michtiii/live_surveillance
cd live_surveillance
- Install dependencies:
pip install -r requirements.txt
Usage
- Launch the Gradio interface:
python live_surveillance.py
- Features in the interface:
- Live Camera Feed β Displays annotated video in real-time.
- Record Video Checkbox β Start/stop recording the live feed.
- Download Report Button β Download Excel report of detected objects.
Directory Structure
live_surveillance/
β
βββ live_surveillance.py # Main application code
βββ requirements.txt # Project dependencies
βββ detection_report.xlsx # Generated Excel report (runtime)
Deployment on Hugging Face Spaces
- Create a new Space (Gradio type).
- Upload
live_surveillance.pyandrequirements.txt. - Click βDeployβ and wait for build to complete.
- Open the Space to use live object detection.
Notes
- Uses
sources=["webcam"]for live streaming (Gradio v6+ compatible). - YOLO configuration files are automatically stored in
/tmp/Ultralytics. - Hugging Face Hub handles YOLOv8 model download automatically.
- Video recordings are saved temporarily; you can modify the path for permanent storage.
Future Enhancements
- Multiple camera streams
- Alerts via email/SMS for specific objects
- Real-time dashboard for object counts and trends
- Integration with cloud storage for reports and video