How aksh1810/fire-detection works
Project type & purpose (what you’re diagramming)
This is a single-repo Python computer vision application centered around a YOLOv8 (Ultralytics) object detection model to detect Fire and Smoke. It has two runtime/inference entrypoints (webcam + image) and a separate training + dataset acquisition toolchain.
In other words, you’re not drawing a typical multi-service web architecture. The “system” is a client-side/edge runtime (camera/image → model inference → alert/overlay) plus an offline ML pipeline (download dataset → train → produce weights → run inference).
Runtime / inference (operational system)
• detect_fire.py
• detect_fire_image.py
Single image load → YOLOv8 inference → visualization/alert.
Training / ML pipeline (build system for the model)
• train_fire.py
YOLOv8 training/fine-tuning using PyTorch/Ultralytics, reading dataset config from data.yaml, producing trained weights.
• data.yaml
Dataset configuration (paths, class names: Fire/Smoke). Critical “config artifact” in the training pipeline.
• Fire_Detection_Colab.ipynb
Alternative execution environment for training (Google Colab GPU). Architecturally, it’s another “runner” for the same training pipeline.
• download_dataset.py + download_manual.py
Dataset acquisition utilities (notably Roboflow per README). These are “ingestion” components feeding training data.
Build/runtime dependencies
• requirements.txt
Pins runtime/training deps: Ultralytics (YOLOv8), OpenCV, PyTorch, etc. Represent as a “Dependency Layer” or annotate components with these techs.
What the README adds (relationships + non-code components)
The README clarifies:
• Inputs: webcam frames OR static image
• Core processing: YOLOv8 model inference
• Training: uses Roboflow dataset sources; can run locally or in Colab
• Roboflow Universe / dataset hosting (external)
• Local machine hardware (CPU, optional GPU)
• Webcam device / file system (image source)
• Audio output device (speaker/beeper)
Important architectural patterns/design principles to highlight (specific to this repo)
• Edge/Local inference: the “deployment target” is a local machine, not a server.
• Two-mode input adapters: webcam vs file input are separate entrypoints but share the same core inference pipeline.
• Model-as-artifact: trained weights are the central contract between training and inference.
• Externalized dataset configuration: data.yaml is the training-time contract to dataset layout + class names.
• OpenCV: capture + display
• Ultralytics YOLOv8: inference + training APIs
• PyTorch: underlying framework
• Roboflow: dataset source/management
• Google Colab: optional training runtime with GPU
• Python 3.8+: runtime
An environment note:
• “Runs on CPU ~30 FPS; optional GPU for training/inference”
User ↔ App; Webcam/Image → App; App → Audio/Display; Roboflow → Dataset Download; Colab → Training.
Roboflow → download scripts → dataset/labels → train_fire.py/Colab → weights artifact.
Runtime Inference Sequence/Dataflow (1 page)
Webcam loop (frame-by-frame) and/or image path; show threshold decision leading to beep.
That will be the most accurate architecture representation for this project: it captures the operational detection system and the lifecycle path that produces the model it depends on.