Views
No views yet
| Feature | How |
|---|---|
| 🚗 Vehicle Detection | YOLOv8 (car, truck, bus, motorcycle) |
| 💨 Speed Estimation | Pixel displacement + FPS calibration |
| ⛑️ Helmet Detection | HSV color analysis on rider head region |
| 🔊 Horn Detection | Librosa spectral analysis (800–3500 Hz range) |
| 📢 Noise Level (dB) | RMS energy per audio window |
| 🚨 Violation Alerts | Real-time on-screen banner + stats |
smarttraffic/
├── app.py # Flask backend — detection pipeline
├── templates/
│ └── index.html # Beautiful frontend UI
├── yolov8n.pt # YOLOv8 model weights (copy here)
├── uploads/ # Temp uploaded videos
└── outputs/ # Processed output videospip install flask ultralytics opencv-python-headless librosa soundfile1# Ubuntu/Debian
2sudo apt install ffmpeg
3
4# macOS
5brew install ffmpeg
6
7# Windows — download from https://ffmpeg.org/download.htmlyolov8n.pt into the smarttraffic/ folder.1cd smarttraffic
2python app.pyhttp://localhost:5000Video Input
│
├── Video frames ──→ YOLOv8 ──→ Vehicle tracking + Speed estimation
│
└── Audio track ──→ ffmpeg extract ──→ Librosa analysis
│
┌───────────┴───────────┐
│ Spectral analysis │
│ • RMS energy (loud?) │
│ • Centroid 800–3500Hz │
│ • Low ZCR (pure tone) │
└───────────┬───────────┘
│
Horn event detected?
YES → Mark timestamp
NO → Skip
Combine: Horn timestamp → closest vehicles in frame → VIOLATION ALERT| Layer | Technology |
|---|---|
| Backend | Python, Flask |
| AI Detection | Ultralytics YOLOv8 |
| Video Processing | OpenCV |
| Audio Analysis | Librosa, SoundFile |
| Audio Extraction | FFmpeg |
| Frontend | HTML, CSS, Vanilla JS |