Fire accidents remain one of the major causes of damage to human life, industrial infrastructure, forests, and public property worldwide. Traditional fire alarm systems mainly rely on smoke sensors and heat detectors, which may fail in large-scale environments or open spaces.
With the advancement of Artificial Intelligence, Computer Vision, and Deep Learning, visual fire detection systems have become more accurate, scalable, and intelligent.
This project presents a Real-Time Fire Detection System developed using:
- YOLOv8 (You Only Look Once)
- OpenCV
- PyTorch
- Python
The system detects fire directly from live webcam video streams using AI-powered object detection techniques.
The project combines concepts of:
- Digital Image Processing
- Computer Vision
- Deep Learning
- Real-Time Object Detection
- Intelligent Surveillance Systems
The primary objectives of this project are:
β
Detect fire in real time using Artificial Intelligence
β
Apply Digital Image Processing concepts practically
β
Train a custom YOLOv8 object detection model
β
Build an intelligent safety monitoring system
β
Explore real-world Computer Vision applications
β
Improve understanding of Deep Learning workflows
| Technology | Purpose |
|---|---|
| Python 3.10 | Core programming language |
| YOLOv8 | Real-time object detection |
| OpenCV | Video processing & visualization |
| PyTorch | Deep learning framework |
| NumPy | Numerical operations |
| Roboflow | Dataset management & annotation |
| VS Code | Development environment |
YOLOv8 (You Only Look Once Version 8) is a state-of-the-art real-time object detection model developed by Ultralytics.
It is widely used because of:
- high speed,
- strong accuracy,
- lightweight architecture,
- and real-time performance.
In this project, YOLOv8 was trained specifically to detect fire from images and live video streams.
The fire dataset used in this project was collected from:
Roboflow is a professional Computer Vision platform used for:
- dataset management,
- image annotation,
- preprocessing,
- augmentation,
- and YOLO dataset export.
The dataset contained:
- fire images,
- labeled annotations,
- training images,
- validation images,
- and testing samples.
The dataset was organized according to YOLO object detection format.
dataset/
β
βββ train/
β βββ images/
β βββ labels/
β βββ labels.cache
β
βββ valid/
β βββ images/
β βββ labels/
β βββ labels.cache
β
βββ test/
β βββ images/
β βββ labels/
β
βββ data.yamlThe data.yaml file contains:
- dataset paths,
- class names,
- training configuration,
- and validation information.
It acts as the main configuration file for YOLOv8 training.
The system works in two major phases:
During training:
β Fire dataset loaded β YOLOv8 pretrained model initialized β Dataset processed into batches β Deep learning training performed β Model optimized over multiple epochs β Best weights saved automatically
The YOLOv8 model was trained using:
- custom fire dataset,
- GPU/CPU processing,
- object detection techniques,
- and supervised learning methods.
| Parameter | Value |
|---|---|
| Model | YOLOv8n |
| Epochs | 30 |
| Framework | PyTorch |
| Detection Type | Fire Detection |
| Dataset Format | YOLO |
After successful training:
best.ptwas generated as the best-performing trained model.
Additional files generated:
- training graphs,
- metrics,
- loss curves,
- validation results,
- and inference outputs.
runs/
βββ detect/
βββ train/
βββ train2/
βββ weights/
β βββ best.pt
β βββ last.pt
β
βββ args.yaml
βββ results.csv
βββ confusion_matrix.png
βββ labels.jpg
βββ training graphsIn the detection phase:
π₯ Webcam captures live video π§ YOLOv8 processes each frame π₯ Fire regions detected instantly π¦ Bounding boxes drawn π Confidence scores displayed
The system performs detection in real time with smooth visualization.
Webcam Input
β
Frame Capture
β
YOLOv8 Inference
β
Fire Detection
β
Bounding Box Visualization
β
Real-Time Output Display
git clone https://github.com/your-username/Real-Time-Fire-Detection-Using-YOLOv8-and-OpenCV.gitcd Real-Time-Fire-Detection-Using-YOLOv8-and-OpenCVpip install -r requirements.txtultralytics
opencv-python
numpypython train.pypython detect.pyThe system generates:
β Real-time fire detection windows β Bounding boxes β Confidence score display β Trained model weights β Training graphs & metrics β Detection visualizations
This system can be used in:
π Industrial safety monitoring π² Forest fire surveillance π’ Smart building systems π¨ Emergency alert systems π Home automation πΉ Intelligent CCTV monitoring π‘οΈ Public safety infrastructure
This project will continue to evolve into a more intelligent smart safety system.
Planned future enhancements include:
π Automatic alarm integration π± SMS and mobile notifications βοΈ IoT-enabled monitoring π«οΈ Smoke detection capability π· Multi-camera CCTV support π Web dashboard integration π§ Improved AI model accuracy π‘ Cloud-based monitoring system π¨ Emergency response automation
β Real-time detection β AI-powered monitoring β Faster than traditional systems β Cost-effective solution β Scalable architecture β Intelligent surveillance support
- Detection quality depends on dataset quality
- Extreme lighting conditions may affect accuracy
- Smoke-only situations remain challenging
- Performance varies depending on hardware
This project demonstrates practical expertise in:
- Artificial Intelligence
- Computer Vision
- Deep Learning
- YOLOv8 Model Training
- Object Detection
- OpenCV Integration
- Dataset Preparation
- Real-Time AI Systems
- Digital Image Processing
- Python Development
This project was developed as a major semester project for:
The project combines theoretical image processing concepts with practical AI implementation to solve real-world safety problems.
It reflects:
- practical learning,
- research mindset,
- implementation ability,
- and problem-solving skills.
Computer Science Student Passionate about:
- Artificial Intelligence
- Computer Vision
- Deep Learning
- Intelligent Safety Systems
- Ultralytics YOLOv8 Documentation
- OpenCV Official Documentation
- PyTorch Documentation
- Roboflow Dataset Platform