Michtiii's picture
Rename SOP to SOP.md
033db97 verified

A newer version of the Gradio SDK is available: 6.13.0

Upgrade

πŸ›‘οΈ 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

  1. Clone this repository:
git clone https://huggingface.co/Michtiii/live_surveillance
cd live_surveillance
  1. Install dependencies:
pip install -r requirements.txt

Usage

  1. Launch the Gradio interface:
python live_surveillance.py
  1. 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

  1. Create a new Space (Gradio type).
  2. Upload live_surveillance.py and requirements.txt.
  3. Click β€œDeploy” and wait for build to complete.
  4. 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

License

MIT License – Feel free to use, modify, and deploy this project. kajaldadas149@gmail.com