Real-Time Crash & Fire Detection from CCTV Streams

YOLOv8 model trained on a custom accident/fire/smoke dataset. Live MJPEG streaming, instant WebSocket alerts with snapshot evidence, and a MongoDB alert log.

View Source on GitHub Run it yourself

โœจ Features

๐Ÿ”ฅ 3-class detection

Accident ยท Fire ยท Smoke โ€” custom YOLOv8 model (best.pt, 22 MB) trained on the 30_SCFD dataset.

๐Ÿ“ก Live streaming

Annotated frames served as an MJPEG feed (/video_feed) โ€” watch detections as they happen.

๐Ÿšจ Instant alerts

flask-socketio pushes alert cards with base64 snapshot + timestamp. Throttled per-class so one incident doesn't flood the DB.

๐Ÿ” Auth + dashboard

Signup/signin with hashed passwords, protected dashboard & alert history pages.

๐Ÿ—„๏ธ Alert log

MongoDB stores every alert (type, image, timestamp); history API returns the latest 100.

๐ŸŽฅ Any video source

Video file, webcam index, or RTSP camera URL โ€” set VIDEO_SOURCE and go.

๐Ÿ—๏ธ Architecture

CCTV / video file โ”€โ”€โ–บ YOLOv8 (custom weights)
                          โ”‚
                          โ–ผ frame inference + annotation
                Flask + flask-socketio โ”€โ”€โ”€โ”€โ–บ browser (MJPEG stream + alert toasts)
                          โ”‚
                          โ–ผ
                     MongoDB (alerts collection)

Python 3.10Flaskflask-socketioYOLOv8 / UltralyticsOpenCVMongoDBeventlet

โ–ถ๏ธ Quick start

git clone https://github.com/alokscfd9004/crash-fire-detection
cd crash-fire-detection/Final-Year-Project/final_project/Code
pip install -r requirements.txt
cp .env.example .env      # set SECRET_KEY + MONGO_URI
python app.py             # โ†’ http://localhost:5500

๐Ÿ“„ Full methodology + results are in the project report and published paper (IJSREM) bundled in the repository.

๐Ÿ“ฌ Contact

Built by Alok Kumar & team ยท portfolio: my-portfolio-alok.vercel.app