# harshaaa69/fire-detection-yolo architecture

> Architecture diagram of the GitHub repository harshaaa69/fire-detection-yolo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshaaa69/fire-detection-yolo
- Repository: https://github.com/harshaaa69/fire-detection-yolo

## Overview

This is a webcam/video fire-detection application with a separate model-training script. Its main runtime flow captures frames, runs YOLO inference, confirms fire across frames with a cooldown, then raises alerts and displays annotated video. The README also documents training, but the training script references a weight filename that differs from the one in the repository; that relationship is omitted.

Main entry points: [`detect.py`](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py) (Detection Loop), [`train.py`](https://github.com/harshaaa69/fire-detection-yolo/blob/main/train.py) (Training Script), [`model/best.pt`](https://github.com/harshaaa69/fire-detection-yolo/blob/main/model/best.pt) (Trained Weights), [`Alarm.wav`](https://github.com/harshaaa69/fire-detection-yolo/blob/main/Alarm.wav) (Alarm Audio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Detection Runtime"]
  node_detector["Detection Loop<br/>[detect.py]"]
  node_capture["Frame Capture<br/>[detect.py]"]
  node_model["YOLO Inference<br/>[detect.py]"]
  node_weights["Trained Weights<br/>[best.pt]"]
  node_fire_check["Fire Confirmation<br/>[detect.py]"]
  node_display["Annotated Display<br/>[detect.py]"]
end

subgraph group_response["Alerts and Records"]
  node_alarm["Alarm Playback<br/>[detect.py]"]
  node_alarm_file["Alarm Audio<br/>[Alarm.wav]"]
  node_email["Email Alert<br/>[detect.py]"]
  node_event_log["Event Logging<br/>[detect.py]"]
  node_log_file["Event Log<br/>[log.txt]"]
end

subgraph group_training["Model Training"]
  node_trainer["Training Script<br/>[train.py]"]
  node_base_weights["Base Weights<br/>[yolo26s.pt]"]
end

node_operator(("Operator"))
node_video_source["Camera or Video"]
node_mail_service["SMTP Service"]

node_operator -->|"starts"| node_detector
node_video_source -->|"provides frames"| node_capture
node_detector -->|"reads frames"| node_capture
node_detector -->|"runs inference"| node_model
node_detector -->|"loads"| node_weights
node_detector -->|"confirms fire"| node_fire_check
node_detector -->|"renders results"| node_display
node_detector -->|"triggers"| node_alarm
node_alarm -->|"plays"| node_alarm_file
node_detector -->|"triggers"| node_email
node_email -->|"sends via"| node_mail_service
node_detector -->|"records event"| node_event_log
node_event_log -->|"appends"| node_log_file
node_operator -->|"runs training"| node_trainer
node_trainer -->|"produces"| node_weights

click node_detector "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_capture "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_model "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_weights "https://github.com/harshaaa69/fire-detection-yolo/blob/main/model/best.pt"
click node_fire_check "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_display "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_alarm "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_alarm_file "https://github.com/harshaaa69/fire-detection-yolo/blob/main/Alarm.wav"
click node_email "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_event_log "https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py"
click node_log_file "https://github.com/harshaaa69/fire-detection-yolo/blob/main/output/log.txt"
click node_trainer "https://github.com/harshaaa69/fire-detection-yolo/blob/main/train.py"
click node_base_weights "https://github.com/harshaaa69/fire-detection-yolo/blob/main/yolo26s.pt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_detector,node_capture,node_model,node_weights,node_fire_check,node_display toneBlue
class node_alarm,node_alarm_file,node_email,node_event_log,node_log_file toneAmber
class node_trainer,node_base_weights toneMint
class node_operator,node_video_source,node_mail_service toneIndigo
```

## Components

### Detection Runtime

- [Detection Loop](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`
- [Frame Capture](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`
- [YOLO Inference](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`
- [Trained Weights](https://github.com/harshaaa69/fire-detection-yolo/blob/main/model/best.pt): `model/best.pt`
- [Fire Confirmation](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`
- [Annotated Display](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`

### Alerts and Records

- [Alarm Playback](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`
- [Alarm Audio](https://github.com/harshaaa69/fire-detection-yolo/blob/main/Alarm.wav): `Alarm.wav`
- [Email Alert](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`
- [Event Logging](https://github.com/harshaaa69/fire-detection-yolo/blob/main/detect.py): `detect.py`
- [Event Log](https://github.com/harshaaa69/fire-detection-yolo/blob/main/output/log.txt): `output/log.txt`

### Model Training

- [Training Script](https://github.com/harshaaa69/fire-detection-yolo/blob/main/train.py): `train.py`
- [Base Weights](https://github.com/harshaaa69/fire-detection-yolo/blob/main/yolo26s.pt): `yolo26s.pt`

### Other components

- **Operator**
- **Camera or Video**
- **SMTP Service**

## Connections

- Operator → Detection Loop: starts (evidence: `README.md`)
- Camera or Video → Frame Capture: provides frames (evidence: `detect.py`)
- Detection Loop → Frame Capture: reads frames (evidence: `detect.py`)
- Detection Loop → YOLO Inference: runs inference (evidence: `detect.py`)
- Detection Loop → Trained Weights: loads (evidence: `detect.py`)
- Detection Loop → Fire Confirmation: confirms fire (evidence: `detect.py`)
- Detection Loop → Annotated Display: renders results (evidence: `detect.py`)
- Detection Loop → Alarm Playback: triggers (evidence: `detect.py`)
- Alarm Playback → Alarm Audio: plays (evidence: `detect.py`)
- Detection Loop → Email Alert: triggers (evidence: `detect.py`)
- Email Alert → SMTP Service: sends via (evidence: `detect.py`)
- Detection Loop → Event Logging: records event (evidence: `detect.py`)
- Event Logging → Event Log: appends (evidence: `detect.py`)
- Operator → Training Script: runs training (evidence: `README.md`)
- Training Script → Trained Weights: produces (evidence: `README.md`)
