How hoanglayor/fireeye-smart-system works
Project Type and Purpose
• This is an ML-powered fire and smoke detection system combining a training pipeline, a model repository, and a real-time inference/alerting pipeline.
• Purpose: train YOLOv8/v10 models on a curated fire-smoke dataset, then run inference on camera feeds to trigger alarms and send notifications.
Main Architectural Components
a. Data Ingestion & Preparation
• Data folder & data.yaml: holds raw images and annotations.
• prepare_data.py / DownloadFireDataset.py / GetDatasetStatistics.py: scripts to fetch, preprocess and analyze the dataset.
b. Model Training Pipeline
• train.py & train_v8s.ipynb: launch YOLO training (v8s for speed, v10m for accuracy).
• W&B integration: logs metrics and training events.
• model/yolov10m: stores trained weights (best.pt, last.pt) and args.yaml.
c. Model Registry / Storage
• model/ directory: versioned subfolders (e.g., yolov10m) for organizing checkpoints and metadata.
d. Inference & Alerting Pipeline
• inference.py: loads a selected model, processes frames (images or live video), runs detection.
• telegram_message.py: sends alert messages via Telegram API when fire/smoke is detected.
• alarm_sound.wav: local audio alert played on detection.
e. External Services
• Telegram API: push notifications to users/devices.
• (Optional) Roboflow: original dataset hosting.
• W&B (Weights & Biases): experiment tracking.
Component Interactions & Data Flow
1) Data Preparation
[Raw Images + Annotations] → prepare_data.py → [Formatted Dataset + data.yaml]
2) Training
[Formatted Dataset] → train.py → [Trained YOLO Model + Logs to W&B] → model/
3) Inference
[Camera Feed / Test Images] → inference.py (loads model/) → [Detections]
4) Alerting
If detection →
• Play alarm_sound.wav → local speaker
• Invoke telegram_message.py → HTTP request → Telegram API → user device
Architectural Patterns & Principles
• Modular separation: data layer, training layer, inference/alert layer.
• Single responsibility: one script per task (prepare, train, infer, notify).
• Externalized configuration: data.yaml, args.yaml, .env for secrets (e.g., Telegram token).
• Versioning of artifacts: model weights in dedicated folders, results in versioned subfolders.
• Left: Data Preparation (data folder, prepare scripts)
• Center: Model Training (train.py, W&B, model repository)
• Right: Inference & Alerting (inference.py, alarm_sound, telegram_message)
c. Overlay “External Services” above or aside, linking W&B to training, Telegram to alerting, Roboflow to data.