AI Based Wildfire Monitoring

by Ihor Volovenko in Outside > Fire

18 Views, 0 Favorites, 0 Comments

AI Based Wildfire Monitoring

2025-06-20 01.31.02.jpg
Picture 1.jpg

I made a device - a box with camera, LCD and LED display. Device uses a YOLO trained model to detect smoke and fire to identify the risks of wildfire. The project can help people to make a full time monitoring to prevent any fire in forests/field/etc.


The project was not that hard by making the box working but the hard part was the model so to train it properly there was needed around 4000 annotated images

Supplies

Supplies

  1. Raspberry Pi 5 – 120 EUR
  2. Camera – 30 EUR (I used mine personal, you can buy cheaper one)
  3. GPIO connection board – 5 EUR(for possible extentions)
  4. LED light – 6 EUR


Dataset

Picture 1.png

I collected a dataset from different sources like internet, keggle, and some of my own pictures. I used Roboflow for labeling as it has user friendly and relatively easy to use UI.

This is my dataset that I used:DATASET

Collect and Label

We need to find different data such as with campfires, houses under fire, wildfires. I strongly recommend you to find as much data as you can, because you are trying to identify such a hard data like smoke that is pretty had to identify, and suggest to use greyscale on your dataset to help your model to under where the smoke is.

Training YOLO Model

Picture 3.png
Picture 4.png

At first try to run model on roboflow website to check if you have enough data, if its fine you can try to run a script to run your model on vscode here is the code:

from ultralytics import YOLO

import torch


if __name__ == "__main__":

# --- Select CUDA GPU if available, else fallback to CPU ---

device = "cuda" if torch.cuda.is_available() else "cpu"

print(f"[INFO] Using device: {device}")


# --- Load YOLOv8 Segmentation model (custom or base) ---

model = YOLO("yolo11s-seg.pt") # Change to yolo11s-seg.pt if needed


# --- Train model ---

model.train(

data="EaseUp_ModelTrainer/Dataset/data.yaml",

epochs=50,

imgsz=640,

batch=16,

name="yolov11n_wild_fire",

device=device

)


Or if you use mac:


from ultralytics import YOLO

import torch

import os


def main():

# Select Apple GPU (MPS) if available

device = "mps" if torch.backends.mps.is_available() else "cpu"

print(f"[INFO] Using device: {device}")


# Path to data.yaml

data_yaml_path = "/Users/ihorvolovenko/Documents/2024-2025/2024-2025/Project_One/train_2/Fire_detection_training/EaseUp_ModelTrainer/Dataset/data.yaml"


if not os.path.exists(data_yaml_path):

raise FileNotFoundError(f"[ERROR] data.yaml not found at: {data_yaml_path}")


# Load model (use segmentation model if needed)

model = YOLO("yolo11n.pt") # or "yolo11n-seg.pt" if you're training segmentation

# Train model

model.train(

data=data_yaml_path,

epochs=50,

imgsz=640,

batch=8, # ⚠️ lower for MPS (avoid OOM)

workers=0, # ⚠️ required for MPS to avoid multiprocessing issues

device=device,

name="yolov11n_wild_fire_mps",

verbose=True

)


if __name__ == "__main__":

main()


Assemble

Picture 5.jpg
Picture 7.jpg

Don’t forget to use camera


Now that’s possible to detect fire and smoke. I short program

We have a loop where camera is going to make a photo every 5 sec and blink led whether happening in front of it green for no risk red for high risk.

Electronic Part

assemble.jpg

Here are all assembled modules

Building the Box

box1.jpg
box2.jpg
box3.png

For casting I used MFD 6mm but can be such less complicated like simple wood.

Run the Code

There is the code for my project, you need to take one code for cam + LED + LCD that code should run on RasPi, second one shoud be on run on pc to check image with model, but It can also be run fully on RasPi

THE CODE