Spaces:
Sleeping
Sleeping
| title: Fire Detections YOLOv8 | |
| emoji: π | |
| colorFrom: green | |
| colorTo: indigo | |
| sdk: gradio | |
| sdk_version: 6.12.0 | |
| app_file: app.py | |
| pinned: false | |
| # π₯ Live Fire & Smoke Detection using YOLOv8 | |
| ## π Project Overview | |
| This project is a **real-time fire and smoke detection system** powered by a YOLOv8 deep learning model. It utilizes a webcam feed to perform **frame-by-frame object detection** and visually highlights detected fire or smoke regions. | |
| The system is deployed using **Gradio**, allowing users to access the application through a web interface, including support for **live webcam streaming** in the browser. | |
| --- | |
| ## π― Objectives | |
| * Detect fire and smoke in real time using a trained YOLOv8 model | |
| * Provide a simple and interactive web-based interface | |
| * Enable deployment on cloud platforms such as Hugging Face Spaces | |
| * Demonstrate AI-based hazard detection without hardware dependencies | |
| --- | |
| ## βοΈ Technologies Used | |
| * Python | |
| * Ultralytics YOLOv8 | |
| * OpenCV | |
| * Gradio | |
| * NumPy | |
| --- | |
| ## π Project Structure | |
| ``` | |
| fire-smoke-detection/ | |
| β | |
| βββ app.py | |
| βββ requirements.txt | |
| βββ-nano_best.pt | |
| βββ README.md | |
| ``` | |
| --- | |
| ## π Installation & Setup | |
| ### 1. Clone the Repository | |
| ``` | |
| git clone https://github.com/your-username/fire-smoke-detection.git | |
| cd fire-smoke-detection | |
| ``` | |
| ### 2. Install Dependencies | |
| ``` | |
| pip install -r requirements.txt | |
| ``` | |
| ### 3. Run the Application | |
| ``` | |
| python app.py | |
| ``` | |
| --- | |
| ## π¦ Requirements | |
| ``` | |
| ultralytics | |
| opencv-python-headless | |
| gradio | |
| numpy | |
| torch | |
| ``` | |
| --- | |
| ## π§ How It Works | |
| 1. The webcam captures live frames through the browser | |
| 2. Each frame is processed using the YOLOv8 model | |
| 3. The model detects fire or smoke based on trained features | |
| 4. Detected objects are highlighted with bounding boxes | |
| 5. The annotated frame is displayed in real time | |
| --- | |
| ## π₯ Features | |
| * π΄ Real-time webcam detection | |
| * π YOLOv8-based object detection | |
| * π₯οΈ Web interface using Gradio | |
| * βοΈ Cloud deployment ready (Hugging Face Spaces) | |
| * β‘ Lightweight model for faster inference | |
| --- | |
| ## β οΈ Limitations | |
| * Frame rate depends on internet speed and server performance | |
| * Not suitable for high-FPS real-time systems | |
| * Requires a trained YOLOv8 model (`.pt` file) | |
| * Webcam access depends on browser permissions | |
| --- | |
| ## π Deployment (Hugging Face Spaces) | |
| 1. Create a new Space (Gradio SDK) | |
| 2. Upload: | |
| * `app.py` | |
| * `requirements.txt` | |
| * model file or model URL | |
| 3. Wait for automatic build and deployment | |
| --- | |
| ## π· Usage | |
| * Open the deployed app in a browser | |
| * Allow webcam access | |
| * Start live detection | |
| * Observe bounding boxes for fire/smoke detection | |
| --- | |
| ## π₯ Future Improvements | |
| * Add confidence score display | |
| * Support video upload detection | |
| * Integrate Firebase for real-time logging | |
| * Optimize model for faster inference (YOLOv8 Nano/Tiny) | |
| * Add alert system (sound/email notification) | |
| --- | |
| ## π¨βπ» Author | |
| Developed as part of an academic project on **AI-based fire detection and IoT systems**. | |
| --- | |
| ## π License | |
| This project is for educational and research purposes. | |
| Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |